RAFW Flexible Software Package Documentation  Release v2.0.1

 
AT Interface

Detailed Description

Interface for AT communications.

Summary

The AT interface provides common APIs for AT HAL drivers. The AT interface supports the following features:

Data Structures

struct  atcmd_w_info_t
 
struct  atcmd_w_callback_args_t
 
struct  atcmd_w_cfg_t
 
struct  atcmd_w_api_t
 
struct  atcmd_w_instance_t
 

Typedefs

typedef void atcmd_w_ctrl_t
 

Enumerations

enum  atcmd_w_event_t
 

Data Structure Documentation

◆ atcmd_w_info_t

struct atcmd_w_info_t

AT driver specific information

Data Fields
uint32_t write_bytes_max

Maximum bytes that can be written at this time. Only applies if atcmd_w_cfg_t::p_transfer_tx is not NULL.

uint32_t read_bytes_max

Maximum bytes that are available to read at one time. Only applies if atcmd_w_cfg_t::p_transfer_rx is not NULL.

◆ atcmd_w_callback_args_t

struct atcmd_w_callback_args_t

AT Callback parameter definition

Data Fields
atcmd_w_event_t event Event code.
uint32_t data

Contains the next character received for the events ATCMD_W_EVENT_RX_CHAR, ATCMD_W_EVENT_ERR_PARITY, ATCMD_W_EVENT_ERR_FRAMING, or ATCMD_W_EVENT_ERR_OVERFLOW. Otherwise unused.

char at_data
char at_buff[ATCMD_W_BUFF_MAX]
void const * p_context Context provided to user during callback.

◆ atcmd_w_cfg_t

struct atcmd_w_cfg_t

AT Configuration

Data Fields

transfer_instance_t const * p_transfer_rx
 
transfer_instance_t const * p_transfer_tx
 
void(* p_callback )(atcmd_w_callback_args_t *p_args)
 Pointer to callback function.
 
void const * p_context
 User defined context passed into callback function.
 
void const * p_extend
 AT hardware dependent configuration.
 

Field Documentation

◆ p_transfer_rx

transfer_instance_t const* atcmd_w_cfg_t::p_transfer_rx

Optional transfer instance used to receive multiple bytes without interrupts. Set to NULL if unused. If NULL, the number of bytes allowed in the read API is limited to one byte at a time.

◆ p_transfer_tx

transfer_instance_t const* atcmd_w_cfg_t::p_transfer_tx

Optional transfer instance used to send multiple bytes without interrupts. Set to NULL if unused. If NULL, the number of bytes allowed in the write APIs is limited to one byte at a time.

◆ atcmd_w_api_t

struct atcmd_w_api_t

Shared Interface definition for AT

Data Fields

fsp_err_t(* open )(atcmd_w_ctrl_t *const p_ctrl, atcmd_w_cfg_t const *const p_cfg)
 
fsp_err_t(* read )(atcmd_w_ctrl_t *const p_ctrl, uint8_t *const p_dest, uint32_t const bytes)
 
fsp_err_t(* write )(atcmd_w_ctrl_t *const p_ctrl, uint8_t const *const p_src, uint32_t const bytes)
 
fsp_err_t(* infoGet )(atcmd_w_ctrl_t *const p_ctrl, atcmd_w_info_t *const p_info)
 
fsp_err_t(* communicationAbort )(atcmd_w_ctrl_t *const p_ctrl)
 
fsp_err_t(* callbackSet )(atcmd_w_ctrl_t *const p_ctrl, void(*p_callback)(atcmd_w_callback_args_t *), void const *const p_context, atcmd_w_callback_args_t *const p_callback_memory)
 
fsp_err_t(* close )(atcmd_w_ctrl_t *const p_ctrl)
 
fsp_err_t(* readStop )(atcmd_w_ctrl_t *const p_ctrl, uint32_t *remaining_bytes)
 

Field Documentation

◆ open

fsp_err_t(* atcmd_w_api_t::open) (atcmd_w_ctrl_t *const p_ctrl, atcmd_w_cfg_t const *const p_cfg)

Open AT device.

