33#ifndef _NO_OS_OA_TC6_H
34#define _NO_OS_OA_TC6_H
40#ifndef CONFIG_OA_TX_FRAME_BUFF_NUM
41#define CONFIG_OA_TX_FRAME_BUFF_NUM 2
44#ifndef CONFIG_OA_RX_FRAME_BUFF_NUM
45#define CONFIG_OA_RX_FRAME_BUFF_NUM 5
48#ifndef CONFIG_OA_CHUNK_BUFFER_SIZE
49#define CONFIG_OA_CHUNK_BUFFER_SIZE 1514
52#ifndef CONFIG_OA_THREAD_RX_LIMIT
53#define CONFIG_OA_THREAD_RX_LIMIT 5
56#ifndef CONFIG_OA_ZERO_SWO_ONLY
57#define CONFIG_OA_ZERO_SWO_ONLY 1
60#define OA_TX_FRAME_BUFF_NUM CONFIG_OA_TX_FRAME_BUFF_NUM
61#define OA_RX_FRAME_BUFF_NUM CONFIG_OA_RX_FRAME_BUFF_NUM
64#define OA_SPI_BUFF_LEN 1632
67#define OA_SPI_CTRL_LEN 16
69#define OA_CHUNK_SIZE 64
71#define OA_HEADER_LEN 4
72#define OA_FOOTER_LEN 4
74#define OA_MMS_REG(m, r) (((m) << 16) | ((r) & NO_OS_GENMASK(15, 0)))
75#define OA_CTRL_ADDR_MMS_MASK NO_OS_GENMASK(27, 8)
77#define OA_CTRL_HDRB_MASK NO_OS_BIT(30)
78#define OA_CTRL_WNR_MASK NO_OS_BIT(29)
79#define OA_CTRL_AID_MASK NO_OS_BIT(28)
80#define OA_CTRL_MMS_MASK NO_OS_GENMASK(27, 24)
81#define OA_CTRL_ADDR_MASK NO_OS_GENMASK(23, 8)
82#define OA_CTRL_LEN_MASK NO_OS_GENMASK(7, 1)
83#define OA_CTRL_P_MASK NO_OS_BIT(0)
85#define OA_DATA_FOOTER_EXST_MASK NO_OS_BIT(31)
86#define OA_DATA_FOOTER_HDRB_MASK NO_OS_BIT(30)
87#define OA_DATA_FOOTER_SYNC_MASK NO_OS_BIT(29)
88#define OA_DATA_FOOTER_RCA_MASK NO_OS_GENMASK(28, 24)
89#define OA_DATA_FOOTER_VS_MASK NO_OS_GENMASK(23, 22)
90#define OA_DATA_FOOTER_DV_MASK NO_OS_BIT(21)
91#define OA_DATA_FOOTER_SV_MASK NO_OS_BIT(20)
92#define OA_DATA_FOOTER_SWO_MASK NO_OS_GENMASK(19, 16)
93#define OA_DATA_FOOTER_FD_MASK NO_OS_BIT(15)
94#define OA_DATA_FOOTER_EV_MASK NO_OS_BIT(14)
95#define OA_DATA_FOOTER_EBO_MASK NO_OS_GENMASK(13, 8)
96#define OA_DATA_FOOTER_RTSA_MASK NO_OS_BIT(7)
97#define OA_DATA_FOOTER_RTSP_MASK NO_OS_BIT(6)
98#define OA_DATA_FOOTER_TXC_MASK NO_OS_GENMASK(5, 1)
99#define OA_DATA_FOOTER_P_MASK NO_OS_BIT(0)
101#define OA_DATA_HEADER_DNC_MASK NO_OS_BIT(31)
102#define OA_DATA_HEADER_SEQ_MASK NO_OS_BIT(30)
103#define OA_DATA_HEADER_NORX_MASK NO_OS_BIT(29)
104#define OA_DATA_HEADER_VS_MASK NO_OS_GENMASK(23, 22)
105#define OA_DATA_HEADER_DV_MASK NO_OS_BIT(21)
106#define OA_DATA_HEADER_SV_MASK NO_OS_BIT(20)
107#define OA_DATA_HEADER_SWO_MASK NO_OS_GENMASK(19, 16)
108#define OA_DATA_HEADER_EV_MASK NO_OS_BIT(14)
109#define OA_DATA_HEADER_EBO_MASK NO_OS_GENMASK(13, 8)
110#define OA_DATA_HEADER_P_MASK NO_OS_BIT(0)
114#define OA_TC6_IDVER_REG OA_MMS_REG(0x0, 0x0000)
115#define OA_TC6_PHYID_REG OA_MMS_REG(0x0, 0x0001)
116#define OA_TC6_STDCAP_REG OA_MMS_REG(0x0, 0x0002)
117#define OA_TC6_RESET_REG OA_MMS_REG(0x0, 0x0003)
118#define OA_TC6_CONFIG0_REG OA_MMS_REG(0x0, 0x0004)
119#define OA_TC6_CONFIG1_REG OA_MMS_REG(0x0, 0x0005)
120#define OA_TC6_CONFIG2_REG OA_MMS_REG(0x0, 0x0006)
121#define OA_TC6_STATUS0_REG OA_MMS_REG(0x0, 0x0008)
122#define OA_TC6_STATUS1_REG OA_MMS_REG(0x0, 0x0009)
123#define OA_TC6_BUFST_REG OA_MMS_REG(0x0, 0x000B)
124#define OA_TC6_IMSK0_REG OA_MMS_REG(0x0, 0x000C)
125#define OA_TC6_IMSK1_REG OA_MMS_REG(0x0, 0x000D)
127#define OA_TC6_TTSCAH_REG OA_MMS_REG(0x0, 0x0010)
128#define OA_TC6_TTSCAL_REG OA_MMS_REG(0x0, 0x0011)
129#define OA_TC6_TTSCBH_REG OA_MMS_REG(0x0, 0x0012)
130#define OA_TC6_TTSCBL_REG OA_MMS_REG(0x0, 0x0013)
131#define OA_TC6_TTSCCH_REG OA_MMS_REG(0x0, 0x0014)
132#define OA_TC6_TTSCCL_REG OA_MMS_REG(0x0, 0x0015)
133#define OA_TC6_MDIOACC0_REG OA_MMS_REG(0x0, 0x0020)
134#define OA_TC6_MDIOACC1_REG OA_MMS_REG(0x0, 0x0021)
135#define OA_TC6_MDIOACC2_REG OA_MMS_REG(0x0, 0x0022)
136#define OA_TC6_MDIOACC3_REG OA_MMS_REG(0x0, 0x0023)
137#define OA_TC6_MDIOACC4_REG OA_MMS_REG(0x0, 0x0024)
138#define OA_TC6_MDIOACC5_REG OA_MMS_REG(0x0, 0x0025)
139#define OA_TC6_MDIOACC6_REG OA_MMS_REG(0x0, 0x0026)
140#define OA_TC6_MDIOACC7_REG OA_MMS_REG(0x0, 0x0027)
142#define OA_TC6_CONFIG0_ZARFE_MASK NO_OS_BIT(12)
144#define OA_TC6_BUFSTS_TXC_MASK NO_OS_GENMASK(15, 8)
145#define OA_TC6_BUFSTS_RCA_MASK NO_OS_GENMASK(7, 0)
Header file of SPI Interface.
Header file of utility functions.
int oa_tc6_get_tx_frame(struct oa_tc6_desc *, struct oa_tc6_frame_buffer **)
Get a frame buffer that can be filled by user.
Definition oa_tc6.c:192
oa_tc6_user_buffer_state
State for data buffers containing Ethernet frames.
Definition oa_tc6.h:150
@ OA_BUFF_RX_IN_PROGRESS
Definition oa_tc6.h:162
@ OA_BUFF_TX_READY
Definition oa_tc6.h:177
@ OA_BUFF_FREE
Definition oa_tc6.h:155
@ OA_BUFF_RX_COMPLETE
Definition oa_tc6.h:168
@ OA_BUFF_RX_USER_OWNED
Definition oa_tc6.h:171
@ OA_BUFF_TX_BUSY
Definition oa_tc6.h:174
#define OA_SPI_CTRL_LEN
Definition oa_tc6.h:67
int oa_tc6_init(struct oa_tc6_desc **, struct oa_tc6_init_param *)
Allocate resources for the OA TC6 driver.
Definition oa_tc6.c:723
int oa_tc6_get_xfer_flags(struct oa_tc6_desc *, struct oa_tc6_flags *, bool)
Gets the latched transfer flags that are read from the data chunk footer. Optionally clears the latch...
Definition oa_tc6.c:629
int oa_tc6_remove(struct oa_tc6_desc *)
Free a device descriptor.
Definition oa_tc6.c:756
#define OA_TX_FRAME_BUFF_NUM
Definition oa_tc6.h:60
int oa_tc6_get_rx_frame_match_vs(struct oa_tc6_desc *, struct oa_tc6_frame_buffer **, uint8_t, uint8_t)
Get a frame buffer that is ready to be read by the user. The VS field in the chunk footer fields shou...
Definition oa_tc6.c:293
#define OA_RX_FRAME_BUFF_NUM
Definition oa_tc6.h:61
int oa_tc6_reg_update(struct oa_tc6_desc *, uint32_t, uint32_t, uint32_t)
Update a field inside a register.
Definition oa_tc6.c:170
int oa_tc6_reg_read(struct oa_tc6_desc *, uint32_t, uint32_t *)
Read a register value.
Definition oa_tc6.c:113
int oa_tc6_put_rx_frame(struct oa_tc6_desc *, struct oa_tc6_frame_buffer *)
Mark a frame buffer as used and ready to be rewritten.
Definition oa_tc6.c:337
int oa_tc6_put_tx_frame(struct oa_tc6_desc *, struct oa_tc6_frame_buffer *)
Mark a frame buffer as ready to be transmitted.
Definition oa_tc6.c:218
int oa_tc6_get_rx_frame(struct oa_tc6_desc *, struct oa_tc6_frame_buffer **)
Get a frame buffer that is ready to be read by the user.
Definition oa_tc6.c:316
int oa_tc6_reg_write(struct oa_tc6_desc *, uint32_t, uint32_t)
Write a register value.
Definition oa_tc6.c:145
#define OA_SPI_BUFF_LEN
Definition oa_tc6.h:64
int oa_tc6_thread(struct oa_tc6_desc *)
Transmit all the frames in the OA_BUFF_TX_READY state and receive the frames in the OA_BUFF_RX_COMPLE...
Definition oa_tc6.c:649
#define CONFIG_OA_CHUNK_BUFFER_SIZE
Definition oa_tc6.h:49
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Holds the frame buffers and the communication descriptor for the OA TC6 driver.
Definition oa_tc6.h:212
uint32_t data_rx_credit
Definition oa_tc6.h:221
struct oa_tc6_flags xfer_flags
Definition oa_tc6.h:226
struct oa_tc6_frame_buffer user_rx_frame_buffer[OA_RX_FRAME_BUFF_NUM]
Definition oa_tc6.h:217
uint32_t ctrl_rx_credit
Definition oa_tc6.h:224
uint8_t ctrl_chunks[OA_SPI_CTRL_LEN]
Definition oa_tc6.h:214
bool prote_spi
Definition oa_tc6.h:227
struct no_os_spi_desc * comm_desc
Definition oa_tc6.h:213
uint8_t data_chunks[OA_SPI_BUFF_LEN]
Definition oa_tc6.h:215
uint32_t ctrl_tx_credit
Definition oa_tc6.h:223
struct oa_tc6_frame_buffer user_tx_frame_buffer[OA_TX_FRAME_BUFF_NUM]
Definition oa_tc6.h:218
uint32_t data_tx_credit
Definition oa_tc6.h:220
Stores the status flags which are provided as part of the footer during data transfers....
Definition oa_tc6.h:202
bool exst
Definition oa_tc6.h:204
bool flags_valid
Definition oa_tc6.h:203
bool hdrb
Definition oa_tc6.h:205
bool sync
Definition oa_tc6.h:206
Stores an Ethernet frame along with metadata needed for parsing. The MAC driver or the user applicati...
Definition oa_tc6.h:185
enum oa_tc6_user_buffer_state state
Definition oa_tc6.h:189
uint8_t data[CONFIG_OA_CHUNK_BUFFER_SIZE]
Definition oa_tc6.h:188
uint8_t vs
Definition oa_tc6.h:190
bool rtsp
Definition oa_tc6.h:194
bool rtsa
Definition oa_tc6.h:193
bool frame_drop
Definition oa_tc6.h:192
uint32_t index
Definition oa_tc6.h:186
uint32_t len
Definition oa_tc6.h:187
Holds the initialization parameters for the OA TC6 driver.
Definition oa_tc6.h:233
bool prote_spi
Definition oa_tc6.h:237
struct no_os_spi_desc * comm_desc
Definition oa_tc6.h:234