SDK4.0
This document shows Ameba SDK 4.0 APIs
|
uart extended functions More...
Ameba Common | |
enum | SerialFifoLevel { FifoLv1Byte =0, FifoLvQuarter =1, FifoLvHalf =2, FifoLvFull =3 } |
Define RX FIFO Level: RX interrupt trigger, RTS de-assert trigger. More... | |
void | serial_clear_tx (serial_t *obj) |
Clear TX fifo. More... | |
void | serial_clear_rx (serial_t *obj) |
Clear RX fifo. More... | |
void | serial_send_comp_handler (serial_t *obj, void *handler, uint32_t id) |
set TX complete handler. More... | |
void | serial_recv_comp_handler (serial_t *obj, void *handler, uint32_t id) |
set RX complete handler. More... | |
int32_t | serial_recv_blocked (serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms) |
recv target length data use poll mode, with time out. More... | |
int32_t | serial_send_blocked (serial_t *obj, char *ptxbuf, uint32_t len, uint32_t timeout_ms) |
send target length data use poll mode, with time out. More... | |
int32_t | serial_recv_stream (serial_t *obj, char *prxbuf, uint32_t len) |
recv target length data use interrupt mode. More... | |
int32_t | serial_send_stream (serial_t *obj, char *ptxbuf, uint32_t len) |
send target length data use interrupt mode. More... | |
int32_t | serial_recv_stream_dma (serial_t *obj, char *prxbuf, uint32_t len) |
recv target length data use DMA mode. More... | |
int32_t | serial_send_stream_dma (serial_t *obj, char *ptxbuf, uint32_t len) |
send target length data use DMA mode. More... | |
int32_t | serial_send_stream_abort (serial_t *obj) |
stop the sream or steam_dma RX. More... | |
int32_t | serial_recv_stream_abort (serial_t *obj) |
stop the sream or steam_dma TX. More... | |
void | serial_disable (serial_t *obj) |
disable uart clock and function. More... | |
void | serial_enable (serial_t *obj) |
enable uart clock and function. More... | |
int32_t | serial_recv_stream_timeout (serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms, void *force_cs) |
recv target length data use interrupt mode. More... | |
int32_t | serial_recv_stream_dma_timeout (serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms, void *force_cs) |
recv target length data use DMA mode. More... | |
uart extended functions
enum SerialFifoLevel |
void serial_clear_rx | ( | serial_t * | obj | ) |
Clear RX fifo.
obj | uart object define in application software. |
none |
void serial_clear_tx | ( | serial_t * | obj | ) |
Clear TX fifo.
obj | uart object define in application software. |
none |
void serial_disable | ( | serial_t * | obj | ) |
disable uart clock and function.
obj | uart object define in application software. |
none |
void serial_enable | ( | serial_t * | obj | ) |
enable uart clock and function.
obj | uart object define in application software. |
none |
int32_t serial_recv_blocked | ( | serial_t * | obj, |
char * | prxbuf, | ||
uint32_t | len, | ||
uint32_t | timeout_ms | ||
) |
recv target length data use poll mode, with time out.
obj | uart object define in application software. |
ptxbuf | buffer to be written to Tx FIFO. |
len | number of data to be recv. |
timeout_ms | polling time before timeout. |
return received bytes count |
void serial_recv_comp_handler | ( | serial_t * | obj, |
void * | handler, | ||
uint32_t | id | ||
) |
set RX complete handler.
obj | uart object define in application software. |
handler | RX complete callback function. |
id | RX complete callback function parameter. |
none |
int32_t serial_recv_stream | ( | serial_t * | obj, |
char * | prxbuf, | ||
uint32_t | len | ||
) |
recv target length data use interrupt mode.
obj | uart object define in application software. |
prxbuf | buffer to save data read from UART FIFO. |
len | number of data to be read. |
HAL_Status |
int32_t serial_recv_stream_abort | ( | serial_t * | obj | ) |
stop the sream or steam_dma TX.
obj | uart object define in application software. |
HAL_Status |
int32_t serial_recv_stream_dma | ( | serial_t * | obj, |
char * | prxbuf, | ||
uint32_t | len | ||
) |
recv target length data use DMA mode.
obj | uart object define in application software. |
prxbuf | buffer to save data read from UART FIFO. |
len | number of data to be read. |
HAL_Status |
int32_t serial_recv_stream_dma_timeout | ( | serial_t * | obj, |
char * | prxbuf, | ||
uint32_t | len, | ||
uint32_t | timeout_ms, | ||
void * | force_cs | ||
) |
recv target length data use DMA mode.
obj | uart object define in application software. |
prxbuf | buffer to save data read from UART FIFO. |
len | number of data to be recv. |
timeout_ms | polling time before timeout. |
force_cs | forcing context switch function. |
the byte count received before timeout, or error(<0) |
int32_t serial_recv_stream_timeout | ( | serial_t * | obj, |
char * | prxbuf, | ||
uint32_t | len, | ||
uint32_t | timeout_ms, | ||
void * | force_cs | ||
) |
recv target length data use interrupt mode.
obj | uart object define in application software. |
prxbuf | buffer to save data read from UART FIFO. |
len | number of data to be recv. |
timeout_ms | polling time before timeout. |
force_cs | forcing context switch function. |
the byte count received before timeout, or error(<0) |
int32_t serial_send_blocked | ( | serial_t * | obj, |
char * | ptxbuf, | ||
uint32_t | len, | ||
uint32_t | timeout_ms | ||
) |
send target length data use poll mode, with time out.
obj | uart object define in application software. |
ptxbuf | buffer to be written to Tx FIFO. |
len | number of data to be send. |
timeout_ms | polling time before timeout. |
transmitted bytes count |
void serial_send_comp_handler | ( | serial_t * | obj, |
void * | handler, | ||
uint32_t | id | ||
) |
set TX complete handler.
obj | uart object define in application software. |
handler | TX complete callback function. |
id | TX complete callback function parameter. |
none |
int32_t serial_send_stream | ( | serial_t * | obj, |
char * | ptxbuf, | ||
uint32_t | len | ||
) |
send target length data use interrupt mode.
obj | uart object define in application software. |
ptxbuf | buffer to be written to Tx FIFO. |
len | number of data to be send. |
HAL_Status |
int32_t serial_send_stream_abort | ( | serial_t * | obj | ) |
stop the sream or steam_dma RX.
obj | uart object define in application software. |
HAL_Status |
int32_t serial_send_stream_dma | ( | serial_t * | obj, |
char * | ptxbuf, | ||
uint32_t | len | ||
) |
send target length data use DMA mode.
obj | uart object define in application software. |
ptxbuf | buffer to be written to Tx FIFO. |
len | number of data to be send. |
HAL_Status |