LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
suart_api.h File Reference
#include "tistdtypes.h"
#include "pru.h"

Go to the source code of this file.

Data Structures

struct  pru_suart_chn_cntrl_config1
 
struct  pru_suart_chn_config2_status
 
struct  pru_suart_regs
 
struct  pru_suart_tx_cntx_priv
 
struct  pru_suart_rx_cntx_priv
 
struct  suart_config
 One line description of the structure. More...
 
struct  suart_struct_handle
 One line description of the structure. More...
 

Macros

#define BIT(x)   (1 << x)
 
#define SINGLE_PRU   0
 
#define BOTH_PRU   1
 
#define PRU_ACTIVE   SINGLE_PRU
 
#define SUART_NUM_OF_CHANNELS_PER_SUART   2
 
#define SUART_NUM_OF_BYTES_PER_CHANNEL   16
 
#define SUART_PASS   0
 
#define SUART_SUCCESS   0
 
#define SUART_FAIL   1
 
#define SUART_FALSE   0
 
#define SUART_TRUE   1
 
#define PRU_TX_INTR   1
 
#define PRU_RX_INTR   2
 
#define CHN_TXRX_STATUS_TIMEOUT   BIT(6)
 
#define CHN_TXRX_STATUS_BI   BIT(5)
 
#define CHN_TXRX_STATUS_FE   BIT(4)
 
#define CHN_TXRX_STATUS_UNERR   BIT(3)
 
#define CHN_TXRX_STATUS_OVRNERR   BIT(3) /* UNERR->TX & OVRNERR->RX */
 
#define CHN_TXRX_STATUS_ERR   BIT(2)
 
#define CHN_TXRX_STATUS_CMPLT   BIT(1)
 
#define CHN_TXRX_STATUS_RDY   BIT(0)
 
#define CHN_RX_IE_MASK_OVRN   BIT(15)
 
#define CHN_TXRX_IE_MASK_TIMEOUT   BIT(14)
 
#define CHN_TXRX_IE_MASK_BI   BIT(13)
 
#define CHN_TXRX_IE_MASK_FE   BIT(12)
 
#define CHN_TXRX_IE_MASK_CMPLT   BIT(1)
 
#define SUART_GBL_INTR_ERR_MASK   BIT(9)
 
#define SUART_PRU_ID_MASK   0xFF
 
#define SUART_FIFO_LEN   15
 
#define SUART_8X_OVRSMPL   1
 
#define SUART_16X_OVRSMPL   2
 
#define SUART_DEFAULT_OVRSMPL   SUART_8X_OVRSMPL
 
#define SUART_DEFAULT_BAUD   115200
 
#define PRU_MODE_INVALID   0x00
 
#define PRU_MODE_TX_ONLY   0x1
 
#define PRU_MODE_RX_ONLY   0x2
 
#define PRU_MODE_RX_TX_BOTH   0x3
 
#define PRU0_MODE   PRU_MODE_RX_TX_BOTH
 
#define PRU1_MODE   PRU_MODE_INVALID
 
#define MCASP_BASE_OFFSET   (0x0)
 
#define MCASP_XBUF_BASE_ADDR   (0x01d00200 + MCASP_BASE_OFFSET)
 
#define MCASP_RBUF_BASE_ADDR   (0x01d00280 + MCASP_BASE_OFFSET)
 
#define MCASP_SRCTL_BASE_ADDR   (0x01d00180 + MCASP_BASE_OFFSET)
 
#define MCASP_SRCTL_TX_MODE   (0x000D)
 
#define MCASP_SRCTL_RX_MODE   (0x000E)
 
#define RX_DEFAULT_DATA_DUMP_ADDR   (0x00001FC)
 
#define PRU_NUM_OF_CHANNELS   (16)
 
#define PRU_SUART_UART1   (1u)
 
#define PRU_SUART_UART2   (2u)
 
#define PRU_SUART_UART3   (3u)
 
#define PRU_SUART_UART4   (4u)
 
#define PRU_SUART_UART5   (5u)
 
#define PRU_SUART_UART6   (6u)
 
