# srio_drv.c File Reference

The file implements the SRIO Driver API which can be used to send and receive data through the SRIO IP module. This is currently limited to support only the Message passing API. The driver utilizes the CPPI LLD and the CSL SRIO Functional layer. More...

`#include <srio_types.h>`
`#include <srio_osal.h>`
`#include <ti/drv/srio/srio_drv.h>`
`#include <string.h>`
`#include <ti/drv/srio/include/listlib.h>`
`#include <ti/csl/csl_srio.h>`
`#include <ti/csl/csl_srioAux.h>`
`#include <ti/csl/csl_srioAuxPhyLayer.h>`
`#include <ti/drv/qmss/qmss_drv.h>`
`#include <ti/drv/cppi/cppi_drv.h>`
`#include <ti/drv/cppi/cppi_desc.h>`

## Data Structures

struct | Srio_SockDataPacket
| The structure describes the SRIO Socket Data payload structure. More...
struct | Srio_DriverInst
| The structure describes the SRIO Driver Instance. More...
struct | Srio_Socket
| The structure describes the SRIO SOCKET. More...
struct | Srio_DriverMCB
| The structure describes the SRIO Driver MCB. More...

## Defines

#define | MAX_DOORBELL_REG 4
| Maximum number of Doorbell registers.
#define | MAX_DOORBELL_BIT 16
| Maximum number of Doorbell bits per register.

## Typedefs

typedef enum Srio_SocketState | Srio_SocketState
| Enumeration which describes the state of the SRIO Socket.
typedef struct Srio_SockDataPacket | Srio_SockDataPacket
| The structure describes the SRIO Socket Data payload structure.
typedef struct Srio_DriverInst | Srio_DriverInst
| The structure describes the SRIO Driver Instance.
typedef struct Srio_Socket | Srio_Socket
| The structure describes the SRIO SOCKET.
typedef struct Srio_DriverMCB | Srio_DriverMCB
| The structure describes the SRIO Driver MCB.

## Enumerations

enum | Srio_SocketState { Srio_SocketState_FREE = 0x0, Srio_SocketState_ALLOCATED = 0x1, Srio_SocketState_BOUND = 0x2 }
| Enumeration which describes the state of the SRIO Socket. More...

## Functions

