AIF2 Functions
[AIF2]

CSL_Status CSL_aif2Init (CSL_Aif2Context *pContext)
 Peripheral specific initialization function.
CSL_Aif2Handle CSL_aif2Open (CSL_Aif2Obj *pAif2Obj, CSL_InstNum aif2Num, CSL_Aif2Param *paif2Param, CSL_Status *pStatus)
 Opens the instance of AIF2 requested.
CSL_Status CSL_aif2Reset (CSL_Aif2Handle hAif2)
 Reset whole AIF2 module.
CSL_Status CSL_aif2Close (CSL_Aif2Handle hAif2)
CSL_Status CSL_aif2HwSetup (CSL_Aif2Handle hAif2, CSL_Aif2Setup *aif2Setup)
CSL_Status CSL_aif2HwControl (CSL_Aif2Handle hAif2, CSL_Aif2HwControlCmd ctrlCmd, void *arg)
 Controls AIF operation based on the control command.
CSL_Status CSL_aif2GetHwStatus (CSL_Aif2Handle hAif2, CSL_Aif2HwStatusQuery Query, void *response)
 Get the status of different operations.

Function Documentation

CSL_Status CSL_aif2Close ( CSL_Aif2Handle  haif2  ) 

============================================================================
CSL_aif2Close

Description
The Close call releases the resources of the peripheral.

Arguments

            haif2Link        Handle to the aif2 instance
     

Return Value CSL_Status

Usage Constraints: Both CSL_aif2Init() and CSL_aif2Open() must be called successfully in that order before CSL_aif2Close() can be called. Example
       CSL_aif2Handle haif2Link;
       // Properly initialize and open desired link for use
       haif2Link = CSL_aif2Open(&aif2LinkObj0, CSL_aif2, &aif2Param, &status);
       CSL_aif2Close(haif2Link);
     
=============================================================================
Parameters:
haif2  Pointer to the object that holds reference to the instance of aif2 link requested after the CSL_aif2Open(...) call

CSL_Status CSL_aif2GetHwStatus ( CSL_Aif2Handle  hAif2,
CSL_Aif2HwStatusQuery  Query,
void *  response 
)

Get the status of different operations.

============================================================================
CSL_aif2GetHwStatus

Description
This function is used to get the value of various parameters of the aif2 instance. The value returned depends on the query passed.

Arguments

            hAif2      Handle to the aif2 instance
 
            Query         Query to be performed 
 
            response      Pointer to buffer to return the data requested by
                          the query passed
     

Return Value CSL_Status

Pre Condition
CSL_aif2Init(), CSL_aif2Open()

Post Condition Data requested by query is returned through the variable "response"

Writes
The input argument "response" is modified

Example

        
        #define CSL_AIF2_MAX_RX_MASTER_FRAME_OFFSET 		256   
 
        CSL_Aif2Handle hAif2;
        // other link related declarations
        ...
        // ctrl argument for hw command
        Bool ctrlArg;
        // query response
        Uint16 response;

        // Open handle  - for use 
        hAif2 = CSL_aif2Open(&Aif2Obj, CSL_AIF2, &aif2Param, &status);

        if ((hAif2 == NULL) || (status != CSL_SOK)) 
        {
           printf ("\nError opening CSL_AIF2");
           exit(1);
        }

        // Do config for link 0 
        Config.globalSetup = &gblCfg;
        ...
         
        //Do setup for link - 0
        CSL_aif2HwSetup(hAif2, &Config);

        ctrlArg = CSL_AIF2_CTRL_RX_LINK_ENABLE;
        hAif2->arg_link = CSL_AIF2_LINK_0; //link 0 enable
        
        // Send hw control command to enable Tx/Rx of link 0 
        CSL_aif2HwControl(hAif2, CSL_AIF2_CMD_ENABLE_DISABLE_RX_LINK, (void *)&ctrlArg);
        ...
        wait(100); //wait for a sufficient length of time, so Rx link has enough 
                     time to sync; 100 cycles wait time is arbitrarily chosen 
    
        // Get status of Rx master frame offset  
        hAif2->arg_link = CSL_AIF2_LINK_0; //get link 0 status
        CSL_aif2GetHwStatus(hAif2, CSL_AIF2_QUERY_RM_LINK_RCVD_MSTR_FRAME_OFFSET, (void *)&response);
   
        if (response > CSL_AIF2_MAX_RX_MASTER_FRAME_OFFSET)
        {
           printf("\nRx Master Frame Offset exceeds bounds");
        }

     
