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#define OA_TX_FRAME_BUFF_NUM CONFIG_OA_TX_FRAME_BUFF_NUM
53#define OA_RX_FRAME_BUFF_NUM CONFIG_OA_RX_FRAME_BUFF_NUM
56#define OA_SPI_BUFF_LEN 1632
57#define OA_CHUNK_SIZE 64
59#define OA_HEADER_LEN 4
60#define OA_FOOTER_LEN 4
62#define OA_MMS_REG(m, r) (((m) << 16) | ((r) & NO_OS_GENMASK(15, 0)))
63#define OA_CTRL_ADDR_MMS_MASK NO_OS_GENMASK(27, 8)
65#define OA_CTRL_HDRB_MASK NO_OS_BIT(30)
66#define OA_CTRL_WNR_MASK NO_OS_BIT(29)
67#define OA_CTRL_AID_MASK NO_OS_BIT(28)
68#define OA_CTRL_MMS_MASK NO_OS_GENMASK(27, 24)
69#define OA_CTRL_ADDR_MASK NO_OS_GENMASK(23, 8)
70#define OA_CTRL_LEN_MASK NO_OS_GENMASK(7, 1)
71#define OA_CTRL_P_MASK NO_OS_BIT(0)
73#define OA_DATA_FOOTER_EXST_MASK NO_OS_BIT(31)
74#define OA_DATA_FOOTER_HDRB_MASK NO_OS_BIT(30)
75#define OA_DATA_FOOTER_SYNC_MASK NO_OS_BIT(29)
76#define OA_DATA_FOOTER_RCA_MASK NO_OS_GENMASK(28, 24)
77#define OA_DATA_FOOTER_VS_MASK NO_OS_GENMASK(23, 22)
78#define OA_DATA_FOOTER_DV_MASK NO_OS_BIT(21)
79#define OA_DATA_FOOTER_SV_MASK NO_OS_BIT(20)
80#define OA_DATA_FOOTER_SWO_MASK NO_OS_GENMASK(19, 16)
81#define OA_DATA_FOOTER_EV_MASK NO_OS_BIT(14)
82#define OA_DATA_FOOTER_EBO_MASK NO_OS_GENMASK(13, 8)
83#define OA_DATA_FOOTER_TXC_MASK NO_OS_GENMASK(5, 1)
84#define OA_DATA_FOOTER_P_MASK NO_OS_BIT(0)
86#define OA_DATA_HEADER_DNC_MASK NO_OS_BIT(31)
87#define OA_DATA_HEADER_SEQ_MASK NO_OS_BIT(30)
88#define OA_DATA_HEADER_NORX_MASK NO_OS_BIT(29)
89#define OA_DATA_HEADER_VS_MASK NO_OS_GENMASK(23, 22)
90#define OA_DATA_HEADER_DV_MASK NO_OS_BIT(21)
91#define OA_DATA_HEADER_SV_MASK NO_OS_BIT(20)
92#define OA_DATA_HEADER_SWO_MASK NO_OS_GENMASK(19, 16)
93#define OA_DATA_HEADER_EV_MASK NO_OS_BIT(14)
94#define OA_DATA_HEADER_EBO_MASK NO_OS_GENMASK(13, 8)
95#define OA_DATA_HEADER_P_MASK NO_OS_BIT(0)
99#define OA_TC6_IDVER_REG OA_MMS_REG(0x0, 0x0000)
100#define OA_TC6_PHYID_REG OA_MMS_REG(0x0, 0x0001)
101#define OA_TC6_STDCAP_REG OA_MMS_REG(0x0, 0x0002)
102#define OA_TC6_RESET_REG OA_MMS_REG(0x0, 0x0003)
103#define OA_TC6_CONFIG0_REG OA_MMS_REG(0x0, 0x0004)
104#define OA_TC6_CONFIG1_REG OA_MMS_REG(0x0, 0x0005)
105#define OA_TC6_CONFIG2_REG OA_MMS_REG(0x0, 0x0006)
106#define OA_TC6_STATUS0_REG OA_MMS_REG(0x0, 0x0008)
107#define OA_TC6_STATUS1_REG OA_MMS_REG(0x0, 0x0009)
108#define OA_TC6_BUFST_REG OA_MMS_REG(0x0, 0x000B)
109#define OA_TC6_IMSK0_REG OA_MMS_REG(0x0, 0x000C)
110#define OA_TC6_IMSK1_REG OA_MMS_REG(0x0, 0x000D)
112#define OA_TC6_TTSCAH_REG OA_MMS_REG(0x0, 0x0010)
113#define OA_TC6_TTSCAL_REG OA_MMS_REG(0x0, 0x0011)
114#define OA_TC6_TTSCBH_REG OA_MMS_REG(0x0, 0x0012)
115#define OA_TC6_TTSCBL_REG OA_MMS_REG(0x0, 0x0013)
116#define OA_TC6_TTSCCH_REG OA_MMS_REG(0x0, 0x0014)
117#define OA_TC6_TTSCCL_REG OA_MMS_REG(0x0, 0x0015)
118#define OA_TC6_MDIOACC0_REG OA_MMS_REG(0x0, 0x0020)
119#define OA_TC6_MDIOACC1_REG OA_MMS_REG(0x0, 0x0021)
120#define OA_TC6_MDIOACC2_REG OA_MMS_REG(0x0, 0x0022)
121#define OA_TC6_MDIOACC3_REG OA_MMS_REG(0x0, 0x0023)
122#define OA_TC6_MDIOACC4_REG OA_MMS_REG(0x0, 0x0024)
123#define OA_TC6_MDIOACC5_REG OA_MMS_REG(0x0, 0x0025)
124#define OA_TC6_MDIOACC6_REG OA_MMS_REG(0x0, 0x0026)
125#define OA_TC6_MDIOACC7_REG OA_MMS_REG(0x0, 0x0027)
127#define OA_TC6_CONFIG0_ZARFE_MASK NO_OS_BIT(12)
129#define OA_TC6_BUFSTS_TXC_MASK NO_OS_GENMASK(15, 8)
130#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:180
oa_tc6_user_buffer_state
State for data buffers containing Ethernet frames.
Definition oa_tc6.h:135
@ OA_BUFF_RX_IN_PROGRESS
Definition oa_tc6.h:147
@ OA_BUFF_TX_READY
Definition oa_tc6.h:162
@ OA_BUFF_FREE
Definition oa_tc6.h:140
@ OA_BUFF_RX_COMPLETE
Definition oa_tc6.h:153
@ OA_BUFF_RX_USER_OWNED
Definition oa_tc6.h:156
@ OA_BUFF_TX_BUSY
Definition oa_tc6.h:159
int oa_tc6_init(struct oa_tc6_desc **, struct oa_tc6_init_param *)
Allocate resources for the OA TC6 driver.
Definition oa_tc6.c:641
int oa_tc6_remove(struct oa_tc6_desc *)
Free a device descriptor.
Definition oa_tc6.c:674
#define OA_TX_FRAME_BUFF_NUM
Definition oa_tc6.h:52
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:281
#define OA_RX_FRAME_BUFF_NUM
Definition oa_tc6.h:53
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:158
int oa_tc6_reg_read(struct oa_tc6_desc *, uint32_t, uint32_t *)
Read a register value.
Definition oa_tc6.c:108
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:325
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:206
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:304
int oa_tc6_reg_write(struct oa_tc6_desc *, uint32_t, uint32_t)
Write a register value.
Definition oa_tc6.c:133
#define OA_SPI_BUFF_LEN
Definition oa_tc6.h:56
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:571
#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:181
uint32_t data_rx_credit
Definition oa_tc6.h:190
struct oa_tc6_frame_buffer user_rx_frame_buffer[OA_RX_FRAME_BUFF_NUM]
Definition oa_tc6.h:186
uint32_t ctrl_rx_credit
Definition oa_tc6.h:193
uint8_t ctrl_chunks[12]
Definition oa_tc6.h:183
struct no_os_spi_desc * comm_desc
Definition oa_tc6.h:182
uint8_t data_chunks[OA_SPI_BUFF_LEN]
Definition oa_tc6.h:184
uint32_t ctrl_tx_credit
Definition oa_tc6.h:192
struct oa_tc6_frame_buffer user_tx_frame_buffer[OA_TX_FRAME_BUFF_NUM]
Definition oa_tc6.h:187
uint32_t data_tx_credit
Definition oa_tc6.h:189
Stores an Ethernet frame along with metadata needed for parsing. The MAC driver or the user applicati...
Definition oa_tc6.h:170
enum oa_tc6_user_buffer_state state
Definition oa_tc6.h:174
uint8_t data[CONFIG_OA_CHUNK_BUFFER_SIZE]
Definition oa_tc6.h:173
uint8_t vs
Definition oa_tc6.h:175
uint32_t index
Definition oa_tc6.h:171
uint32_t len
Definition oa_tc6.h:172
Holds the initialization parameters for the OA TC6 driver.
Definition oa_tc6.h:199
struct no_os_spi_desc * comm_desc
Definition oa_tc6.h:200