AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches
argus_hal_test.c File Reference

Tests for the AFBR-S50 API hardware abstraction layer. More...

Include dependency graph for argus_hal_test.c:

Macros

#define error_log(fmt, ...)   print("ERROR: " fmt "\n", ##__VA_ARGS__)
 

Functions

static status_t VerifyHALImplementation (s2pi_slave_t spi_slave)
 Executes a series of tests in order to verify the HAL implementation.
 
static status_t TimerPlausibilityTest (void)
 Plausibility Test for Timer HAL Implementation.
 
static status_t TimerWraparoundTest (void)
 Wraparound Test for the Timer HAL Implementation.
 
static status_t SpiConnectionTest (s2pi_slave_t slave)
 SPI Connection Test for S2PI HAL Implementation.
 
static status_t SpiMaxLengthTest (s2pi_slave_t slave)
 Maximum SPI Data Size Test for S2PI HAL Implementation.
 
static status_t GpioInterruptTest (s2pi_slave_t slave)
 SPI Interrupt Test for S2PI HAL Implementation.
 
static status_t GpioModeTest (s2pi_slave_t slave)
 GPIO Mode Test for S2PI HAL Implementation.
 
static status_t TimerTest (s2pi_slave_t slave)
 Test for Timer HAL Implementation by comparing timings to the device.
 
static status_t PITTest (void)
 Test for PIT HAL Implementation by comparing timings to the device.
 
static status_t SpiTransferFromInterruptTest (s2pi_slave_t slave)
 SPI Transfer from Interrupt Test for S2PI HAL Implementation.
 
static status_t CheckTimerCounterValues (uint32_t hct, uint32_t lct)
 Checks the validity of timer counter values.
 
static status_t SPITransferSync (s2pi_slave_t slave, uint8_t *data, size_t size)
 Helper function for transfer data to SPI in blocking mode.
 
static status_t ConfigureDevice (s2pi_slave_t slave, int8_t rcoTrim)
 Configures the device with a bare minimum setup to run the tests.
 
static status_t TriggerMeasurement (s2pi_slave_t slave, uint16_t samples, s2pi_callback_t callback, void *callbackData)
 Triggers a measurement on the device with specified sample count.
 
static status_t ReadEEPROM (s2pi_slave_t slave, uint8_t *eeprom)
 Reads the EEPROM byte-wise and applies Hamming weight.
 
static status_t ReadRcoTrim (s2pi_slave_t slave, int8_t *rcotrim)
 Reads the RCO_TRIM value from the devices EEPROM.
 
static status_t RunMeasurement (s2pi_slave_t slave, uint16_t samples)
 Triggers a measurement on the device and waits for the data ready interrupt.
 
static status_t RunPITTest (uint32_t exp_dt_us, uint32_t n)
 Executes a PIT measurement and verifies the callback interval.
 
static void PIT_Callback (void *param)
 Callback function invoked by the PIT.
 
static void GPIO_Callback (void *param)
 The IRQ callback dedicated to the GpioInterruptTest.
 
status_t Argus_VerifyHALImplementation (s2pi_slave_t spi_slave)
 Executes a series of tests in order to verify the HAL implementation.
 
static status_t SpiTransferInterruptCallback (status_t status, void *param)
 SPI interrupt callback function for the SPI transfer interrupt test.
 
static status_t GPIO_SPI_Callback (status_t status, void *param)
 The SPI transfer callback dedicated to the GpioInterruptTest.
 
static void MeasurementCallback (void *param)
 Callback function for the data ready interrupt.
 
static status_t SpiTransferFromSpiInterruptCallback (status_t status, void *param)
 SPI interrupt callback function for the SPI transfer from IRQ test.
 
static status_t SpiTransferFromSpiInterrupt (s2pi_slave_t slave)
 SPI transfer from SPI interrupt callback test.
 
static void SpiTransferFromGpioInterruptCallback (void *param)
 GPIO interrupt callback function for the SPI transfer from IRQ test.
 
static status_t SpiTransferFromGpioInterrupt (s2pi_slave_t slave)
 SPI transfer from GPIO interrupt callback test.
 
static void SpiTransferFromPitInterruptCallback (void *param)
 PIT interrupt callback function for the SPI transfer from IRQ test.
 
static status_t SpiTransferFromPitInterrupt (s2pi_slave_t slave)
 SPI transfer from PIT interrupt callback test.
 

Detailed Description

Tests for the AFBR-S50 API hardware abstraction layer.

Copyright (c) 2023, Broadcom Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.