Files
OpenBK7231T_App/src/driver/drv_uart.h
NonPIayerCharacter 969e5bfa50 RTL8720D (#1550)
* ambd

* update sdk, get current fw idx

* test

* ota

* reset if hard fault

* revert and fix

* uart flow control

* disable uart tcp debug by default

* test

* wifi test

* adjust lwip
adjust scan

* increase timeout

* enable ssdp, close uart tcp sockets on restart

* test

* pwm

* fix bl0942

* cut some code
2025-02-28 08:43:00 +01:00

46 lines
1.7 KiB
C

#pragma once
//---------------------------------------------------
// Routines using UART port depending on config
// flag OBK_FLAG_USE_SECONDARY_UART
// Note: using same buffer as routines below
//--------------------------------------------------
void UART_InitReceiveRingBuffer(int size);
int UART_GetReceiveRingBufferSize();
int UART_GetDataSize();
byte UART_GetByte(int idx);
void UART_ConsumeBytes(int idx);
void UART_AppendByteToReceiveRingBuffer(int rc);
void UART_SendByte(byte b);
int UART_InitUART(int baud, int parity, bool hwflowc);
void UART_AddCommands();
void UART_RunEverySecond();
// used to detect uart reinit/takeover by driver
int get_g_uart_init_counter();
// used to get selected port from config - OBK_FLAG_USE_SECONDARY_UART
int UART_GetSelectedPortIndex();
//---------------------------------------------------
// XJIKKA 20241123 new routines with uart index param
// BEKEN platform only (yet)
// Independent of OBK_FLAG_USE_SECONDARY_UART
//---------------------------------------------------
//index of UART port
// BEKEN - UART_PORT_INDEX_0 = BK_UART_1 RX1 TX1
// BEKEN - UART_PORT_INDEX_1 = BK_UART_2 RX2 TX2
#define UART_PORT_INDEX_0 0
#define UART_PORT_INDEX_1 1
//
int UART_GetBufIndexFromPort(int aport);
void UART_InitReceiveRingBufferEx(int auartindex, int size);
void UART_AppendByteToReceiveRingBufferEx(int auartindex, int rc);
int UART_GetReceiveRingBufferSizeEx(int auartindex);
int UART_GetDataSizeEx(int auartindex);
byte UART_GetByteEx(int auartindex, int idx);
void UART_ConsumeBytesEx(int auartindex, int idx);
void UART_SendByteEx(int auartindex, byte b);
int UART_InitUARTEx(int auartindex, int baud, int parity, bool hwflowc);
void UART_LogBufState(int auartindex);