⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_srioaux.h

📁 Dm6455 driver,magbe useful to you!
💻 H
📖 第 1 页 / 共 4 页
字号:
/* ============================================================================
 * Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
 *
 * Use of this software is controlled by the terms and conditions found in the
 * license agreement under which this software has been supplied.
 * =========================================================================
 */

/** ===========================================================================
 * @file csl_srioAux.h
 *
 * @brief API Auxilary header file for SRIO CSL
 * 
 * @path $(CSLPATH)\srio\inc
 *  
 * @desc It gives the definitions of the status query and control functions.
 * ============================================================================
 */

/* ============================================================================
 * Revision History
 * ===============
 * 26-Aug-2005 PSK File Created.
 * ============================================================================
 */

#ifndef _CSL_SRIOAUX_H_
#define _CSL_SRIOAUX_H_

#include <csl_srio.h>

#ifdef __cplusplus
extern "C" {
#endif

/** ============================================================================
 *   @n@b CSL_SrioDoorbellIntrClear
 *
 *   @b Description
 *   @n This function Clears doorbell interrupts. Macros can be OR'ed to get 
 *      the value
 *
 *   @b Arguments
 *   @verbatim
         hSrio        Pointer to the object that holds reference to the 
                     instance of SRIO   

         clearData   pointer to the clear value
     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b  Modifies
 *   @n  None
 *
 *   @b  Example
 *   @verbatim
        CSL_SrioHandle   hSrio;
        CSL_SrioPortData clearData;

        clearData.data = CSL_SRIO_DOORBELL_INTR0 |
                         CSL_SRIO_DOORBELL_INTR1 |
                         CSL_SRIO_DOORBELL_INTR2;
        clearData.index = 1;
        ...
        CSL_SrioDoorbellIntrClear(hSrio, &clearData);
        ...
     @endverbatim
 * ============================================================================
 */
static inline
 void CSL_SrioDoorbellIntrClear (
    CSL_SrioHandle   hSrio,
    CSL_SrioPortData *clearData
)
{
    hSrio->regs->DOORBELL_INTR[clearData->index].DOORBELL_ICCR = 
                                                            clearData->data;
}



/** ===========================================================================
 *   @n@b CSL_SrioSrcAddrSet
 *
 *   @b Description
 *   @n This function Sets 32-bit DSP byte source address
 *
 *   @b Arguments
 *   @verbatim
         hSrio        Pointer to the object that holds reference to the 
                     instance of SRIO  
                        
         arg     contains the source address and index
     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle hSrio;
        CSL_SrioPortData   arg;
        
        arg.data = 0x050;
        arg.index = 1; //index to the LSU BLOCKs
        ...
        CSL_SrioSrcAddrSet(hSrio, &arg);
        ...
     @endverbatim
 * ============================================================================ 
 */
static inline
void CSL_SrioSrcAddrSet (
    CSL_SrioHandle   hSrio,
    CSL_SrioPortData *arg
)
{
    hSrio->regs->LSU[arg->index].LSU_REG2 = arg->data;
}



/** ===========================================================================
 *   @n@b CSL_SrioDstAddrMsbSet
 *
 *   @b Description
 *   @n This function Sets the rapid IO destination MSB address
 *
 *   @b Arguments
 *   @verbatim
         hSrio      Pointer to the object that holds reference to the 
                    instance of SRIO  
         arg        pointer to the structure that contains destination MSB 
                    address and index to LSU registers set  
     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle  hSrio;
        CSL_SrioPortData arg;

        arg.index = 2; 
        arg.data = 0x02e00000; // destination address
        ...
        CSL_SrioDstAddrMsbSet(hSrio, &arg);
        ...
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_SrioDstAddrMsbSet (
    CSL_SrioHandle   hSrio, 
    CSL_SrioPortData *arg
)
{
   hSrio->regs->LSU[arg->index].LSU_REG0 = arg->data;
}



/** ===========================================================================
 *   @n@b CSL_SrioDstAddrLsbSet
 *
 *   @b Description
 *   @n This function Sets the rapid IO destination LSB address
 *
 *   @b Arguments
 *   @verbatim
        hSrio       Pointer to the object that holds reference to the 
                    instance of SRIO  
        arg         pointer to the structure that contains destination LSB 
                    address and index to LSU registers set
     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle  hSrio;
        CSL_SrioPortData arg;
        arg.index = 2; 
        arg.data = 0x02e00000; // destination address
        ...
        CSL_SrioDstAddrLsbSet(hSrio, &arg);
        ...
     @endverbatim
 * ============================================================================
 */
static inline
void CSL_SrioDstAddrLsbSet (
    CSL_SrioHandle   hSrio, 
    CSL_SrioPortData *arg
)
{
   hSrio->regs->LSU[arg->index].LSU_REG1 = arg->data;
}



/** ===========================================================================
 *   @n@b CSL_SrioLsuXfrByteCntSet
 *
 *   @b Description
 *   @n This function sets the Number of data bytes to Read/Write - up to 4KB
 *
 *   @b Arguments
 *   @verbatim

         hSrio      Pointer to the object that holds reference to the 
                    instance of SRIO  
         arg        pointer to the structure that contains Number of data bytes 
                    to Read/Write and index to LSU registers set

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle          hSrio;
        CSL_SrioPortData        arg;

        arg.index = 2; 
        arg.data = 0x0f; 
        ...
        CSL_SrioLsuXfrByteCntSet(hSrio, &arg);
        ...
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_SrioLsuXfrByteCntSet (
    CSL_SrioHandle   hSrio, 
    CSL_SrioPortData *arg
)
{
    CSL_FINS(hSrio->regs->LSU[arg->index].LSU_REG3, 
                                        SRIO_LSU_REG3_BYTE_COUNT, arg->data);
}



/** ============================================================================
 *   @n@b CSL_SrioLsuXfrTypeSet
 *
 *   @b Description
 *      Sets 4 MSBs to 4-bit ftype field for all packets 
 *       and 4 LSBs to 4-bit trans field for Packet types 2,5 and 8
 *
 *   @b Arguments
 *   @verbatim
         hSrio       Pointer to the object that holds reference to the 
                     instance of SRIO  

         arg       pointer to the structure that contains transfer type
                    and index to LSU registers set
     @endverbatim
 *
 *   <b> Return Value </b>
 *       None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle hSrio;
        CSL_SrioPortData   arg;

        arg.index = 2; 
        arg.data = 2; //packet type
        ...
        CSL_SrioLsuXfrTypeSet(hSrio, &arg);
        ...
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_SrioLsuXfrTypeSet (
    CSL_SrioHandle   hSrio,
    CSL_SrioPortData *arg
)
{
    CSL_FINS(hSrio->regs->LSU[arg->index].LSU_REG5, 
                                        SRIO_LSU_REG5_PACKET_TYPE, arg->data);
}



/** ============================================================================
 *   @n@b CSL_SrioDoorbellXfrTypeSet
 *
 *   @b Description
 *      Sets RapidIO doorbell info field for type 10 packets and sets the 
 *      packet type to 10.
 *
 *   @b Arguments
 *   @verbatim
         hSrio       Pointer to the object that holds reference to the 
                     instance of SRIO  

         arg     pointer to the structure that contains doorbell info
                    and index to LSU registers set
     @endverbatim
 *
 *   <b> Return Value </b>
 *       None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None.
 *
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle hSrio;
        CSL_SrioPortData   arg;

        arg.index = 2; 
        arg.data = 0; //doorbell info for type 10 packets
        ...
        CSL_SrioDoorbellXfrTypeSet(hSrio, &arg);
        ...
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_SrioDoorbellXfrTypeSet (
    CSL_SrioHandle   hSrio,
    CSL_SrioPortData *arg
)
{
    Uint32 val = hSrio->regs->LSU[arg->index].LSU_REG5;

    CSL_FINS (val, SRIO_LSU_REG5_DRBLL_INFO, arg->data);
    CSL_FINS (val, SRIO_LSU_REG5_PACKET_TYPE, 10); /* Doorbell packet type */ 
    
    hSrio->regs->LSU[arg->index].LSU_REG5 = val;
}