#define PRU_SUART_UART7   (7u)
 
#define PRU_SUART_UART8   (8u)
 
#define PRU_SUART_UARTx_INVALID   (9u)
 
#define PRU_SUART_HALF_TX   (1u)
 
#define PRU_SUART_HALF_RX   (2u)
 
#define PRU_SUART_HALF_TX_DISABLED   (4u)
 
#define PRU_SUART_HALF_RX_DISABLED   (8u)
 

Typedefs

typedef volatile pru_suart_regsPRU_SUART_RegsOvly
 
typedef pru_suart_tx_cntx_privppru_suart_tx_cntx_priv
 
typedef pru_suart_rx_cntx_privppru_suart_rx_cntx_priv
 
typedef suart_struct_handlesuart_handle
 

Enumerations

enum  SUART_CHN_DIR { SUART_CHN_TX = 1, SUART_CHN_RX = 2 }
 Chanel direction. More...
 
enum  SUART_CHN_STATE { SUART_CHN_DISABLED = 0, SUART_CHN_ENABLED = 1 }
 Chanel State. More...
 
enum  SUART_EN_BITSPERCHAR {
  ePRU_SUART_DATA_BITS6 = 8, ePRU_SUART_DATA_BITS7, ePRU_SUART_DATA_BITS8, ePRU_SUART_DATA_BITS9,
  ePRU_SUART_DATA_BITS10, ePRU_SUART_DATA_BITS11, ePRU_SUART_DATA_BITS12
}
 One line description of the enum. More...
 
enum  SUART_EN_UARTNUM {
  ePRU_SUART_NUM_1 = 1, ePRU_SUART_NUM_2, ePRU_SUART_NUM_3, ePRU_SUART_NUM_4,
  ePRU_SUART_NUM_5, ePRU_SUART_NUM_6, ePRU_SUART_NUM_7, ePRU_SUART_NUM_8
}
 One line description of the enum. More...
 
enum  SUART_EN_UARTTYPE {
  ePRU_SUART_HALF_TX = 1, ePRU_SUART_HALF_RX, ePRU_SUART_FULL_TX_RX, ePRU_SUART_HALF_TX_DISABLED = 4,
  ePRU_SUART_HALF_RX_DISABLED = 8
}
 One line description of the enum. More...
 
enum  SUART_EN_TXCHANNEL {
  ePRU_SUART_TX_CH0 = 0, ePRU_SUART_TX_CH1, ePRU_SUART_TX_CH2, ePRU_SUART_TX_CH3,
  ePRU_SUART_TX_CH4, ePRU_SUART_TX_CH5, ePRU_SUART_TX_CH6, ePRU_SUART_TX_CH7
}
 One line description of the enum. More...
 
enum  SUART_EN_RXCHANNEL {
  ePRU_SUART_RX_CH0 = 0, ePRU_SUART_RX_CH1, ePRU_SUART_RX_CH2, ePRU_SUART_RX_CH3,
  ePRU_SUART_RX_CH4, ePRU_SUART_RX_CH5, ePRU_SUART_RX_CH6, ePRU_SUART_RX_CH7
}
 One line description of the enum. More...
 
enum  SUART_EN_UART_STATUS { ePRU_SUART_UART_FREE = 0, ePRU_SUART_UART_IN_USE }
 One line description of the enum. More...
 

Functions

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)
 
int pru_intr_set_mask (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)
 
short pru_softuart_close (suart_handle hUart)
 
short pru_softuart_setbaud (suart_handle hUart, unsigned short txClkDivisor, unsigned short rxClkDivisor)
 
short pru_softuart_setdatabits (suart_handle hUart, unsigned short txDataBits, unsigned short rxDataBits)
 
short pru_softuart_setconfig (suart_handle hUart, suart_config *configUart)
 
short pru_softuart_getconfig (suart_handle hUart, suart_config *configUart)
 
int pru_softuart_pending_tx_request (void)
 
short pru_softuart_write (suart_handle hUart, unsigned int *ptTxDataBuf, unsigned short dataLen)
 
