Skip to content

Commit

Permalink
feature(cdc_class): Applied sections & alignment to cdc data buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-jam committed Nov 14, 2024
1 parent e2b1207 commit 7dc862a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/class/cdc/cdc_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
#define BULK_PACKET_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)

typedef struct {
// Endpoint Transfer buffer
// Hint: When DMA capability is enabled and cache is used and the buffers
// should be in specific section CFG_TUD_MEM_SECTION we declare them first
CFG_TUSB_MEM_ALIGN uint8_t epout_buf[CFG_TUD_CDC_EP_BUFSIZE];
CFG_TUSB_MEM_ALIGN uint8_t epin_buf[CFG_TUD_CDC_EP_BUFSIZE];

uint8_t itf_num;
uint8_t ep_notif;
uint8_t ep_in;
Expand All @@ -68,17 +74,15 @@ typedef struct {
OSAL_MUTEX_DEF(rx_ff_mutex);
OSAL_MUTEX_DEF(tx_ff_mutex);

// Endpoint Transfer buffer
CFG_TUSB_MEM_ALIGN uint8_t epout_buf[CFG_TUD_CDC_EP_BUFSIZE];
CFG_TUSB_MEM_ALIGN uint8_t epin_buf[CFG_TUD_CDC_EP_BUFSIZE];
} cdcd_interface_t;

#define ITF_MEM_RESET_SIZE offsetof(cdcd_interface_t, wanted_char)

//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
CFG_TUD_MEM_SECTION static cdcd_interface_t _cdcd_itf[CFG_TUD_CDC];
CFG_TUD_MEM_SECTION CFG_TUSB_MEM_ALIGN tu_static cdcd_interface_t _cdcd_itf[CFG_TUD_CDC];

static tud_cdc_configure_fifo_t _cdcd_fifo_cfg;

static bool _prep_out_transaction (cdcd_interface_t* p_cdc) {
Expand Down

0 comments on commit 7dc862a

Please sign in to comment.