no-OS
axi_sysid.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef AXI_SYSID_H_
34 #define AXI_SYSOD_H_
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include <stdio.h>
41 
42 /******************************************************************************/
43 /********************** Macros and Constants Definitions **********************/
44 /******************************************************************************/
45 #define AXI_SYSID_VER_1_00_A 0x10061
46 #define AXI_SYSID_VER_1_01_A 0x10161
47 
48 #define AXI_SYSID_WORD_SIZE sizeof(uint32_t)
49 #define AXI_SYSID_REG_ROM_ADDR_WIDTH 0x40
50 
51 #define AXI_SYSID_REG_VERSION 0x0000
52 #define AXI_SYSID_REG_PERIPH_ID 0x0004
53 #define AXI_SYSID_REG_SCRATCH 0x0008
54 #define AXI_SYSID_REG_ID 0x000c
55 #define AXI_SYSID_REG_SYSROM_START 0x0800
56 #define AXI_SYSID_REG_PRROM_START 0x1000
57 
58 #ifndef AXI_PCORE_VER_MAJOR
59 #define AXI_PCORE_VER_MAJOR(version) (version >> 16)
60 #endif
61 #ifndef AXI_PCORE_VER_MINOR
62 #define AXI_PCORE_VER_MINOR(version) ((version >> 8) & 0xff)
63 #endif
64 #ifndef AXI_PCORE_VER_LETTER
65 #define AXI_PCORE_VER_LETTER(version) (version & 0xff)
66 #endif
67 
68 /******************************************************************************/
69 /*************************** Types Declarations *******************************/
70 /******************************************************************************/
74 };
75 
76 struct axi_sysid {
77  uint32_t base;
79  uint32_t size;
80  uint32_t *mem;
81 };
82 
83 struct __attribute__((__packed__)) sysid_header_v1 {
84  uint32_t version;
85  uint32_t build_info_offs;
86  uint32_t board_info_offs;
88  uint32_t custom_info_offs;
90  uint32_t padding[9];
91  uint32_t crc;
92 };
93 
94 struct __attribute__((__packed__)) build_info_header_v1 {
95  int8_t git_hash[44];
96  int8_t git_clean_chk[4];
97  int8_t vadj_chk[4];
98  int8_t epoch[12];
99  uint8_t padding[4];
100  uint32_t crc;
101 };
102 
103 struct __attribute__((__packed__)) build_info_header_v1_1 {
104  int8_t git_branch[28];
105  int8_t git_hash[44];
106  int8_t git_clean_chk[4];
107  int8_t vadj_chk[4];
108  int8_t epoch[12];
109  uint8_t padding[4];
110  uint32_t crc;
111 };
112 
114  uint32_t version;
115  uint32_t header_version;
116 };
117 
119  uint32_t base;
120 };
121 
122 /******************************************************************************/
123 /************************ Functions Declarations ******************************/
124 /******************************************************************************/
125 // Initialization function for AXI_SYID.
126 int32_t axi_sysid_init(struct axi_sysid **sysid_core,
127  const struct axi_sysid_init_param *init);
128 // Remove the SYSID instance.
129 int32_t axi_sysid_remove(struct axi_sysid *sysid);
130 // Get the board listed in SYSID.
131 char *axi_sysid_get_fpga_board(struct axi_sysid *sysid);
132 
133 #endif
sysid_header_v1::version
uint32_t version
Definition: axi_sysid.h:84
AXI_SYSID_VER_1_00_A
#define AXI_SYSID_VER_1_00_A
Definition: axi_sysid.h:45
no_os_alloc.h
axi_sysid
Definition: axi_sysid.h:76
axi_sysid.h
Driver for the Analog Devices AXI-SYSID core.
axi_sysid_core_info
Definition: axi_sysid.h:113
AXI_SYSID_HEADER_V1
@ AXI_SYSID_HEADER_V1
Definition: axi_sysid.h:72
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
axi_sysid_core_info::version
uint32_t version
Definition: axi_sysid.h:114
pr_info
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:115
no_os_print_log.h
Print messages helpers.
axi_sysid::base
uint32_t base
Definition: axi_sysid.h:77
no_os_axi_io.h
Header file of AXI IO.
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
sysid_header_version
sysid_header_version
Definition: axi_sysid.h:71
axi_sysid::mem
uint32_t * mem
Definition: axi_sysid.h:80
axi_sysid_init_param
Definition: axi_sysid.h:118
no_os_error.h
Error codes definition.
build_info_header_v1_1::crc
uint32_t crc
Definition: axi_sysid.h:110
sysid_header_v1
Definition: axi_sysid.h:83
sysid_header_v1::pr_custom_info_offs
uint32_t pr_custom_info_offs
Definition: axi_sysid.h:89
no_os_axi_io_read
int32_t no_os_axi_io_read(uint32_t base, uint32_t offset, uint32_t *data)
AXI IO Altera specific read function.
Definition: altera_axi_io.c:53
sysid_header_v1::build_info_offs
uint32_t build_info_offs
Definition: axi_sysid.h:85
AXI_SYSID_VER_1_01_A
#define AXI_SYSID_VER_1_01_A
Definition: axi_sysid.h:46
axi_sysid_remove
int32_t axi_sysid_remove(struct axi_sysid *sysid)
Definition: axi_sysid.c:272
sysid_header_v1::product_info_offs
uint32_t product_info_offs
Definition: axi_sysid.h:87
axi_sysid_init
int32_t axi_sysid_init(struct axi_sysid **sysid_core, const struct axi_sysid_init_param *init)
Definition: axi_sysid.c:214
build_info_header_v1::crc
uint32_t crc
Definition: axi_sysid.h:100
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
AXI_SYSID_HEADER_V2
@ AXI_SYSID_HEADER_V2
Definition: axi_sysid.h:73
NULL
#define NULL
Definition: wrapper.h:64
sysid_header_v1::crc
uint32_t crc
Definition: axi_sysid.h:91
axi_sysid_init
int32_t axi_sysid_init(struct axi_sysid **sysid_core, const struct axi_sysid_init_param *init)
Definition: axi_sysid.c:214
axi_sysid_get_fpga_board
char * axi_sysid_get_fpga_board(struct axi_sysid *sysid)
Definition: axi_sysid.c:289
build_info_header_v1
Definition: axi_sysid.h:94
axi_sysid_remove
int32_t axi_sysid_remove(struct axi_sysid *sysid)
Definition: axi_sysid.c:272
AXI_SYSID_REG_ROM_ADDR_WIDTH
#define AXI_SYSID_REG_ROM_ADDR_WIDTH
Definition: axi_sysid.h:49
axi_sysid_get_fpga_board
char * axi_sysid_get_fpga_board(struct axi_sysid *sysid)
Definition: axi_sysid.c:289
axi_sysid_init_param::base
uint32_t base
Definition: axi_sysid.h:119
axi_sysid::info
struct axi_sysid_core_info * info
Definition: axi_sysid.h:78
AXI_SYSID_WORD_SIZE
#define AXI_SYSID_WORD_SIZE
Definition: axi_sysid.h:48
AXI_SYSID_REG_VERSION
#define AXI_SYSID_REG_VERSION
Definition: axi_sysid.h:51
axi_sysid_core_info::header_version
uint32_t header_version
Definition: axi_sysid.h:115
axi_sysid::size
uint32_t size
Definition: axi_sysid.h:79
build_info_header_v1_1
Definition: axi_sysid.h:103
sysid_header_v1::custom_info_offs
uint32_t custom_info_offs
Definition: axi_sysid.h:88
sysid_header_v1::board_info_offs
uint32_t board_info_offs
Definition: axi_sysid.h:86