hal clean up

- replace tusb_hal_int_enable/disable to dcd_int_enable/disable,
hcd_int_enable/disable
- remove tusb_hal_init(), this will be part of dcd_init/hcd_init,
anything beyond dcd/hcd should be inited by bsp
This commit is contained in:
hathach
2018-12-05 13:20:25 +07:00
parent 6048a3bff4
commit a73017fdc2
17 changed files with 125 additions and 290 deletions
+9 -28
View File
@@ -51,55 +51,37 @@ extern "C" {
//--------------------------------------------------------------------+
// HAL API
//--------------------------------------------------------------------+
/** \ingroup group_mcu
* \defgroup group_hal Hardware Abtract Layer (HAL)
* Hardware Abstraction Layer (HAL) is an abstraction layer, between the physical hardware and the tinyusb stack.
* Its function is to hide differences in hardware from most of MCUs, so that most of the stack code does not need to be changed to
* run on systems with a different MCU.
* HAL are sets of routines that emulate some platform-specific details, giving programs direct access to the hardware resources.
* @{ */
/** \brief Initialize USB controller hardware
* \returns true if succeeded
* \note This function is invoked by \ref tusb_init as part of the initialization.
*/
bool tusb_hal_init(void);
/** \brief Enable USB Interrupt on a specific USB Controller
* \param[in] rhport is a zero-based index to identify USB controller's ID
*/
void tusb_hal_int_enable(uint8_t rhport);
/** \brief Disable USB Interrupt on a specific USB Controller
* \param[in] rhport is a zero-based index to identify USB controller's ID
*/
void tusb_hal_int_disable(uint8_t rhport);
// Only required to implement if using No RTOS (osal_none)
uint32_t tusb_hal_millis(void);
// TODO remove
extern void dcd_int_enable (uint8_t rhport);
extern void dcd_int_disable(uint8_t rhport);
// Enable all ports' interrupt
// TODO remove
static inline void tusb_hal_int_enable_all(void)
{
#ifdef CFG_TUSB_RHPORT0_MODE
tusb_hal_int_enable(0);
dcd_int_enable(0);
#endif
#ifdef CFG_TUSB_RHPORT0_MODE
tusb_hal_int_enable(1);
dcd_int_enable(1);
#endif
}
// Disable all ports' interrupt
// TODO remove
static inline void tusb_hal_int_disable_all(void)
{
#ifdef CFG_TUSB_RHPORT0_MODE
tusb_hal_int_disable(0);
dcd_int_disable(0);
#endif
#ifdef CFG_TUSB_RHPORT0_MODE
tusb_hal_int_disable(1);
dcd_int_disable(1);
#endif
}
@@ -111,4 +93,3 @@ static inline void tusb_hal_int_disable_all(void)
#endif /* _TUSB_HAL_H_ */
/** @} */