Morse Micro IoT SDK  2.9.7
rf-test.c File Reference

Detailed Description

RF test application, alpha release.

Note
It is assumed that you have followed the steps in the Getting Started guide and are therefore familiar with how to build, flash, and monitor an application using the MM-IoT-SDK framework.

This application is not intended for general use and requires additional tools. Please contact Morse support for more information.

Definition in file rf-test.c.

#include <endian.h>
#include <string.h>
#include "mmbuf.h"
#include "mmcrc.h"
#include "mmhal.h"
#include "mmhal_uart.h"
#include "mmosal.h"
#include "mmutils.h"
#include "mmwlan.h"
#include "mm_app_common.h"
#include "slip.h"
Include dependency graph for rf-test.c:

Go to the source code of this file.

Macros

#define SEQ_NUM_LEN   (4)
 Length of the sequence number field appended to command/response packets. More...
 
#define COMMAND_MAX_LEN   (252)
 Maximum possible length of a command that we may wish to receive. More...
 
#define RESPONSE_MAX_LEN   (2048)
 Maximum possible length of a response that we may wish to send. More...
 
#define RESPONSE_HDR_LEN   (12)
 Length of a response header (excluding status field). More...
 

Functions

static int slip_tx_handler (uint8_t c, void *arg)
 TX callback handler for SLIP. More...
 
static void rf_test_handle_command (struct mmbuf *cmd_buf)
 Callback to handle reception of a command packet from the data-link HAL. More...
 
static void uart_rx_handler (const uint8_t *data, size_t length, void *arg)
 Handler for UART HAL RX callback. More...
 
void app_init (void)
 Main entry point to the application. More...
 

Variables

static uint8_t slip_rx_buffer [SLIP_RX_BUFFER_SIZE]
 Buffer for SLIP processing on receive path. More...
 
static struct slip_rx_state rx_slip_state
 State data for SLIP processing on receive path. More...
 

Macro Definition Documentation

◆ COMMAND_MAX_LEN

#define COMMAND_MAX_LEN   (252)

Maximum possible length of a command that we may wish to receive.

Definition at line 34 of file rf-test.c.

◆ RESPONSE_HDR_LEN

#define RESPONSE_HDR_LEN   (12)

Length of a response header (excluding status field).

Definition at line 38 of file rf-test.c.

◆ RESPONSE_MAX_LEN

#define RESPONSE_MAX_LEN   (2048)

Maximum possible length of a response that we may wish to send.

Definition at line 36 of file rf-test.c.

◆ SEQ_NUM_LEN

#define SEQ_NUM_LEN   (4)

Length of the sequence number field appended to command/response packets.

Definition at line 32 of file rf-test.c.

Function Documentation

◆ app_init()

void app_init ( void  )

Main entry point to the application.

This will be invoked in a thread once operating system and hardware initialization has completed. It may return, but it does not have to.

Definition at line 215 of file rf-test.c.

◆ rf_test_handle_command()

static void rf_test_handle_command ( struct mmbuf cmd_buf)
static

Callback to handle reception of a command packet from the data-link HAL.

Parameters
cmd_bufThe received command.

Definition at line 60 of file rf-test.c.

◆ slip_tx_handler()

static int slip_tx_handler ( uint8_t  c,
void *  arg 
)
static

TX callback handler for SLIP.

This is invoked by SLIP to trigger transmission of a character.

Parameters
cThe character to transmit
argOpaque argument (ignored in this case).
Returns
0 on success, otherwise an error code.

Definition at line 48 of file rf-test.c.

◆ uart_rx_handler()

static void uart_rx_handler ( const uint8_t *  data,
size_t  length,
void *  arg 
)
static

Handler for UART HAL RX callback.

Parameters
dataThe received data.
lengthLength of the received data.
argOpaque argument – the SLIP state in our case.

Definition at line 158 of file rf-test.c.

Variable Documentation

◆ rx_slip_state

struct slip_rx_state rx_slip_state
static
Initial value:
=
#define SLIP_RX_STATE_INIT(_buffer, _buffer_length)
Static initializer for slip_rx_state.
Definition: slip.h:59
static uint8_t slip_rx_buffer[SLIP_RX_BUFFER_SIZE]
Buffer for SLIP processing on receive path.
Definition: rf-test.c:206

State data for SLIP processing on receive path.

Definition at line 208 of file rf-test.c.

◆ slip_rx_buffer

uint8_t slip_rx_buffer[SLIP_RX_BUFFER_SIZE]
static

Buffer for SLIP processing on receive path.

Definition at line 206 of file rf-test.c.