/*
 * @file hv_pm51_driver_UART.h
 * @brief Header file of uart driver.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use ()
 *
 * @endverbatim
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2023-03-01
 */

#ifndef __HV_PM51_DRIVER_UART_H__
#define __HV_PM51_DRIVER_UART_H__

#include "hv_pm51_Base.h"

#define FSCLK            10000000

typedef enum _UartMode
{
    E_UART_MODE0,
    E_UART_MODE1,
    E_UART_MODE2,
    E_UART_MODE3
}UartMode;

typedef enum _BaudRate
{
    E_BR_NULL,
    E_BR_9600,
    E_BR_115200
}BaudRate;

/**
 * @brief UART initialization: using timer2 clk and baudrate = 115200.
 * @return None.
 */ 
void Hv_PM51_Uart_Init(UartMode enMode, BaudRate enBaud);

/**
 * @brief Print string by Uart, string must end with '\0'
 * @param [in] pucStr string to print, must end with '\0'
 * @return None.
 */ 
void Hv_PM51_Uart_Print(UCHAR8 *pucStr);

/**
 * @brief Print unsigned integer by Uart
 * @param [in] ulVal: unsigned integer to print
 * @return None.
 */ 
void Hv_PM51_Uart_PrintU32(ULONG32 ulVal);

/**
 * @brief Input echo processing using USRT RX interrupt
 * @param [in] ucCh: Input echo character
 * @return None.
 */ 
void Hv_PM51_Uart_IrqPut(UCHAR8 ucCh);

#endif