void | Srio_processReceivedBD (Srio_DriverInst *ptr_srioDrvInst, Cppi_Desc *ptrDesc)
void | Srio_rxCompletionIsr (Srio_DrvHandle hSrioDrv)
void | Srio_dioCompletionIsr (Srio_DrvHandle hSrioDrv, uint8_t intDstDoorbell[])
void | Srio_dioTxCompletionIsr (Srio_DrvHandle hSrioDrv, CSL_SrioHandle hSrioCSL)
static void | Srio_flushSockData (Srio_Socket *ptr_srioSocket)
static int32_t | Srio_initSockData (Srio_Socket *ptr_srioSocket)
int32_t | Srio_init (void)
static int32_t | Srio_getDescSize (Qmss_MemRegion memRegion)
static int32_t | Srio_processDrvConfig (Srio_DriverInst *ptr_srioDrvInst)
static int32_t | Srio_processAppConfig (Srio_DriverInst *ptr_srioDrvInst)
Srio_DrvHandle | Srio_start (Srio_DrvConfig *ptr_cfg)
Srio_SockHandle | Srio_sockOpen (Srio_DrvHandle hSrio, Srio_SocketType type, uint16_t isBlocking)
static int32_t | Srio_validateBindingId (uint16_t id, uint8_t tt)
static int32_t | Srio_validateDIOBindingId (uint16_t idMap, uint8_t tt)
int32_t | Srio_sockBind_TYPE11 (Srio_SockHandle srioSock, Srio_SockBindAddrInfo *ptr_bindInfo)
int32_t | Srio_sockBind_TYPE9 (Srio_SockHandle srioSock, Srio_SockBindAddrInfo *ptr_bindInfo)
int32_t | Srio_sockBind_DIO (Srio_SockHandle srioSock, Srio_SockBindAddrInfo *ptr_bindInfo)
int32_t | Srio_sockBind (Srio_SockHandle srioSock, Srio_SockBindAddrInfo *ptr_bindInfo)
Srio_DrvBuffer | Srio_allocTransmitBuffer (Srio_DrvHandle hSrioDrv, uint8_t **ptrData, uint32_t *bufferLen)
void | Srio_freeTransmitBuffer (Srio_DrvHandle hSrioDrv, Srio_DrvBuffer hDrvBuffer)
int32_t | Srio_sockSend_TYPE11 (Srio_SockHandle srioSock, Srio_DrvBuffer hDrvBuffer, uint32_t numBytes, Srio_SockAddrInfo *to)
int32_t | Srio_sockSend_TYPE9 (Srio_SockHandle srioSock, Srio_DrvBuffer hDrvBuffer, uint32_t numBytes, Srio_SockAddrInfo *to)
int32_t | Srio_sockSend_DIO (Srio_SockHandle srioSock, Srio_DrvBuffer hDrvBuffer, uint32_t numBytes, Srio_SockAddrInfo *to)
int32_t | Srio_sockSend (Srio_SockHandle srioSock, Srio_DrvBuffer hDrvBuffer, uint32_t numBytes, Srio_SockAddrInfo *to)
int32_t | Srio_sockRecv (Srio_SockHandle srioSock, Srio_DrvBuffer *hDrvBuffer, Srio_SockAddrInfo *from)
void | Srio_freeRxDrvBuffer (Srio_SockHandle srioSock, Srio_DrvBuffer hDrvBuffer)
int32_t | Srio_setSockOpt (Srio_SockHandle srioSock, Srio_Opt option, void *optval, int32_t optlen)
int32_t | Srio_getSockOpt (Srio_SockHandle srioSock, Srio_Opt option, void *optval, int32_t optlen)
int32_t | Srio_sockClose_TYPE11 (Srio_SockHandle srioSock)
int32_t | Srio_sockClose_TYPE9 (Srio_SockHandle srioSock)
int32_t | Srio_sockClose_DIO (Srio_SockHandle srioSock)
int32_t | Srio_sockClose (Srio_SockHandle srioSock)
uint32_t | Srio_getVersion (void)
const char * | Srio_getVersionStr (void)

## Variables

Srio_DriverMCB | gSRIODriverMCB
| Global Variable which maintains SRIO Driver persistent info. This is shared across multiple cores and we need to align this on the L2 Cache Line Boundary.
const char | gSrioDriverVersionStr [] = SRIO_DRV_VERSION_STR ":" __DATE__ ":" __TIME__
| Global Variable which describes the SRIO Driver Version Information.

## Detailed Description

The file implements the SRIO Driver API which can be used to send and receive data through the SRIO IP module. This is currently limited to support only the Message passing API. The driver utilizes the CPPI LLD and the CSL SRIO Functional layer.

  NOTE: (C) Copyright 2009-2012 Texas Instruments, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## Typedef Documentation

typedef struct Srio_DriverInst Srio_DriverInst

The structure describes the SRIO Driver Instance.

The SRIO driver can have multiple instances each of which is bound to a specific SRIO channel.

typedef struct Srio_DriverMCB Srio_DriverMCB

The structure describes the SRIO Driver MCB.

The structure is used to store the SRIO driver information which is shared across multiple instances.

typedef struct Srio_SockDataPacket Srio_SockDataPacket

The structure describes the SRIO Socket Data payload structure.

This structure is associated with each SRIO socket and is used to store a list of all pending packets which have been received on the socket but have still not been picked up by the application.

typedef struct Srio_Socket Srio_Socket

The structure describes the SRIO SOCKET.

The structure is used to store all the SRIO socket information which is required to send and receive data.

typedef enum Srio_SocketState Srio_SocketState

Enumeration which describes the state of the SRIO Socket.

The SRIO Sockets in the system can be in any of the following states as described in the enumeration.

## Enumeration Type Documentation

enum Srio_SocketState

Enumeration which describes the state of the SRIO Socket.

The SRIO Sockets in the system can be in any of the following states as described in the enumeration.

Enumerator:

  Srio_SocketState_FREE | Socket is free and available and can be used.
  Srio_SocketState_ALLOCATED | Socket has been allocated but has no local binding information associated with it.
  Srio_SocketState_BOUND | Socket has been allocated and is associated with local binding information.

Copyright 2012, Texas Instruments Incorporated