Skip to content

Commit 71fb646

Browse files
committed
separate CFG_TUSB_MEM_SECTION and CFG_TUSB_MEM_ALIGN to
- CFG_TUD_MEM_SECTION and CFG_TUD_MEM_ALIGN - CFG_TUH_MEM_SECTION and CFG_TUH_MEM_ALIGN - fix missing mem section and align for host
1 parent 7440782 commit 71fb646

File tree

13 files changed

+68
-27
lines changed

13 files changed

+68
-27
lines changed

hw/bsp/ea4088qs/board.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ CFLAGS += \
1010
-nostdlib \
1111
-DCORE_M4 \
1212
-D__USE_LPCOPEN \
13-
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
13+
-DCFG_TUD_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
14+
-DCFG_TUH_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
1415
-DCFG_TUSB_MCU=OPT_MCU_LPC40XX
1516

1617
# mcu driver cause following warnings

src/class/cdc/cdc_host.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ typedef struct {
6262
tu_edpt_stream_t rx;
6363

6464
uint8_t tx_ff_buf[CFG_TUH_CDC_TX_BUFSIZE];
65-
CFG_TUSB_MEM_ALIGN uint8_t tx_ep_buf[CFG_TUH_CDC_TX_EPSIZE];
65+
CFG_TUH_MEM_ALIGN uint8_t tx_ep_buf[CFG_TUH_CDC_TX_EPSIZE];
6666

6767
uint8_t rx_ff_buf[CFG_TUH_CDC_TX_BUFSIZE];
68-
CFG_TUSB_MEM_ALIGN uint8_t rx_ep_buf[CFG_TUH_CDC_TX_EPSIZE];
68+
CFG_TUH_MEM_ALIGN uint8_t rx_ep_buf[CFG_TUH_CDC_TX_EPSIZE];
6969
} stream;
7070

7171
} cdch_interface_t;
@@ -74,7 +74,7 @@ typedef struct {
7474
// INTERNAL OBJECT & FUNCTION DECLARATION
7575
//--------------------------------------------------------------------+
7676

77-
CFG_TUSB_MEM_SECTION
77+
CFG_TUH_MEM_SECTION
7878
static cdch_interface_t cdch_data[CFG_TUH_CDC];
7979

8080
static inline cdch_interface_t* get_itf(uint8_t idx)

src/class/cdc/cdc_rndis_host.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
//--------------------------------------------------------------------+
5151
#define RNDIS_MSG_PAYLOAD_MAX (1024*4)
5252

53-
CFG_TUSB_MEM_SECTION static uint8_t msg_notification[CFG_TUH_DEVICE_MAX][8];
54-
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4) static uint8_t msg_payload[RNDIS_MSG_PAYLOAD_MAX];
53+
CFG_TUH_MEM_SECTION static uint8_t msg_notification[CFG_TUH_DEVICE_MAX][8];
54+
CFG_TUH_MEM_SECTION CFG_TUH_MEM_ALIGN static uint8_t msg_payload[RNDIS_MSG_PAYLOAD_MAX];
5555

5656
static rndish_data_t rndish_data[CFG_TUH_DEVICE_MAX];
5757

src/class/hid/hid_host.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ typedef struct
5454
uint16_t epin_size;
5555
uint16_t epout_size;
5656

57-
uint8_t epin_buf[CFG_TUH_HID_EPIN_BUFSIZE];
58-
uint8_t epout_buf[CFG_TUH_HID_EPOUT_BUFSIZE];
57+
CFG_TUH_MEM_ALIGN uint8_t epin_buf[CFG_TUH_HID_EPIN_BUFSIZE];
58+
CFG_TUH_MEM_ALIGN uint8_t epout_buf[CFG_TUH_HID_EPOUT_BUFSIZE];
5959
} hidh_interface_t;
6060

61-
CFG_TUSB_MEM_SECTION
61+
CFG_TUH_MEM_SECTION
6262
tu_static hidh_interface_t _hidh_itf[CFG_TUH_HID];
6363

6464
//--------------------------------------------------------------------+

src/class/msc/msc_host.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ typedef struct
7171
tuh_msc_complete_cb_t complete_cb;
7272
uintptr_t complete_arg;
7373

74-
msc_cbw_t cbw;
75-
msc_csw_t csw;
74+
CFG_TUH_MEM_ALIGN msc_cbw_t cbw;
75+
CFG_TUH_MEM_ALIGN msc_csw_t csw;
7676
}msch_interface_t;
7777

78-
CFG_TUSB_MEM_SECTION static msch_interface_t _msch_itf[CFG_TUH_DEVICE_MAX];
78+
CFG_TUH_MEM_SECTION static msch_interface_t _msch_itf[CFG_TUH_DEVICE_MAX];
7979

