EasyManua.ls Logo

Analog Devices ADRV9002

Analog Devices ADRV9002
277 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
UG-1828 Preliminary Technical Data
Rev. PrB | Page 34 of 277
API Error Handling and Debug
Logging Functions
The API provides a simple logging feature function that may be enabled for debugging purposes. Available logging levels are given by
adi_common_LogLevel_e as shown in Table 11.
Table 11. Logging Level
Function Name Purpose
ADI_LOGLEVEL_TRACE
Log everything in exhaustive detail. Used only for development
ADI_LOGLEVEL_DEBUG Log diagnostic information
ADI_LOGLEVEL_INFO Log state changes in the application
ADI_LOGLEVEL_WARN Log bad, but recoverable events
ADI_LOGLEVEL_ERROR Log events that cannot be recovered from
ADI_LOGLEVEL_FATAL Log events that are likely to be fatal
ADI_LOGLEVEL_NONE Disable all logging
When logging is enabled, the APIs log various messages to the system via the HAL. This feature requires an implementation for the
customer_LogWrite function. To enable logging, set #define ADI_COMPILED_LOGLEVEL to one of the defined log levels other than
ADI_LOGLEVEL_NONE. Any log initialization (e.g., opening files) must be done by the application before calling any APIs, or
messages will not be logged properly. Log levels increase in severity numerically. When a given level is used, messages logged with a log
level at least as severe (greater than or equal to) as the set level will be published. Less severe logging calls will be compiled out of the API.
By default, ADI_COMPILED_LOGLEVEL is set to ADI_LOGLEVEL_WARN, which means that only messages with severities of
ADI_LOGLEVEL_WARN, ADI_LOGLEVEL_ERROR, and ADI_LOGLEVEL_FATAL will be included. Log levels are passed to
customer_LogWrite as it may be desirable to log messages of differing severity in different manners (e.g., insert a message prefix for each
level, log errors to standard error, etc.).
Error Handling
Each ADRV9001 API function returns an int32_t value representing a recovery action, with 0 being no action or success. Recovery
actions are divided into:
Warning actions are those that do not have an impact at the time of executing the device API but can cause performance issues or
logging problems. The value of this action is positive.
Error actions are those that cause API not to be able to run and an action is required for API to go back to a good state. The value of
this action is negative.
See the ADRV9001_API.chm document for additional details.
DEVELOPING THE APPLICATION
The user application must allocate the init (adi_adrv9001_Init_t) and device (adi_adrv9001_Device_t) structures. Users may want to
consider allocating memory from the heap for the adi_adrv9001_Device_t and adi_adrv9001_Init_t as the structures have members
expected to be on the order of TBD KB.
The adi_adrv9001_Init_t structure is used to contain the customer profile initialization settings to configure an ADRV9001 device. This
init structure is passed to the ADRV9001 API init functions during the initialization phase. This structure contains the device profile
settings, system clock settings, data interface settings, and ADRV9001 specific SPI slave controller settings. The application layer passes a
pointer to an instance of the adi_adrv9001_Init_t structure for a particular ADRV9001 device to handle the majority of the device core
initialization. After initialization is complete, the adi_adrv9001_Init_t structure may be deallocated if desired.
The adi_adrv9001_Device_t data structure contains information for a particular ADRV9001 device, including devHalInfo, error and
caching structures. To support multiple ADRV9001 devices, the Application would need to instantiate multiple adi_adrv9001_Device_t
structures to describe each physical ADRV9001 device. Multiple ADRV9001 devices can have their own adi_adrv9001_Init_t or can
share a common adi_adrv9001_Init_t if they are to be configured identically.
devHalInfo
devHalInfo is a structure that allows the user to define and pass any platform hardware settings to the platform HAL layer functions. The
common device structure adi_common_Device_t contains devHalInfo. devHalInfo is passed to the platform specific HAL function as a
void *devHalCfg. ADRV9001 API functions shall not read or write the devHalInfo but pass it as parameter to all HAL function calls.

Table of Contents

Related product manuals