mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
hcd_init() take init struct
This commit is contained in:
parent
f3b7d7515e
commit
1587d48e89
@ -53,26 +53,21 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
HCD_EVENT_DEVICE_ATTACH,
|
||||
HCD_EVENT_DEVICE_REMOVE,
|
||||
HCD_EVENT_XFER_COMPLETE,
|
||||
|
||||
// Not an HCD event, just a convenient way to defer ISR function
|
||||
USBH_EVENT_FUNC_CALL,
|
||||
|
||||
USBH_EVENT_FUNC_CALL, // Not an HCD event
|
||||
HCD_EVENT_COUNT
|
||||
} hcd_eventid_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint8_t rhport;
|
||||
uint8_t event_id;
|
||||
uint8_t dev_addr;
|
||||
|
||||
union
|
||||
{
|
||||
union {
|
||||
// Attach, Remove
|
||||
struct {
|
||||
uint8_t hub_addr;
|
||||
@ -93,11 +88,9 @@ typedef struct
|
||||
void* param;
|
||||
}func_call;
|
||||
};
|
||||
|
||||
} hcd_event_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint8_t rhport;
|
||||
uint8_t hub_addr;
|
||||
uint8_t hub_port;
|
||||
@ -128,7 +121,7 @@ bool hcd_dcache_clean_invalidate(void const* addr, uint32_t data_size) TU_ATTR_W
|
||||
bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param);
|
||||
|
||||
// Initialize controller to host mode
|
||||
bool hcd_init(uint8_t rhport);
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init);
|
||||
|
||||
// De-initialize controller
|
||||
bool hcd_deinit(uint8_t rhport);
|
||||
|
@ -405,7 +405,7 @@ bool tuh_rhport_init(const tusb_rhport_init_t* rh_init) {
|
||||
|
||||
// Init host controller
|
||||
_usbh_controller = rh_init->rhport;
|
||||
TU_ASSERT(hcd_init(rh_init->rhport));
|
||||
TU_ASSERT(hcd_init(rh_init));
|
||||
hcd_int_enable(rh_init->rhport);
|
||||
|
||||
return true;
|
||||
|
@ -494,8 +494,8 @@ bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param) {
|
||||
}
|
||||
|
||||
// Initialize controller to host mode
|
||||
bool hcd_init(uint8_t rhport) {
|
||||
(void) rhport;
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
const uint8_t rhport = rh_init->rhport;
|
||||
|
||||
tuh_max3421_int_api(rhport, false);
|
||||
|
||||
|
@ -70,7 +70,8 @@ bool hcd_dcache_clean_invalidate(void const* addr, uint32_t data_size) {
|
||||
// Controller API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
bool hcd_init(uint8_t rhport) {
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
const uint8_t rhport = rh_init->rhport;
|
||||
ci_hs_regs_t *hcd_reg = CI_HS_REG(rhport);
|
||||
|
||||
// Reset controller
|
||||
|
@ -556,9 +556,8 @@ static void process_pipe_rx(uint8_t rhport, uint_fast8_t pipenum)
|
||||
* Host API
|
||||
*------------------------------------------------------------------*/
|
||||
|
||||
bool hcd_init(uint8_t rhport)
|
||||
{
|
||||
(void)rhport;
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
(void) rh_init;
|
||||
|
||||
NVIC_ClearPendingIRQ(USB0_IRQn);
|
||||
_hcd.bmRequestType = REQUEST_TYPE_INVALID;
|
||||
|
@ -368,10 +368,8 @@ static void process_bus_reset(uint8_t rhport)
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Host API
|
||||
*------------------------------------------------------------------*/
|
||||
bool hcd_init(uint8_t rhport)
|
||||
{
|
||||
(void)rhport;
|
||||
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
(void) rh_init;
|
||||
KHCI->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
|
||||
while (KHCI->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
|
||||
|
||||
|
@ -178,8 +178,8 @@ TU_ATTR_ALWAYS_INLINE static inline void *_virt_addr(void *physical_address)
|
||||
}
|
||||
|
||||
// Initialization according to 5.1.1.4
|
||||
bool hcd_init(uint8_t rhport)
|
||||
{
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
const uint8_t rhport = rh_init->rhport;
|
||||
(void) rhport;
|
||||
|
||||
//------------- Data Structure init -------------//
|
||||
|
@ -55,8 +55,8 @@ bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void *cfg_param) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hcd_init(uint8_t rhport) {
|
||||
(void) rhport;
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
(void) rh_init;
|
||||
|
||||
// To run USB SOF interrupt in core1, call this init in core1
|
||||
pio_usb_host_init(&pio_host_cfg);
|
||||
|
@ -375,9 +375,8 @@ static void _hw_endpoint_init(struct hw_endpoint *ep, uint8_t dev_addr, uint8_t
|
||||
//--------------------------------------------------------------------+
|
||||
// HCD API
|
||||
//--------------------------------------------------------------------+
|
||||
bool hcd_init(uint8_t rhport)
|
||||
{
|
||||
(void) rhport;
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
(void) rh_init;
|
||||
pico_trace("hcd_init %d\n", rhport);
|
||||
assert(rhport == 0);
|
||||
|
||||
|
@ -466,8 +466,8 @@ static void enable_interrupt(uint32_t pswi)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool hcd_init(uint8_t rhport)
|
||||
{
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
const uint8_t rhport = rh_init->rhport;
|
||||
rusb2_reg_t* rusb = RUSB2_REG(rhport);
|
||||
rusb2_module_start(rhport, true);
|
||||
|
||||
|
@ -44,9 +44,8 @@ bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param) {
|
||||
}
|
||||
|
||||
// Initialize controller to host mode
|
||||
bool hcd_init(uint8_t rhport) {
|
||||
(void) rhport;
|
||||
|
||||
bool hcd_init(const tusb_rhport_init_t* rh_init) {
|
||||
(void) rh_init;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user