Austin Schuh | 41baf20 | 2022-01-01 14:33:40 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * tusb_config.h |
| 3 | * |
| 4 | * Created on: Sep 5, 2019 |
| 5 | * Author: nconrad |
| 6 | */ |
| 7 | |
| 8 | #ifndef TUSB_CONFIG_H_ |
| 9 | #define TUSB_CONFIG_H_ |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | //-------------------------------------------------------------------- |
| 16 | // COMMON CONFIGURATION |
| 17 | //-------------------------------------------------------------------- |
| 18 | |
| 19 | // defined by board.mk |
| 20 | #ifndef CFG_TUSB_MCU |
| 21 | #error CFG_TUSB_MCU must be defined |
| 22 | #endif |
| 23 | |
| 24 | // RHPort number used for device can be defined by board.mk, default to port 0 |
| 25 | #ifndef BOARD_DEVICE_RHPORT_NUM |
| 26 | #define BOARD_DEVICE_RHPORT_NUM 0 |
| 27 | #endif |
| 28 | |
| 29 | // RHPort max operational speed can defined by board.mk |
| 30 | // Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed |
| 31 | #ifndef BOARD_DEVICE_RHPORT_SPEED |
| 32 | #if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ |
| 33 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56) |
| 34 | #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED |
| 35 | #else |
| 36 | #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED |
| 37 | #endif |
| 38 | #endif |
| 39 | |
| 40 | // Device mode with rhport and speed defined by board.mk |
| 41 | #if BOARD_DEVICE_RHPORT_NUM == 0 |
| 42 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED) |
| 43 | #elif BOARD_DEVICE_RHPORT_NUM == 1 |
| 44 | #define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED) |
| 45 | #else |
| 46 | #error "Incorrect RHPort configuration" |
| 47 | #endif |
| 48 | |
| 49 | #ifndef CFG_TUSB_OS |
| 50 | #define CFG_TUSB_OS OPT_OS_NONE |
| 51 | #endif |
| 52 | |
| 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build |
| 54 | // #define CFG_TUSB_DEBUG 0 |
| 55 | |
| 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. |
| 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put |
| 58 | * into those specific section. |
| 59 | * e.g |
| 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) |
| 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) |
| 62 | */ |
| 63 | #ifndef CFG_TUSB_MEM_SECTION |
| 64 | #define CFG_TUSB_MEM_SECTION |
| 65 | #endif |
| 66 | |
| 67 | #ifndef CFG_TUSB_MEM_ALIGN |
| 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) |
| 69 | #endif |
| 70 | |
| 71 | //-------------------------------------------------------------------- |
| 72 | // DEVICE CONFIGURATION |
| 73 | //-------------------------------------------------------------------- |
| 74 | |
| 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE |
| 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 |
| 77 | #endif |
| 78 | |
| 79 | //------------- CLASS -------------// |
| 80 | |
| 81 | #define CFG_TUD_USBTMC 1 |
| 82 | #define CFG_TUD_USBTMC_ENABLE_INT_EP 1 |
| 83 | #define CFG_TUD_USBTMC_ENABLE_488 1 |
| 84 | |
| 85 | #ifdef __cplusplus |
| 86 | } |
| 87 | #endif |
| 88 | |
| 89 | #endif /* TUSB_CONFIG_H_ */ |