40 #define BIT(x) (1 << x)
45 #define PRU_ACTIVE SINGLE_PRU //BOTH_PRU
47 #define SUART_NUM_OF_CHANNELS_PER_SUART 2
48 #define SUART_NUM_OF_BYTES_PER_CHANNEL 16
51 #define SUART_SUCCESS 0
60 #define CHN_TXRX_STATUS_TIMEOUT BIT(6)
61 #define CHN_TXRX_STATUS_BI BIT(5)
62 #define CHN_TXRX_STATUS_FE BIT(4)
63 #define CHN_TXRX_STATUS_UNERR BIT(3)
64 #define CHN_TXRX_STATUS_OVRNERR BIT(3)
65 #define CHN_TXRX_STATUS_ERR BIT(2)
66 #define CHN_TXRX_STATUS_CMPLT BIT(1)
67 #define CHN_TXRX_STATUS_RDY BIT(0)
69 #define CHN_RX_IE_MASK_OVRN BIT(15)
70 #define CHN_TXRX_IE_MASK_TIMEOUT BIT(14)
71 #define CHN_TXRX_IE_MASK_BI BIT(13)
72 #define CHN_TXRX_IE_MASK_FE BIT(12)
73 #define CHN_TXRX_IE_MASK_CMPLT BIT(1)
75 #define SUART_GBL_INTR_ERR_MASK BIT(9)
76 #define SUART_PRU_ID_MASK 0xFF
78 #define SUART_FIFO_LEN 15
80 #define SUART_8X_OVRSMPL 1
81 #define SUART_16X_OVRSMPL 2
82 #define SUART_DEFAULT_OVRSMPL SUART_8X_OVRSMPL
84 #if (SUART_DEFAULT_OVRSMPL == SUART_16X_OVRSMPL)
85 #define SUART_DEFAULT_BAUD 57600
87 #define SUART_DEFAULT_BAUD 115200
90 #define PRU_MODE_INVALID 0x00
91 #define PRU_MODE_TX_ONLY 0x1
92 #define PRU_MODE_RX_ONLY 0x2
93 #define PRU_MODE_RX_TX_BOTH 0x3
95 #if (PRU_ACTIVE == BOTH_PRU)
96 #define PRU0_MODE PRU_MODE_RX_ONLY
97 #define PRU1_MODE PRU_MODE_TX_ONLY
98 #elif (PRU_ACTIVE == SINGLE_PRU)
99 #define PRU0_MODE PRU_MODE_RX_TX_BOTH
100 #define PRU1_MODE PRU_MODE_INVALID
102 #define PRU0_MODE PRU_MODE_INVALID
103 #define PRU1_MODE PRU_MODE_INVALID
106 #if !(defined CONFIG_OMAPL_SUART_MCASP) || (CONFIG_OMAPL_SUART_MCASP == 0)
107 #define MCASP_BASE_OFFSET (0x0)
108 #elif (CONFIG_OMAPL_SUART_MCASP == 1)
109 #define MCASP_BASE_OFFSET (0x4000)
110 #elif (CONFIG_OMAPL_SUART_MCASP == 2)
111 #define MCASP_BASE_OFFSET (0x8000)
114 #define MCASP_XBUF_BASE_ADDR (0x01d00200 + MCASP_BASE_OFFSET)
115 #define MCASP_RBUF_BASE_ADDR (0x01d00280 + MCASP_BASE_OFFSET)
116 #define MCASP_SRCTL_BASE_ADDR (0x01d00180 + MCASP_BASE_OFFSET)
118 #define MCASP_SRCTL_TX_MODE (0x000D)
119 #define MCASP_SRCTL_RX_MODE (0x000E)
122 #define RX_DEFAULT_DATA_DUMP_ADDR (0x00001FC)
123 #define PRU_NUM_OF_CHANNELS (16)
125 #define PRU_SUART_UART1 (1u)
127 #define PRU_SUART_UART2 (2u)
129 #define PRU_SUART_UART3 (3u)
132 #define PRU_SUART_UART4 (4u)
134 #define PRU_SUART_UART5 (5u)
136 #define PRU_SUART_UART6 (6u)
138 #define PRU_SUART_UART7 (7u)
140 #define PRU_SUART_UART8 (8u)
143 #define PRU_SUART_UARTx_INVALID (9u)
146 #define PRU_SUART_HALF_TX (1u)
147 #define PRU_SUART_HALF_RX (2u)
148 #define PRU_SUART_HALF_TX_DISABLED (4u)
149 #define PRU_SUART_HALF_RX_DISABLED (8u)
308 unsigned int service_req:1;
309 unsigned int asp_id:2;
310 unsigned int reserved1:3;
311 unsigned int serializer_num:4;
312 unsigned int reserved2:4;
313 unsigned int presacler:10;
314 unsigned int over_sampling:2;
315 unsigned int framing_mask:1;
316 unsigned int break_mask:1;
317 unsigned int timeout_mask:1;
318 unsigned int reserved3:1;
323 unsigned int bits_per_char:4;
324 unsigned int reserved1:4;
325 unsigned int data_len:4;
326 unsigned int reserved2:4;
327 unsigned int txrx_ready:1;
328 unsigned int txrx_complete:1;
329 unsigned int txrx_error:1;
330 unsigned int txrx_underrun:1;
331 unsigned int framing_error:1;
332 unsigned int break_error:1;
333 unsigned int timeout_error:1;
334 unsigned int reserved3:8;
335 unsigned int chn_state:1;
415 unsigned int rxBaudValue,
416 unsigned int oversampling,
417 unsigned char *pru_suart_emu_code,
418 unsigned int fw_size,
421 unsigned int txrxmode,
unsigned int intrmask);
423 unsigned int rxBaudValue,
424 unsigned int oversampling);
432 unsigned short txClkDivisor,
unsigned short rxClkDivisor);
436 unsigned short txDataBits,
unsigned short rxDataBits);
448 unsigned int *ptTxDataBuf,
unsigned short dataLen);
452 unsigned int *ptDataBuf,
unsigned short dataLen);
455 unsigned int txrxmode,
unsigned int intrmask);
466 unsigned short *txrxFlag);
471 unsigned int txrxmode,
unsigned int intrmask);
473 unsigned int txrxmode,
unsigned int intrmask);
488 Int32 s32MaxLen, Uint32 * pu32DataRead);
493 unsigned int txrxmode,
int s32Flag);
short suart_arm_to_pru_intr(unsigned short uartNum)
short pru_softuart_setdatabits(suart_handle hUart, unsigned short txDataBits, unsigned short rxDataBits)
pru_suart_chn_cntrl_config1 CH_Ctrl_Config1
short pru_softuart_init(unsigned int txBaudValue, unsigned int rxBaudValue, unsigned int oversampling, unsigned char *pru_suart_emu_code, unsigned int fw_size, arm_pru_iomap *pru_arm_iomap1)
unsigned int asp_xsrctl_base
void pru_set_fifo_timeout(Uint32 timeout)
unsigned char Oversampling
SUART_EN_UART_STATUS
One line description of the enum.
unsigned char rxBitsPerChar
int suart_pru_to_host_intr_enable(unsigned short uartNum, unsigned int txrxmode, int s32Flag)
SUART_EN_UARTNUM
One line description of the enum.
SUART_EN_RXCHANNEL
One line description of the enum.
short pru_softuart_close(suart_handle hUart)
pru_suart_tx_cntx_priv * ppru_suart_tx_cntx_priv
short pru_softuart_clrRxFifo(suart_handle hUart)
unsigned short rxClkDivisor
short pru_softuart_getRxStatus(suart_handle hUart)
unsigned char RXSerializer
unsigned short txClkDivisor
int pru_intr_clr_isrstatus(unsigned short uartNum, unsigned int txrxmode)
SUART_CHN_STATE
Chanel State.
volatile pru_suart_regs * PRU_SUART_RegsOvly
SUART_CHN_DIR
Chanel direction.
int suart_intr_setmask(unsigned short uartNum, unsigned int txrxmode, unsigned int intrmask)
short pru_softuart_reset(unsigned int txBaudValue, unsigned int rxBaudValue, unsigned int oversampling)
short pru_softuart_open(suart_handle hSuart)
suart_struct_handle * suart_handle
short arm_to_pru_intr_init(void)
int pru_softuart_pending_tx_request(void)
unsigned int asp_xbuf_base
One line description of the structure.
pru_suart_chn_config2_status CH_Config2_TXRXStatus
pru_suart_rx_cntx_priv * ppru_suart_rx_cntx_priv
unsigned short uartTxChannel
SUART_EN_TXCHANNEL
One line description of the enum.
short pru_softuart_getTxStatus(suart_handle hUart)
short pru_softuart_getTxDataLen(suart_handle hUart)
SUART_EN_BITSPERCHAR
One line description of the enum.
unsigned int asp_rsrctl_base
int pru_intr_set_mask(unsigned short uartNum, unsigned int txrxmode, unsigned int intrmask)
unsigned short uartRxChannel
short pru_softuart_read_data(suart_handle hUart, Uint8 *pDataBuffer, Int32 s32MaxLen, Uint32 *pu32DataRead)
short pru_softuart_clrRxStatus(suart_handle hUart)
int suart_intr_clrmask(unsigned short uartNum, unsigned int txrxmode, unsigned int intrmask)
short pru_softuart_getRxDataLen(suart_handle hUart)
One line description of the structure.
short pru_softuart_setconfig(suart_handle hUart, suart_config *configUart)
short pru_softuart_deinit(void)
short pru_softuart_get_isrstatus(unsigned short uartNum, unsigned short *txrxFlag)
unsigned char bits_loaded
SUART_EN_UARTTYPE
One line description of the enum.
short pru_softuart_setbaud(suart_handle hUart, unsigned short txClkDivisor, unsigned short rxClkDivisor)
short pru_softuart_read(suart_handle hUart, unsigned int *ptDataBuf, unsigned short dataLen)
unsigned char txBitsPerChar
unsigned char TXSerializer
short pru_softuart_stopReceive(suart_handle hUart)
int suart_intr_getmask(unsigned short uartNum, unsigned int txrxmode, unsigned int intrmask)
short pru_softuart_getconfig(suart_handle hUart, suart_config *configUart)
unsigned short uartStatus
void pru_mcasp_deinit(void)
short pru_softuart_clrTxStatus(suart_handle hUart)
short pru_softuart_write(suart_handle hUart, unsigned int *ptTxDataBuf, unsigned short dataLen)
unsigned int asp_rbuf_base