iekc64_ser.h

来自「TI公司的算法标准 Framework5的源代码」· C头文件 代码 · 共 419 行 · 第 1/2 页

H
419
字号
        //! Enhanced receive channel 3 enable register value
        Uint32 rcere3;
        //! Enhanced transmit channel 0 enable register value
        Uint32 xcere0;
        //! Enhanced transmit channel 1 enable register value
        Uint32 xcere1;
        //! Enhanced transmit channel 2 enable register value
        Uint32 xcere2;
        //! Enhanced transmit channel 3 enable register value
        Uint32 xcere3;
        //! Pin control register value
        Uint32 pcr;
} IEKC64_CONFIG;

/*--------------------------------------------------------------------------*/
/*! Defines the SERIAL configuration used for acquisition and restitution 
                All fields have to be set before the call.
*/
typedef struct
{
        /*! This field inform the board if you want a default configuration structure 
            FALSE or    if you want to define your MCBSP configuration parameters 
            via IEKC64_CONFIG structure ( Config = TRUE)
        */
        Uint8  ConfigMode;
        /*! This field holds the baud rate (only used with UART.)
        */
        Uint32 uartBaudRate;
        /*! This field holds the MCBSP configuration used for acquisition and restitution 
        */
        IEKC64_CONFIG McbspConfig;
} IEKC64_SER;

/*! Module error codes.<br>
         If status returned from a module call is negative (or 
         IEKC64_SUCCESS(return code) is false), the value represents en error
         from the list below
*/
enum
{
  //! \ MCBSP initialization global error
  IEKC64_MCBSP_OPENFAIL                                 = IEKC64_ERR_CODE( IEKC64_VIDEO,  1 ),
  //! \ EDMA receive open fail 
  IEKC64_MCBSP_EDMA_CHA_REVT0_OPENFAIL  = IEKC64_ERR_CODE( IEKC64_VIDEO,  2 ),
  //! \ EDMA transmit open fail 
  IEKC64_MCBSP_EDMA_CHA_XEVT0_OPENFAIL  = IEKC64_ERR_CODE( IEKC64_VIDEO,  3 ),
  //! \ EDMA reload fail 
  IEKC64_MCBSP_EDMA_RLD_OPENFAIL                = IEKC64_ERR_CODE( IEKC64_VIDEO,  4 ),
  //! \ EDMA link open fail
  IEKC64_SER_UNKNOWN_LINK                               = IEKC64_ERR_CODE( IEKC64_VIDEO,  5 ),
  //! \ EDMA transmit timeout
  IEKC64_RS422_XMT_TIMEOUT                              = IEKC64_ERR_CODE( IEKC64_VIDEO,  6 ),
  //! \ EDMA receive timeout
  IEKC64_RS422_RCV_TIMEOUT                              = IEKC64_ERR_CODE( IEKC64_VIDEO,  7 ),
  //! \ UART transmit timeout
  IEKC64_UART_XMT_TIMEOUT                               = IEKC64_ERR_CODE( IEKC64_VIDEO,  8 ),
  //! \ UART receive timeout
  IEKC64_UART_RCV_TIMEOUT                               = IEKC64_ERR_CODE( IEKC64_VIDEO,  9 ),
  //! \ Bad TCC for EDMA
  IEKC64_ERR_SER_BADTCC                                 = IEKC64_ERR_CODE( IEKC64_VIDEO,  10 ),
  //! \ Cannot allocate semaphore
  IEKC64_ERR_SER_RCV_SEM                                = IEKC64_ERR_CODE( IEKC64_VIDEO,  11 ),
  //! \ Cannot allocate semaphore
  IEKC64_ERR_SER_XMT_SEM                                = IEKC64_ERR_CODE( IEKC64_VIDEO,  12 )
};

/*--------------------------------------------------------------------------*/
/*! Special timeout values RS422 communication
*/
enum IEKC64_SER_WAIT
{
        //! Tell the API no to wait until the function is complete
        IEKC64_SER_NO_WAIT = 0,
        //! Tell the API to wait until the function complete
        IEKC64_SER_WAIT_INFINITE  
};

// function prototypes

/*--------------------------------------------------------------------------*/
/*! Initialize the SERIAL module
 
        \param Mode 
                                Define if you want to configure UART or RS422

        \param pConfig
                                Configuration struture 

        \return An 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 SER_open(Uint8 Mode, IEKC64_SER *pConfig);

/*--------------------------------------------------------------------------*/
/*! Start the SERIAL module
 
        \param Mode 
                                Define if you want to start UART or RS422

        
        \return An 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 SER_start(Uint8 Mode);


/*--------------------------------------------------------------------------*/
/*! Stop SERIAL module
 
        \param Mode 
                                Define if you want to stop UART or RS422

        \return An 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 SER_stop(Uint8 Mode);

/*--------------------------------------------------------------------------*/
/*! Receive data with the SERIAL module
 
        \param Mode 
                                Define if you want to use UART or RS422

        \param pAddr
                                A pointer to the next data to be acquired

        \param SizeofFrame
                                Size of the frame to be acquired

        \param TimeOut
                                Time out value

        \return An 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 SER_receive(Uint8 Mode, Uint32* pAddr, Uint32 SizeofFrame, Uint32 TimeOut);

/*--------------------------------------------------------------------------*/
/*! Send data with the SERIAL module
 
        \param Mode 
                                Define if you want to use UART or RS422

        \param pAddr
                                A pointer to the data to be send

        \param SizeofFrame
                                Size of the frame to be send

        \param TimeOut
                                Time out value

        \return An 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 SER_send(Uint8 Mode, Uint32 *pAddr, Uint32 SizeofFrame, Uint32 TimeOut);

/*--------------------------------------------------------------------------*/
/*! Wait end of previous transfert on the SERIAL module
 
        \param Mode 
                                Define if you want to use UART or RS422

        \param TimeOut
                                Time out value

        \return An 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 SER_waitEndXmt(Uint32 nWaitTimeout,Uint8 Mode);     
IEKC64_STATUS SER_waitEndRcv(Uint32 nWaitTimeout,Uint8 Mode);     





IEKC64_STATUS SER_mcbspConfig(IEKC64_SER *pConfig, MCBSP_Handle *hMcbsp);
IEKC64_STATUS SER_edmaConfig();
void UART_transmit();
void UART_receive();


/*@}*//* end of group SER */

#ifdef __cplusplus
}
#endif

#endif /* ifndef _IEK_SER_H_ */

⌨️ 快捷键说明

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