no-OS
|
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 "xilinx_gpio.h"
#include "no_os_spi.h"
#include "xilinx_spi.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 "RxGainTable_GainCompensated.h"
#include "adi_platform_types.h"
#include "no_os_platform.h"
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 |
adrv9002 Hardware Abstraction Layer for no-OS.
Copyright 2020(c) Analog Devices, Inc.
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, INC. “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 ANALOG DEVICES, INC. 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.
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.
devHalCfg | Pointer to device instance specific platform settings |
ADI_COMMON_ERR_OK | Function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | The function has been called with a null pointer |
int32_t no_os_hw_open | ( | void * | devHalCfg | ) |
Opens all neccessary files and device drivers for a specific device.
devHalCfg | Pointer to device instance specific platform settings |
ADI_COMMON_ERR_OK | Function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | The function has been called with a null pointer |
errors | returned by other function calls. |
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.
devHalCfg | Pointer to device instance specific platform settings |
pinLevel | The desired pin logic level 0=low, 1=high to set the GPIO pin to. |
ADI_COMMON_ERR_OK | Function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | The function has been called with a null pointer |
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_log_file_close | ( | void * | devHalCfg | ) |
Gracefully closes the log file(s).
devHalCfg | Pointer to device instance specific platform settings |
ADI_COMMON_ERR_OK | Function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | The function has been called with a null pointer |
ADI_COMMON_ERR_API_FAIL | Error while flushing or closing the log file. |
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.
devHalCfg | Pointer to device instance specific platform settings |
filename | The user provided name of the file to open. |
ADI_COMMON_ERR_OK | Function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | The function has been called with a null pointer |
ADI_COMMON_ERR_API_FAIL | If the function failed to open or write to the specified filename |
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.
devHalCfg | Pointer to device instance specific platform settings |
log_level | the log level to be written into |
comment | the string to include in the line added to the log. |
argp | variable argument list to be printed |
ADI_COMMON_ERR_OK | Function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | The function has been called with a null pointer |
ADI_COMMON_ERR_API_FAIL | If the function failed to flush to write |
int32_t no_os_LogFileFlush | ( | void * | devHalCfg | ) |
Flushes the logFile buffer to the currently open log file.
devHalCfg | Pointer to device instance specific platform settings |
ADI_COMMON_ERR_OK | Function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | The function has been called with a null pointer |
int32_t no_os_mcs_pulse | ( | void * | devHalCfg, |
uint8_t | numberOfPulses | ||
) |
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_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.
devHalCfg | Pointer to device instance specific platform settings |
txData | Pointer to byte array that has numTxRxBytes number of bytes |
rxData | Pointer to byte array where read back data will be returned, that is at least numTxRxBytes in size. |
numTxRxBytes | The length of txData and rxData arrays |
ADI_COMMON_ERR_OK | function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | the function has been called with a null pointer |
ADI_COMMON_ERR_API_FAIL | the data was not read successfully |
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.
devHalCfg | Pointer to device instance specific platform settings |
txData | Pointer to byte array txData buffer that has numTxBytes number of bytes |
numTxBytes | The length of txData array |
ADI_COMMON_ERR_OK | function completed successfully, no action required |
ADI_COMMON_ERR_NULL_PARAM | the function has been called with a null pointer |
ADI_COMMON_ERR_API_FAIL | the data was not written successfully |
int32_t no_os_ssi_reset | ( | void * | devHalCfg | ) |
int32_t no_os_timer_wait_us | ( | void * | devHalCfg, |
uint32_t | time_us | ||
) |
Provides a blocking delay of the current thread.
devHalCfg | Pointer to device instance specific platform settings |
time_us | the time to delay in mico seconds |
ADI_COMMON_ERR_OK | Function completed successfully |
ADI_COMMON_ERR_NULL_PARAM | the function has been called with a null pointer |
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 | ||
) |
int32_t(* adi_adrv9001_hal_close) (void *devHalCfg) = no_os_hw_close |
int32_t(* adi_adrv9001_hal_open) (void *devHalCfg) = no_os_hw_open |
int32_t(* adi_adrv9001_hal_resetbPin_set) (void *devHalCfg, uint8_t pinLevel) = no_os_hw_reset |
int32_t(* adi_common_hal_LogWrite) (void *devHalCfg, uint32_t logLevel, const char *comment, va_list args) = no_os_log_write |
int32_t(* adi_common_hal_Wait_us) (void *devHalCfg, uint32_t time_us) = no_os_timer_wait_us |
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_LogFileClose) (void *devHalCfg) = no_os_log_file_close |
int32_t(* adi_hal_LogFileOpen) (void *devHalCfg, const char *filename) = no_os_log_file_open |
int32_t(* adi_hal_Mcs_Pulse) (void *devHalCfg, uint8_t numberOfPulses) = no_os_mcs_pulse |
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_SpiRead) (void *devHalCfg, const uint8_t txData[], uint8_t rxData[], uint32_t numRxBytes) = no_os_spi_read |
int32_t(* adi_hal_SpiWrite) (void *devHalCfg, const uint8_t txData[], uint32_t numTxBytes) = no_os_spi_write |
int32_t(* adi_hal_ssi_Reset) (void *devHalCfg) = no_os_ssi_reset |
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_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 |