short pru_softuart_read (suart_handle hUart, unsigned int *ptDataBuf, unsigned short dataLen)
 
int suart_intr_clrmask (unsigned short uartNum, unsigned int txrxmode, unsigned int intrmask)
 
short pru_softuart_clrTxStatus (suart_handle hUart)
 
short pru_softuart_getTxStatus (suart_handle hUart)
 
short pru_softuart_clrRxStatus (suart_handle hUart)
 
short pru_softuart_getRxStatus (suart_handle hUart)
 
short pru_softuart_get_isrstatus (unsigned short uartNum, unsigned short *txrxFlag)
 
int pru_intr_clr_isrstatus (unsigned short uartNum, unsigned int txrxmode)
 
int suart_intr_getmask (unsigned short uartNum, unsigned int txrxmode, unsigned int intrmask)
 
int suart_intr_setmask (unsigned short uartNum, unsigned int txrxmode, unsigned int intrmask)
 
short pru_softuart_getTxDataLen (suart_handle hUart)
 
short pru_softuart_getRxDataLen (suart_handle hUart)
 
short suart_arm_to_pru_intr (unsigned short uartNum)
 
short arm_to_pru_intr_init (void)
 
void pru_mcasp_deinit (void)
 
short pru_softuart_deinit (void)
 
short pru_softuart_clrRxFifo (suart_handle hUart)
 
short pru_softuart_read_data (suart_handle hUart, Uint8 *pDataBuffer, Int32 s32MaxLen, Uint32 *pu32DataRead)
 
short pru_softuart_stopReceive (suart_handle hUart)
 
int suart_pru_to_host_intr_enable (unsigned short uartNum, unsigned int txrxmode, int s32Flag)
 
void pru_set_fifo_timeout (Uint32 timeout)
 

Macro Definition Documentation

#define BIT (   x)    (1 << x)

Definition at line 40 of file suart_api.h.

#define BOTH_PRU   1

Definition at line 44 of file suart_api.h.

#define CHN_RX_IE_MASK_OVRN   BIT(15)

Definition at line 69 of file suart_api.h.

#define CHN_TXRX_IE_MASK_BI   BIT(13)

Definition at line 71 of file suart_api.h.

#define CHN_TXRX_IE_MASK_CMPLT   BIT(1)

Definition at line 73 of file suart_api.h.

#define CHN_TXRX_IE_MASK_FE   BIT(12)

Definition at line 72 of file suart_api.h.

#define CHN_TXRX_IE_MASK_TIMEOUT   BIT(14)

Definition at line 70 of file suart_api.h.

#define CHN_TXRX_STATUS_BI   BIT(5)

Definition at line 61 of file suart_api.h.

#define CHN_TXRX_STATUS_CMPLT   BIT(1)

Definition at line 66 of file suart_api.h.

#define CHN_TXRX_STATUS_ERR   BIT(2)

Definition at line 65 of file suart_api.h.

#define CHN_TXRX_STATUS_FE   BIT(4)

Definition at line 62 of file suart_api.h.

#define CHN_TXRX_STATUS_OVRNERR   BIT(3) /* UNERR->TX & OVRNERR->RX */

Definition at line 64 of file suart_api.h.

#define CHN_TXRX_STATUS_RDY   BIT(0)

Definition at line 67 of file suart_api.h.

#define CHN_TXRX_STATUS_TIMEOUT   BIT(6)

Definition at line 60 of file suart_api.h.

#define CHN_TXRX_STATUS_UNERR   BIT(3)

Definition at line 63 of file suart_api.h.

#define MCASP_BASE_OFFSET   (0x0)

Definition at line 107 of file suart_api.h.

#define MCASP_RBUF_BASE_ADDR   (0x01d00280 + MCASP_BASE_OFFSET)

Definition at line 115 of file suart_api.h.

#define MCASP_SRCTL_BASE_ADDR   (0x01d00180 + MCASP_BASE_OFFSET)

Definition at line 116 of file suart_api.h.

#define MCASP_SRCTL_RX_MODE   (0x000E)

Definition at line 119 of file suart_api.h.

