diff options
| author | hathach <[email protected]> | 2013-03-04 17:07:14 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-03-04 17:07:14 +0700 |
| commit | e1033b9b3c10a75fece0c2c398f5ed3f4b08d174 (patch) | |
| tree | 46187ad8c70499817072700c268a5632ad5bf46c /tinyusb/tusb_option.h | |
| parent | 94c004724ccbe2b74af74fc1753184f6b3ccb9cf (diff) | |
replace TUSB_CFG_HOST by MODE_HOST_SUPPORTED
move stuffs around
Diffstat (limited to 'tinyusb/tusb_option.h')
| -rw-r--r-- | tinyusb/tusb_option.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h index 3b1830419..274e4e0f9 100644 --- a/tinyusb/tusb_option.h +++ b/tinyusb/tusb_option.h @@ -64,11 +64,30 @@ #include "mcu_capacity.h" //--------------------------------------------------------------------+ +// CONTROLLER +//--------------------------------------------------------------------+ +#define TUSB_MODE_HOST 0x02 +#define TUSB_MODE_DEVICE 0x01 +#define TUSB_MODE_NONE 0x00 + +#define CONTROLLER_HOST_NUMBER (\ + ((TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_HOST) ? 1 : 0) + \ + ((TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST) ? 1 : 0)) + +#define CONTROLLER_DEVICE_NUMBER (\ + ((TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_DEVICE) ? 1 : 0) + \ + ((TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_DEVICE) ? 1 : 0)) + +#define MODE_HOST_SUPPORTED (CONTROLLER_HOST_NUMBER > 0) +#define MODE_DEVICE_SUPPORTED (CONTROLLER_DEVICE_NUMBER > 0) + +#if !MODE_HOST_SUPPORTED && !MODE_DEVICE_SUPPORTED + #error please configure at least 1 TUSB_CFG_CONTROLLERn_MODE to TUSB_MODE_HOST and/or TUSB_MODE_DEVICE +#endif + +//--------------------------------------------------------------------+ // COMMON OPTIONS //--------------------------------------------------------------------+ -#define TUSB_MODE_HOST BIN8(10) -#define TUSB_MODE_DEVICE BIN8(01) -#define TUSB_MODE_NONE BIN8(00) /// 0: no debug information 3: most debug information provided #ifndef TUSB_CFG_DEBUG @@ -97,9 +116,7 @@ //--------------------------------------------------------------------+ // HOST OPTIONS //--------------------------------------------------------------------+ -#ifdef TUSB_CFG_HOST - //------------- Controller -------------// - +#if MODE_HOST_SUPPORTED #ifndef TUSB_CFG_HOST_CONTROLLER_START_INDEX #error TUSB_CFG_HOST_CONTROLLER_START_INDEX is not defined #endif @@ -162,6 +179,8 @@ #define CDC_NOTIFICATION_EP_MAXPACKETSIZE 8 #define CDC_DATA_EP_MAXPACKET_SIZE 16 + + #ifdef __cplusplus } #endif |
