rename a bunch of configure macros

This commit is contained in:
hathach 2012-12-20 16:56:19 +07:00
parent ec4a3f6048
commit 00b3f48519
12 changed files with 62 additions and 39 deletions

View File

@ -631,6 +631,7 @@
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
<cconfiguration id="com.crt.advproject.config.lib.debug.1649411711.804680655">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.lib.debug.1649411711.804680655" moduleId="org.eclipse.cdt.core.settings" name="lpc11uxx">
@ -1260,6 +1261,7 @@
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
<cconfiguration id="com.crt.advproject.config.lib.debug.1649411711.573376249.2021640335">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.lib.debug.1649411711.573376249.2021640335" moduleId="org.eclipse.cdt.core.settings" name="lpc43xx">
@ -1890,6 +1892,7 @@
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">

View File

@ -38,7 +38,7 @@
#include "cdc.h"
#include "common/fifo.h"
#if defined CFG_CLASS_CDC && defined CFG_TUSB_DEVICE
#if defined TUSB_CFG_DEVICE_CDC && defined TUSB_CFG_DEVICE
static USBD_HANDLE_T g_hCdc;
static CDC_LINE_CODING line_coding;

View File

@ -37,14 +37,14 @@
#include "hid.h"
#if defined TUSB_CLASS_HID && defined CFG_TUSB_DEVICE
#if defined DEVICE_CLASS_HID && defined TUSB_CFG_DEVICE
#ifdef CFG_CLASS_HID_KEYBOARD
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
USB_HID_KeyboardReport_t hid_keyboard_report;
volatile static bool bKeyChanged = false;
#endif
#ifdef CFG_CLASS_HID_MOUSE
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
USB_HID_MouseReport_t hid_mouse_report;
volatile static bool bMouseChanged = false;
#endif
@ -64,7 +64,7 @@ ErrorCode_t HID_GetReport( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t
switch (pHidCtrl->protocol)
{
#ifdef CFG_CLASS_HID_KEYBOARD
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
case HID_PROTOCOL_KEYBOARD:
*pBuffer = (uint8_t*) &hid_keyboard_report;
*plength = sizeof(USB_HID_KeyboardReport_t);
@ -77,7 +77,7 @@ ErrorCode_t HID_GetReport( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t
break;
#endif
#ifdef CFG_CLASS_HID_MOUSE
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
case HID_PROTOCOL_MOUSE:
*pBuffer = (uint8_t*) &hid_mouse_report;
*plength = sizeof(USB_HID_MouseReport_t);
@ -127,7 +127,7 @@ ErrorCode_t HID_EpIn_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event)
USB_HID_CTRL_T* pHidCtrl = (USB_HID_CTRL_T*)data;
switch(pHidCtrl->protocol)
{
#ifdef CFG_CLASS_HID_KEYBOARD
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
case HID_PROTOCOL_KEYBOARD:
if (!bKeyChanged)
{
@ -138,7 +138,7 @@ ErrorCode_t HID_EpIn_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event)
break;
#endif
#ifdef CFG_CLASS_HID_MOUSE
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
case HID_PROTOCOL_MOUSE:
if (!bMouseChanged)
{
@ -222,18 +222,18 @@ 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)
{
#ifdef CFG_CLASS_HID_KEYBOARD
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
USBD_API->hw->WriteEP(hUsb , HID_KEYBOARD_EP_IN , (uint8_t* ) &hid_keyboard_report , sizeof(USB_HID_KeyboardReport_t) ); // initial packet for IN endpoint , will not work if omitted
#endif
#ifdef CFG_CLASS_HID_MOUSE
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
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
return tERROR_NONE;
}
#ifdef CFG_CLASS_HID_KEYBOARD
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
/**************************************************************************/
/*!
@brief Send the supplied key codes out via HID USB keyboard emulation
@ -295,7 +295,7 @@ TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], ui
}
#endif
#ifdef CFG_CLASS_HID_MOUSE
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
/**************************************************************************/
/*!
@brief Send the supplied mouse event out via HID USB mouse emulation

View File

@ -57,8 +57,14 @@
// TODO refractor
#include "common/common.h"
#include "device/dcd.h"
#ifdef TUSB_CFG_DEVICE
#include "device/dcd.h"
#endif
#ifdef TUSB_CFG_HOST
#include "device/hcd.h"
#endif
/** \struct USB_HID_MouseReport_t
* \brief Standard HID Boot Protocol Mouse Report.
@ -160,7 +166,7 @@ enum USB_HID_LOCAL_CODE
* \return Error Code of the \ref TUSB_ERROR enum
* \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) ATTR_NON_NULL;
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
*
@ -178,7 +184,7 @@ TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb);
* \return Error Code of the \ref TUSB_ERROR enum
* \note
*/
TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey) ATTR_NON_NULL;
TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey);
/** \brief
*
@ -190,6 +196,10 @@ TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], ui
TUSB_Error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y);
#endif
#ifdef TUSB_CFG_HOST
#endif
#ifdef __cplusplus
}
#endif

View File

@ -109,7 +109,7 @@
//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
#if CFG_TUSB_DEBUG_LEVEL
#if TUSB_CFG_DEBUG
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)

View File

@ -35,9 +35,15 @@
* This file is part of the tinyUSB stack.
*/
#include "errors.h"
#if TUSB_CFG_DEBUG == 3
char const* const TUSB_ErrorStr[] = {
# define ERROR_ENUM(x) #x,
# include "errors_def"
# undef ERROR_ENUM
0
};
#endif

View File

@ -49,6 +49,8 @@
#ifndef _TUSB_ERRORS_H_
#define _TUSB_ERRORS_H_
#include "../tusb_cfg.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -64,8 +66,10 @@ typedef enum {
ERROR_COUNT
}TUSB_Error_t;
/// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG_LEVEL > 0
#if TUSB_CFG_DEBUG == 3
/// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0
extern char const* const TUSB_ErrorStr[];
#endif
#ifdef __cplusplus
}

