Microchip® Advanced Software Framework

unit_tests.c File Reference

Unit tests for SSC driver.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdint.h>
#include <stdbool.h>
#include <board.h>
#include <sysclk.h>
#include <ssc.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_test.h>
#include <conf_board.h>

Macros

#define BIT_LEN_PER_CHANNEL   8
 SSC work bit rate. More...
 
#define BUFFER_SIZE   10
 Transmitter and receiver buffer size. More...
 
#define SAMPLE_RATE   8000
 
#define SSC_BIT_RATE   (BIT_LEN_PER_CHANNEL * SAMPLE_RATE)
 
#define SSC_IRQ_PRIO   4
 The SSC interrupt IRQ priority. More...
 

Functions

int main (void)
 Run SSC driver unit tests. More...
 
static void run_ssc_test (const struct test_case *test)
 Test Synchronous Serial Controller. More...
 
void SSC_Handler (void)
 Synchronous Serial Controller Handler. More...
 

Variables

uint8_t g_uc_rx_buff [BUFFER_SIZE]
 Receiver buffer content. More...
 
volatile uint8_t g_uc_rx_done = 0
 Receive done flag. More...
 
uint8_t g_uc_rx_index = 0
 Receive index. More...
 
uint8_t g_uc_tx_buff [BUFFER_SIZE]
 Transmit buffer content. More...
 
uint8_t g_uc_tx_index = 0
 Transmit index. More...
 

#define BIT_LEN_PER_CHANNEL   8

SSC work bit rate.

Referenced by run_ssc_test().

#define BUFFER_SIZE   10

Transmitter and receiver buffer size.

Referenced by run_ssc_test(), and SSC_Handler().

#define SAMPLE_RATE   8000
#define SSC_BIT_RATE   (BIT_LEN_PER_CHANNEL * SAMPLE_RATE)

Referenced by run_ssc_test().

#define SSC_IRQ_PRIO   4

The SSC interrupt IRQ priority.

Referenced by run_ssc_test().

void SSC_Handler ( void  )

Synchronous Serial Controller Handler.

References BUFFER_SIZE, g_uc_rx_buff, g_uc_rx_done, g_uc_rx_index, ssc_disable_interrupt(), ssc_get_status(), and ssc_read().

uint8_t g_uc_rx_buff[BUFFER_SIZE]

Receiver buffer content.

Referenced by run_ssc_test(), and SSC_Handler().

volatile uint8_t g_uc_rx_done = 0

Receive done flag.

Referenced by run_ssc_test(), and SSC_Handler().

uint8_t g_uc_rx_index = 0

Receive index.

Referenced by SSC_Handler().

uint8_t g_uc_tx_buff[BUFFER_SIZE]
Initial value:
=
{ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89 }

Transmit buffer content.

Referenced by run_ssc_test().

uint8_t g_uc_tx_index = 0

Transmit index.

Referenced by run_ssc_test().