no-OS
Functions | Variables
no_os_platform.c File Reference

adrv9002 Hardware Abstraction Layer for no-OS. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "adi_platform.h"
#include "parameters.h"
#include "no-os/gpio.h"
#include "gpio_extra.h"
#include "no-os/spi.h"
#include "spi_extra.h"
#include "no-os/error.h"
#include "no-os/delay.h"
#include "adi_common_error.h"
#include "Navassa_EvaluationFw.h"
#include "Navassa_Stream.h"
#include "ORxGainTable.h"
#include "RxGainTable.h"
#include "TxAttenTable.h"
#include "adi_platform_types.h"
#include "no_os_platform.h"
Include dependency graph for no_os_platform.c:

Functions

int32_t no_os_hw_open (void *devHalCfg)
 Opens all neccessary files and device drivers for a specific device. More...
 
int32_t no_os_hw_close (void *devHalCfg)
 Gracefully shuts down the the hardware closing any open resources such as log files, I2C, SPI, GPIO drivers, timer resources, etc. More...
 
int32_t no_os_hw_reset (void *devHalCfg, uint8_t pinLevel)
 This function control a BBIC GPIO pin that connects to the reset pin of each device. More...
 
int32_t no_os_spi_write (void *devHalCfg, const uint8_t txData[], uint32_t numTxBytes)
 Write an array of 8-bit data to a SPI device. More...
 
int32_t no_os_spi_read (void *devHalCfg, const uint8_t txData[], uint8_t rxData[], uint32_t numTxRxBytes)
 Read one or more bytes from the device specified by the devHalCfg structure. More...
 
int32_t no_os_log_file_open (void *devHalCfg, const char *filename)
 Opens a logFile. If the file is already open it will be closed and reopened. More...
 
int32_t no_os_LogFileFlush (void *devHalCfg)
 Flushes the logFile buffer to the currently open log file. More...
 
int32_t no_os_log_file_close (void *devHalCfg)
 Gracefully closes the log file(s). More...
 
int32_t no_os_log_write (void *devHalCfg, uint32_t log_level, const char *comment, va_list argp)
 Writes a message to the currently open logFile specified in the adi_hal_LogCfg_t of the devHalCfg structure passed. More...
 
int32_t no_os_timer_wait_us (void *devHalCfg, uint32_t time_us)
 Provides a blocking delay of the current thread. More...
 
int32_t no_os_mcs_pulse (void *devHalCfg, uint8_t numberOfPulses)
 
int32_t no_os_ssi_reset (void *devHalCfg)
 
int32_t no_os_image_page_get (void *devHalCfg, const char *ImagePath, uint32_t pageIndex, uint32_t pageSize, uint8_t *rdBuff)
 
int32_t no_os_rx_gain_table_entry_get (void *devHalCfg, const char *rxGainTablePath, uint16_t lineCount, uint8_t *gainIndex, uint8_t *rxFeGain, uint8_t *tiaControl, uint8_t *adcControl, uint8_t *extControl, uint16_t *phaseOffset, int16_t *digGain)
 
int32_t no_os_tx_atten_table_entry_get (void *devHalCfg, const char *txAttenTablePath, uint16_t lineCount, uint16_t *attenIndex, uint8_t *txAttenHp, uint16_t *txAttenMult)
 

Variables

int32_t(* adi_adrv9001_hal_open )(void *devHalCfg) = no_os_hw_open
 
int32_t(* adi_adrv9001_hal_close )(void *devHalCfg) = no_os_hw_close
 
int32_t(* adi_adrv9001_hal_resetbPin_set )(void *devHalCfg, uint8_t pinLevel) = no_os_hw_reset
 
int32_t(* adi_hal_SpiWrite )(void *devHalCfg, const uint8_t txData[], uint32_t numTxBytes) = no_os_spi_write
 