8080
// buffer used to read scsi information when mounted
8181
// largest response data currently is inquiry TODO Inquiry is not part of enum anymore
82-
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4)
82+
CFG_TUH_MEM_SECTION CFG_TUH_MEM_ALIGN
8383
static uint8_t _msch_buffer[sizeof(scsi_inquiry_resp_t)];
8484

8585
TU_ATTR_ALWAYS_INLINE

src/host/hub.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ typedef struct
4343
uint8_t port_count;
4444
uint8_t status_change; // data from status change interrupt endpoint
4545

46-
hub_port_status_response_t port_status;
47-
hub_status_response_t hub_status;
46+
CFG_TUH_MEM_ALIGN hub_port_status_response_t port_status;
47+
CFG_TUH_MEM_ALIGN hub_status_response_t hub_status;
4848
} hub_interface_t;
4949

50-
CFG_TUSB_MEM_SECTION static hub_interface_t hub_data[CFG_TUH_HUB];
51-
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4) static uint8_t _hub_buffer[sizeof(descriptor_hub_desc_t)];
50+
CFG_TUH_MEM_SECTION static hub_interface_t hub_data[CFG_TUH_HUB];
51+
CFG_TUH_MEM_SECTION CFG_TUH_MEM_ALIGN static uint8_t _hub_buffer[sizeof(descriptor_hub_desc_t)];
5252

5353
TU_ATTR_ALWAYS_INLINE
5454
static inline hub_interface_t* get_itf(uint8_t dev_addr)

src/host/usbh.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static usbh_dev0_t _dev0;
203203
// all devices excluding zero-address
204204
// hub address start from CFG_TUH_DEVICE_MAX+1
205205
// TODO: hub can has its own simpler struct to save memory
206-
CFG_TUSB_MEM_SECTION usbh_device_t _usbh_devices[TOTAL_DEVICES];
206+
static usbh_device_t _usbh_devices[TOTAL_DEVICES];
207207

208208
// Mutex for claiming endpoint
209209
#if OSAL_MUTEX_REQUIRED
@@ -218,15 +218,15 @@ CFG_TUSB_MEM_SECTION usbh_device_t _usbh_devices[TOTAL_DEVICES];
218218
OSAL_QUEUE_DEF(usbh_int_set, _usbh_qdef, CFG_TUH_TASK_QUEUE_SZ, hcd_event_t);
219219
static osal_queue_t _usbh_q;
220220

221-
CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN
221+
CFG_TUH_MEM_SECTION CFG_TUH_MEM_ALIGN
222222
static uint8_t _usbh_ctrl_buf[CFG_TUH_ENUMERATION_BUFSIZE];
223223

224224
// Control transfers: since most controllers do not support multiple control transfers
225225
// on multiple devices concurrently and control transfers are not used much except for
226226
// enumeration, we will only execute control transfers one at a time.
227-
CFG_TUSB_MEM_SECTION struct
227+
CFG_TUH_MEM_SECTION struct
228228
{
229-
tusb_control_request_t request TU_ATTR_ALIGNED(4);
229+
CFG_TUH_MEM_ALIGN tusb_control_request_t request;
230230
uint8_t* buffer;
231231
tuh_xfer_cb_t complete_cb;
232232
uintptr_t user_data;

src/portable/ehci/ehci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ typedef struct
8585
}ehci_data_t;
8686

8787
// Periodic frame list must be 4K alignment
88-
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4096) static ehci_data_t ehci_data;
88+
CFG_TUH_MEM_SECTION TU_ATTR_ALIGNED(4096) static ehci_data_t ehci_data;
8989

9090
//--------------------------------------------------------------------+
9191
// PROTOTYPE

src/portable/nxp/khci/hcd_khci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ typedef struct
137137
// INTERNAL OBJECT & FUNCTION DECLARATION
138138
//--------------------------------------------------------------------+
139139
// BDT(Buffer Descriptor Table) must be 256-byte aligned
140-
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(512) static hcd_data_t _hcd;
141-
//CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4) static uint8_t _rx_buf[1024];
140+
CFG_TUH_MEM_SECTION TU_ATTR_ALIGNED(512) static hcd_data_t _hcd;
141+
//CFG_TUH_MEM_SECTION TU_ATTR_ALIGNED(4) static uint8_t _rx_buf[1024];
142142

143143
int find_pipe(uint8_t dev_addr, uint8_t ep_addr)
144144
{

src/portable/ohci/ohci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ enum {
145145
//--------------------------------------------------------------------+
146146
// INTERNAL OBJECT & FUNCTION DECLARATION
147147
//--------------------------------------------------------------------+
148-
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(256) static ohci_data_t ohci_data;
148+
CFG_TUH_MEM_SECTION TU_ATTR_ALIGNED(256) static ohci_data_t ohci_data;
149149

150150
static ohci_ed_t * const p_ed_head[] =
151151
{

0 commit comments

Comments
 (0)