Solaris Software
Loading...
Searching...
No Matches
uart.c File Reference

UART telemetry consumer service implementation. More...

Include dependency graph for uart.c:

Go to the source code of this file.

Functions

static SPP_RetVal_t SPP_SERVICES_UART_init (void)
 Initialise the UART port and clear the packet mailbox.
static SPP_RetVal_t SPP_SERVICES_UART_deliverToMailbox (const SPP_Packet_t packet)
 Store a packet delivered by the PUBSUB router.
static SPP_RetVal_t SPP_SERVICES_UART_consumeData (void *p_data)
 Transmit the oldest pending SPP packet over UART.
const SPP_SERVICE_ConsumerContract_t * SPP_SERVICES_UART_getConsumerContract (void)
 Get the UART consumer contract.
SPP_RetVal_t SPP_SERVICES_UART_getInitStatus (void)
 Get the result of the last UART service init.

Variables

static SPP_Packet_t s_mailbox [K_UART_MAILBOX_SIZE]
static spp_uint8_t s_mailboxHead = 0U
static spp_uint8_t s_mailboxTail = 0U
static spp_uint8_t s_mailboxCount = 0U
static SPP_RetVal_t s_initStatus = K_SPP_ERROR_NOT_INITIALIZED
static const SPP_SERVICE_ConsumerContract_t g_uartConsumerContract

Detailed Description

UART telemetry consumer service implementation.

The service keeps a small FIFO of SPP packets delivered by the PUBSUB router. Every superloop tick, SPP_SERVICES_UART_consumeData transmits the oldest pending packet over the UART HAL, byte-for-byte.

Definition in file uart.c.

Function Documentation

◆ SPP_SERVICES_UART_init()

SPP_RetVal_t SPP_SERVICES_UART_init ( void )
static

Initialise the UART port and clear the packet mailbox.

Returns
K_SPP_OK on success, error code from the HAL otherwise.

Definition at line 64 of file uart.c.

References s_initStatus, s_mailboxCount, s_mailboxHead, s_mailboxTail, SPP_HAL_UART_portInit(), and SPP_SERVICES_UART_init().

Referenced by SPP_SERVICES_UART_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_UART_deliverToMailbox()

SPP_RetVal_t SPP_SERVICES_UART_deliverToMailbox ( const SPP_Packet_t packet)
static

Store a packet delivered by the PUBSUB router.

Parameters
packetPacket dispatched by the router.
Returns
K_SPP_OK always; when the FIFO is full the oldest packet is dropped.

Definition at line 79 of file uart.c.

References K_SPP_OK, K_UART_MAILBOX_SIZE, s_mailbox, s_mailboxCount, s_mailboxHead, s_mailboxTail, SPP_Packet_t, and SPP_SERVICES_UART_deliverToMailbox().

Referenced by SPP_SERVICES_UART_deliverToMailbox().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_UART_consumeData()

SPP_RetVal_t SPP_SERVICES_UART_consumeData ( void * p_data)
static

Transmit the oldest pending SPP packet over UART.

Parameters
p_dataUnused (context pointer reserved for future use).
Returns
K_SPP_OK on success (or empty mailbox), error code from the HAL otherwise.

Definition at line 101 of file uart.c.

References K_SPP_OK, K_UART_MAILBOX_SIZE, s_mailbox, s_mailboxCount, s_mailboxHead, SPP_HAL_UART_transmit(), SPP_Packet_t, and SPP_SERVICES_UART_consumeData().

Referenced by SPP_SERVICES_UART_consumeData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_UART_getConsumerContract()

const SPP_SERVICE_ConsumerContract_t * SPP_SERVICES_UART_getConsumerContract ( void )

Get the UART consumer contract.

Returns
Pointer to the static consumer contract.

Definition at line 46 of file uart.c.

References g_uartConsumerContract, and SPP_SERVICES_UART_getConsumerContract().

Referenced by SPP_SERVICES_UART_getConsumerContract().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_UART_getInitStatus()

SPP_RetVal_t SPP_SERVICES_UART_getInitStatus ( void )

Get the result of the last UART service init.

Returns
K_SPP_OK if the UART port was initialised, error code otherwise.

Definition at line 51 of file uart.c.

References s_initStatus, and SPP_SERVICES_UART_getInitStatus().

Referenced by SPP_SERVICES_UART_getInitStatus().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ s_mailbox

SPP_Packet_t s_mailbox[K_UART_MAILBOX_SIZE]
static

Definition at line 27 of file uart.c.

Referenced by SPP_SERVICES_UART_consumeData(), and SPP_SERVICES_UART_deliverToMailbox().

◆ s_mailboxHead

spp_uint8_t s_mailboxHead = 0U
static

◆ s_mailboxTail

spp_uint8_t s_mailboxTail = 0U
static

Definition at line 29 of file uart.c.

Referenced by SPP_SERVICES_UART_deliverToMailbox(), and SPP_SERVICES_UART_init().

◆ s_mailboxCount

spp_uint8_t s_mailboxCount = 0U
static

◆ s_initStatus

◆ g_uartConsumerContract

const SPP_SERVICE_ConsumerContract_t g_uartConsumerContract
static
Initial value:
= {
.priority = K_UART_CONSUMER_PRIO,
.p_nameConsumer = "uart",
.tiemoutMs = K_UART_TIMEOUT_MS,
}
static SPP_RetVal_t SPP_SERVICES_UART_consumeData(void *p_data)
Transmit the oldest pending SPP packet over UART.
Definition uart.c:101
static SPP_RetVal_t SPP_SERVICES_UART_deliverToMailbox(const SPP_Packet_t packet)
Store a packet delivered by the PUBSUB router.
Definition uart.c:79
static SPP_RetVal_t SPP_SERVICES_UART_init(void)
Initialise the UART port and clear the packet mailbox.
Definition uart.c:64
#define K_UART_TIMEOUT_MS
Definition uart.h:21
#define K_UART_CONSUMER_PRIO
Definition uart.h:20

Definition at line 34 of file uart.c.

Referenced by SPP_SERVICES_UART_getConsumerContract().