/** ============================================================================
 *   @n@b CSL_SrioLsuFlowMaskSet
 *
 *   @b Description
 *      Sets LSU flow masks.Port number is passed as input.
 *         Macros can be OR'ed to get the value for argument
 *
 *   @b Arguments
 *   @verbatim
         hSrio       Pointer to the object that holds reference to the 
                     instance of SRIO  

         arg         pointer to the structure that contains flowmask value
                    and index to LSU registers set
     @endverbatim
 *
 *   <b> Return Value </b>
 *       None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None.
 *
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle   hSrio;
        CSL_SrioPortData arg;

        arg.index = 1;
        arg.data = 0x0;
        ...
        CSL_SrioLsuFlowMaskSet(hSrio, &arg);
        ...
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_SrioLsuFlowMaskSet (
    CSL_SrioHandle   hSrio,
    CSL_SrioPortData *arg
)
{
  hSrio->regs->LSU[arg->index].LSU_FLOW_MASKS = arg->data;
}



/** ============================================================================
 *   @n@b CSL_SrioPortCmdSet
 *
 *   @b Description
 *      Sets the command to be sent in the link-request control symbol
 *
 *   @b Arguments
 *   @verbatim
         hSrio       Pointer to the object that holds reference to the 
                     instance of SRIO  

         arg         pointer to structure that contains the command value and
                     index to ports
     @endverbatim
 *
 *   <b> Return Value </b>
 *       None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n   None
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle  hSrio;
        CSL_SrioPortData arg;

        arg.index = 2; 
        arg.data = 0x0;
        ...
        CSL_SrioPortCmdSet(hSrio, &arg);
        ...
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_SrioPortCmdSet (
    CSL_SrioHandle   hSrio,
    CSL_SrioPortData *arg
)
{
    CSL_FINS(hSrio->regs->PORT[arg->index].SP_LM_REQ, 
                                        SRIO_SP_LM_REQ_COMMAND, arg->data);
}



/** ============================================================================
 *   @n@b CSL_SrioSpErrStatClear
 *
 *   @b Description
 *      Clear port errors status. Macros can be OR'ed to get the value to 
 *      pass the argument
 *
 *   @b Arguments
 *   @verbatim
         hSrio       Pointer to the object that holds reference to the 
                     instance of SRIO  

         arg         Pointer to a structure containing the error status 
                     clear value and index to the port
     @endverbatim
 *
 *   <b> Return Value </b>
 *       None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n   None
 *
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle  hSrio;
        CSL_SrioPortData arg;

        arg.index = 0; 
        arg.data = CSL_SRIO_ERR_OUTPUT_PKT_DROP  |
                   CSL_SRIO_ERR_OUTPUT_FLD_ENC   |
                   CSL_SRIO_ERR_OUTPUT_DEGRD_ENC |
                   ...
                   CSL_SRIO_INPUT_ERROR_ENC;
        
        CSL_SrioSpErrStatClear(hSrio, &arg);
        ...
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_SrioSpErrStatClear (
    CSL_SrioHandle   hSrio,
    CSL_SrioPortData *arg
)
{
    hSrio->regs->PORT[arg->index].SP_ERR_STAT = arg->data;
}



/** ============================================================================
 *   @n@b CSL_SrioSpErrDetStatClear
 *
 *   @b Description
 *      Clear port error detect status. Macros can be OR'ed to get the value 
 *      to pass the argument
 *
 *   @b Arguments
 *   @verbatim
         hSrio       Pointer to the object that holds reference to the 
                     instance of SRIO  

         arg         Pointer to the structure that specify, port number and the 
                     argument
     @endverbatim
 *
 *   <b> Return Value </b>
 *       None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n   None
 *
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_SrioHandle  hSrio;
        CSL_SrioPortData arg;

        arg.index = 3;
        arg.data = CSL_SRIO_ERR_IMP_SPECIFIC |
                   CSL_SRIO_CORRUPT_CNTL_SYM
                   ...
                   CSL_SRIO_RCVD_PKT_WITH_BAD_CRC;
                   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -