rename hal_* to tusb_hal_*

This commit is contained in:
hathach
2018-03-11 13:01:57 +07:00
parent c39b24001d
commit 0384e40320
14 changed files with 37 additions and 38 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ extern "C"
do{\
setup_statement;\
if (!(condition)) {\
hal_debugger_breakpoint();\
tusb_hal_dbg_breakpoint();\
_ASSERT_MESSAGE(format, __VA_ARGS__);\
error_handler(error, handler_para);\
}\
+3 -3
View File
@@ -148,12 +148,12 @@
/*------------------------------------------------------------------*/
/* ASSERT
* basically VERIFY with hal_debugger_breakpoint as handler
* basically VERIFY with tusb_hal_dbg_breakpoint as handler
* - 1 arg : return false if failed
* - 2 arg : return error if failed
*------------------------------------------------------------------*/
#define ASSERT_1ARGS(cond) do { if (!(cond)) { hal_debugger_breakpoint(); _ASSERT_MESS() return false; } } while(0)
#define ASSERT_2ARGS(cond, _error) do { if (!(cond)) { hal_debugger_breakpoint(); _ASSERT_MESS() return _error;} } while(0)
#define ASSERT_1ARGS(cond) do { if (!(cond)) { tusb_hal_dbg_breakpoint(); _ASSERT_MESS() return false; } } while(0)
#define ASSERT_2ARGS(cond, _error) do { if (!(cond)) { tusb_hal_dbg_breakpoint(); _ASSERT_MESS() return _error;} } while(0)
#define ASSERT_(...) GET_3RD_ARG(__VA_ARGS__, ASSERT_2ARGS, ASSERT_1ARGS)(__VA_ARGS__)
-1
View File
@@ -58,7 +58,6 @@ typedef enum
USBD_BUS_EVENT_RESUME
}usbd_bus_event_type_t;
// TODO move Hal
typedef struct {
uint8_t port;
uint8_t index; // must be zero to indicate control
+1 -1
View File
@@ -647,7 +647,7 @@ static void qhd_xfer_error_isr(ehci_qhd_t * p_qhd)
p_qhd->total_xferred_bytes += p_qhd->p_qtd_list_head->expected_bytes - p_qhd->p_qtd_list_head->total_bytes;
// if ( TUSB_EVENT_XFER_ERROR == error_event ) hal_debugger_breakpoint(); // TODO skip unplugged device
// if ( TUSB_EVENT_XFER_ERROR == error_event ) tusb_hal_dbg_breakpoint(); // TODO skip unplugged device
p_qhd->p_qtd_list_head->used = 0; // free QTD
qtd_remove_1st_from_qhd(p_qhd);
+4 -4
View File
@@ -53,7 +53,7 @@
//--------------------------------------------------------------------+
// TICK API
//--------------------------------------------------------------------+
#define osal_tick_get hal_tick_get
#define osal_tick_get tusb_hal_tick_get
//--------------------------------------------------------------------+
// TASK API
@@ -204,11 +204,11 @@ static inline void osal_queue_flush(osal_queue_t const queue_hdl)
else\
return TUSB_ERROR_OSAL_WAITING;\
} else{\
/*TODO mutex lock hal_usb_int_disable */\
/*TODO mutex lock tusb_hal_init_disable */\
memcpy(p_data, queue_hdl->buffer + (queue_hdl->rd_idx * queue_hdl->item_size), queue_hdl->item_size);\
queue_hdl->rd_idx = (queue_hdl->rd_idx + 1) % queue_hdl->depth;\
queue_hdl->count--;\
/*TODO mutex unlock hal_usb_int_enable */\
/*TODO mutex unlock tusb_hal_init_enable */\
*(p_error) = TUSB_ERROR_NONE;\
}\
}while(0)
@@ -258,7 +258,7 @@ static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl)
else\
return TUSB_ERROR_OSAL_WAITING;\
} else{\
if (sem_hdl->count) sem_hdl->count--; /*TODO mutex hal_usb_int_disable consideration*/\
if (sem_hdl->count) sem_hdl->count--; /*TODO mutex tusb_hal_init_disable consideration*/\
*(p_error) = TUSB_ERROR_NONE;\
}\
}while(0)
+3 -3
View File
@@ -42,7 +42,7 @@
tusb_error_t tusb_init(void)
{
VERIFY( hal_usb_init(), TUSB_ERROR_FAILED ) ; // hardware init
VERIFY( tusb_hal_init(), TUSB_ERROR_FAILED ) ; // hardware init
#if MODE_HOST_SUPPORTED
ASSERT_STATUS( usbh_init() ); // host stack init
@@ -53,11 +53,11 @@ tusb_error_t tusb_init(void)
#endif
#if (TUSB_CFG_CONTROLLER_0_MODE)
hal_usb_int_enable(0);
tusb_hal_init_enable(0);
#endif
#if (TUSB_CFG_CONTROLLER_1_MODE)
hal_usb_int_enable(1);
tusb_hal_init_enable(1);
#endif
return TUSB_ERROR_NONE;
+5 -5
View File
@@ -68,26 +68,26 @@ extern "C" {
* \returns true if succeedded
* \note This function is invoked by \ref tusb_init as part of the initialization.
*/
bool hal_usb_init(void);
bool tusb_hal_init(void);
/** \brief Enable USB Interrupt on a specific USB Controller
* \param[in] port is a zero-based index to identify USB controller's ID
* \note Some MCUs such as NXP LPC43xx has multiple USB controllers. It is necessary to know which USB controller for
* those MCUs.
*/
void hal_usb_int_enable(uint8_t port);
void tusb_hal_init_enable(uint8_t port);
/** \brief Disable USB Interrupt on a specific USB Controller
* \param[in] port is a zero-based index to identify USB controller's ID
* \note Some MCUs such as NXP LPC43xx has multiple USB controllers. It is necessary to know which USB controller for
* those MCUs.
*/
void hal_usb_int_disable(uint8_t port);
void tusb_hal_init_disable(uint8_t port);
uint32_t hal_tick_get(void);
uint32_t tusb_hal_tick_get(void);
// for debug only, halt mcu if assert/verify is failed if debugger is attached
void hal_debugger_breakpoint(void) ATTR_WEAK;
void tusb_hal_dbg_breakpoint(void) ATTR_WEAK;
#ifdef __cplusplus
}