View File

@ -37,7 +37,7 @@
#include "dcd.h"
#ifdef CFG_TUSB_DEVICE
#ifdef TUSB_CFG_DEVICE
// TODO refractor later
#include "descriptors.h"
@ -59,11 +59,11 @@ ErrorCode_t USB_Configure_Event (USBD_HANDLE_T hUsb)
USB_CORE_CTRL_T* pCtrl = (USB_CORE_CTRL_T*)hUsb;
if (pCtrl->config_value)
{
#if defined(TUSB_CLASS_HID)
#if defined(DEVICE_CLASS_HID)
ASSERT( tERROR_NONE == tusb_hid_configured(hUsb), ERR_FAILED );
#endif
#ifdef CFG_CLASS_CDC
#ifdef TUSB_CFG_DEVICE_CDC
ASSERT( tERROR_NONE == tusb_cdc_configured(hUsb), ERR_FAILED );
#endif
}
@ -118,18 +118,18 @@ TUSB_Error_t dcd_init(uint8_t coreid)
memsize = usb_param.mem_size;
/* Initialise the class driver(s) */
#ifdef CFG_CLASS_CDC
#ifdef TUSB_CFG_DEVICE_CDC
ASSERT_ERROR( tusb_cdc_init(g_hUsb, &USB_FsConfigDescriptor.CDC_CCI_Interface,
&USB_FsConfigDescriptor.CDC_DCI_Interface, &membase, &memsize) );
#endif
#ifdef CFG_CLASS_HID_KEYBOARD
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
ASSERT_ERROR( tusb_hid_init(g_hUsb , &USB_FsConfigDescriptor.HID_KeyboardInterface ,
HID_KeyboardReportDescriptor, USB_FsConfigDescriptor.HID_KeyboardHID.DescriptorList[0].wDescriptorLength,
&membase , &memsize) );
#endif
#ifdef CFG_CLASS_HID_MOUSE
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
ASSERT_ERROR( tusb_hid_init(g_hUsb , &USB_FsConfigDescriptor.HID_MouseInterface ,
HID_MouseReportDescriptor, USB_FsConfigDescriptor.HID_MouseHID.DescriptorList[0].wDescriptorLength,
&membase , &memsize) );

View File

@ -37,7 +37,7 @@
#include "hcd.h"
#ifdef CFG_TUSB_HOST
#ifdef TUSB_CFG_HOST
TUSB_Error_t hcd_init(uint8_t coreid)
{

View File

@ -41,11 +41,11 @@ TUSB_Error_t tusb_init(void)
{
ASSERT_ERROR( hal_init() ) ; /* HARDWARE INIT */
#ifdef CFG_TUSB_HOST
#ifdef TUSB_CFG_HOST
ASSERT_ERROR( hcd_init(0) );
#endif
#ifdef CFG_TUSB_DEVICE
#ifdef TUSB_CFG_DEVICE
ASSERT_ERROR( dcd_init(0) );
#endif

View File

@ -50,19 +50,19 @@
#include "common/common.h"
#ifdef CFG_TUSB_HOST
#ifdef TUSB_CFG_HOST
#include "host/hcd.h"
#endif
#ifdef CFG_TUSB_DEVICE
#ifdef TUSB_CFG_DEVICE
#include "device/dcd.h"
#endif
#if TUSB_CLASS_HID
#if DEVICE_CLASS_HID
#include "class/hid.h"
#endif
#ifdef CFG_CLASS_CDC
#ifdef TUSB_CFG_DEVICE_CDC
#include "class/cdc.h"
#endif

View File

@ -59,27 +59,27 @@
#endif
/// 0: no debug infor 3: most debug infor provided
#ifndef CFG_TUSB_DEBUG_LEVEL
#define CFG_TUSB_DEBUG_LEVEL 3
#ifndef TUSB_CFG_DEBUG
#define TUSB_CFG_DEBUG 3
#endif
/// Enable Host Support
#define CFG_TUSB_HOST
//#define TUSB_CFG_HOST
/// Enable Device Support
//#define CFG_TUSB_DEVICE
#define TUSB_CFG_DEVICE
/// Enable CDC Support
#define CFG_CLASS_CDC
#define TUSB_CFG_DEVICE_CDC
/// Enable HID Keyboard support
#define CFG_CLASS_HID_KEYBOARD
#define TUSB_CFG_DEVICE_HID_KEYBOARD
/// Enable HID Mouse support
#define CFG_CLASS_HID_MOUSE
#define TUSB_CFG_DEVICE_HID_MOUSE
#define TUSB_CLASS_HID ( (defined CFG_CLASS_HID_KEYBOARD) || (defined CFG_CLASS_HID_MOUSE) )
#define TUSB_EHCI
#define DEVICE_CLASS_HID ( (defined TUSB_CFG_DEVICE_HID_KEYBOARD) || (defined TUSB_CFG_DEVICE_HID_MOUSE) )
#define HOST_EHCI