=============================================================================

returns VC AIF2 version

returns VC Emu status

RM link Status 0. use hAif2->arg_link to choose link.

Parameters:
(CSL_Aif2RmStatus0 *)
RM link Status 1. use hAif2->arg_link to choose link.
Parameters:
(CSL_Aif2RmStatus1 *)
RM link Status 2. use hAif2->arg_link to choose link.
Parameters:
(CSL_Aif2RmStatus2 *)
RM link Status 3. use hAif2->arg_link to choose link.
Parameters:
(CSL_Aif2RmStatus3 *)
RM link Status 4. use hAif2->arg_link to choose link.
Parameters:
(CSL_Aif2RmStatus4 *)
Return TM link CPRI HFN Status. use hAif2->arg_link to choose link.
Parameters:
(Uint8 *)
TM link Status. use hAif2->arg_link to choose link.
Parameters:
(CSL_Aif2TmStatus *)
RT Internal FIFO depth Status. use hAif2->arg_link to choose link.
Parameters:
(Uint8 *)
RT Header Error Status. use hAif2->arg_link to choose link.
Parameters:
(CSL_Aif2RtHeaderStatus *)
RT link Status. use hAif2->arg_link to choose link.
Parameters:
(CSL_Aif2RtStatus *)
PD 128 Channel Status.
Parameters:
(Uint32 *)
PD Packet Status for 128 channels if it is in or out of packet.
Parameters:
(Uint32 *)
PE 128 Channel Status.
Parameters:
(Uint32 *)
PE Packet Status for 128 channels if it is in or out of packet.
Parameters:
(Uint32 *)
Debug data written to bits 128:0 of Egress DB RAM
Parameters:
( Uint32 *)
Egress DB debug side band data setup
Parameters:
( CSL_Aif2DbSideData *)

CSL_Status CSL_aif2HwControl ( CSL_Aif2Handle  hAif2,
CSL_Aif2HwControlCmd  cmd,
void *  arg 
)

Controls AIF operation based on the control command.

===========================================================================
CSL_aif2HwControl

Description
This function performs various control operations on aif2 link, based on the command passed.

Arguments

            haif2        Handle to the aif2 instance and link number for an argument
 
            cmd         Operation to be performed on the aif2
 
            arg         Argument specific to the command 
 
     

Return Value CSL_Status

Pre Condition
CSL_aif2Init(), CSL_aif2Open()

Post Condition
Registers of aif2 instance are configured according to the command and the command arguments. The command determines which registers are modified.

Writes
Registers determined by the command

Example

        // handle for AIF2
        CSL_Aif2Handle hAif2;
        // other related declarations
        ...
        // ctrl argument for hw command
        Bool ctrlArg;

        // Open handle  - for use 
        hAif2 = CSL_aif2Open(&Aif2Obj, CSL_AIF2, &aif2Param, &status);

        if ((hAif2 == NULL) || (status != CSL_SOK)) 
        {
           printf ("\nError opening CSL_AIF2");
           exit(1);
        }

        // Do config 
        Config.globalSetup = &gblCfg;
        ...
        //Do setup 
        CSL_aif2HwSetup(handleAif2, &Config);

        ctrlArg = CSL_AIF2_CTRL_RX_LINK_ENABLE;
        hAif2->arg_link = CSL_AIF2_LINK_0; //link 0 enable

        // Send hw control command to enable Tx/Rx of link 0 
        CSL_aif2HwControl(hAif2, CSL_AIF2_CMD_ENABLE_DISABLE_RX_LINK, (void *)&ctrlArg);
     
============================================================================

Starts Rx link (use hAif2->arg_link to select link)

Starts Tx link (use hAif2->arg_link to select link)

Enable loopback mode for specific link (use hAif2->arg_link to select link)

Control Aif2 Emulation (argument type: CSL_Aif2VcEmu*)

Enable SD B8 PLL

Enable SD B4 PLL

Select Serdes link Tx test pattern (argument type: CSL_Aif2SdTestPattern *, use hAif2->arg_link to select link)

Select Serdes link Rx test pattern (argument type: CSL_Aif2SdTestPattern *, use hAif2->arg_link to select link)

Force RM Sync State (argument type: CSL_Aif2RmForceSyncState *, use hAif2->arg_link to select link)

TM L1 Inband Control Signal Set (argument type: Uint8 *, use hAif2->arg_link to select link)

Force TM Flush FIFO (argument type: Bool *, use hAif2->arg_link to select link)

Force TM Idle state (argument type: Bool *, use hAif2->arg_link to select link)