#define MCASP_SRCTL_TX_MODE   (0x000D)

Definition at line 118 of file suart_api.h.

#define MCASP_XBUF_BASE_ADDR   (0x01d00200 + MCASP_BASE_OFFSET)

Definition at line 114 of file suart_api.h.

#define PRU0_MODE   PRU_MODE_RX_TX_BOTH

Definition at line 99 of file suart_api.h.

#define PRU1_MODE   PRU_MODE_INVALID

Definition at line 100 of file suart_api.h.

#define PRU_ACTIVE   SINGLE_PRU

Definition at line 45 of file suart_api.h.

#define PRU_MODE_INVALID   0x00

Definition at line 90 of file suart_api.h.

#define PRU_MODE_RX_ONLY   0x2

Definition at line 92 of file suart_api.h.

#define PRU_MODE_RX_TX_BOTH   0x3

Definition at line 93 of file suart_api.h.

#define PRU_MODE_TX_ONLY   0x1

Definition at line 91 of file suart_api.h.

#define PRU_NUM_OF_CHANNELS   (16)

Definition at line 123 of file suart_api.h.

#define PRU_RX_INTR   2

Definition at line 58 of file suart_api.h.

#define PRU_SUART_HALF_RX   (2u)

Definition at line 147 of file suart_api.h.

#define PRU_SUART_HALF_RX_DISABLED   (8u)

Definition at line 149 of file suart_api.h.

#define PRU_SUART_HALF_TX   (1u)

UART instance

Definition at line 146 of file suart_api.h.

#define PRU_SUART_HALF_TX_DISABLED   (4u)

Definition at line 148 of file suart_api.h.

#define PRU_SUART_UART1   (1u)

Definition at line 125 of file suart_api.h.

#define PRU_SUART_UART2   (2u)

UART instance

Definition at line 127 of file suart_api.h.

#define PRU_SUART_UART3   (3u)

UART instance

Definition at line 129 of file suart_api.h.

#define PRU_SUART_UART4   (4u)

UART instance

Definition at line 132 of file suart_api.h.

#define PRU_SUART_UART5   (5u)

UART instance

Definition at line 134 of file suart_api.h.

#define PRU_SUART_UART6   (6u)

UART instance

Definition at line 136 of file suart_api.h.

#define PRU_SUART_UART7   (7u)

UART instance

Definition at line 138 of file suart_api.h.

#define PRU_SUART_UART8   (8u)

UART instance

Definition at line 140 of file suart_api.h.

#define PRU_SUART_UARTx_INVALID   (9u)

UART instance

Definition at line 143 of file suart_api.h.

#define PRU_TX_INTR   1

Definition at line 57 of file suart_api.h.

#define RX_DEFAULT_DATA_DUMP_ADDR   (0x00001FC)

Definition at line 122 of file suart_api.h.

#define SINGLE_PRU   0

Definition at line 43 of file suart_api.h.

#define SUART_16X_OVRSMPL   2

Definition at line 81 of file suart_api.h.

#define SUART_8X_OVRSMPL   1

Definition at line 80 of file suart_api.h.

#define SUART_DEFAULT_BAUD   115200

Definition at line 87 of file suart_api.h.

#define SUART_DEFAULT_OVRSMPL   SUART_8X_OVRSMPL

Definition at line 82 of file suart_api.h.

#define SUART_FAIL   1

Definition at line 52 of file suart_api.h.

#define SUART_FALSE   0

Definition at line 54 of file suart_api.h.

#define SUART_FIFO_LEN   15

Definition at line 78 of file suart_api.h.

#define SUART_GBL_INTR_ERR_MASK   BIT(9)

Definition at line 75 of file suart_api.h.

#define SUART_NUM_OF_BYTES_PER_CHANNEL   16

Definition at line 48 of file suart_api.h.

#define SUART_NUM_OF_CHANNELS_PER_SUART   2

Definition at line 47 of file suart_api.h.

#define SUART_PASS   0

Definition at line 50 of file suart_api.h.

#define SUART_PRU_ID_MASK   0xFF