Parameters
[in,out]p_ctrlPointer to the AT control block. Must be declared by user. Value set here.
[in]atcmd_w_cfg_tPointer to AT configuration structure. All elements of this structure must be set by user.

◆ read

fsp_err_t(* atcmd_w_api_t::read) (atcmd_w_ctrl_t *const p_ctrl, uint8_t *const p_dest, uint32_t const bytes)

Read from AT device. The read buffer is used until the read is complete. When a transfer is complete, the callback is called with event ATCMD_W_EVENT_RX_COMPLETE. Bytes received outside an active transfer are received in the callback function with event ATCMD_W_EVENT_RX_CHAR. The maximum transfer size is reported by infoGet().

Parameters
[in]p_ctrlPointer to the AT control block for the channel.
[in]p_destDestination address to read data from.
[in]bytesRead data length.

◆ write

fsp_err_t(* atcmd_w_api_t::write) (atcmd_w_ctrl_t *const p_ctrl, uint8_t const *const p_src, uint32_t const bytes)

Write to AT device. The write buffer is used until write is complete. Do not overwrite write buffer contents until the write is finished. When the write is complete (all bytes are fully transmitted on the wire), the callback called with event ATCMD_W_EVENT_TX_COMPLETE. The maximum transfer size is reported by infoGet().

Parameters
[in]p_ctrlPointer to the AT control block.
[in]p_srcSource address to write data to.
[in]bytesWrite data length.

◆ infoGet

fsp_err_t(* atcmd_w_api_t::infoGet) (atcmd_w_ctrl_t *const p_ctrl, atcmd_w_info_t *const p_info)

Get the driver specific information.

Parameters
[in]p_ctrlPointer to the AT control block.
[in]baudrateBaud rate in bps.

◆ communicationAbort

fsp_err_t(* atcmd_w_api_t::communicationAbort) (atcmd_w_ctrl_t *const p_ctrl)

Abort ongoing transfer.

Parameters
[in]p_ctrlPointer to the AT control block.

◆ callbackSet

fsp_err_t(* atcmd_w_api_t::callbackSet) (atcmd_w_ctrl_t *const p_ctrl, void(*p_callback)(atcmd_w_callback_args_t *), void const *const p_context, atcmd_w_callback_args_t *const p_callback_memory)

Specify callback function and optional context pointer and working memory pointer.

Parameters
[in]p_ctrlPointer to the AT control block.
[in]p_callbackCallback function
[in]p_contextPointer to send to callback function
[in]p_working_memoryPointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback.

◆ close

fsp_err_t(* atcmd_w_api_t::close) (atcmd_w_ctrl_t *const p_ctrl)

Close AT device.

Parameters
[in]p_ctrlPointer to the AT control block.

◆ readStop

fsp_err_t(* atcmd_w_api_t::readStop) (atcmd_w_ctrl_t *const p_ctrl, uint32_t *remaining_bytes)

Stop ongoing read and return the number of bytes remaining in the read.

Parameters
[in]p_ctrlPointer to the AT control block.
[in,out]remaining_bytesPointer to location to store remaining bytes for read.

◆ atcmd_w_instance_t

struct atcmd_w_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
atcmd_w_ctrl_t * p_ctrl Pointer to the control structure for this instance.
atcmd_w_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
atcmd_w_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ atcmd_w_ctrl_t

typedef void atcmd_w_ctrl_t

AT control block. Allocate an instance specific control block to pass into the AT API calls.

Enumeration Type Documentation

◆ atcmd_w_event_t

AT Event codes

Enumerator
ATCMD_W_EVENT_RX_COMPLETE 

Receive complete event.

ATCMD_W_EVENT_TX_COMPLETE 

Transmit complete event.

ATCMD_W_EVENT_RX_CHAR 

Character received.

ATCMD_W_EVENT_ERR_PARITY 

Parity error event.

ATCMD_W_EVENT_ERR_FRAMING 

Mode fault error event.

ATCMD_W_EVENT_ERR_OVERFLOW 

FIFO Overflow error event.

ATCMD_W_EVENT_BREAK_DETECT 

Break detect error event.

ATCMD_W_EVENT_TX_DATA_EMPTY 

Last byte is transmitting, ready for more data.