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

📄 uart.h

📁 信号fm调制与解调的dsp实现
💻 H
📖 第 1 页 / 共 2 页
字号:
/*                                                                           */
/*  Parameters:                                                              */
/*      - None                                                               */
/*                                                                           */
/*  Return:                                                                  */
/*  - OK success                                                             */
/*  - ERROR failure                                                          */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
void uart_reset(void);

/*****************************************************************************/
/*  s16 uart_read_reg()                                                      */
/*                                                                           */
/*  This routine reads the specified uart register.                          */
/*                                                                           */
/*  Parameters:                                                              */
/*      - reg - the uart register to read.                                   */
/*      - val - stores the read register value.                              */
/*                                                                           */
/*  Return:                                                                  */
/*  - OK success                                                             */
/*  - ERROR failure                                                          */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
u16 uart_read_reg(UartReg reg);

/*****************************************************************************/
/*  s16 uart_write_reg()                                                     */
/*                                                                           */
/*  This routine writes the specified uart register.                         */
/*                                                                           */
/*  Parameters:                                                              */
/*      - reg - the uart register to write to.                               */
/*      - val - stores the register value to write.                          */
/*                                                                           */
/*  Return:                                                                  */
/*  - OK success                                                             */
/*  - ERROR failure                                                          */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
u16 uart_write_reg(UartReg reg, u16 value, u16 mask);

/*****************************************************************************/
/*  s16 uart_interrupt_control(UartIntr intr, bool enable)                   */
/*                                                                           */
/*  This routine enables the specified uart interrupt.                       */
/*                                                                           */
/*  Parameters:                                                              */
/*      - intr - The uart interrupt to enable or disable.                    */
/*      - enable - Specifies action to perform.                              */
/*                                                                           */
/*  Return:                                                                  */
/*  - OK success                                                             */
/*  - ERROR failure                                                          */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
int uart_interrupt_control(UartIntr intr, bool enable);

/*****************************************************************************/
/*  s16 uart_interrupt_hook(Fp uartIsr)                                      */
/*                                                                           */
/*  This routine installs an ISR for the uart interrupt (INT0 on DSP).       */
/*  The ISR will be called once when the receive buffer is full or when the  *
/*  transmit buffer is empty.                                                */
/*                                                                           */
/*  Parameters:                                                              */
/*      - uartIsr - The interrupt service routine.                           */
/*                                                                           */
/*  Return:                                                                  */
/*  - OK success                                                             */
/*  - ERROR failure                                                          */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
int uart_interrupt_hook(Fp uartIsr);

/*****************************************************************************/
/*  UartIntrInfo uart_interrupt_info()                                       */
/*                                                                           */
/*  This routine retrieves interrupt information from the Interrupt          */
/*  Identification register (UART_IIR_REG).                                  */
/*                                                                           */
/*  Parameters:                                                              */
/*      - none.                                                              */
/*                                                                           */
/*  Return:                                                                  */
/*  - One of UartIntrInfo enumerations.                                      */
/*                                                                           */
/*  Notes:                                                                   */
/*  For some interrupts more specific information may have to be read from   */
/*  other registers. See notes on tne UartIntrInfo enumerated type above.    */
/*                                                                           */
/*****************************************************************************/
UartIntrInfo uart_interrupt_info();

/*****************************************************************************/
/*  s16 uart_read()                                                          */
/*                                                                           */
/*  This routine recieves data into the supplied buffer.                     */
/*                                                                           */
/*  Parameters:                                                              */
/*      - buf - buffer to read data into.                                    */
/*      - cnt - number of data samples to capture into buffer.               */
/*                                                                           */
/*  Return:                                                                  */
/*  - OK success                                                             */
/*  - ERROR failure                                                          */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
int uart_read(char *pBuf, unsigned cnt);

