Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
MitySOMAM57Version.h
Go to the documentation of this file.
1 
11 #ifndef MITYSOMAM57VERSION_H
12 #define MITYSOMAM57VERSION_H
13 
14 #include <libfpga/fpgaregister.h>
16 #include <string>
17 
21 typedef union corever0 {
22  struct bits0 {
23  unsigned int core_id : 8; /* Core ID 0xF0-0xFF are reserved for customers */
24  unsigned int vector : 5; /* interrupt vector level */
25  unsigned int level : 1; /* interrupt level */
26  unsigned int FIFO_no : 2; /* = 00 */
27  } bits;
28  uint16_t word;
29 } corever0;
30 
34 typedef union corever1 {
35  struct bits1 {
36  unsigned int minor : 4; /* minor revision */
37  unsigned int major : 4; /* major revision */
38  unsigned int year : 5; /* years since 2000 */
39  unsigned int reserved : 1; /* not used */
40  unsigned int FIFO_no : 2; /* = 01 */
41  } bits;
42  uint16_t word;
43 } corever1;
44 
48 typedef union corever2 {
49  struct bits2 {
50  unsigned int day : 5; /* minor revision */
51  unsigned int reserved : 3; /* not used */
52  unsigned int month : 4; /* major revision */
53  unsigned int reserved1 : 2; /* not used */
54  unsigned int FIFO_no : 2; /* = 10 */
55  } bits;
56  uint16_t word;
57 } corever2;
58 
62 typedef union corever3 {
63  struct bits3 {
64  unsigned int reserved1 : 14; /* not used */
65  unsigned int FIFO_no : 2; /* = 10 */
66  } bits;
67  uint16_t word;
68 } corever3;
69 
74 struct coreversion {
79 };
80 
81 namespace MitySOMAM57XUtils {
82 
83 #define FPGA_BASE_ADDR 0x66000000 /* ARM side interface, CS5 */
84 #define FPGA_CORE_SIZE 0x80 /* Core address region */
85 #define FPGA_BASEMODULE_OFFSET 0
86 #define FPGA_BASEYEAR 2000
87 
96  template <class T>
97  int read_core_version(T& regs, struct coreversion* pdata)
98  {
99  int i;
100  corever0 ver;
101  int found = 0;
102  int rv = -1;
103 
104  for (i = 0; i < 4; i++)
105  {
106  ver.word = regs[0];
107  switch(ver.bits.FIFO_no)
108  {
109  case 0:
110  pdata->ver0.word = ver.word;
111  break;
112  case 1:
113  pdata->ver1.word = ver.word;
114  break;
115  case 2:
116  pdata->ver2.word = ver.word;
117  break;
118  case 3:
119  pdata->ver3.word = ver.word;
120  break;
121  }
122  found |= (1<<ver.bits.FIFO_no);
123  }
124  if (found == 0x0F)
125  rv = 0;
126  return rv;
127  }
128 
135  void DumpVersion(std::string pretext, struct coreversion* pdata)
136  {
137  UpdateStatus("%s Version %02d.%02d, %04d-%04d-%02d", pretext.c_str(), pdata->ver1.bits.major,
138  pdata->ver1.bits.minor, FPGA_BASEYEAR+pdata->ver1.bits.year,
139  pdata->ver2.bits.month, pdata->ver2.bits.day);
140  }
141 };
142 
143 #endif // MITYSOMAM57VERSION_H
corever2::bits2::month
unsigned int month
Definition: MitySOMAM57Version.h:52
coreversion
This structure holds the MitySOM-AM57X version data.
Definition: MitySOMAM57Version.h:74
corever0
Definition: MitySOMAM57Version.h:21
FPGA_BASEYEAR
#define FPGA_BASEYEAR
Definition: MitySOMAM57Version.h:86
corever2::word
uint16_t word
Definition: MitySOMAM57Version.h:56
corever1
union corever1 corever1
corever0::bits0::level
unsigned int level
Definition: MitySOMAM57Version.h:25
corever0::bits
struct corever0::bits0 bits
corever3::bits3::FIFO_no
unsigned int FIFO_no
Definition: MitySOMAM57Version.h:65
UpdateStatus
void UpdateStatus(const char *apFMT,...)
Definition: StatusReporter.cpp:47
corever0::bits0
Definition: MitySOMAM57Version.h:22
corever1::bits
struct corever1::bits1 bits
corever0::bits0::FIFO_no
unsigned int FIFO_no
Definition: MitySOMAM57Version.h:26
coreversion::ver3
corever3 ver3
Definition: MitySOMAM57Version.h:78
coreversion::ver2
corever2 ver2
Definition: MitySOMAM57Version.h:77
corever2::bits2::FIFO_no
unsigned int FIFO_no
Definition: MitySOMAM57Version.h:54
corever1::bits1::year
unsigned int year
Definition: MitySOMAM57Version.h:38
corever1::word
uint16_t word
Definition: MitySOMAM57Version.h:42
corever0::bits0::core_id
unsigned int core_id
Definition: MitySOMAM57Version.h:23
coreversion::ver1
corever1 ver1
Definition: MitySOMAM57Version.h:76
corever2::bits2::reserved1
unsigned int reserved1
Definition: MitySOMAM57Version.h:53
corever0
union corever0 corever0
corever3
union corever3 corever3
corever2
Definition: MitySOMAM57Version.h:48
corever3::bits3::reserved1
unsigned int reserved1
Definition: MitySOMAM57Version.h:64
coreversion::ver0
corever0 ver0
Definition: MitySOMAM57Version.h:75
corever2::bits2
Definition: MitySOMAM57Version.h:49
StatusReporter.h
corever0::word
uint16_t word
Definition: MitySOMAM57Version.h:28
corever3::bits
struct corever3::bits3 bits
corever1::bits1::reserved
unsigned int reserved
Definition: MitySOMAM57Version.h:39
corever1::bits1::minor
unsigned int minor
Definition: MitySOMAM57Version.h:36
corever1
Definition: MitySOMAM57Version.h:34
corever2::bits2::reserved
unsigned int reserved
Definition: MitySOMAM57Version.h:51
corever2::bits
struct corever2::bits2 bits
corever3::bits3
Definition: MitySOMAM57Version.h:63
corever1::bits1::FIFO_no
unsigned int FIFO_no
Definition: MitySOMAM57Version.h:40
corever2
union corever2 corever2
corever3
Definition: MitySOMAM57Version.h:62
corever3::word
uint16_t word
Definition: MitySOMAM57Version.h:67
corever2::bits2::day
unsigned int day
Definition: MitySOMAM57Version.h:50
corever1::bits1::major
unsigned int major
Definition: MitySOMAM57Version.h:37
MitySOMAM57XUtils::DumpVersion
void DumpVersion(std::string pretext, struct coreversion *pdata)
Dump MitySOM-AM57X version data as a status INFO line.
Definition: MitySOMAM57Version.h:135
MitySOMAM57XUtils::read_core_version
int read_core_version(T &regs, struct coreversion *pdata)
Fetch the MitySOM-AM57x standard core version data from the memory mapped FPAG registers.
Definition: MitySOMAM57Version.h:97
corever1::bits1
Definition: MitySOMAM57Version.h:35
MitySOMAM57XUtils
Definition: MitySOMAM57Version.h:81
corever0::bits0::vector
unsigned int vector
Definition: MitySOMAM57Version.h:24