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

📄 tvpuarts.h

📁 ti的数字电视芯片 tvp9000的源码
💻 H
字号:
#ifndef TVPUARTS_DOT_H_IS_DEFINED
#define TVPUARTS_DOT_H_IS_DEFINED

/********************************************************************* 
*    Property of Texas Instruments Incorporated, Copyright 2004
*    All rights reserved
**********************************************************************/
/*********************************************************************
*
* Description:
*   public include file for module
*   It includes only the definitions that are needed for the API
*   
**********************************************************************/
/***************************************************************************
*   tvpUarts.h Contains all definitions that pertain to the uarts.h modules
*
*   $Revision:  $
*
*   $History: tvpUarts.h $
* 
****************************************************************************/

/* Common Constants */
#define TVP_XON          0x11    /* XON character            */
#define TVP_XOFF         0x13    /* XOFF character           */

/* General Purpose UART Status codes returned to the User through the IRQ   
   Note: If these values ever change, uartIntSet_l function must be checked,
          as well as the Uart_DataStatus data type (will the error's still
          fit in a uchar?)  */
#define TVP_GPU_DR          0x00000001
#define TVP_GPU_THRE        0x00000002
#define TVP_GPU_OE          0x00000004
#define TVP_GPU_PE          0x00000008
#define TVP_GPU_FE          0x00000010
#define TVP_GPU_BRK         0x00000020

// Uart Initialization Parameters
typedef unsigned long TvpUartStatusOut;
typedef unsigned char TvpUartDataBuffer;
typedef unsigned char TvpUartDataStatus;
typedef unsigned long TvpUartDataSize;
typedef unsigned long TvpUartXoffThresh;


// Baud rates
typedef enum  {
   TVP_B_1200=0,
   TVP_B_2400,
   TVP_B_4800,
   TVP_B_9600,
   TVP_B_19200,
   TVP_B_28800,
   TVP_B_38400,
   TVP_B_57600,
   TVP_B_115200, 
   TVP_B_14400,
   TVP_UART_MAXBAUD
} TvpUartBaudRate;

// Uart number
typedef enum  {
   TVP_UART_0      = 0, 
   TVP_UART_1      = 1, 
   TVP_NUMOF_UARTS = 2
} TvpUartNum;

// Number of data bits in a Uart data byte
typedef enum  {
   TVP_DATA7  = 0, 
   TVP_DATA8  = 1
} TvpUartCharSize;

// Use/Don't use parity choices
typedef enum  {
   TVP_NO_PARITY    = 0, 
   TVP_PARITY       = 1,
   TVP_STICK_PARITY = 2,
   TVP_MAX_PARITY_CHOICE
} TvpUartParity;

// Parity choices (when using parity or stick parity)
typedef enum { 
   TVP_EVEN_PARITY     = 0,  // Even Parity
   TVP_ODD_PARITY      = 1,  // Odd Parity
   TVP_STICK_PARITY_0  = 0,  // Use 0 when stick parity enabled
   TVP_STICK_PARITY_1  = 1,  // Use 1 when stick parity enabled
   TVP_PARITY_NOT_USED = 2   // Used in NO_PARITY cases
} TvpUartParSelect;

// Stop bits   
typedef enum { 
   TVP_STOPBT_1 = 0,   // 1 stop bit
   TVP_STOPBT_2 = 1    // 2 stop bits
} TvpUartStopBits;
             
// Flow Control Level selections
typedef enum { 
   TVP_HWHS_DISABLE = 0,   // HW ignores CTS, RTS always asserted
   TVP_HWHS_ENABLE  = 1,   // HW Asserts CTS and RTS
   TVP_HWHS_CTS_EN  = 2,   // HW CTS, RTS always asserted
   TVP_HWHS_RTS_DIS = 3    // HW ignores CTS, RTS never asserted
} TvpUartFlowCtrl;
               
// Fifo interrupt level selections               
typedef enum { 
   TVP_INTLEV_01 = 0x0,    // Trigger after 1 byte in fifo
   TVP_INTLEV_04 = 0x4,    // Trigger after 4 bytes in fifo
   TVP_INTLEV_08 = 0x8,    // Trigger after 8 bytes in fifo
   TVP_INTLEV_14 = 0xc     // Trigger after 14 bytes in fifo
                           //  (This is a hardware control value, 
                           //   so 0xc - bits 2 & 3 -  is correct)
} TvpUartIntLvl;
       

/*****************************************************************************
API functions
******************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
 
TVP_FERROR tvpUartDrvrInit(TvpUartNum uart_adr, TvpIntNum int_num,
                TvpUartStatusOut *status, TvpUartDataBuffer *recv_buf,
                TvpUartDataStatus *recv_buf_sts, TvpUartDataSize recv_buf_size,
                TvpUartXoffThresh xoff_thres);
TVP_FERROR tvpUartSet(TvpUartNum uart_adr, TvpUartBaudRate baud, 
               TvpUartCharSize chrsize, TvpUartParity parity, 
               TvpUartParSelect par_sel, TvpUartStopBits nm_stp, 
               TvpUartIntLvl int_level, TvpUartFlowCtrl hwhs_en, 
               Tvp_En_Dis fifo_tmot);
TVP_FERROR tvpUartSend(TvpUartNum uart_adr, TvpUartDataBuffer *ch, 
                TvpUartDataSize count);
TVP_FERROR tvpUartReceiveBytes(TvpUartNum uart_adr, TvpUartDataBuffer *buf_ptr, 
                   TvpUartDataSize count, TvpUartDataSize *bytes_moved);
TVP_FERROR tvpUartEnable(TvpUartNum uart_adr);
TVP_FERROR tvpUartXoff(TvpUartNum uart_adr);
TVP_FERROR tvpUartXon(TvpUartNum uart_adr);
TVP_FERROR tvpUartXonEnable(TvpUartNum uart_adr);
TVP_FERROR tvpUartXonDisable(TvpUartNum uart_adr);
TVP_FERROR tvpUartCheckXoffThres(TvpUartNum uart_adr);
TVP_FERROR tvpUartHwFlwCtrl(TvpUartNum uart_adr, TvpUartFlowCtrl flwctrl_level);
TVP_FERROR tvpUartXmitChar(TvpUartNum uart_adr, TvpUartDataBuffer xbyte);

#ifdef __cplusplus
};
#endif


#endif

⌨️ 快捷键说明

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