binaries in, std=gnu99, for loop variable declaration inside for loop

This commit is contained in:
2020-06-10 17:27:02 +02:00
parent 7388bb4aa7
commit 200186ddde
35 changed files with 410 additions and 615 deletions

View File

@@ -42,12 +42,11 @@ void Feb_Interface_FebInterface() {
}
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list) {
unsigned int i;
if (Feb_Interface_feb_numb)
free(Feb_Interface_feb_numb);
Feb_Interface_nfebs = n;
Feb_Interface_feb_numb = malloc(n * sizeof(unsigned int));
for (i = 0; i < n; i++)
for (unsigned int i = 0; i < n; i++)
Feb_Interface_feb_numb[i] = list[i];
}
@@ -72,7 +71,6 @@ int Feb_Interface_WriteTo(unsigned int ch) {
}
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
unsigned int t;
if (ch >= 0xfff)
return 0;
@@ -81,7 +79,7 @@ int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
usleep(20);
Feb_Interface_recv_ndata = -1;
for (t = 0; t < ntrys; t++) {
for (unsigned int t = 0; t < ntrys; t++) {
if ((Feb_Interface_recv_ndata =
Local_Read(ll, Feb_Interface_recv_buffer_size * 4,
Feb_Interface_recv_data_raw) /
@@ -102,9 +100,8 @@ int Feb_Interface_SetByteOrder() {
Feb_Interface_send_ndata = 2;
Feb_Interface_send_data[0] = 0;
Feb_Interface_send_data[1] = 0;
unsigned int i;
unsigned int dst = 0xff;
for (i = 0; i < Feb_Interface_nfebs; i++)
for (unsigned int i = 0; i < Feb_Interface_nfebs; i++)
dst = (dst | Feb_Interface_feb_numb[i]);
int passed = Feb_Interface_WriteTo(dst);
@@ -119,8 +116,6 @@ int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
unsigned int *reg_nums,
unsigned int *values_read) {
// here cout<<"Reading Register ...."<<endl;
unsigned int i;
nreads &= 0x3ff;
if (!nreads || nreads > Feb_Interface_send_buffer_size - 2)
return 0;
@@ -128,7 +123,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
Feb_Interface_send_ndata = nreads + 2;
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
for (i = 0; i < nreads; i++)
for (unsigned int i = 0; i < nreads; i++)
Feb_Interface_send_data[i + 1] = reg_nums[i];
Feb_Interface_send_data[nreads + 1] = 0;
@@ -137,7 +132,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
Feb_Interface_recv_ndata != (int)(nreads + 2))
return 0;
for (i = 0; i < nreads; i++)
for (unsigned int i = 0; i < nreads; i++)
values_read[i] = Feb_Interface_recv_data[i + 1];
return 1;
@@ -154,7 +149,6 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
unsigned int *reg_nums, unsigned int *values,
int *wait_ons,
unsigned int *wait_on_addresses) {
unsigned int i;
nwrites &= 0x3ff; // 10 bits
if (!nwrites || 2 * nwrites > Feb_Interface_send_buffer_size - 2)
return 0;
@@ -165,13 +159,13 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
Feb_Interface_send_data[2 * nwrites + 1] = 0;
for (i = 0; i < nwrites; i++)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 1] = 0x3fff & reg_nums[i];
for (i = 0; i < nwrites; i++)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 2] = values[i];
// wait on busy data(28), address of busy flag data(27 downto 14)
if (wait_ons && wait_on_addresses)
for (i = 0; i < nwrites; i++)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 1] |=
(wait_ons[i] << 28 | (0x3fff & wait_on_addresses[i]) << 14);
@@ -211,7 +205,6 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
unsigned int start_address, unsigned int nwrites,
unsigned int *values) {
// -1 means write to all
unsigned int i;
mem_num &= 0x3f;
start_address &= 0x3fff;
nwrites &= 0x3ff;
@@ -226,7 +219,7 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
start_address; // cmd -> write to memory, nwrites, mem number, start
// address
Feb_Interface_send_data[nwrites + 1] = 0;
for (i = 0; i < nwrites; i++)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[i + 1] = values[i];
if (!Feb_Interface_WriteTo(sub_num))