int32_t(* adi_hal_SpiRead )(void *devHalCfg, const uint8_t txData[], uint8_t rxData[], uint32_t numRxBytes) = no_os_spi_read
 
int32_t(* adi_hal_LogFileOpen )(void *devHalCfg, const char *filename) = no_os_log_file_open
 
int32_t(* adi_common_hal_LogWrite )(void *devHalCfg, uint32_t logLevel, const char *comment, va_list args) = no_os_log_write
 
int32_t(* adi_hal_LogFileClose )(void *devHalCfg) = no_os_log_file_close
 
int32_t(* adi_common_hal_Wait_us )(void *devHalCfg, uint32_t time_us) = no_os_timer_wait_us
 
int32_t(* adi_hal_Mcs_Pulse )(void *devHalCfg, uint8_t numberOfPulses) = no_os_mcs_pulse
 
int32_t(* adi_hal_ssi_Reset )(void *devHalCfg) = no_os_ssi_reset
 
int32_t(* adi_hal_ArmImagePageGet )(void *devHalCfg, const char *ImagePath, uint32_t pageIndex, uint32_t pageSize, uint8_t *rdBuff) = no_os_image_page_get
 
int32_t(* adi_hal_StreamImagePageGet )(void *devHalCfg, const char *ImagePath, uint32_t pageIndex, uint32_t pageSize, uint8_t *rdBuff) = no_os_image_page_get
 
int32_t(* adi_hal_RxGainTableEntryGet )(void *devHalCfg, const char *rxGainTablePath, uint16_t lineCount, uint8_t *gainIndex, uint8_t *rxFeGain, uint8_t *tiaControl, uint8_t *adcControl, uint8_t *extControl, uint16_t *phaseOffset, int16_t *digGain) = no_os_rx_gain_table_entry_get
 
int32_t(* adi_hal_TxAttenTableEntryGet )(void *devHalCfg, const char *txAttenTablePath, uint16_t lineCount, uint16_t *attenIndex, uint8_t *txAttenHp, uint16_t *txAttenMult) = no_os_tx_atten_table_entry_get
 

Detailed Description

adrv9002 Hardware Abstraction Layer for no-OS.

