mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-19 06:40:45 +00:00
change error type to lower case for more consistency
change Error Enum to TUSB prefix for more consistency start to add check for OS configure
This commit is contained in:
parent
d8c8b9e38a
commit
cfe7a3d23b
@ -59,15 +59,16 @@
|
|||||||
#define TUSB_CFG_DEVICE
|
#define TUSB_CFG_DEVICE
|
||||||
|
|
||||||
/// Enable CDC Support
|
/// Enable CDC Support
|
||||||
//#define TUSB_CFG_DEVICE_CDC
|
#define TUSB_CFG_DEVICE_CDC
|
||||||
|
|
||||||
/// Enable HID Keyboard support
|
/// Enable HID Keyboard support
|
||||||
#define TUSB_CFG_DEVICE_HID_KEYBOARD
|
#define TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||||
|
|
||||||
/// Enable HID Mouse support
|
/// Enable HID Mouse support
|
||||||
//#define TUSB_CFG_DEVICE_HID_MOUSE
|
#define TUSB_CFG_DEVICE_HID_MOUSE
|
||||||
|
|
||||||
#define TUSB_CFG_DEBUG 3
|
#define TUSB_CFG_DEBUG 3
|
||||||
|
#define TUSB_CFG_OS TUSB_OS_NONE
|
||||||
|
|
||||||
#ifdef __CODE_RED // make use of code red's support for ram region macros
|
#ifdef __CODE_RED // make use of code red's support for ram region macros
|
||||||
#if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
|
#if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
|
||||||
|
@ -71,6 +71,8 @@
|
|||||||
|
|
||||||
#define TUSB_CFG_DEBUG 3
|
#define TUSB_CFG_DEBUG 3
|
||||||
|
|
||||||
|
#define TUSB_CFG_OS TUSB_OS_NONE
|
||||||
|
|
||||||
#ifdef __CODE_RED // make use of code red's support for ram region macros
|
#ifdef __CODE_RED // make use of code red's support for ram region macros
|
||||||
#if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
|
#if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
|
||||||
#define TUSB_RAM_SECTION ".data.$RAM2"
|
#define TUSB_RAM_SECTION ".data.$RAM2"
|
||||||
|
@ -71,6 +71,8 @@
|
|||||||
|
|
||||||
#define TUSB_CFG_DEBUG 3
|
#define TUSB_CFG_DEBUG 3
|
||||||
|
|
||||||
|
#define TUSB_CFG_OS TUSB_OS_NONE
|
||||||
|
|
||||||
#ifdef __CODE_RED // make use of code red's support for ram region macros
|
#ifdef __CODE_RED // make use of code red's support for ram region macros
|
||||||
#if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
|
#if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
|
||||||
#define TUSB_RAM_SECTION ".data.$RAM2"
|
#define TUSB_RAM_SECTION ".data.$RAM2"
|
||||||
|
@ -265,7 +265,7 @@ ErrorCode_t CDC_BulkOut_Hdlr(USBD_HANDLE_T hUsb, void* data, uint32_t event)
|
|||||||
@brief Initialises USB CDC using the ROM driver
|
@brief Initialises USB CDC using the ROM driver
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
TUSB_Error_t tusb_cdc_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pControlIntfDesc, USB_INTERFACE_DESCRIPTOR const *const pDataIntfDesc, uint32_t* mem_base, uint32_t* mem_size)
|
tusb_error_t tusb_cdc_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pControlIntfDesc, USB_INTERFACE_DESCRIPTOR const *const pDataIntfDesc, uint32_t* mem_base, uint32_t* mem_size)
|
||||||
{
|
{
|
||||||
USBD_CDC_INIT_PARAM_T cdc_param =
|
USBD_CDC_INIT_PARAM_T cdc_param =
|
||||||
{
|
{
|
||||||
@ -296,7 +296,7 @@ TUSB_Error_t tusb_cdc_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *c
|
|||||||
*mem_base = cdc_param.mem_base;
|
*mem_base = cdc_param.mem_base;
|
||||||
*mem_size = cdc_param.mem_size;
|
*mem_size = cdc_param.mem_size;
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
@ -304,7 +304,7 @@ TUSB_Error_t tusb_cdc_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *c
|
|||||||
@brief TODO Add description
|
@brief TODO Add description
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
TUSB_Error_t tusb_cdc_configured(USBD_HANDLE_T hUsb)
|
tusb_error_t tusb_cdc_configured(USBD_HANDLE_T hUsb)
|
||||||
{
|
{
|
||||||
uint8_t dummy=0;
|
uint8_t dummy=0;
|
||||||
USBD_API->hw->WriteEP(hUsb, CDC_DATA_EP_IN, &dummy, 1); // initial packet for IN endpoint, will not work if omitted
|
USBD_API->hw->WriteEP(hUsb, CDC_DATA_EP_IN, &dummy, 1); // initial packet for IN endpoint, will not work if omitted
|
||||||
@ -323,7 +323,7 @@ TUSB_Error_t tusb_cdc_configured(USBD_HANDLE_T hUsb)
|
|||||||
#error No MCU defined // TODO asbtract MCU
|
#error No MCU defined // TODO asbtract MCU
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,7 +101,7 @@ uint16_t tusb_cdc_recv(uint8_t* buffer, uint16_t max);
|
|||||||
* \return Error Code of the \ref TUSB_ERROR enum
|
* \return Error Code of the \ref TUSB_ERROR enum
|
||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
TUSB_Error_t tusb_cdc_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pControlIntfDesc, USB_INTERFACE_DESCRIPTOR const *const pDataIntfDesc, uint32_t* mem_base, uint32_t* mem_size);
|
tusb_error_t tusb_cdc_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pControlIntfDesc, USB_INTERFACE_DESCRIPTOR const *const pDataIntfDesc, uint32_t* mem_base, uint32_t* mem_size);
|
||||||
|
|
||||||
/** \brief notify cdc driver that usb is configured
|
/** \brief notify cdc driver that usb is configured
|
||||||
*
|
*
|
||||||
@ -110,7 +110,7 @@ TUSB_Error_t tusb_cdc_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *c
|
|||||||
* \return Error Code of the \ref TUSB_ERROR enum
|
* \return Error Code of the \ref TUSB_ERROR enum
|
||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
TUSB_Error_t tusb_cdc_configured(USBD_HANDLE_T hUsb);
|
tusb_error_t tusb_cdc_configured(USBD_HANDLE_T hUsb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -179,7 +179,7 @@ ErrorCode_t HID_EpOut_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event)
|
|||||||
@brief Initialises USB HID using the ROM based drivers
|
@brief Initialises USB HID using the ROM based drivers
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
TUSB_Error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size)
|
tusb_error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size)
|
||||||
{
|
{
|
||||||
USB_HID_REPORT_T reports_data =
|
USB_HID_REPORT_T reports_data =
|
||||||
{
|
{
|
||||||
@ -212,7 +212,7 @@ TUSB_Error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *c
|
|||||||
*mem_base += (*mem_size - hid_param.mem_size);
|
*mem_base += (*mem_size - hid_param.mem_size);
|
||||||
*mem_size = hid_param.mem_size;
|
*mem_size = hid_param.mem_size;
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
@ -220,7 +220,7 @@ TUSB_Error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *c
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb)
|
tusb_error_t tusb_hid_configured(USBD_HANDLE_T hUsb)
|
||||||
{
|
{
|
||||||
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||||
USBD_API->hw->WriteEP(hUsb , HID_KEYBOARD_EP_IN , (uint8_t* ) &hid_keyboard_report , sizeof(tusb_keyboard_report_t) ); // initial packet for IN endpoint , will not work if omitted
|
USBD_API->hw->WriteEP(hUsb , HID_KEYBOARD_EP_IN , (uint8_t* ) &hid_keyboard_report , sizeof(tusb_keyboard_report_t) ); // initial packet for IN endpoint , will not work if omitted
|
||||||
@ -230,7 +230,7 @@ TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb)
|
|||||||
USBD_API->hw->WriteEP(hUsb , HID_MOUSE_EP_IN , (uint8_t* ) &hid_mouse_report , sizeof(USB_HID_MouseReport_t) ); // initial packet for IN endpoint, will not work if omitted
|
USBD_API->hw->WriteEP(hUsb , HID_MOUSE_EP_IN , (uint8_t* ) &hid_mouse_report , sizeof(USB_HID_MouseReport_t) ); // initial packet for IN endpoint, will not work if omitted
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||||
@ -270,7 +270,7 @@ TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb)
|
|||||||
@endcode
|
@endcode
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey)
|
tusb_error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey)
|
||||||
{
|
{
|
||||||
// uint32_t start_time = systickGetSecondsActive();
|
// uint32_t start_time = systickGetSecondsActive();
|
||||||
// while (bKeyChanged) // TODO blocking while previous key has yet sent - can use fifo to improve this
|
// while (bKeyChanged) // TODO blocking while previous key has yet sent - can use fifo to improve this
|
||||||
@ -291,7 +291,7 @@ TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], ui
|
|||||||
|
|
||||||
bKeyChanged = true;
|
bKeyChanged = true;
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], ui
|
|||||||
@endcode
|
@endcode
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
TUSB_Error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y)
|
tusb_error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y)
|
||||||
{
|
{
|
||||||
// uint32_t start_time = systickGetSecondsActive();
|
// uint32_t start_time = systickGetSecondsActive();
|
||||||
// while (bMouseChanged) // TODO Block while previous key hasn't been sent - can use fifo to improve this
|
// while (bMouseChanged) // TODO Block while previous key hasn't been sent - can use fifo to improve this
|
||||||
@ -340,7 +340,7 @@ TUSB_Error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y)
|
|||||||
|
|
||||||
bMouseChanged = true;
|
bMouseChanged = true;
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
* \return Error Code of the \ref TUSB_ERROR enum
|
* \return Error Code of the \ref TUSB_ERROR enum
|
||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
TUSB_Error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size);
|
tusb_error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size);
|
||||||
|
|
||||||
/** \brief Notify HID class that usb is configured
|
/** \brief Notify HID class that usb is configured
|
||||||
*
|
*
|
||||||
@ -74,7 +74,7 @@ TUSB_Error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *c
|
|||||||
* \return Error Code of the \ref TUSB_ERROR enum
|
* \return Error Code of the \ref TUSB_ERROR enum
|
||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb);
|
tusb_error_t tusb_hid_configured(USBD_HANDLE_T hUsb);
|
||||||
|
|
||||||
/** \brief Used by Application to send Keycode to Host
|
/** \brief Used by Application to send Keycode to Host
|
||||||
*
|
*
|
||||||
@ -83,7 +83,7 @@ TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb);
|
|||||||
* \return Error Code of the \ref TUSB_ERROR enum
|
* \return Error Code of the \ref TUSB_ERROR enum
|
||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey);
|
tusb_error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey);
|
||||||
|
|
||||||
/** \brief
|
/** \brief
|
||||||
*
|
*
|
||||||
@ -92,7 +92,7 @@ TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], ui
|
|||||||
* \return Error Code of the \ref TUSB_ERROR enum
|
* \return Error Code of the \ref TUSB_ERROR enum
|
||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
TUSB_Error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y);
|
tusb_error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y);
|
||||||
|
|
||||||
#endif /* ROM DRIVRER */
|
#endif /* ROM DRIVRER */
|
||||||
|
|
||||||
|
@ -81,12 +81,12 @@ extern "C"
|
|||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// TUSB_Error_t Status Assert
|
// tusb_error_t Status Assert
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#define ASSERT_STATUS_MESSAGE(sts, message) \
|
#define ASSERT_STATUS_MESSAGE(sts, message) \
|
||||||
do{\
|
do{\
|
||||||
TUSB_Error_t status = (TUSB_Error_t)(sts);\
|
tusb_error_t status = (tusb_error_t)(sts);\
|
||||||
if (tERROR_NONE != status) {\
|
if (TUSB_ERROR_NONE != status) {\
|
||||||
_PRINTF("Assert at %s line %d: %s %s\n", ASSERT_FILENAME, ASSERT_FUNCTION, __LINE__, TUSB_ErrorStr[status], message); \
|
_PRINTF("Assert at %s line %d: %s %s\n", ASSERT_FILENAME, ASSERT_FUNCTION, __LINE__, TUSB_ErrorStr[status], message); \
|
||||||
return status;\
|
return status;\
|
||||||
}\
|
}\
|
||||||
|
@ -71,6 +71,8 @@
|
|||||||
#include "hal/hal.h"
|
#include "hal/hal.h"
|
||||||
#include "core/tusb_types.h"
|
#include "core/tusb_types.h"
|
||||||
#include "core/std_descriptors.h"
|
#include "core/std_descriptors.h"
|
||||||
|
#include "osal/osal.h"
|
||||||
|
|
||||||
|
|
||||||
/// min value
|
/// min value
|
||||||
static inline uint32_t min_of(uint32_t x, uint32_t y) ATTR_ALWAYS_INLINE;
|
static inline uint32_t min_of(uint32_t x, uint32_t y) ATTR_ALWAYS_INLINE;
|
||||||
|
@ -59,17 +59,17 @@
|
|||||||
#define ERROR_STRING(x) #x,
|
#define ERROR_STRING(x) #x,
|
||||||
|
|
||||||
#define ERROR_TABLE(ENTRY) \
|
#define ERROR_TABLE(ENTRY) \
|
||||||
ENTRY(tERROR_NONE)\
|
ENTRY(TUSB_ERROR_NONE)\
|
||||||
ENTRY(tERROR_FAILED)\
|
ENTRY(tERROR_FAILED)\
|
||||||
|
|
||||||
|
|
||||||
/** \enum TUSB_Error_t
|
/** \enum tusb_error_t
|
||||||
* \brief Error Code returned
|
* \brief Error Code returned
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ERROR_TABLE(ERROR_ENUM)
|
ERROR_TABLE(ERROR_ENUM)
|
||||||
ERROR_COUNT
|
ERROR_COUNT
|
||||||
}TUSB_Error_t;
|
}tusb_error_t;
|
||||||
|
|
||||||
#if TUSB_CFG_DEBUG == 3
|
#if TUSB_CFG_DEBUG == 3
|
||||||
/// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0
|
/// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0
|
||||||
|
@ -57,11 +57,11 @@ ErrorCode_t USB_Configure_Event (USBD_HANDLE_T hUsb)
|
|||||||
if (pCtrl->config_value)
|
if (pCtrl->config_value)
|
||||||
{
|
{
|
||||||
#if defined(DEVICE_CLASS_HID)
|
#if defined(DEVICE_CLASS_HID)
|
||||||
ASSERT( tERROR_NONE == tusb_hid_configured(hUsb), ERR_FAILED );
|
ASSERT( TUSB_ERROR_NONE == tusb_hid_configured(hUsb), ERR_FAILED );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TUSB_CFG_DEVICE_CDC
|
#ifdef TUSB_CFG_DEVICE_CDC
|
||||||
ASSERT( tERROR_NONE == tusb_cdc_configured(hUsb), ERR_FAILED );
|
ASSERT( TUSB_ERROR_NONE == tusb_cdc_configured(hUsb), ERR_FAILED );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ ErrorCode_t USB_Reset_Event (USBD_HANDLE_T hUsb)
|
|||||||
return LPC_OK;
|
return LPC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
TUSB_Error_t dcd_init(uint8_t coreid)
|
tusb_error_t dcd_init(uint8_t coreid)
|
||||||
{
|
{
|
||||||
#ifdef DEVICE_ROMDRIVER // TODO refractor later
|
#ifdef DEVICE_ROMDRIVER // TODO refractor later
|
||||||
/* ROM DRIVER INIT */
|
/* ROM DRIVER INIT */
|
||||||
@ -138,7 +138,7 @@ TUSB_Error_t dcd_init(uint8_t coreid)
|
|||||||
USBD_API->hw->Connect(g_hUsb, 1);
|
USBD_API->hw->Connect(g_hUsb, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TUSB_Error_t dcd_init(uint8_t coreid) ATTR_WARN_UNUSED_RESULT;
|
tusb_error_t dcd_init(uint8_t coreid) ATTR_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
* \return Error Code of the \ref TUSB_ERROR enum
|
* \return Error Code of the \ref TUSB_ERROR enum
|
||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
TUSB_Error_t hal_init();
|
tusb_error_t hal_init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable USB Interrupt
|
* Enable USB Interrupt
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#if MCU == MCU_LPC11UXX
|
#if MCU == MCU_LPC11UXX
|
||||||
|
|
||||||
TUSB_Error_t hal_init()
|
tusb_error_t hal_init()
|
||||||
{
|
{
|
||||||
// TODO remove magic number
|
// TODO remove magic number
|
||||||
/* Enable AHB clock to the USB block and USB RAM. */
|
/* Enable AHB clock to the USB block and USB RAM. */
|
||||||
@ -52,7 +52,7 @@ TUSB_Error_t hal_init()
|
|||||||
LPC_IOCON->PIO0_6 &= ~0x07;
|
LPC_IOCON->PIO0_6 &= ~0x07;
|
||||||
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
|
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#if MCU == MCU_LPC13UXX
|
#if MCU == MCU_LPC13UXX
|
||||||
|
|
||||||
TUSB_Error_t hal_init()
|
tusb_error_t hal_init()
|
||||||
{
|
{
|
||||||
// TODO usb abstract later
|
// TODO usb abstract later
|
||||||
/* Enable AHB clock to the USB block and USB RAM. */
|
/* Enable AHB clock to the USB block and USB RAM. */
|
||||||
@ -52,7 +52,7 @@ TUSB_Error_t hal_init()
|
|||||||
LPC_IOCON->PIO0_6 &= ~0x07;
|
LPC_IOCON->PIO0_6 &= ~0x07;
|
||||||
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
|
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#if MCU == MCU_LPC43XX
|
#if MCU == MCU_LPC43XX
|
||||||
|
|
||||||
TUSB_Error_t hal_init()
|
tusb_error_t hal_init()
|
||||||
{
|
{
|
||||||
/* Set up USB0 clock */
|
/* Set up USB0 clock */
|
||||||
CGU_EnableEntity(CGU_CLKSRC_PLL0, DISABLE); /* Disable PLL first */
|
CGU_EnableEntity(CGU_CLKSRC_PLL0, DISABLE); /* Disable PLL first */
|
||||||
@ -48,7 +48,7 @@ TUSB_Error_t hal_init()
|
|||||||
CGU_EnableEntity(CGU_CLKSRC_PLL0, ENABLE); /* Enable PLL after all setting is done */
|
CGU_EnableEntity(CGU_CLKSRC_PLL0, ENABLE); /* Enable PLL after all setting is done */
|
||||||
LPC_CREG->CREG0 &= ~(1<<5); /* Turn on the phy */
|
LPC_CREG->CREG0 &= ~(1<<5); /* Turn on the phy */
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,10 +39,10 @@
|
|||||||
|
|
||||||
#ifdef TUSB_CFG_HOST
|
#ifdef TUSB_CFG_HOST
|
||||||
|
|
||||||
TUSB_Error_t hcd_init(uint8_t coreid)
|
tusb_error_t hcd_init(uint8_t coreid)
|
||||||
{
|
{
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,15 +66,15 @@
|
|||||||
* \note
|
* \note
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TUSB_Error_t hcd_init(uint8_t hostid) ATTR_WARN_UNUSED_RESULT;
|
tusb_error_t hcd_init(uint8_t hostid) ATTR_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
//TUSB_Error_t hcd_pipe_open(
|
//tusb_error_t hcd_pipe_open(
|
||||||
// uint8_t hostid, uint8_t device_address,
|
// uint8_t hostid, uint8_t device_address,
|
||||||
//
|
//
|
||||||
// )ATTR_WARN_UNUSED_RESULT;
|
// )ATTR_WARN_UNUSED_RESULT;
|
||||||
TUSB_Error_t hcd_pipe_close()ATTR_WARN_UNUSED_RESULT;
|
tusb_error_t hcd_pipe_close()ATTR_WARN_UNUSED_RESULT;
|
||||||
TUSB_Error_t hcd_pipe_transfer()ATTR_WARN_UNUSED_RESULT;
|
tusb_error_t hcd_pipe_transfer()ATTR_WARN_UNUSED_RESULT;
|
||||||
TUSB_Error_t hcd_pipe_cancel()ATTR_WARN_UNUSED_RESULT;
|
tusb_error_t hcd_pipe_cancel()ATTR_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
|
|
||||||
TUSB_Error_t tusb_init(void)
|
tusb_error_t tusb_init(void)
|
||||||
{
|
{
|
||||||
ASSERT_STATUS( hal_init() ) ; /* HARDWARE INIT */
|
ASSERT_STATUS( hal_init() ) ; /* HARDWARE INIT */
|
||||||
|
|
||||||
@ -49,5 +49,5 @@ TUSB_Error_t tusb_init(void)
|
|||||||
ASSERT_STATUS( dcd_init(0) );
|
ASSERT_STATUS( dcd_init(0) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return tERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
#include "class/cdc.h"
|
#include "class/cdc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TUSB_Error_t tusb_init(void);
|
tusb_error_t tusb_init(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user