Microchip® Advanced Software Framework

unit_tests.c File Reference

Unit tests for CAN driver.

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

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

Macros

#define CAN0_RX_MB_IDX   1
 
#define CAN0_TX_MB_IDX   0
 The CAN0 communication mailbox ID. More...
 
#define CAN1_PRO_MB_IDX   0
 The CAN1 communication mailbox ID. More...
 
#define CAN_TRANSFER_DATA_LEN   8
 The transfer data length. More...
 
#define CAN_TRANSFER_ID   0x0a
 The transfer identifier. More...
 
#define TRANSFER_DATA_HIGH   0x87654321
 
#define TRANSFER_DATA_LOW   0x12345678
 The data transfer between the CAN0 and CAN1. More...
 

Functions

void CAN0_Handler (void)
 Default interrupt handler for CAN0. More...
 
int main (void)
 Run RSTC driver unit tests. More...
 
static void reset_mailbox_conf (can_mb_conf_t *p_mailbox)
 Reset mailbox configure structure. More...
 
static void run_can_test (const struct test_case *test)
 Test Controller Area Network (CAN) Controller. More...
 

Variables

can_mb_conf_t can0_mailbox
 CAN0 Transfer. More...
 
sn65hvd234_ctrl_t can0_transceiver
 CAN0 Transceiver. More...
 
can_mb_conf_t can1_mailbox
 CAN1 Transfer. More...
 
sn65hvd234_ctrl_t can1_transceiver
 CAN1 Transceiver. More...
 
volatile uint32_t g_ul_recv_status = 0
 Receive status. More...
 

#define CAN0_RX_MB_IDX   1

Referenced by CAN0_Handler(), and run_can_test().

#define CAN0_TX_MB_IDX   0

The CAN0 communication mailbox ID.

Referenced by run_can_test().

#define CAN1_PRO_MB_IDX   0

The CAN1 communication mailbox ID.

Referenced by run_can_test().

#define CAN_TRANSFER_DATA_LEN   8

The transfer data length.

Referenced by run_can_test().

#define CAN_TRANSFER_ID   0x0a

The transfer identifier.

Referenced by run_can_test().

#define TRANSFER_DATA_HIGH   0x87654321

Referenced by run_can_test().

#define TRANSFER_DATA_LOW   0x12345678

The data transfer between the CAN0 and CAN1.

Referenced by run_can_test().

static void reset_mailbox_conf ( can_mb_conf_t p_mailbox)
static

can_mb_conf_t can0_mailbox

CAN0 Transfer.

sn65hvd234_ctrl_t can0_transceiver

CAN0 Transceiver.

can_mb_conf_t can1_mailbox

CAN1 Transfer.

sn65hvd234_ctrl_t can1_transceiver

CAN1 Transceiver.

volatile uint32_t g_ul_recv_status = 0

Receive status.

Referenced by CAN0_Handler(), and run_can_test().