Author
Darius Berghe (dariu.nosp@m.s.be.nosp@m.rghe@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2020(c) Analog Devices, 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:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, 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.

Function Documentation

◆ no_os_hw_close()

int32_t no_os_hw_close ( void *  devHalCfg)

Gracefully shuts down the the hardware closing any open resources such as log files, I2C, SPI, GPIO drivers, timer resources, etc.

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_COMMON_ERR_OKFunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMThe function has been called with a null pointer

◆ no_os_hw_open()

int32_t no_os_hw_open ( void *  devHalCfg)

Opens all neccessary files and device drivers for a specific device.

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_COMMON_ERR_OKFunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMThe function has been called with a null pointer
errorsreturned by other function calls.

◆ no_os_hw_reset()

int32_t no_os_hw_reset ( void *  devHalCfg,
uint8_t  pinLevel 
)

This function control a BBIC GPIO pin that connects to the reset pin of each device.

This function is called by each device API giving access to the Reset pin connected to each device.

Parameters
devHalCfgPointer to device instance specific platform settings
pinLevelThe desired pin logic level 0=low, 1=high to set the GPIO pin to.
Return values
ADI_COMMON_ERR_OKFunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMThe function has been called with a null pointer

◆ no_os_image_page_get()

int32_t no_os_image_page_get ( void *  devHalCfg,
const char *  ImagePath,
uint32_t  pageIndex,
uint32_t  pageSize,
uint8_t *  rdBuff 
)

◆ no_os_log_file_close()

int32_t no_os_log_file_close ( void *  devHalCfg)

Gracefully closes the log file(s).

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_COMMON_ERR_OKFunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMThe function has been called with a null pointer
ADI_COMMON_ERR_API_FAILError while flushing or closing the log file.

◆ no_os_log_file_open()

int32_t no_os_log_file_open ( void *  devHalCfg,
const char *  filename 
)

Opens a logFile. If the file is already open it will be closed and reopened.

This function opens the file for writing and saves the resulting file descriptor to the devHalCfg structure.

Parameters
devHalCfgPointer to device instance specific platform settings
filenameThe user provided name of the file to open.
Return values
ADI_COMMON_ERR_OKFunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMThe function has been called with a null pointer
ADI_COMMON_ERR_API_FAILIf the function failed to open or write to the specified filename

◆ no_os_log_write()

int32_t no_os_log_write ( void *  devHalCfg,
uint32_t  log_level,
const char *  comment,
va_list  argp 
)

Writes a message to the currently open logFile specified in the adi_hal_LogCfg_t of the devHalCfg structure passed.

Uses the vfprintf functionality to allow the user to supply the format and the number of aguments that will be logged.

Parameters
devHalCfgPointer to device instance specific platform settings
log_levelthe log level to be written into
commentthe string to include in the line added to the log.
argpvariable argument list to be printed
Return values
ADI_COMMON_ERR_OKFunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMThe function has been called with a null pointer
ADI_COMMON_ERR_API_FAILIf the function failed to flush to write

◆ no_os_LogFileFlush()

int32_t no_os_LogFileFlush ( void *  devHalCfg)

Flushes the logFile buffer to the currently open log file.

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_COMMON_ERR_OKFunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMThe function has been called with a null pointer

◆ no_os_mcs_pulse()

int32_t no_os_mcs_pulse ( void *  devHalCfg,
uint8_t  numberOfPulses 
)

◆ no_os_rx_gain_table_entry_get()

int32_t no_os_rx_gain_table_entry_get ( void *  devHalCfg,
const char *  rxGainTablePath,
uint16_t  lineCount,
uint8_t *  gainIndex,
uint8_t *  rxFeGain,
uint8_t *  tiaControl,
uint8_t *  adcControl,
uint8_t *  extControl,
uint16_t *  phaseOffset,
int16_t *  digGain 
)

◆ no_os_spi_read()

int32_t no_os_spi_read ( void *  devHalCfg,
const uint8_t  txData[],
uint8_t  rxData[],
uint32_t  numTxRxBytes 
)

Read one or more bytes from the device specified by the devHalCfg structure.

The function will read numTxRxBytes number of bytes from the SPI device selected in the devHalCfg parameter and store the resulting data sent by the device in the rxData data buffer.

For each byte in txData written to the device, a byte is read and returned by this function at the pointer provided by the rxData parameter.

Parameters
devHalCfgPointer to device instance specific platform settings
txDataPointer to byte array that has numTxRxBytes number of bytes
rxDataPointer to byte array where read back data will be returned, that is at least numTxRxBytes in size.
numTxRxBytesThe length of txData and rxData arrays
Return values
ADI_COMMON_ERR_OKfunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMthe function has been called with a null pointer
ADI_COMMON_ERR_API_FAILthe data was not read successfully

◆ no_os_spi_write()

int32_t no_os_spi_write ( void *  devHalCfg,
const uint8_t  txData[],
uint32_t  numTxBytes 
)

Write an array of 8-bit data to a SPI device.

The function will write numTxBytes number of bytes to the SPI device selected in the devHalCfg structure.

Parameters
devHalCfgPointer to device instance specific platform settings
txDataPointer to byte array txData buffer that has numTxBytes number of bytes
numTxBytesThe length of txData array
Return values
ADI_COMMON_ERR_OKfunction completed successfully, no action required
ADI_COMMON_ERR_NULL_PARAMthe function has been called with a null pointer
ADI_COMMON_ERR_API_FAILthe data was not written successfully

◆ no_os_ssi_reset()

int32_t no_os_ssi_reset ( void *  devHalCfg)

◆ no_os_timer_wait_us()

int32_t no_os_timer_wait_us ( void *  devHalCfg,
uint32_t  time_us 
)

Provides a blocking delay of the current thread.

Parameters
devHalCfgPointer to device instance specific platform settings
time_usthe time to delay in mico seconds
Return values
ADI_COMMON_ERR_OKFunction completed successfully
ADI_COMMON_ERR_NULL_PARAMthe function has been called with a null pointer

◆ no_os_tx_atten_table_entry_get()

int32_t no_os_tx_atten_table_entry_get ( void *  devHalCfg,
const char *  txAttenTablePath,
uint16_t  lineCount,
uint16_t *  attenIndex,
uint8_t *  txAttenHp,
uint16_t *  txAttenMult 
)

Variable Documentation

◆ adi_adrv9001_hal_close

int32_t(* adi_adrv9001_hal_close) (void *devHalCfg) = no_os_hw_close

◆ adi_adrv9001_hal_open

int32_t(* adi_adrv9001_hal_open) (void *devHalCfg) = no_os_hw_open

◆ adi_adrv9001_hal_resetbPin_set

int32_t(* adi_adrv9001_hal_resetbPin_set) (void *devHalCfg, uint8_t pinLevel) = no_os_hw_reset

◆ adi_common_hal_LogWrite

int32_t(* adi_common_hal_LogWrite) (void *devHalCfg, uint32_t logLevel, const char *comment, va_list args) = no_os_log_write

◆ adi_common_hal_Wait_us

int32_t(* adi_common_hal_Wait_us) (void *devHalCfg, uint32_t time_us) = no_os_timer_wait_us

◆ adi_hal_ArmImagePageGet

int32_t(* adi_hal_ArmImagePageGet) (void *devHalCfg, const char *ImagePath, uint32_t pageIndex, uint32_t pageSize, uint8_t *rdBuff) = no_os_image_page_get

◆ adi_hal_LogFileClose

int32_t(* adi_hal_LogFileClose) (void *devHalCfg) = no_os_log_file_close

◆ adi_hal_LogFileOpen

int32_t(* adi_hal_LogFileOpen) (void *devHalCfg, const char *filename) = no_os_log_file_open

◆ adi_hal_Mcs_Pulse

int32_t(* adi_hal_Mcs_Pulse) (void *devHalCfg, uint8_t numberOfPulses) = no_os_mcs_pulse

◆ adi_hal_RxGainTableEntryGet

int32_t(* adi_hal_RxGainTableEntryGet) (void *devHalCfg, const char *rxGainTablePath, uint16_t lineCount, uint8_t *gainIndex, uint8_t *rxFeGain, uint8_t *tiaControl, uint8_t *adcControl, uint8_t *extControl, uint16_t *phaseOffset, int16_t *digGain) = no_os_rx_gain_table_entry_get

◆ adi_hal_SpiRead

int32_t(* adi_hal_SpiRead) (void *devHalCfg, const uint8_t txData[], uint8_t rxData[], uint32_t numRxBytes) = no_os_spi_read

◆ adi_hal_SpiWrite

int32_t(* adi_hal_SpiWrite) (void *devHalCfg, const uint8_t txData[], uint32_t numTxBytes) = no_os_spi_write

◆ adi_hal_ssi_Reset

int32_t(* adi_hal_ssi_Reset) (void *devHalCfg) = no_os_ssi_reset

◆ adi_hal_StreamImagePageGet

int32_t(* adi_hal_StreamImagePageGet) (void *devHalCfg, const char *ImagePath, uint32_t pageIndex, uint32_t pageSize, uint8_t *rdBuff) = no_os_image_page_get

◆ adi_hal_TxAttenTableEntryGet

int32_t(* adi_hal_TxAttenTableEntryGet) (void *devHalCfg, const char *txAttenTablePath, uint16_t lineCount, uint16_t *attenIndex, uint8_t *txAttenHp, uint16_t *txAttenMult) = no_os_tx_atten_table_entry_get