Definition at line 76 of file suart_api.h.

#define SUART_SUCCESS   0

Definition at line 51 of file suart_api.h.

#define SUART_TRUE   1

Definition at line 55 of file suart_api.h.

Typedef Documentation

Definition at line 368 of file suart_api.h.

Definition at line 358 of file suart_api.h.

Definition at line 349 of file suart_api.h.

Definition at line 406 of file suart_api.h.

Enumeration Type Documentation

Chanel direction.

UART RX/TX Enable Flag This enum is used to specify the direction of the channel in UART

Enumerator
SUART_CHN_TX 

Channel configured for Transmission

SUART_CHN_RX 

Channel configured for receiving

Definition at line 163 of file suart_api.h.

Chanel State.

This enum is used to specify the state of the channel in UART. It is either enabled or disabled.

Enumerator
SUART_CHN_DISABLED 

Channel is not enabled

SUART_CHN_ENABLED 

Channel enabled

Definition at line 174 of file suart_api.h.

One line description of the enum.

Detailed description of the enum

Enumerator
ePRU_SUART_DATA_BITS6 

6 + 2

ePRU_SUART_DATA_BITS7 

member2 description

ePRU_SUART_DATA_BITS8 

member1 description

ePRU_SUART_DATA_BITS9 

member2 description

ePRU_SUART_DATA_BITS10 

member1 description

ePRU_SUART_DATA_BITS11 

member1 description

ePRU_SUART_DATA_BITS12 

member1 description

Definition at line 185 of file suart_api.h.

One line description of the enum.

Detailed description of the enum

Enumerator
ePRU_SUART_RX_CH0 

member1 description

ePRU_SUART_RX_CH1 

member1 description

ePRU_SUART_RX_CH2 

member1 description

ePRU_SUART_RX_CH3 

member1 description

ePRU_SUART_RX_CH4 

member1 description

ePRU_SUART_RX_CH5 

member1 description

ePRU_SUART_RX_CH6 

member1 description

ePRU_SUART_RX_CH7 

member1 description

Definition at line 268 of file suart_api.h.

One line description of the enum.

Detailed description of the enum

Enumerator
ePRU_SUART_TX_CH0 

member1 description

ePRU_SUART_TX_CH1 

member1 description

ePRU_SUART_TX_CH2 

member1 description

ePRU_SUART_TX_CH3 

member1 description

ePRU_SUART_TX_CH4 

member1 description

ePRU_SUART_TX_CH5 

member1 description

ePRU_SUART_TX_CH6 

member1 description

ePRU_SUART_TX_CH7 

member1 description

Definition at line 244 of file suart_api.h.

One line description of the enum.

Detailed description of the enum

Enumerator
ePRU_SUART_UART_FREE 

member1 description

ePRU_SUART_UART_IN_USE 

member1 description

Definition at line 292 of file suart_api.h.

One line description of the enum.

Detailed description of the enum

Enumerator
ePRU_SUART_NUM_1 

member1 description

ePRU_SUART_NUM_2 

member1 description

ePRU_SUART_NUM_3 

member1 description

ePRU_SUART_NUM_4 

member1 description

ePRU_SUART_NUM_5 

member1 description

ePRU_SUART_NUM_6 

member1 description

ePRU_SUART_NUM_7 

member1 description

ePRU_SUART_NUM_8 

member1 description

Definition at line 207 of file suart_api.h.

One line description of the enum.

Detailed description of the enum

Enumerator
ePRU_SUART_HALF_TX 
ePRU_SUART_HALF_RX 
ePRU_SUART_FULL_TX_RX 
ePRU_SUART_HALF_TX_DISABLED 
ePRU_SUART_HALF_RX_DISABLED 

Definition at line 231 of file suart_api.h.

Function Documentation

short arm_to_pru_intr_init ( void  )

Definition at line 2444 of file suart_api.c.

int pru_intr_clr_isrstatus ( unsigned short  uartNum,
unsigned int  txrxmode 
)

Definition at line 2352 of file suart_api.c.

