Skip to content

Commit ce43ca1

Browse files
committed
Publish Slow Control CRU registers
1 parent 9083bba commit ce43ca1

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

include/ReadoutCard/Cru.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define ALICEO2_INCLUDE_READOUTCARD_CRU_H_
1818

1919
#include <cstdint>
20+
#include "Register.h"
2021

2122
namespace AliceO2
2223
{
@@ -42,6 +43,35 @@ static constexpr uint32_t GBT_MODE_WB(0x1);
4243
static constexpr uint32_t GBT_PACKET(0x1);
4344
static constexpr uint32_t GBT_CONTINUOUS(0x0);
4445

46+
namespace ScRegisters
47+
{
48+
static constexpr Register SC_BASE_INDEX(0x00f00000);
49+
50+
static constexpr Register SCA_WR_DATA(0x00f00000);
51+
static constexpr Register SCA_WR_CMD(0x00f00004);
52+
static constexpr Register SCA_WR_CTRL(0x00f00008);
53+
54+
static constexpr Register SCA_RD_DATA(0x00f00010);
55+
static constexpr Register SCA_RD_CMD(0x00f00014);
56+
static constexpr Register SCA_RD_CTRL(0x00f00018);
57+
static constexpr Register SCA_RD_MON(0x00f0001c);
58+
59+
static constexpr Register SC_LINK(0x00f00078);
60+
static constexpr Register SC_RESET(0x00f0007c);
61+
62+
static constexpr Register SWT_WR_WORD_L(0x00f00040);
63+
static constexpr Register SWT_WR_WORD_M(0x00f00044);
64+
static constexpr Register SWT_WR_WORD_H(0x00f00048);
65+
66+
static constexpr Register SWT_RD_WORD_L(0x00f00050);
67+
static constexpr Register SWT_RD_WORD_M(0x00f00054);
68+
static constexpr Register SWT_RD_WORD_H(0x00f00058);
69+
70+
static constexpr Register SWT_CMD(0x00f0004c);
71+
static constexpr Register SWT_MON(0x00f0005c);
72+
static constexpr Register SWT_WORD_MON(0x00f00060);
73+
} // namespace ScRegisters
74+
4575
} // namespace Cru
4676
} // namespace roc
4777
} // namespace AliceO2

src/Cru/cru_constants_populate.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,34 @@
7070
'add_bsp_i2c_si5345_1':'SI5345_1',
7171
'add_bsp_i2c_si5345_2':'SI5345_2',
7272
'add_bsp_i2c_si5344':'SI5344',
73-
'add_pcie_dma_ep_id':'ENDPOINT_ID'
73+
'add_pcie_dma_ep_id':'ENDPOINT_ID',
74+
75+
### SCA ###
76+
'add_gbt_sc':'SC_BASE_INDEX',
77+
'add_gbt_sca_wr_data':'SCA_WR_DATA',
78+
'add_gbt_sca_wr_cmd':'SCA_WR_CMD',
79+
'add_gbt_sca_wr_ctr':'SCA_WR_CTRL',
80+
81+
'add_gbt_sca_rd_data':'SCA_RD_DATA',
82+
'add_gbt_sca_rd_cmd':'SCA_RD_CMD',
83+
'add_gbt_sca_rd_ctr':'SCA_RD_CTRL',
84+
'add_gbt_sca_rd_mon':'SCA_RD_MON',
85+
86+
'add_gbt_sc_link':'SC_LINK',
87+
'add_gbt_sc_rst':'SC_RESET',
88+
89+
### SWT ###
90+
'add_gbt_swt_wr_l':'SWT_WR_WORD_L',
91+
'add_gbt_swt_wr_m':'SWT_WR_WORD_M',
92+
'add_gbt_swt_wr_h':'SWT_WR_WORD_H',
93+
94+
'add_gbt_swt_rd_l':'SWT_RD_WORD_L',
95+
'add_gbt_swt_rd_m':'SWT_RD_WORD_M',
96+
'add_gbt_swt_rd_h':'SWT_RD_WORD_H',
97+
98+
'add_gbt_swt_cmd':'SWT_CMD',
99+
'add_gbt_swt_mon':'SWT_MON',
100+
'add_gbt_swt_word_mon':'SWT_WORD_MON'
74101
}
75102

76103
# e.g. 'TEMPERATURE':0x00010008
@@ -111,6 +138,7 @@ def parse_vhdl_hex(vhdl_lines, line):
111138

112139
print(to_replace)
113140

141+
# Update Cru/Constants.h
114142
cfile = open('Constants.h')
115143
contents = cfile.readlines()
116144

@@ -124,3 +152,18 @@ def parse_vhdl_hex(vhdl_lines, line):
124152

125153
cfile = open('Constants.h', 'w')
126154
cfile.writelines(contents)
155+
156+
# Update include/ReadoutCard/Cru.h
157+
cfile = open('../../include/ReadoutCard/Cru.h')
158+
contents = cfile.readlines()
159+
160+
for key,value in to_replace.items():
161+
for (i, line) in enumerate(contents):
162+
if(re.search("\s+Register\s*" + key, line)):
163+
contents[i] = re.sub("\([^)]*\)", '(' + value + ')', line)
164+
elif(re.search("\s+IntervalRegister\s*" + key, line)):
165+
contents[i] = re.sub("\([^,]*\,", '(' + value + ',', line)
166+
167+
168+
cfile = open('../../include/ReadoutCard/Cru.h', 'w')
169+
cfile.writelines(contents)

0 commit comments

Comments
 (0)