95 lines
2.9 KiB
C
Raw Normal View History

2022-01-18 00:58:54 +08:00
/*********************************************************************************************************************
* COPYRIGHT NOTICE
* Copyright (c) 2020,<EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD>
* All rights reserved.
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><EFBFBD>824575535
*
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>;<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD>λʹ<EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD>İ<EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @file uart
* @company <EFBFBD>ɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾
* @author <EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD>(QQ3184284598)
* @version <EFBFBD>doc<EFBFBD><EFBFBD>version<EFBFBD>ļ<EFBFBD> <EFBFBD>˵<EFBFBD><EFBFBD>
* @Software ADS v1.2.2
* @Target core TC264D
* @Taobao https://seekfree.taobao.com/
* @date 2020-3-23
********************************************************************************************************************/
#ifndef _zf_uart_h
#define _zf_uart_h
#include "common.h"
#include "ifxAsclin_Asc.h"
#define UART0_TX_BUFFER_SIZE 16 //<2F><><EFBFBD><EFBFBD><E5B4AE>0<EFBFBD><30><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
#define UART0_RX_BUFFER_SIZE 16 //<2F><><EFBFBD><EFBFBD><E5B4AE>0<EFBFBD><30><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
#define UART1_TX_BUFFER_SIZE 16
#define UART1_RX_BUFFER_SIZE 16
#define UART2_TX_BUFFER_SIZE 16
#define UART2_RX_BUFFER_SIZE 16
#define UART3_TX_BUFFER_SIZE 16
#define UART3_RX_BUFFER_SIZE 16
//<2F><>ö<EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><E5B2BB><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>޸<EFBFBD>
typedef enum //ö<>ٴ<EFBFBD><D9B4>ں<EFBFBD>
{
UART_0,
UART_1,
UART_2,
UART_3,
}UARTN_enum;
//<2F><>ö<EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><E5B2BB><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>޸<EFBFBD>
typedef enum //ö<>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
//<2F><><EFBFBD><EFBFBD>0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>ѡ<EFBFBD><D1A1>Χ
UART0_TX_P14_0, UART0_TX_P14_1, UART0_TX_P15_2, UART0_TX_P15_3,
//<2F><><EFBFBD><EFBFBD>0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>ѡ<EFBFBD><D1A1>Χ
UART0_RX_P14_1, UART0_RX_P15_3,
//<2F><>LQFP144<34><34>װ<EFBFBD><D7B0>û<EFBFBD><C3BB>P14_10<31><30>P14_8
//<2F><><EFBFBD><EFBFBD>1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>ѡ<EFBFBD><D1A1>Χ
UART1_TX_P02_2, UART1_TX_P11_12, UART1_TX_P14_10, UART1_TX_P15_0, UART1_TX_P15_1, UART1_TX_P15_4, UART1_TX_P15_5, UART1_TX_P20_10, UART1_TX_P33_12, UART1_TX_P33_13,
//<2F><><EFBFBD><EFBFBD>1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>ѡ<EFBFBD><D1A1>Χ
UART1_RX_P02_3, UART1_RX_P11_10, UART1_RX_P14_8, UART1_RX_P15_1, UART1_RX_P15_5, UART1_RX_P20_9, UART1_RX_P33_13,
//<2F><><EFBFBD><EFBFBD>2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>ѡ<EFBFBD><D1A1>Χ
UART2_TX_P02_0, UART2_TX_P10_5, UART2_TX_P14_2, UART2_TX_P14_3, UART2_TX_P33_8, UART2_TX_P33_9,
//<2F><><EFBFBD><EFBFBD>2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>ѡ<EFBFBD><D1A1>Χ
UART2_RX_P02_0, UART2_RX_P02_1, UART2_RX_P10_6, UART2_RX_P14_3, UART2_RX_P33_8,
//<2F><>LQFP144<34><34>װ<EFBFBD><D7B0>û<EFBFBD><C3BB>P32_2<5F><32>P32_3
//<2F><><EFBFBD><EFBFBD>3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>ѡ<EFBFBD><D1A1>Χ
UART3_TX_P00_0, UART3_TX_P00_1, UART3_TX_P15_6, UART3_TX_P15_7, UART3_TX_P20_0, UART3_TX_P20_3, UART3_TX_P21_7, UART3_TX_P32_2, UART3_TX_P32_3,
//<2F><><EFBFBD><EFBFBD>3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>ѡ<EFBFBD><D1A1>Χ
UART3_RX_P00_1, UART3_RX_P15_7, UART3_RX_P20_3, UART3_RX_P21_6, UART3_RX_P32_2,
}UART_PIN_enum;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>handle<6C><65><EFBFBD><EFBFBD>
extern IfxAsclin_Asc uart0_handle;
extern IfxAsclin_Asc uart1_handle;
extern IfxAsclin_Asc uart2_handle;
extern IfxAsclin_Asc uart3_handle;
void uart_init(UARTN_enum uartn, uint32 baud, UART_PIN_enum tx_pin, UART_PIN_enum rx_pin);
void uart_putchar(UARTN_enum uartn, uint8 dat);
void uart_putbuff(UARTN_enum uartn, uint8 *buff, uint32 len);
void uart_putstr(UARTN_enum uartn, const int8 *str);
void uart_getchar(UARTN_enum uartn, uint8 *dat);
uint8 uart_query(UARTN_enum uartn, uint8 *dat);
#endif