1 /* SPDX-License-Identifier: BSD-3-Clause
5 #ifndef _FSL_DPDMAI_CMD_H
6 #define _FSL_DPDMAI_CMD_H
9 #define DPDMAI_VER_MAJOR 3
10 #define DPDMAI_VER_MINOR 3
12 /* Command versioning */
13 #define DPDMAI_CMD_BASE_VERSION 1
14 #define DPDMAI_CMD_VERSION_2 2
15 #define DPDMAI_CMD_ID_OFFSET 4
17 #define DPDMAI_CMD(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_BASE_VERSION)
18 #define DPDMAI_CMD_V2(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_VERSION_2)
21 #define DPDMAI_CMDID_CLOSE DPDMAI_CMD(0x800)
22 #define DPDMAI_CMDID_OPEN DPDMAI_CMD(0x80E)
23 #define DPDMAI_CMDID_CREATE DPDMAI_CMD_V2(0x90E)
24 #define DPDMAI_CMDID_DESTROY DPDMAI_CMD(0x98E)
25 #define DPDMAI_CMDID_GET_API_VERSION DPDMAI_CMD(0xa0E)
27 #define DPDMAI_CMDID_ENABLE DPDMAI_CMD(0x002)
28 #define DPDMAI_CMDID_DISABLE DPDMAI_CMD(0x003)
29 #define DPDMAI_CMDID_GET_ATTR DPDMAI_CMD_V2(0x004)
30 #define DPDMAI_CMDID_RESET DPDMAI_CMD(0x005)
31 #define DPDMAI_CMDID_IS_ENABLED DPDMAI_CMD(0x006)
33 #define DPDMAI_CMDID_SET_RX_QUEUE DPDMAI_CMD_V2(0x1A0)
34 #define DPDMAI_CMDID_GET_RX_QUEUE DPDMAI_CMD_V2(0x1A1)
35 #define DPDMAI_CMDID_GET_TX_QUEUE DPDMAI_CMD_V2(0x1A2)
37 /* Macros for accessing command fields smaller than 1byte */
38 #define DPDMAI_MASK(field) \
39 GENMASK(DPDMAI_##field##_SHIFT + DPDMAI_##field##_SIZE - 1, \
40 DPDMAI_##field##_SHIFT)
41 #define dpdmai_set_field(var, field, val) \
42 ((var) |= (((val) << DPDMAI_##field##_SHIFT) & DPDMAI_MASK(field)))
43 #define dpdmai_get_field(var, field) \
44 (((var) & DPDMAI_MASK(field)) >> DPDMAI_##field##_SHIFT)
47 struct dpdmai_cmd_open {
51 struct dpdmai_cmd_create {
53 uint8_t priorities[2];
56 struct dpdmai_cmd_destroy {
60 #define DPDMAI_ENABLE_SHIFT 0
61 #define DPDMAI_ENABLE_SIZE 1
63 struct dpdmai_rsp_is_enabled {
64 /* only the LSB bit */
68 struct dpdmai_rsp_get_attr {
70 uint8_t num_of_priorities;
71 uint8_t num_of_queues;
74 #define DPDMAI_DEST_TYPE_SHIFT 0
75 #define DPDMAI_DEST_TYPE_SIZE 4
77 struct dpdmai_cmd_set_rx_queue {
79 uint8_t dest_priority;
81 /* from LSB: dest_type:4 */
88 struct dpdmai_cmd_get_queue {
94 struct dpdmai_rsp_get_rx_queue {
96 uint8_t dest_priority;
98 /* from LSB: dest_type:4 */
105 struct dpdmai_rsp_get_tx_queue {
111 #endif /* _FSL_DPDMAI_CMD_H */