no-OS
Functions | Variables
no_os_platform.c File Reference
#include "stream_image_6E3E00EFB74FE7D465FA88A171B81B8F.h"
#include "ActiveUtilInit_profile.h"
#include "ActiveUseCase_profile.h"
#include "ADRV9025_TxAttenTable.h"
#include "ADRV9025_RxGainTable.h"
#include "ADRV9025_DPDCORE_FW.h"
#include "adi_common_error.h"
#include "no_os_print_log.h"
#include "no_os_platform.h"
#include "adi_platform.h"
#include "no_os_delay.h"
#include "common_data.h"
#include "ADRV9025_FW.h"
#include "no_os_alloc.h"
#include "parameters.h"
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
Include dependency graph for no_os_platform.c:

Functions

int32_t no_os_LogFileOpen (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_LogFileClose (void *devHalCfg)
 Gracefully closes the log file(s). More...
 
int32_t no_os_LogLevelSet (void *devHalCfg, int32_t logLevel)
 Sets the log level, allowing the end user to select the granularity of what events get logged. More...
 
int32_t no_os_LogLevelGet (void *devHalCfg, int32_t *logLevel)
 Gets the currently set log level: the mask of different types of log events that are currently enabled to be logged. More...
 
int32_t no_os_LogWrite (void *devHalCfg, int32_t logLevel, 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_SpiOpen (void *devHalCfg)
 Opens/allocates any necessary resources to communicate via SPI to a particular device specified in the devHalCfg structure. More...
 
int32_t no_os_SpiClose (void *devHalCfg)
 Closes any resources open/allocated for a specific SPI device. More...
 
int32_t no_os_SpiInit (void *devHalCfg)
 Initializes the SPI device driver mode, bits per word, and speed. More...
 
int32_t no_os_SpiWrite (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_SpiRead (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_TimerOpen (void *devHalCfg)
 Function to open/allocate any necessary resources for the timer wait functions below. More...
 
int32_t no_os_TimerClose (void *devHalCfg)
 Function to close any necessary resources for the timer wait functions below. More...
 
int32_t no_os_TimerInit (void *devHalCfg)
 Function to initialize any necessary resources for the timer wait functions below. More...
 
int32_t no_os_TimerWait_us (void *devHalCfg, uint32_t time_us)
 Provides a blocking delay of the current thread. More...
 
int32_t no_os_TimerWait_ms (void *devHalCfg, uint32_t time_ms)
 Provides a blocking delay of the current thread. More...
 
int32_t no_os_HwOpen (void *devHalCfg)
 Opens all neccessary files and device drivers for a specific device. More...
 
int32_t no_os_HwClose (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_HwReset (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_image_page_get (void *devHalCfg, const char *ImagePath, uint32_t pageIndex, uint32_t pageSize, uint8_t *rdBuff)
 
long int ftell (FILE *stream)
 
FILE * __fopen (const char *filename, const char *mode)
 
int fseek (FILE *stream, long int offset, int origin)
 
int __fclose (FILE *stream)
 
char * fgets (char *dst, int num, FILE *stream)
 
size_t fread (void *ptr, size_t size, size_t count, FILE *stream)
 
size_t fwrite (const void *ptr, size_t size, size_t count, FILE *stream)
 

Variables

CUSTOM_FILE profile
 
int32_t(* adi_hal_HwOpen )(void *devHalCfg) = no_os_HwOpen
 
int32_t(* adi_hal_HwClose )(void *devHalCfg) = no_os_HwClose
 
int32_t(* adi_hal_HwReset )(void *devHalCfg, uint8_t pinLevel) = no_os_HwReset
 
int32_t(* adi_hal_SpiInit )(void *devHalCfg)
 
void *(* adi_hal_DevHalCfgCreate )(uint32_t interfaceMask, uint8_t spiChipSelect, const char *logFilename) = NULL
 
int32_t(* adi_hal_DevHalCfgFree )(void *devHalCfg) = NULL
 
int32_t(* adi_hal_HwVerify )(void *devHalCfg) = no_os_HwOpen
 
int32_t(* adrv9025_hal_SpiWrite )(void *devHalCfg, const uint8_t txData[], uint32_t numTxBytes) = no_os_SpiWrite
 
int32_t(* adrv9025_hal_SpiRead )(void *devHalCfg, const uint8_t txData[], uint8_t rxData[], uint32_t numRxBytes) = no_os_SpiRead
 
int32_t(* adi_hal_CustomSpiStreamWrite )(void *devHalCfg, const uint16_t address, const uint8_t txData[], uint32_t numTxBytes, uint8_t numBytesofAddress, uint8_t numBytesOfDataPerStream) = NULL
 
int32_t(* adi_hal_CustomSpiStreamRead )(void *devHalCfg, const uint16_t address, uint8_t rxData[], uint32_t numRxBytes, uint8_t numBytesofAddress, uint8_t numBytesOfDataPerStream) = NULL
 
int32_t(* adi_hal_LogFileOpen )(void *devHalCfg, const char *filename) = no_os_LogFileOpen
 
int32_t(* adi_hal_LogLevelSet )(void *devHalCfg, int32_t logLevel) = no_os_LogLevelSet
 
int32_t(* adi_hal_LogLevelGet )(void *devHalCfg, int32_t *logLevel) = no_os_LogLevelGet
 
int32_t(* adi_hal_LogWrite )(void *devHalCfg, int32_t logLevel, const char *comment, va_list args) = no_os_LogWrite
 
int32_t(* adi_hal_LogFileClose )(void *devHalCfg) = no_os_LogFileClose
 
int32_t(* adi_hal_Wait_ms )(void *devHalCfg, uint32_t time_ms) = no_os_TimerWait_ms
 
int32_t(* adi_hal_Wait_us )(void *devHalCfg, uint32_t time_us) = no_os_TimerWait_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_StreamImagePageGet )(void *devHalCfg, const char *ImagePath, uint32_t pageIndex, uint32_t pageSize, uint8_t *rdBuff) = no_os_image_page_get
 

Function Documentation

◆ __fclose()

int __fclose ( FILE *  stream)

◆ __fopen()

FILE* __fopen ( const char *  filename,
const char *  mode 
)

◆ fgets()

char* fgets ( char *  dst,
int  num,
FILE *  stream 
)

◆ fread()

size_t fread ( void *  ptr,
size_t  size,
size_t  count,
FILE *  stream 
)

◆ fseek()

int fseek ( FILE *  stream,
long int  offset,
int  origin 
)

◆ ftell()

long int ftell ( FILE *  stream)

◆ fwrite()

size_t fwrite ( const void *  ptr,
size_t  size,
size_t  count,
FILE *  stream 
)

◆ no_os_HwClose()

int32_t no_os_HwClose ( 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_HAL_OKFunction completed successfully, no action required
ADI_HAL_NULL_PTRThe function has been called with a null pointer

◆ no_os_HwOpen()

int32_t no_os_HwOpen ( void *  devHalCfg)

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

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

◆ no_os_HwReset()

int32_t no_os_HwReset ( 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_HAL_OKFunction completed successfully, no action required
ADI_HAL_NULL_PTRThe 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_LogFileClose()

int32_t no_os_LogFileClose ( void *  devHalCfg)

Gracefully closes the log file(s).

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

◆ 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_HAL_OKFunction completed successfully, no action required
ADI_HAL_NULL_PTRThe function has been called with a null pointer

◆ no_os_LogFileOpen()

int32_t no_os_LogFileOpen ( 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_HAL_OKFunction completed successfully, no action required
ADI_HAL_NULL_PTRThe function has been called with a null pointer
ADI_HAL_LOGGING_FAILIf the function failed to open or write to the specified filename

◆ no_os_LogLevelGet()

int32_t no_os_LogLevelGet ( void *  devHalCfg,
int32_t *  logLevel 
)

Gets the currently set log level: the mask of different types of log events that are currently enabled to be logged.

Parameters
devHalCfgPointer to device instance specific platform settings
logLevelReturns the current log level mask.
Return values
ADI_HAL_OKFunction completed successfully, no action required
ADI_HAL_NULL_PTRThe function has been called with a null pointer

◆ no_os_LogLevelSet()

int32_t no_os_LogLevelSet ( void *  devHalCfg,
int32_t  logLevel 
)

Sets the log level, allowing the end user to select the granularity of what events get logged.

Parameters
devHalCfgPointer to device instance specific platform settings
logLevelA mask of valid log levels to allow to be written to the log file.
Return values
ADI_COMMON_ACT_ERR_CHECK_PARAMRecovery action for bad parameter check
ADI_COMMON_ACT_NO_ACTIONFunction completed successfully, no action required

◆ no_os_LogWrite()

int32_t no_os_LogWrite ( void *  devHalCfg,
int32_t  logLevel,
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
logLevelthe 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_HAL_OKFunction completed successfully, no action required
ADI_HAL_NULL_PTRThe function has been called with a null pointer
ADI_HAL_LOGGING_FAILIf the function failed to flush to write

◆ no_os_SpiClose()

int32_t no_os_SpiClose ( void *  devHalCfg)

Closes any resources open/allocated for a specific SPI device.

Any information needed to close the particular SPI device should be passed in the devHalCfg structure.

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_HAL_OKfunction completed successfully, no action required
ADI_HAL_NULL_PTRthe function has been called with a null pointer
ADI_HAL_SPI_FAILthe device driver was not closed successfully

◆ no_os_SpiInit()

int32_t no_os_SpiInit ( void *  devHalCfg)

Initializes the SPI device driver mode, bits per word, and speed.

Any settings needed should be passed in the devHalCfg structure

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_HAL_OKfunction completed successfully, no action required
ADI_HAL_NULL_PTRthe function has been called with a null pointer
ADI_HAL_SPI_FAILthe SPI initialization failed

◆ no_os_SpiOpen()

int32_t no_os_SpiOpen ( void *  devHalCfg)

Opens/allocates any necessary resources to communicate via SPI to a particular device specified in the devHalCfg structure.

This function should perform any necessary steps to open the SPI master resource on the BBIC to enable SPI communications to a particular SPI device.

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_HAL_OKfunction completed successfully, no action required
ADI_HAL_NULL_PTRthe function has been called with a null pointer
ADI_HAL_SPI_FAILthe device driver was not opened successfully

◆ no_os_SpiRead()

int32_t no_os_SpiRead ( 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_HAL_OKfunction completed successfully, no action required
ADI_HAL_NULL_PTRthe function has been called with a null pointer
ADI_HAL_SPI_FAILthe data was not read successfully

◆ no_os_SpiWrite()

int32_t no_os_SpiWrite ( 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_HAL_OKfunction completed successfully, no action required
ADI_HAL_NULL_PTRthe function has been called with a null pointer
ADI_HAL_SPI_FAILthe data was not written successfully

◆ no_os_TimerClose()

int32_t no_os_TimerClose ( void *  devHalCfg)

Function to close any necessary resources for the timer wait functions below.

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_HAL_OKFunction completed successfully

◆ no_os_TimerInit()

int32_t no_os_TimerInit ( void *  devHalCfg)

Function to initialize any necessary resources for the timer wait functions below.

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_HAL_OKFunction completed successfully

◆ no_os_TimerOpen()

int32_t no_os_TimerOpen ( void *  devHalCfg)

Function to open/allocate any necessary resources for the timer wait functions below.

Parameters
devHalCfgPointer to device instance specific platform settings
Return values
ADI_HAL_OKFunction completed successfully

◆ no_os_TimerWait_ms()

int32_t no_os_TimerWait_ms ( void *  devHalCfg,
uint32_t  time_ms 
)

Provides a blocking delay of the current thread.

Parameters
devHalCfgPointer to device instance specific platform settings
time_msthe Time to delay in milli seconds
Return values
ADI_HAL_OKFunction completed successfully
ADI_HAL_NULL_PTRthe function has been called with a null pointer

◆ no_os_TimerWait_us()

int32_t no_os_TimerWait_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_HAL_OKFunction completed successfully
ADI_HAL_NULL_PTRthe function has been called with a null pointer

Variable Documentation

◆ 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_CustomSpiStreamRead

int32_t(* adi_hal_CustomSpiStreamRead) (void *devHalCfg, const uint16_t address, uint8_t rxData[], uint32_t numRxBytes, uint8_t numBytesofAddress, uint8_t numBytesOfDataPerStream) = NULL

◆ adi_hal_CustomSpiStreamWrite

int32_t(* adi_hal_CustomSpiStreamWrite) (void *devHalCfg, const uint16_t address, const uint8_t txData[], uint32_t numTxBytes, uint8_t numBytesofAddress, uint8_t numBytesOfDataPerStream) = NULL

◆ adi_hal_DevHalCfgCreate

void*(* adi_hal_DevHalCfgCreate) (uint32_t interfaceMask, uint8_t spiChipSelect, const char *logFilename) = NULL

◆ adi_hal_DevHalCfgFree

int32_t(* adi_hal_DevHalCfgFree) (void *devHalCfg) = NULL

◆ adi_hal_HwClose

int32_t(* adi_hal_HwClose) (void *devHalCfg) = no_os_HwClose

◆ adi_hal_HwOpen

int32_t(* adi_hal_HwOpen) (void *devHalCfg) = no_os_HwOpen

◆ adi_hal_HwReset

int32_t(* adi_hal_HwReset) (void *devHalCfg, uint8_t pinLevel) = no_os_HwReset

◆ adi_hal_HwVerify

int32_t(* adi_hal_HwVerify) (void *devHalCfg) = no_os_HwOpen

◆ adi_hal_LogFileClose

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

◆ adi_hal_LogFileOpen

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

◆ adi_hal_LogLevelGet

int32_t(* adi_hal_LogLevelGet) (void *devHalCfg, int32_t *logLevel) = no_os_LogLevelGet

◆ adi_hal_LogLevelSet

int32_t(* adi_hal_LogLevelSet) (void *devHalCfg, int32_t logLevel) = no_os_LogLevelSet

◆ adi_hal_LogWrite

int32_t(* adi_hal_LogWrite) (void *devHalCfg, int32_t logLevel, const char *comment, va_list args) = no_os_LogWrite

BBIC Logging functions

◆ adi_hal_SpiInit

int32_t(* adi_hal_SpiInit) (void *devHalCfg)
Initial value:

◆ 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_Wait_ms

int32_t(* adi_hal_Wait_ms) (void *devHalCfg, uint32_t time_ms) = no_os_TimerWait_ms

◆ adi_hal_Wait_us

int32_t(* adi_hal_Wait_us) (void *devHalCfg, uint32_t time_us) = no_os_TimerWait_us

BBIC Timer functions

◆ adrv9025_hal_SpiRead

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

◆ adrv9025_hal_SpiWrite

int32_t(* adrv9025_hal_SpiWrite) (void *devHalCfg, const uint8_t txData[], uint32_t numTxBytes) = no_os_SpiWrite

◆ profile

CUSTOM_FILE profile

Copyright 2015 - 2023 Analog Devices Inc. Released under the ADRV9025 API license, for more information. see the "LICENSE.txt" file in this zip file.

no_os_SpiInit
int32_t no_os_SpiInit(void *devHalCfg)
Initializes the SPI device driver mode, bits per word, and speed.
Definition: no_os_platform.c:285