1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2017-2018, 2020-2021 NXP
4 #ifndef _FSL_DPDMAI_CMD_H
5 #define _FSL_DPDMAI_CMD_H
8 #define DPDMAI_VER_MAJOR 3
9 #define DPDMAI_VER_MINOR 4
11 /* Command versioning */
12 #define DPDMAI_CMD_BASE_VERSION 1
13 #define DPDMAI_CMD_VERSION_2 2
14 #define DPDMAI_CMD_VERSION_3 3
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)
19 #define DPDMAI_CMD_V3(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_VERSION_3)
22 #define DPDMAI_CMDID_CLOSE DPDMAI_CMD(0x800)
23 #define DPDMAI_CMDID_OPEN DPDMAI_CMD(0x80E)
24 #define DPDMAI_CMDID_CREATE DPDMAI_CMD_V3(0x90E)
25 #define DPDMAI_CMDID_DESTROY DPDMAI_CMD(0x98E)
26 #define DPDMAI_CMDID_GET_API_VERSION DPDMAI_CMD(0xa0E)
28 #define DPDMAI_CMDID_ENABLE DPDMAI_CMD(0x002)
29 #define DPDMAI_CMDID_DISABLE DPDMAI_CMD(0x003)
30 #define DPDMAI_CMDID_GET_ATTR DPDMAI_CMD_V3(0x004)
31 #define DPDMAI_CMDID_RESET DPDMAI_CMD(0x005)
32 #define DPDMAI_CMDID_IS_ENABLED DPDMAI_CMD(0x006)
34 #define DPDMAI_CMDID_SET_RX_QUEUE DPDMAI_CMD_V2(0x1A0)
35 #define DPDMAI_CMDID_GET_RX_QUEUE DPDMAI_CMD_V2(0x1A1)
36 #define DPDMAI_CMDID_GET_TX_QUEUE DPDMAI_CMD_V2(0x1A2)
38 /* Macros for accessing command fields smaller than 1byte */
39 #define DPDMAI_MASK(field) \
40 GENMASK(DPDMAI_##field##_SHIFT + DPDMAI_##field##_SIZE - 1, \
41 DPDMAI_##field##_SHIFT)
42 #define dpdmai_set_field(var, field, val) \
43 ((var) |= (((val) << DPDMAI_##field##_SHIFT) & DPDMAI_MASK(field)))
44 #define dpdmai_get_field(var, field) \
45 (((var) & DPDMAI_MASK(field)) >> DPDMAI_##field##_SHIFT)
48 struct dpdmai_cmd_open {
52 struct dpdmai_cmd_create {
54 uint8_t priorities[2];
59 struct dpdmai_cmd_destroy {
63 #define DPDMAI_ENABLE_SHIFT 0
64 #define DPDMAI_ENABLE_SIZE 1
66 struct dpdmai_rsp_is_enabled {
67 /* only the LSB bit */
71 struct dpdmai_rsp_get_attr {
73 uint8_t num_of_priorities;
74 uint8_t num_of_queues;
79 #define DPDMAI_DEST_TYPE_SHIFT 0
80 #define DPDMAI_DEST_TYPE_SIZE 4
82 struct dpdmai_cmd_set_rx_queue {
84 uint8_t dest_priority;
86 /* from LSB: dest_type:4 */
93 struct dpdmai_cmd_get_queue {
99 struct dpdmai_rsp_get_rx_queue {
101 uint8_t dest_priority;
103 /* from LSB: dest_type:4 */
110 struct dpdmai_rsp_get_tx_queue {
116 #endif /* _FSL_DPDMAI_CMD_H */