Force TM Resync state (argument type: Bool *, use hAif2->arg_link to select link)

Dynamic configuration of PD CPRI id lut register (argument type: CSL_Aif2PdCpriIdLut *, use hAif2->arg_link to select link)

Dynamic configuration of PD CPRI Control Word lut register (argument type: CSL_Aif2PdCpriCwLut *, use hAif2->arg_link to select link)

Dynamic configuration of PD DBMR (argument type: CSL_Aif2DualbitMap *, use hAif2->arg_link to select link)

Dynamic configuration of PD channel config registers (argument type: CSL_Aif2PdChannelConfig *)

Dynamic configuration of PE CPRI Control Word lut register (argument type: CSL_Aif2CpriCwLut *, use hAif2->arg_link to select link)

Dynamic configuration of PE obsai header register (argument type: CSL_Aif2PeObsaiHeader *)

Dynamic configuration of PE DBMR (argument type: CSL_Aif2PeDbmr *)

Dynamic configuration of PE Modulo rule (argument type: CSL_Aif2DualbitMap *)

Dynamic configuration of PE channel config registers (argument type: CSL_Aif2PeChannelConfig *)

Dynamic configuration of PE channel rule LUT config registers (argument type: CSL_Aif2PeChRuleLut *)

Enables Trace data and framing data capture (use hAif2->arg_link to select link, argument type: Bool *)

Data Trace Sync Enable. (argument type: Bool *)

Enables Ingress DB Debug mode (argument type: Bool *)

Debug data written to bits 128:0 of Ingress DB RAM (argument type: Uint32 *)

Ingress DB debug side band data setup (argument type: CSL_Aif2DbSideData *)

Writes the data in the following registers into the Ingress DB and sideband RAMS DB_IDB_DEBUG_D0, DB_IDB_DEBUG_D1, DB_IDB_DEBUG_D2, DB_IDB_DEBUG_D3, DB_IDB_DEBUG_SBDN (argument type: Bool *)

Set Read and Write Address used to access write or read Offset RAM for DB Debug (argument type: Uint8 * arg[0] : write offset addr arg[1] : read offset addr)

Enable or Disable Ingress DB channel to add or remove channel dynamically (argument type: Uint32 *)

Setup Ingress DB channel to add or remove channel dynamically (argument type: CSL_Aif2DbChannel *)

Enables Egress DB Debug mode (argument type: Bool *)

Setup Side band data control info like dio and fifo write enable and channel id and dio base address.(argument type: CSL_Aif2DbSideData *)

the value loaded into DB_EDB_DEBUG_RD_CNTL.CH_ID being issued to the AxC Token FIFO.(argument type: Bool *)

Reads the data in the following registers from the Egress DB and sideband RAMS DB_EDB_DEBUG_D0, DB_EDB_DEBUG_D1, DB_EDB_DEBUG_D2, DB_EDB_DEBUG_D3, DB_EDB_DEBUG_SBDN (argument type: Bool *)

Set Read and Write Address used to access write or read Offset RAM for DB Debug (argument type: Uint8 * arg[0] : write offset addr arg[1] : read offset addr)

Enable or Disable Egress DB channel to add or remove channel dynamically (argument type: Uint32 *)

Setup Egress DB channel to add or remove channel dynamically (argument type: CSL_Aif2DbChannel *)

Enable or Disable Global AD module dynamically (argument type: Bool *)

Enable or Disable Global AD module dynamically (argument type: Bool *)

Enable or Disable Global Ingress DIO mode dynamically (argument type: Bool *)

Enable or Disable Global Egress DIO mode dynamically (argument type: Bool *)

Change Ingress DIO table selection dynamically (use hAif2->arg_dioEngine to select dio engine. argument type: Uint8 *)

Change Ingress DIO num of AxC dynamically (use hAif2->arg_dioEngine to select dio engine. argument type: Uint8 *)

Change Ingress DIO BCN table dynamically (use hAif2->arg_dioEngine to select dio engine. argument type: Uint8 *)

Change Egress DIO table selection dynamically (use hAif2->arg_dioEngine to select dio engine. argument type: Uint8 *)

Change Egress DIO num of AxC dynamically (use hAif2->arg_dioEngine to select dio engine. argument type: Uint8 *)

Change Egress DIO BCN table dynamically (use hAif2->arg_dioEngine to select dio engine. argument type: Uint8 *)

Set Enable or disable Data trace DMA channel (argument type: Bool *)

Set Trace data base address (argument type: Uint32 *)