int pru_intr_set_mask ( unsigned short  uartNum,
unsigned int  txrxmode,
unsigned int  intrmask 
)
void pru_mcasp_deinit ( void  )

Definition at line 684 of file suart_api.c.

void pru_set_fifo_timeout ( Uint32  timeout)

Definition at line 644 of file suart_api.c.

short pru_softuart_close ( suart_handle  hUart)

Definition at line 875 of file suart_api.c.

short pru_softuart_clrRxFifo ( suart_handle  hUart)

Definition at line 2123 of file suart_api.c.

short pru_softuart_clrRxStatus ( suart_handle  hUart)

Definition at line 2203 of file suart_api.c.

short pru_softuart_clrTxStatus ( suart_handle  hUart)

Definition at line 2018 of file suart_api.c.

short pru_softuart_deinit ( void  )

Definition at line 689 of file suart_api.c.

short pru_softuart_get_isrstatus ( unsigned short  uartNum,
unsigned short *  txrxFlag 
)

Definition at line 2262 of file suart_api.c.

short pru_softuart_getconfig ( suart_handle  hUart,
suart_config configUart 
)

Definition at line 1401 of file suart_api.c.

short pru_softuart_getRxDataLen ( suart_handle  hUart)

Definition at line 1343 of file suart_api.c.

short pru_softuart_getRxStatus ( suart_handle  hUart)

Definition at line 2074 of file suart_api.c.

short pru_softuart_getTxDataLen ( suart_handle  hUart)

Definition at line 1286 of file suart_api.c.

short pru_softuart_getTxStatus ( suart_handle  hUart)

Definition at line 1969 of file suart_api.c.

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 
)

Definition at line 530 of file suart_api.c.

short pru_softuart_open ( suart_handle  hSuart)

Definition at line 722 of file suart_api.c.

int pru_softuart_pending_tx_request ( void  )

Definition at line 1530 of file suart_api.c.

short pru_softuart_read ( suart_handle  hUart,
unsigned int *  ptDataBuf,
unsigned short  dataLen 
)

Definition at line 1664 of file suart_api.c.

short pru_softuart_read_data ( suart_handle  hUart,
Uint8 *  pDataBuffer,
Int32  s32MaxLen,
Uint32 *  pu32DataRead 
)

Definition at line 1753 of file suart_api.c.

short pru_softuart_reset ( unsigned int  txBaudValue,
unsigned int  rxBaudValue,
unsigned int  oversampling 
)
short pru_softuart_setbaud ( suart_handle  hUart,
unsigned short  txClkDivisor,
unsigned short  rxClkDivisor 
)

Definition at line 894 of file suart_api.c.

short pru_softuart_setconfig ( suart_handle  hUart,
suart_config configUart 
)

Definition at line 1112 of file suart_api.c.

short pru_softuart_setdatabits ( suart_handle  hUart,
unsigned short  txDataBits,
unsigned short  rxDataBits 
)

Definition at line 1005 of file suart_api.c.

short pru_softuart_stopReceive ( suart_handle  hUart)

Definition at line 1899 of file suart_api.c.

short pru_softuart_write ( suart_handle  hUart,
unsigned int *  ptTxDataBuf,
unsigned short  dataLen 
)

Definition at line 1577 of file suart_api.c.

short suart_arm_to_pru_intr ( unsigned short  uartNum)

Definition at line 2398 of file suart_api.c.

int suart_intr_clrmask ( unsigned short  uartNum,
unsigned int  txrxmode,
unsigned int  intrmask 
)

Definition at line 2953 of file suart_api.c.

int suart_intr_getmask ( unsigned short  uartNum,
unsigned int  txrxmode,
unsigned int  intrmask 
)

Definition at line 3075 of file suart_api.c.

int suart_intr_setmask ( unsigned short  uartNum,
unsigned int  txrxmode,
unsigned int  intrmask 
)

Definition at line 2824 of file suart_api.c.

int suart_pru_to_host_intr_enable ( unsigned short  uartNum,
unsigned int  txrxmode,
int  s32Flag 
)

Definition at line 2772 of file suart_api.c.