iekc64_pci.h

来自「TI公司的算法标准 Framework5的源代码」· C头文件 代码 · 共 223 行

H
223
字号
/*
 *  Copyright 2002 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) RF5_IEK 2.00.02 12-11-02 (swat-c19)" */
/*! \verbatim
==============================================================================
                                  Copyright (C) 2002 A.T.E.M.E.
                          All Rights Reserved
------------------------------------------------------------------------------
 MODULE NAME... IEKC64_PCI
 FILENAME...... iekc64_pci.h
 PROJECT....... IEK C64x
------------------------------------------------------------------------------
 HISTORY:
 V1.0    05/02/2002             NBA  Initial release
 V1.2    22/07/2002             NBA  DMA implementation
------------------------------------------------------------------------------
\endverbatim <P> \file
 
        \brief Header file for the IEK C64 pci module.

        This module manage pci interface on IEK board

</P>*//*====================================================================*/

#ifndef _iekc64_pci_h_
#define _iekc64_pci_h_

#include "csl_stdinc.h"
#include "iekc64_error.h"

#ifdef __cplusplus
extern "C" {
#endif

/*=======================================================================*//*!
\defgroup PCI PCI - Pci interface management module

        \brief This module manage pci interface on IEK board
  
  This module is related to manage :
  \li messages,
  \li DMA transferts

  between PC and DSP.

  <b> General </b>

    A CommDesc section is defined in internal DSP memory to reserve 3 space :
    \li DMA descriptor space
    \li message to PC descriptor space
    \li message from PC descriptor space

  Descriptors are mapping in DSP memory on a continguous 4MB page memory.


  <b> Message </b>
  
    Message descriptors contains few sections like :
    \li Markers (use by SDK only, must be unchanged),
    \li Parameters ( internal read index, internal write index, fifosize )
    \li Fifo message,
    
    If message identifiers are needed, they must be implemented in message itself, cause internal markers are not seen by users.

    Fifo message are limited to 16kB in each direction (PC to DSP / DSP to PC). 
  This value can be modify in the header file "defpcdsp.h". The iekc64_pci.lib 
  file must be recompilated in that case.


        <b> DMA transfert </b>

    DMA descriptors contains few sections like :
    \li Markers (use by SDK only, must be unchanged),
    \li Parameters ( internal status, Buffer address, current count of bytes transferred )
    \li Page descriptor,

        DMA transfer are limited to 1MB in each direction (PC to DSP / DSP to PC). 
  This value cannot be modify.

</P>*//*==============================================================*//*@{*/

/*--------------------------------------------------------------------------*/
/*! Defines the pci error code possibilities
*/

enum
{
        //! Invalid pointer 
  IEKC64_PCI_ERR_BAD_PTR                = IEKC64_ERR_CODE( IEKC64_PCI,  1 ),
        //! Invalid memory mapping
  IEKC64_PCI_ERR_MAP_FIFO_MSG           = IEKC64_ERR_CODE( IEKC64_PCI,  2 ),
        //! No message available
  IEKC64_PCI_ERR_NO_MSG                         = IEKC64_ERR_CODE( IEKC64_PCI,  3 ),
        //! Buffer size too small
  IEKC64_PCI_ERR_SIZE_BUFFER            = IEKC64_ERR_CODE( IEKC64_PCI,  4 ),
        //! Invalid message 
  IEKC64_PCI_ERR_MSG                            = IEKC64_ERR_CODE( IEKC64_PCI,  5 )
};

/*--------------------------------------------------------------------------*/
/*! Initializes the PCI interface 

        \param none.

        \return A IEKC64_STATUS. If the call succeed, the value will be IEKC64_OK.
                                Otherwise it holds an error code. The status code can be tested by
                                the IEKC64_SUCCESS(return code) macro that is true is the value
                                represents a successful call.

  You can find usage of this function in <a target="_blank" href="../../example/pci/message/messageDsp">example/pci/message/messageDsp</a>
  /<a target="_blank" href="../../example/pci/message/messageDsp/messageDspAsync.c">messageDspAsync.c</a>.


*/

IEKC64_STATUS PCI_init( void );

/*--------------------------------------------------------------------------*/
/*! Send a message to PC 

        \param dwflag
         This parameter is need to send a DMA request to PC.
         
  \param dwSize
         This specify the number of bytes to send to PC.
                                
  \param pMessage
                                This should point to a Buffer that will be send to PC.

        \return A IEKC64_STATUS. If the call succeed, the value will be IEKC64_OK.
                                Otherwise it holds an error code. The status code can be tested by
                                the IEKC64_SUCCESS(return code) macro that is true is the value
                                represents a successful call.

  You can find usage of this function in <a target="_blank" href="../../example/pci/message/messageDsp">example/pci/message/messageDsp</a>
  /<a target="_blank" href="../../example/pci/message/messageDsp/messageDspAsync.c">messageDspAsync.c</a>.

*/

IEKC64_STATUS PCI_sendMessage( Uint32 dwflag, Uint32 dwsize, void* pMessage );

/*--------------------------------------------------------------------------*/
/*! Get a message from PC 

        \param pflag
         This parameter is reserved.
  
  \param pBytesRead
                                 A UINT32 passed by reference to receive the number of bytes read.
      
  \param dwSize
         This specify the number of bytes to read.
                                
  \param pMessage
                                 This should point to a Buffer that will be filled
                                 by the call with message.

        \return A IEKC64_STATUS. If the call succeed, the value will be IEKC64_OK.
                                Otherwise it holds an error code. The status code can be tested by
                                the IEKC64_SUCCESS(return code) macro that is true is the value
                                represents a successful call.

  You can find usage of this function in <a target="_blank" href="../../example/pci/message/messageDsp">example/pci/message/messageDsp</a>
  /<a target="_blank" href="../../example/pci/message/messageDsp/messageDspAsync.c">messageDspAsync.c</a>.

*/

IEKC64_STATUS PCI_getMessage(  Uint32 *pflag, Uint32 *pBytesRead, Uint32 dwsize, void* pMessage  );

/*--------------------------------------------------------------------------*/
/*! Set a callback function to launch on message reception from PC 

  \param pFunction
                                This should point to a Function that will be launch if a
                                message is received from PC.
                                It can be NULL, to disable the call to the function on event.

        \return A IEKC64_STATUS. If the call succeed, the value will be IEKC64_OK.
                                Otherwise it holds an error code. The status code can be tested by
                                the IEKC64_SUCCESS(return code) macro that is true is the value
                                represents a successful call.

  You can find usage of this function in <a target="_blank" href="../../example/pci/callback/SoftDsp">example/pci/callback/SoftDsp</a>
  /<a target="_blank" href="../../example/pci/callback/SoftDsp/softDsp.c">softDsp.c</a>.

*/

IEKC64_STATUS PCI_OnReceiveMsgCallback( void (*pFunction)(void) );


/*--------------------------------------------------------------------------*/
/*! Set a callback function to launch on acknowledge message reception from PC 
        due to an indirect message request
  \param pFunction
                                This should point to a Function that will be launch if an
                                acknowledge message is received from PC.
                                It can be NULL, to disable the call to the function on event.

        \return A IEKC64_STATUS. If the call succeed, the value will be IEKC64_OK.
                                Otherwise it holds an error code. The status code can be tested by
                                the IEKC64_SUCCESS(return code) macro that is true is the value
                                represents a successful call.

*/

IEKC64_STATUS PCI_OnReceiveAckIndMsgCallback( void (*pFunction)(void) );


/*@}*//* end of group PCI */

#ifdef __cplusplus
}
#endif

#endif /* #ifndef _iekc64_pci_h_ */

/* Fin du fichier iekc64_pci.H */

⌨️ 快捷键说明

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