Set Trace side data base address (argument type: Uint32 *)

Sets the number of burst transfers before the destination address wraps back to the base address(argument type: Uint32 *)

Sets AT External Rad timer event dynamically (argument type: CSL_Aif2AtEvent *)

Sets AT Delta offset (use hAif2->arg_link to select link argument type: CSL_Aif2AtEvent *)

Sets AT Halt timer (argument type: Bool *)

Sets AT diable all events for debug purpose (argument type: Bool *)

Sets AT Arm timer (argument type: Bool *)

Sets AT Phy debug sync (argument type: Bool *)

Sets AT radt wcdma clock divider terminal count (argument type: Uint8 *)

Sets AT Rad terminal count (argument type: CSL_Aif2AtTcObj *)

Sets AT GSM Tcount (argument type: CSL_Aif2AtGsmTCount *)

Enable Eight Rad and Six DIO Events (argument type: CSL_Aif2AtEventIndex *)

Disable Eight Rad and Six DIO Events (argument type: CSL_Aif2AtEventIndex *)

Force set Eight Rad and Six DIO Events (argument type: CSL_Aif2AtEventIndex *)

EE End of interrupt vector value setup (argument type: Uint8 *)

EE VB error interrupt set or clear (use hAif2->ee_arg to select between set and clear argument type: CSL_Aif2EeAif2Int *)

EE DB interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function argument type: CSL_Aif2EeDbInt *)

EE AD interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function argument type: CSL_Aif2EeAdInt *)

EE CD(PKTDMA) interrupt set, clear, enable set or clear for EV0 (use hAif2->ee_arg to select function argument type: CSL_Aif2EeCdInt *)

EE SD interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function argument type: CSL_Aif2EeSdInt *)

EE VC interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function argument type: CSL_Aif2EeVcInt *)

EE Aif2 run control register setup (argument type: CSL_Aif2EeAif2Run *)

EE Link A interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function and hAif2->arg_link to select link argument type: CSL_Aif2EeLinkAInt *)

EE Link B interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function and hAif2->arg_link to select link argument type: CSL_Aif2EeLinkBInt *)

EE AT interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function argument type: CSL_Aif2EeAtInt *)

EE PD common interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function argument type: CSL_Aif2EePdInt *)

EE PE common interrupt set, clear, enable set or clear for EV0 and EV1 (use hAif2->ee_arg to select function argument type: CSL_Aif2EePeInt *)

CSL_Status CSL_aif2HwSetup ( CSL_Aif2Handle  hAif2,
CSL_Aif2Setup aif2Setup 
)

============================================================================
CSL_aif2HwSetup

Description
It configures the AIF2 instance registers as per the values passed in the hardware setup structure.

Arguments

            hAif2        Handle to the AIF2 instance

            aif2Setup       Pointer to hardware setup structure
     

Return Value CSL_Status

Pre Condition
Both CSL_aif2Init() and CSL_aif2Open() must be called successfully in that order before CSL_aif2HwSetup() can be called. The user has to allocate space for & fill in the main setup structure appropriately before calling this function.

Post Condition
The specified instance will be setup according to value passed.

Writes
The hardware registers of AIF2.

Example

          CSL_Aif2Handle handleAif2;
          
          CSL_Aif2Obj Aif2Obj;
          //AIF module specific parameters
          CSL_Aif2Param  aif2Param;
          // CSL status
          CSL_Status status;
          // global config for AIF2 
          CSL_Aif2GlobalSetup gblCfg = {…};

          // Setup objects for global configuring  
          CSL_Aif2GlobalSetup GlobalConfig;
          // Setup for common params  
          CSL_Aif2CommonSetup commoncfg= {CSL_AIF2_LINK_0};
          // Setup for link 
          CSL_Aif2Setup Config = {…};
   
          // Open handle - for use 
          handleAif2 = CSL_aif2Open(&Aif2Obj, CSL_AIF2, &aif2Param, &status);

          if ((handleAif2 == NULL) || (status != CSL_SOK)) 
          {
             printf ("\nError opening CSL_AIF2");
             exit(1);
          }

          // Do config 
          Config.globalSetup = &gblCfg;
          Config.commonSetup = &commoncfg;
          Config.linkSetup = &linkCfg;
       
          //Do setup 
          CSL_aif2HwSetup(handleAif2, &Config);
     
=============================================================================
Parameters:
hAif2  Pointer to the object that holds reference to the instance of AIF2 link requested after the call
aif2Setup  Pointer to setup structure which contains the information to program AIF2 to a useful state

