Skip to content

Commit da61ccc

Browse files
niedzwiecki-dawidfabiobaltieri
authored andcommitted
mgmt: ec_host_cmd: add buffer alignment config
Add a new config to specify an alignment for the buffers defined by the ec_host_cmd handler. Signed-off-by: Dawid Niedzwiecki <[email protected]>
1 parent 1852f9c commit da61ccc

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

subsys/mgmt/ec_host_cmd/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ config EC_HOST_CMD_HANDLER_RX_BUFFER_SIZE
4747
avoid duplicating buffers. If multiple backends are used, the size has to be
4848
set by user to the largest one.
4949

50+
config EC_HOST_CMD_HANDLER_BUFFER_ALIGN
51+
int "Memory alignment for the tx/rx buffers"
52+
default 4
53+
help
54+
Some interfaces need a special memory alignment to work properly. Use that config
55+
to specify the alignment.
56+
5057
config EC_HOST_CMD_HANDLER_PRIO
5158
int "Priority of host command task"
5259
default 13

subsys/mgmt/ec_host_cmd/ec_host_cmd_handler.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ BUILD_ASSERT(NUMBER_OF_CHOSEN_BACKENDS < 2, "Number of chosen backends > 1");
4040
#endif
4141

4242
COND_CODE_1(CONFIG_EC_HOST_CMD_HANDLER_RX_BUFFER_DEF,
43-
(static uint8_t hc_rx_buffer[CONFIG_EC_HOST_CMD_HANDLER_RX_BUFFER_SIZE] __aligned(4)
43+
(static uint8_t hc_rx_buffer[CONFIG_EC_HOST_CMD_HANDLER_RX_BUFFER_SIZE]
44+
__aligned(CONFIG_EC_HOST_CMD_HANDLER_BUFFER_ALIGN)
4445
BUFFERS_CACHE_ATTR;), ())
4546
COND_CODE_1(CONFIG_EC_HOST_CMD_HANDLER_TX_BUFFER_DEF,
46-
(static uint8_t hc_tx_buffer[CONFIG_EC_HOST_CMD_HANDLER_TX_BUFFER_SIZE] __aligned(4)
47+
(static uint8_t hc_tx_buffer[CONFIG_EC_HOST_CMD_HANDLER_TX_BUFFER_SIZE]
48+
__aligned(CONFIG_EC_HOST_CMD_HANDLER_BUFFER_ALIGN)
4749
BUFFERS_CACHE_ATTR;), ())
4850

4951
#ifdef CONFIG_EC_HOST_CMD_DEDICATED_THREAD

0 commit comments

Comments
 (0)