blob: 10407b93ceb691a0f06ed9eac307399d98d74015 [file] [log] [blame]
/*
* Copyright (C) 2018 Synaptics Incorporated. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED "AS-IS," AND
* SYNAPTICS EXPRESSLY DISCLAIMS ALL EXPRESS AND IMPLIED WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE, AND ANY WARRANTIES OF NON-INFRINGEMENT OF ANY
* INTELLECTUAL PROPERTY RIGHTS. IN NO EVENT SHALL SYNAPTICS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, OR
* CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN CONNECTION WITH THE USE
* OF THE INFORMATION CONTAINED IN THIS DOCUMENT, HOWEVER CAUSED AND
* BASED ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, AND EVEN IF SYNAPTICS WAS
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IF A TRIBUNAL OF
* COMPETENT JURISDICTION DOES NOT PERMIT THE DISCLAIMER OF DIRECT
* DAMAGES OR ANY OTHER DAMAGES, SYNAPTICS' TOTAL CUMULATIVE LIABILITY
* TO ANY PARTY SHALL NOT EXCEED ONE HUNDRED U.S. DOLLARS.
*/
#ifndef __APB_UART_DRV_H__
#define __APB_UART_DRV_H__
#include "com_type.h"
#include "apb_uart.h"
/*******************************************************************************
* Function: APB_UART_init
*
* Description: initialize UART
*
* Inputs: channel-- choose UART0 or UART1, 0 means UART0, 1 means UART1
* tclk-- UART source clock
* baud-- UART baud rate
* Outputs: none
*
* Return: none
*******************************************************************************/
void APB_UART_init(UNSG32 channel, UNSG32 tclk, UNSG32 baud);
/*******************************************************************************
* Function: APB_UART_putc
*
* Description: initialize UART
*
* Inputs: channel-- choose UART0 or UART1, 0 means UART0, 1 means UART1
* c-- output character
* Outputs: none
*
* Return: none
*******************************************************************************/
void APB_UART_putc(UNSG32 channel, SIGN8 ch);
/*******************************************************************************
* Function: APB_UART_tstc
*
* Description: Test if there's input character from UART.
*
* Inputs: channel-- choose UART0 or UART1, 0 means UART0, 1 means UART1
*
* Outputs: none
*
* Return: 0-- there's no char input
* 1-- there's char input
*******************************************************************************/
UNSG8 APB_UART_tstc(UNSG32 channel);
/*******************************************************************************
* Function: APB_UART_getc_nonblock
*
* Description: non blocking mode read charactor from UART
*
* Inputs: channel-- choose UART0 or UART1, 0 means UART0, 1 means UART1
* c-- output character
* Outputs: none
*
* Return: 0-- didn't get any character
* 1-- get one character
*******************************************************************************/
UNSG8 APB_UART_getc_nonblock(UNSG32 channel, UNSG8 *ch);
/*******************************************************************************
* Function: APB_UART_getc
*
* Description: blocking mode read charactor from UART. Wait until get something
*
* Inputs: channel-- choose UART0 or UART1, 0 means UART0, 1 means UART1
* Outputs: none
*
* Return: return UIN8 value.
*******************************************************************************/
UNSG8 APB_UART_getc(UNSG32 channel);
/*******************************************************************************
* Function: APB_UART_write
*
* Description: Write the buffer into UART.
*
* Inputs: channel-- choose UART0 or UART1, 0 means UART0, 1 means UART1
* buf-- pointer point to the string what will be written to UART
* len-- length of the string
* Outputs: none
*
* Return: none.
*******************************************************************************/
void APB_UART_write(UNSG32 channel, SIGN8 *buf);
/*******************************************************************************
* Function: APB_UART_read
*
* Description: read the string from UART.
*
* Inputs: channel-- choose UART0 or UART1, 0 means UART0, 1 means UART1
* buf-- pointer point to the string what will be written to UART
* len-- length of the string
* Outputs: none
*
* Return: none.
*******************************************************************************/
void APB_UART_read(UNSG32 channel, SIGN8 *buf, UNSG32 len);
/*******************************************************************************
* Function: APB_UART_printf
*
* Description: printf sytle output.print the output to UART
*
* Inputs: channel-- choose UART0 or UART1, 0 means UART0, 1 means UART1
* szFormat-- print format
* Outputs: none
*
* Return: none
*******************************************************************************/
void APB_UART_printf(UNSG32 channel, UNSG8* szFormat, ...);
#endif //__APB_UART_DRV_H__