CSL_Status CSL_aif2Init ( CSL_Aif2Context pContext  ) 

Peripheral specific initialization function.

============================================================================
CSL_aif2Init

Description
This is the peripheral specific intialization function. This function is idempotent in that calling it many times is same as calling it once. This function initializes the CSL data structures, and doesn't touches the hardware.

Arguments

        pContext    Pointer to module-context. As aif2 doesn't
                    have any context based information user is expected to pass
                    NULL.
     

Return Value CSL_Status

Pre Condition
This function should be called before using any of the CSL APIs in the aif2 module.

Post Condition
The CSL for aif2 is initialized

Writes
None

Example

          CSL_aif2Init(NULL); // Init CSL for aif2 module
     
=============================================================================
Parameters:
pContext  AIF2 specific context information

CSL_Aif2Handle CSL_aif2Open ( CSL_Aif2Obj paif2Obj,
CSL_InstNum  aif2Num,
CSL_Aif2Param paif2Param,
CSL_Status *  pStatus 
)

Opens the instance of AIF2 requested.

============================================================================
CSL_aif2Open

Description
The open call sets up the data structures for the particular instance of aif2 device. The device can be re-opened anytime after it has been normally closed if so required. The handle returned by this call is input as an essential argument for rest of the APIs described for this module.

Arguments

           paif2LinkObj    Pointer to the object that holds reference to the
                          instance of aif2 requested after the call
                           
           aif2Num         Instance of aif2 to which a handle is requested
           
           paif2Param      Module specific parameters
 
           pStatus        pointer for returning status of the function call

     

Return Value CSL_aif2Handle Valid aif2 instance handle will be returned if status value is equal to CSL_SOK.

Pre Condition
aif2 must be successfully initialized via CSL_aif2Init() before calling this function. Memory for the CSL_aif2Obj must be allocated outside this call. This object must be retained while usage of this peripheral.

Post Condition
1. The status is returned in the status variable. If status returned is

2. aif2 object structure is populated

Writes
1. The status variable 2. aif2 object structure

Example:

          // handle for link 0
          CSL_aif2Handle handleaif2Link0;
          //  link object for link 0
          CSL_aif2LinkObj aif2LinkObj0;
          //aif2 module specific parameters
          CSL_aif2Param  aif2Param;
          // CSL status
          CSL_Status status;

          aif2Param.LinkIndex = CSL_aif2_LINK_0;
   
          // Open handle for link 0 - for use 
          handleaif2Link0 = CSL_aif2Open(&aif2LinkObj0, CSL_aif2, &aif2Param, &status);

          if ((handleaif2Link0 == NULL) || (status != CSL_SOK)) 
          {
             printf ("\nError opening CSL_aif2");
             exit(1);
          }
       

===========================================================================

Parameters:
paif2Obj  Pointer to the object that holds reference to the instance of aif2 requested after the call
aif2Num  Instance of aif2 to which a handle is requested
paif2Param  Module specific parameters;
pStatus  This returns the status (success/errors) of the call. Could be 'NULL' if the user does not want status information.

CSL_Status CSL_aif2Reset ( CSL_Aif2Handle  pAif2Handle  ) 

Reset whole AIF2 module.

============================================================================
CSL_aif2Reset

Description
Reset whole AIF2 devices and MMRs The handle returned by this call is input as an essential argument for rest of the APIs described for this module.

Arguments

           pAif2Handle    Pointer to the object that holds reference to the
                          instance of AIF2 requested after the call

     

Return Value CSL_Status Valid AIF2 status will be returned if status value is equal to CSL_SOK.

Pre Condition
AIF2 must be successfully initialized via CSL_AIF2Init(), CSL_AIF2Open() before calling this function. Memory for the CSL_Aif2Obj must be allocated outside this call. This object must be retained while usage of this peripheral.

Post Condition
1. The status is returned in the status variable. If status returned is

Writes
AIF2_AIF2_RESET_SW_RST

Example:

          //aif2  handle
          CSL_Aif2Handle hAif2;
         
          // CSL status
          CSL_Status status;
   
          //Reset handle  - for use 
          status = CSL_aif2Reset(hAif2);

          if (status != CSL_SOK) 
          {
             printf ("\nError resetting CSL_AIF2");
             exit(1);
          }
       

===========================================================================

Parameters:
pAif2Handle  Pointer to the object that holds reference to the instance of AIF2 requested after the call


Copyright 2011, Texas Instruments Incorporated