/*****************************************************************************/
/*  s16 uart_write()                                                         */
/*                                                                           */
/*  This routine sends data in the supplied buffer to the uart.              */
/*                                                                           */
/*  Parameters:                                                              */
/*      - buf - buffer                                                       */
/*      - cnt - number of data samples to send to uart.                      */
/*                                                                           */
/*  Return:                                                                  */
/*  - OK success                                                             */
/*  - ERROR failure                                                          */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
int uart_write(char *pBuf, unsigned cnt);

/*****************************************************************************/
/*  s16 uart_setup()                                                         */
/*                                                                           */
/*  Change the values of uart setable parameters including baud rate, word   */
/*  size, stop bits, parity, fifo, enabled interrupts, and loopback. Each    */
/*  group is handled by an enumeration that includes the option of no-change.*/
/*                                                                           */
/*  Parameters:                                                              */
/*      - baud - The requested baud rate                                     */
/*      - wordSize - Sample word size                                        */
/*      - stopBits - Number of stop bits                                     */
/*      - parity - Specifies parity to use                                   */
/*      - fifoControl - Specifies fifo control command. this parameter may   */
/*                      be overloaded                                        */
/*      - loopEnable - Enables or disables loopback mode                     */
/*                                                                           */
/*  Return:                                                                  */
/*  - OK success                                                             */
/*  - ERROR failure                                                          */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
int uart_setup(UartBaud         baud,
               UartWordLen      wlen,
               UartStopBits     stopBits,
               UartParity       parity,
               UartFifoControl  fifoControl,
               UartLoop         loopEnable);

/*****************************************************************************/
/*  int uart_fgetc() - read a character from the uart.                       */
/*                                                                           */
/*  This routine reads a character from the uart.                            */
/*                                                                           */
/*  Parameters:                                                              */
/*      - None                                                               */
/*                                                                           */
/*  Return:                                                                  */
/*  - If character available, returns character as non-sign extended int     */
/*  - If no character available, returns EOF                                 */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
int uart_fgetc(void);

/*****************************************************************************/
/*    int uart_fputc(const int c) - write a character to the uart.           */
/*                                                                           */
/*  This routine writes a character to the uart.                             */
/*                                                                           */
/*  Parameters:                                                              */
/*      - c - The character, as an int, to be sent to the uart.              */
/*                                                                           */
/*  Return:                                                                  */
/*  - On Success, returns character written                                  */
/*  - On Failure, returns EOF                                                */
/*                                                                           */
/*  Notes:                                                                   */
/*        The int representing the character will be masked to 8 bits prior  */
/*        to being written to the uart.                                      */
/*                                                                           */
/*****************************************************************************/
int uart_fputc(const int c);

/*****************************************************************************/
/*  char* uart_fgets(char* pbuf, int bufSize) - read a string from the uart. */
/*                                                                           */
/*  This routine reads a string from the uart. The string will be read upto  */
/*  a newline or until the buffer is filled. The string is always NULL       */
/*  terminated and does not have any newline character removed.              */
/*                                                                           */
/*  Parameters:                                                              */
/*      - pbuf - an area of memory to use for character storage              */
/*      - bufSize - the size of that memory area in characters (must include */
/*                  space for the NULL terminator).                          */
/*                                                                           */
/*                                                                           */
/*  Return:                                                                  */
/*  - On Success, returns pointer to string                                  */
/*  - On Failure, returns NULL pointer                                       */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
char* uart_fgets(char* pbuf, int bufSize);

/*****************************************************************************/
/*    int uart_fputs(const char* pbuf) - write a string to the uart.         */
/*                                                                           */
/*  This routine writes a string to the uart. The NULL terminator is not     */
/*  written and a newline is not added to the output.                        */
/*                                                                           */
/*  Parameters:                                                              */
/*      - pbuf - an area of memory containing the string to be written.      */
/*                                                                           */
/*                                                                           */
/*  Return:                                                                  */
/*  - On Success, returns 0                                                  */
/*  - On Failure, returns non-0                                              */
/*                                                                           */
/*  Notes:                                                                   */
/*                                                                           */
/*****************************************************************************/
int uart_fputs(const char* pbuf);

#endif

⌨️ 快捷键说明

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