xiaoxiang781216 commented on code in PR #6834: URL: https://github.com/apache/incubator-nuttx/pull/6834#discussion_r943739740
########## mm/iob/iob_initialize.c: ########## @@ -30,14 +30,32 @@ #include "iob.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define ROUNDUP(x, y) (((x) + (y) - 1) / (y) * (y)) + +/* Fix the I/O Buffer size with specified alignment size */ + +#define IOB_ALIGN_SIZE ROUNDUP(sizeof(struct iob_s), CONFIG_IOB_ALIGNMENT) +#define IOB_BUFFER_SIZE (IOB_ALIGN_SIZE * CONFIG_IOB_NBUFFERS + \ + CONFIG_IOB_ALIGNMENT - 1) + /**************************************************************************** * Private Data ****************************************************************************/ -/* This is a pool of pre-allocated I/O buffers */ +/* Following raw buffer will be divided into iob_s instances, the initial + * procedure will ensure that the member io_head of each iob_s is aligned + * to the CONFIG_IOB_ALIGNMENT memory boundary. + */ + +static uint8_t g_iob_buffer[IOB_BUFFER_SIZE]; Review Comment: let's add a new string option(e.g. IOB_SECTION), so we can arrange the g_iob_buffer to a special data region: static uint8_t g_iob_buffer[IOB_BUFFER_SIZE] locate_data(CONFIG_IOB_SECTION); It is important for some hardware which has the special requirement for DMA buffer. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org