![]() |
MAX32655 Peripheral Driver API
Peripheral Driver API for the MAX32655
|
Modules | |
UART_Registers | |
Data Structures | |
struct | mxc_uart_req_t |
Typedefs | |
typedef void(* | mxc_uart_complete_cb_t) (mxc_uart_req_t *req, int result) |
typedef void(* | mxc_uart_dma_complete_cb_t) (mxc_uart_req_t *req, int num, int result) |
Enumerations | |
enum | mxc_uart_stop_t |
enum | mxc_uart_parity_t |
enum | mxc_uart_flow_t |
enum | mxc_uart_clock_t |
struct _mxc_uart_req_t |
The information required to perform a complete UART transaction.
Data Fields | |
mxc_uart_regs_t * | uart |
const uint8_t * | txData |
uint8_t * | rxData |
uint32_t | txLen |
uint32_t | rxLen |
uint32_t | txCnt |
uint32_t | rxCnt |
mxc_uart_complete_cb_t | callback |
typedef void(* mxc_uart_complete_cb_t) (mxc_uart_req_t *req, int result) |
The callback routine used to indicate the transaction has terminated.
req | The details of the transaction. |
result | See Error Codes for the list of error codes. |
typedef void(* mxc_uart_dma_complete_cb_t) (mxc_uart_req_t *req, int num, int result) |
The callback routine used to indicate the transaction has terminated.
req | The details of the transaction. |
num | The number of characters actually copied |
result | See Error Codes for the list of error codes. |
enum mxc_uart_flow_t |
enum mxc_uart_parity_t |
enum mxc_uart_stop_t |
int MXC_UART_AbortAsync | ( | mxc_uart_regs_t * | uart | ) |
Abort any asynchronous requests in progress.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_AbortTransmission | ( | mxc_uart_regs_t * | uart | ) |
Aborts an ongoing UART Transmission.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_AsyncCallback | ( | mxc_uart_regs_t * | uart, |
int | retVal | ||
) |
Async callback.
uart | The uart |
retVal | The ret value |
int MXC_UART_AsyncHandler | ( | mxc_uart_regs_t * | uart | ) |
The processing function for asynchronous transactions.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_AsyncStop | ( | mxc_uart_regs_t * | uart | ) |
stop any async callbacks
uart | The uart |
int MXC_UART_ClearFlags | ( | mxc_uart_regs_t * | uart, |
unsigned int | flags | ||
) |
Clears the interrupt flags that are currently set.
uart | Pointer to UART registers (selects the UART block used.) |
flags | mask of flags to clear |
int MXC_UART_ClearRXFIFO | ( | mxc_uart_regs_t * | uart | ) |
Removes and discards all bytes currently in the receive FIFO.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_ClearTXFIFO | ( | mxc_uart_regs_t * | uart | ) |
Removes and discards all bytes currently in the transmit FIFO.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_DisableInt | ( | mxc_uart_regs_t * | uart, |
unsigned int | mask | ||
) |
Disables specific interrupts.
uart | Pointer to UART registers (selects the UART block used.) |
mask | The interrupts to be disabled |
int MXC_UART_DMACallback | ( | int | ch, |
int | error | ||
) |
DMA Callback function.
ch | DMA channel |
error | Error |
int MXC_UART_EnableInt | ( | mxc_uart_regs_t * | uart, |
unsigned int | mask | ||
) |
Enables specific interrupts.
uart | Pointer to UART registers (selects the UART block used.) |
mask | The interrupts to be enabled |
int MXC_UART_GetActive | ( | mxc_uart_regs_t * | uart | ) |
Checks the UART Peripheral for an ongoing transmission.
uart | Pointer to UART registers (selects the UART block used.) |
unsigned int MXC_UART_GetFlags | ( | mxc_uart_regs_t * | uart | ) |
Gets the interrupt flags that are currently set.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_GetFrequency | ( | mxc_uart_regs_t * | uart | ) |
Get the frequency of the UART interface.
uart | Pointer to UART registers (selects the UART block used.) |
unsigned int MXC_UART_GetRXFIFOAvailable | ( | mxc_uart_regs_t * | uart | ) |
Get the number of bytes currently available in the receive FIFO.
uart | Pointer to UART registers (selects the UART block used.) |
unsigned int MXC_UART_GetRXThreshold | ( | mxc_uart_regs_t * | uart | ) |
Get the current receive threshold level.
uart | Pointer to UART registers (selects the UART block used.) |
unsigned int MXC_UART_GetStatus | ( | mxc_uart_regs_t * | uart | ) |
Gets the status flags that are currently set.
uart | Pointer to UART registers (selects the UART block used.) |
unsigned int MXC_UART_GetTXFIFOAvailable | ( | mxc_uart_regs_t * | uart | ) |
Get the amount of free space available in the transmit FIFO.
uart | Pointer to UART registers (selects the UART block used.) |
unsigned int MXC_UART_GetTXThreshold | ( | mxc_uart_regs_t * | uart | ) |
Get the current transmit threshold level.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_Init | ( | mxc_uart_regs_t * | uart, |
unsigned int | baud, | ||
mxc_uart_clock_t | clock | ||
) |
Initialize and enable UART peripheral.
This function initializes everything necessary to call a UART transaction function. Some parameters are set to defaults as follows: UART Data Size - 8 bits UART Stop Bits - 1 bit UART Parity - None UART Flow Control - None
These parameters can be modified after initialization using low level functions
uart | Pointer to UART registers (selects the UART block used.) |
baud | The requested clock frequency. The actual clock frequency will be returned by the function if successful. |
clock | Clock source |
int MXC_UART_Read | ( | mxc_uart_regs_t * | uart, |
uint8_t * | buffer, | ||
int * | len | ||
) |
Reads the next available character.
uart | Pointer to UART registers (selects the UART block used.) |
buffer | Buffer to store data in |
len | Number of characters |
int MXC_UART_ReadCharacter | ( | mxc_uart_regs_t * | uart | ) |
Reads the next available character.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_ReadCharacterRaw | ( | mxc_uart_regs_t * | uart | ) |
Reads the next available character. If no character is available, this function will return an error.
uart | Pointer to UART registers (selects the UART block used.) |
unsigned int MXC_UART_ReadRXFIFO | ( | mxc_uart_regs_t * | uart, |
unsigned char * | bytes, | ||
unsigned int | len | ||
) |
Unloads bytes from the receive FIFO.
uart | Pointer to UART registers (selects the UART block used.) |
bytes | The buffer to read the data into. |
len | The number of bytes to read. |
int MXC_UART_ReadRXFIFODMA | ( | mxc_uart_regs_t * | uart, |
unsigned char * | bytes, | ||
unsigned int | len, | ||
mxc_uart_dma_complete_cb_t | callback | ||
) |
Unloads bytes from the receive FIFO user DMA for longer reads.
uart | Pointer to UART registers (selects the UART block used.) |
bytes | The buffer to read the data into. |
len | The number of bytes to read. |
callback | The function to call when the read is complete |
int MXC_UART_ReadyForSleep | ( | mxc_uart_regs_t * | uart | ) |
Checks if the given UART bus can be placed in sleep more.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_SetClockSource | ( | mxc_uart_regs_t * | uart, |
mxc_uart_clock_t | clock | ||
) |
Sets the clock source for the baud rate generator.
uart | Pointer to UART registers (selects the UART block used.) |
clock | Clock source |
int MXC_UART_SetDataSize | ( | mxc_uart_regs_t * | uart, |
int | dataSize | ||
) |
Sets the number of bits per character.
uart | Pointer to UART registers (selects the UART block used.) |
dataSize | The number of bits per character (5-8 bits/character are valid) |
int MXC_UART_SetFlowCtrl | ( | mxc_uart_regs_t * | uart, |
mxc_uart_flow_t | flowCtrl, | ||
int | rtsThreshold | ||
) |
Sets the flow control used.
uart | Pointer to UART registers (selects the UART block used.) |
flowCtrl | see UART Flow Control Types for details |
rtsThreshold | Number of bytes remaining in the RX FIFO when RTS is asserted |
int MXC_UART_SetFrequency | ( | mxc_uart_regs_t * | uart, |
unsigned int | baud, | ||
mxc_uart_clock_t | clock | ||
) |
Set the frequency of the UART interface.
uart | Pointer to UART registers (selects the UART block used.) |
baud | The desired baud rate |
clock | Clock source |
int MXC_UART_SetParity | ( | mxc_uart_regs_t * | uart, |
mxc_uart_parity_t | parity | ||
) |
Sets the type of parity generation used.
uart | Pointer to UART registers (selects the UART block used.) |
parity | see UART Parity Types for details |
int MXC_UART_SetRXThreshold | ( | mxc_uart_regs_t * | uart, |
unsigned int | numBytes | ||
) |
Set the receive threshold level.
uart | Pointer to UART registers (selects the UART block used.) |
numBytes | The threshold level to set. This value must be between 0 and 8 inclusive. |
int MXC_UART_SetStopBits | ( | mxc_uart_regs_t * | uart, |
mxc_uart_stop_t | stopBits | ||
) |
Sets the number of stop bits sent at the end of a character.
uart | Pointer to UART registers (selects the UART block used.) |
stopBits | The number of stop bits used |
int MXC_UART_SetTXThreshold | ( | mxc_uart_regs_t * | uart, |
unsigned int | numBytes | ||
) |
Set the transmit threshold level.
uart | Pointer to UART registers (selects the UART block used.) |
numBytes | The threshold level to set. This value must be between 0 and 8 inclusive. |
int MXC_UART_Shutdown | ( | mxc_uart_regs_t * | uart | ) |
Disable and shutdown UART peripheral.
uart | Pointer to UART registers (selects the UART block used.) |
int MXC_UART_Transaction | ( | mxc_uart_req_t * | req | ) |
Performs a blocking UART transaction.
req | Pointer to details of the transaction |
int MXC_UART_TransactionAsync | ( | mxc_uart_req_t * | req | ) |
Setup an interrupt-driven UART transaction.
req | Pointer to details of the transaction |
int MXC_UART_TransactionDMA | ( | mxc_uart_req_t * | req | ) |
Setup a DMA driven UART transaction.
req | Pointer to details of the transaction |
int MXC_UART_Write | ( | mxc_uart_regs_t * | uart, |
const uint8_t * | byte, | ||
int * | len | ||
) |
Writes a byte on the UART.
uart | Pointer to UART registers (selects the UART block used.) |
byte | The buffer of characters to write |
len | The number of characters to write |
int MXC_UART_WriteCharacter | ( | mxc_uart_regs_t * | uart, |
uint8_t | character | ||
) |
Writes a character on the UART.
uart | Pointer to UART registers (selects the UART block used.) |
character | The character to write |
int MXC_UART_WriteCharacterRaw | ( | mxc_uart_regs_t * | uart, |
uint8_t | character | ||
) |
Writes a character on the UART. If the character cannot be written because the transmit FIFO is currently full, this function returns an error.
uart | Pointer to UART registers (selects the UART block used.) |
character | The character to write |
unsigned int MXC_UART_WriteTXFIFO | ( | mxc_uart_regs_t * | uart, |
const unsigned char * | bytes, | ||
unsigned int | len | ||
) |
Loads bytes into the transmit FIFO.
uart | Pointer to UART registers (selects the UART block used.) |
bytes | The buffer containing the bytes to write |
len | The number of bytes to write. |
int MXC_UART_WriteTXFIFODMA | ( | mxc_uart_regs_t * | uart, |
const unsigned char * | bytes, | ||
unsigned int | len, | ||
mxc_uart_dma_complete_cb_t | callback | ||
) |
Loads bytes into the transmit FIFO using DMA for longer writes.
uart | Pointer to UART registers (selects the UART block used.) |
bytes | The buffer containing the bytes to write |
len | The number of bytes to write. |
callback | The function to call when the write is complete |