21ic问答首页 - gd32f105中的usb例程找不到usb管脚配置
gd32f105中的usb例程找不到usb管脚配置
wfclhu12024-06-30
近期使用gd32f105做USB升级程序,拟使用官方usb的例程,但怎么也找不到官方例程的中的usb管脚配置,哪位大神给看一下。以下是官方例程中的主函数
extern usb_core_driver usbh_core;
usbh_host usb_host;
/*!
\brief main routine
\param[in] none
\param[out] none
\retval none
*/
int main(void)
{
usb_rcu_config();
usb_timer_init();
/* configure GPIO pin used for switching VBUS power and charge pump I/O */
usb_vbus_config ();
usbh_class_register (&usb_host, &usbh_msc);
/* initialize host library */
usbh_init (&usb_host, &usr_cb);
/* enable interrupts */
usb_intr_config ();
while (1) {
/* host task handler */
usbh_core_task (&usb_host);
}
}
extern usb_core_driver usbh_core;
usbh_host usb_host;
/*!
\brief main routine
\param[in] none
\param[out] none
\retval none
*/
int main(void)
{
usb_rcu_config();
usb_timer_init();
/* configure GPIO pin used for switching VBUS power and charge pump I/O */
usb_vbus_config ();
usbh_class_register (&usb_host, &usbh_msc);
/* initialize host library */
usbh_init (&usb_host, &usr_cb);
/* enable interrupts */
usb_intr_config ();
while (1) {
/* host task handler */
usbh_core_task (&usb_host);
}
}
赞0
评论
2024-07-01
赞0
usbh_host_struct *puhost,
void *pustate)
{
usbh_state_handle_struct *p_state = (usbh_state_handle_struct *)pustate;
scd_begin(p_state, HOST_FSM_ID);
if (-1 == p_state->usbh_current_state_stack_top) {
uint8_t cur_state = p_state->usbh_current_state;
if ((0U == hcd_is_device_connected(pudev)) && (HOST_IDLE != cur_state)) {
if (HOST_DEV_DETACHED != cur_state) {
p_state->usbh_current_state = HOST_DEV_DETACHED;
cur_state = HOST_DEV_DETACHED;
}
}
host_state_handle[cur_state](pudev, puhost, p_state);
} else {
uint8_t stack0_state = p_state->stack[0].state;
if ((0U == hcd_is_device_connected(pudev)) && (HOST_IDLE != stack0_state)) {
if (HOST_DEV_DETACHED != stack0_state) {
p_state->stack[0].state = HOST_DEV_DETACHED;
stack0_state = HOST_DEV_DETACHED;
p_state->usbh_current_state = HOST_DEV_DETACHED;
}
}
host_state_handle[stack0_state](pudev, puhost, p_state);
}
return USBH_OK;
}
评论
2024-07-01
赞0
评论
2024-07-01
赞0
评论
2024-06-30
赞0
评论
2024-06-30
您需要登录后才可以回复 登录 | 注册