mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
Our USB buffers are just arrays of uint8_t in program RAM, so let's treat them that way. The DMA descriptors are in normal RAM, too. BUG=chrome-os-partner:40693 BRANCH=none TEST=make buildall Change-Id: Ibafe1a557a328bbf8cf37ce113675fcd35bad376 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273918 Reviewed-by: Randall Spangler <rspangler@chromium.org>
37 lines
1.4 KiB
C
37 lines
1.4 KiB
C
/* Copyright 2015 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef __CROS_EC_USB_HW_H
|
|
#define __CROS_EC_USB_HW_H
|
|
|
|
/* Helpers for endpoint declaration */
|
|
#define _EP_HANDLER2(num, suffix) CONCAT3(ep_, num, suffix)
|
|
#define _EP_TX_HANDLER(num) _EP_HANDLER2(num, _tx)
|
|
#define _EP_RX_HANDLER(num) _EP_HANDLER2(num, _rx)
|
|
#define _EP_RESET_HANDLER(num) _EP_HANDLER2(num, _rst)
|
|
|
|
#define USB_DECLARE_EP(num, tx_handler, rx_handler, rst_handler) \
|
|
void _EP_TX_HANDLER(num)(void) \
|
|
__attribute__ ((alias(STRINGIFY(tx_handler)))); \
|
|
void _EP_RX_HANDLER(num)(void) \
|
|
__attribute__ ((alias(STRINGIFY(rx_handler)))); \
|
|
void _EP_RESET_HANDLER(num)(void) \
|
|
__attribute__ ((alias(STRINGIFY(rst_handler))));
|
|
|
|
/* arrays with all endpoint callbacks */
|
|
extern void (*usb_ep_tx[]) (void);
|
|
extern void (*usb_ep_rx[]) (void);
|
|
extern void (*usb_ep_reset[]) (void);
|
|
/* array with interface-specific control request callbacks */
|
|
extern int (*usb_iface_request[]) (uint8_t *ep0_buf_rx, uint8_t *ep0_buf_tx);
|
|
|
|
#define _IFACE_HANDLER(num) CONCAT3(iface_, num, _request)
|
|
#define USB_DECLARE_IFACE(num, handler) \
|
|
int _IFACE_HANDLER(num)(uint8_t *ep0_buf_rx, \
|
|
uint8_t *epo_buf_tx) \
|
|
__attribute__ ((alias(STRINGIFY(handler))));
|
|
|
|
#endif /* __CROS_EC_USB_HW_H */
|