precision-converters-firmware
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
common.h
Go to the documentation of this file.
1/***************************************************************************//*
2 * @file common.h
3 * @brief Precision converters firmware common headers
4******************************************************************************
5 * Copyright (c) 2023 Analog Devices, Inc.
6 * All rights reserved.
7 *
8 * This software is proprietary to Analog Devices, Inc. and its licensors.
9 * By using this software you agree to the terms of the associated
10 * Analog Devices Software License Agreement.
11******************************************************************************/
12
13#ifndef COMMON_H_
14#define COMMON_H_
15
16/******************************************************************************/
17/***************************** Include Files **********************************/
18/******************************************************************************/
19
20#include <stdint.h>
21#include <stdbool.h>
22#include <string.h>
23#include <stdint.h>
24#include <stdio.h>
25#include "iio.h"
26#include "24xx32a.h"
27#include "no_os_eeprom.h"
28#include "no_os_error.h"
29
30/******************************************************************************/
31/********************** Macros and Constants Definition ***********************/
32/******************************************************************************/
33
34#if defined (TARGET_SDP_K1)
35/* SDRAM configs for SDP-K1 */
36#define SDRAM_START_ADDRESS (volatile int8_t *)0xC0000000
37#define SDRAM_SIZE_BYTES (16777216) // 16MBytes
38#endif
39
40/* EEPROM valid device address range */
41#define EEPROM_DEV_ADDR_START 0x50
42#define EEPROM_DEV_ADDR_END 0x57
43
44/* Last accessible EEPROM address/location (default 32Kbit EEPROM size ) */
45#define MAX_REGISTER_ADDRESS 0xFFF
46
47/* Macros for stringification */
48#define XSTR(s) #s
49#define STR(s) XSTR(s)
50
51/******************************************************************************/
52/********************** Public/Extern Declarations ****************************/
53/******************************************************************************/
54
55int32_t get_iio_context_attributes(struct iio_ctx_attr **ctx_attr,
56 uint32_t *attrs_cnt,
57 struct no_os_eeprom_desc *eeprom_desc,
58 const char *hw_mezzanine, const char *hw_carrier,
59 bool *hw_mezzanine_is_valid);
60int32_t eeprom_init(struct no_os_eeprom_desc **eeprom_desc,
61 struct no_os_eeprom_init_param *eeprom_init_params);
64int32_t sdram_init(void);
65
66#endif /* COMMON_H_ */
struct no_os_eeprom_desc * eeprom_desc
Definition app_config.c:176
int32_t eeprom_init(struct no_os_eeprom_desc **eeprom_desc, struct no_os_eeprom_init_param *eeprom_init_params)
Initialize the EEPROM.
Definition common.c:61
bool is_eeprom_valid_dev_addr_detected(void)
Return the flag indicating if valid EEPROM address is detected.
Definition common.c:161
int32_t get_iio_context_attributes(struct iio_ctx_attr **ctx_attr, uint32_t *attrs_cnt, struct no_os_eeprom_desc *eeprom_desc, const char *hw_mezzanine, const char *hw_carrier, bool *hw_mezzanine_is_valid)
Read IIO context attributes.
Definition common.c:185
uint8_t get_eeprom_detected_dev_addr(void)
Get the EEPROM device address detected by firmware.
Definition common.c:170
int32_t sdram_init(void)
Initialize the SDP-K1 SDRAM.
Definition common.c:291