Commit 1f34dad4 authored by Tiago Jorge's avatar Tiago Jorge
Browse files

Update 1) gnc block global set to ready at startup 2) using sprintf and print...

Update 1) gnc block global set to ready at startup 2) using sprintf and print log only after a certain NR_MODE_SWITCHES
parent 9a213de8
......@@ -11,20 +11,33 @@ char p_szGlobalState[] = "modeX";
#define FPGA_ERROR "error"
#define FPGA_DISABLED "disabled"
char globalFpgaStatus_gnc[] = FPGA_DISABLED;
char globalFpgaStatus_gnc[] = FPGA_READY;
#define NR_MODE_SWITCHES 40
char testLog[40 * NR_MODE_SWITCHES][100];
int line = 0;
void calling_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
printf("\n[calling_startup] Starting up ...\n");
sprintf(testLog[line++], "\n[calling_startup] Starting up ...\n");
}
void calling_PI_pulse()
{
/* Write your code here! */
printf("\n[calling_PI_pulse] Current mode is %s\n", p_szGlobalState);
static int ite = 0;
if(ite == (3 * NR_MODE_SWITCHES)) { // at ~ (3 * NR_MODE_SWITCHES) sec print log
for(int i = 0; i <= line; i++){
printf(testLog[i]);
}
}
if(ite > (3 * NR_MODE_SWITCHES)) { // do noth
return;
}
sprintf(testLog[line++], "\n[calling_PI_pulse] Current mode is %s\n", p_szGlobalState);
static asn1SccSeq3 in1 = {0,0,0};
static asn1SccSeq3 in2 = {1,1,1};
......@@ -34,15 +47,15 @@ void calling_PI_pulse()
asn1SccSeqout out1 = {0,0,0,0,0,0,0,0};
asn1SccOut_Nested outn = {{0,0,0,0,0,0,0}};
printf("[calling_PI_pulse] Calling 'do_something'\n");
sprintf(testLog[line++], "[calling_PI_pulse] Calling 'do_something'\n");
calling_RI_do_something(&in1, &in2, &in3, &inn, &out1, &outn);
printf("[calling_PI_pulse] Sent: %lld %lld %lld\n", in1.arr[0], in1.arr[1], in1.arr[2]);
printf("[calling_PI_pulse] Sent: %lld %lld %lld\n", in2.arr[0], in2.arr[1], in2.arr[2]);
printf("[calling_PI_pulse] Sent: %lld %lld %lld %lld\n", in3.arr[0], in3.arr[1], in3.arr[2], in3.arr[3]);
printf("[calling_PI_pulse] Sent: {%lld %lld %lld %lld - %lld %lld %lld}\n\n", inn.inest_a.arr[0], inn.inest_a.arr[1], inn.inest_a.arr[2], inn.inest_a.arr[3], inn.inest_b.arr[0], inn.inest_b.arr[1], inn.inest_b.arr[2]);
sprintf(testLog[line++], "[calling_PI_pulse] Sent: %lld %lld %lld\n", in1.arr[0], in1.arr[1], in1.arr[2]);
sprintf(testLog[line++], "[calling_PI_pulse] Sent: %lld %lld %lld\n", in2.arr[0], in2.arr[1], in2.arr[2]);
sprintf(testLog[line++], "[calling_PI_pulse] Sent: %lld %lld %lld %lld\n", in3.arr[0], in3.arr[1], in3.arr[2], in3.arr[3]);
sprintf(testLog[line++], "[calling_PI_pulse] Sent: {%lld %lld %lld %lld - %lld %lld %lld}\n\n", inn.inest_a.arr[0], inn.inest_a.arr[1], inn.inest_a.arr[2], inn.inest_a.arr[3], inn.inest_b.arr[0], inn.inest_b.arr[1], inn.inest_b.arr[2]);
printf("[calling_PI_pulse] Received: %lld %lld %lld %lld %lld %lld %lld %lld\n", out1.arr[0], out1.arr[1], out1.arr[2], out1.arr[3], out1.arr[4], out1.arr[5], out1.arr[6], out1.arr[7]);
printf("[calling_PI_pulse] Received: {%lld %lld %lld %lld %lld %lld %lld}\n", outn.onest_a.arr[0], outn.onest_a.arr[1], outn.onest_a.arr[2], outn.onest_a.arr[3], outn.onest_a.arr[4], outn.onest_a.arr[5], outn.onest_a.arr[6]);
sprintf(testLog[line++], "[calling_PI_pulse] Received: %lld %lld %lld %lld %lld %lld %lld %lld\n", out1.arr[0], out1.arr[1], out1.arr[2], out1.arr[3], out1.arr[4], out1.arr[5], out1.arr[6], out1.arr[7]);
sprintf(testLog[line++], "[calling_PI_pulse] Received: {%lld %lld %lld %lld %lld %lld %lld}\n", outn.onest_a.arr[0], outn.onest_a.arr[1], outn.onest_a.arr[2], outn.onest_a.arr[3], outn.onest_a.arr[4], outn.onest_a.arr[5], outn.onest_a.arr[6]);
in1.arr[0]++; in1.arr[1]++; in1.arr[2]++;
......@@ -50,11 +63,9 @@ void calling_PI_pulse()
in3.arr[0]++; in3.arr[1]++; in3.arr[2]++; in3.arr[3]++;
inn.inest_a.arr[0]++; inn.inest_a.arr[1]++; inn.inest_a.arr[2]++; inn.inest_a.arr[3]++; inn.inest_b.arr[0]++; inn.inest_b.arr[1]++; inn.inest_b.arr[2]++;
static int ite = 0;
ite++;
if((ite % 3) == 0) { // each 3 sec
puts("\n[calling_PI_pulse] ************** Switching Configuration (SW <> HW) **************");
sprintf(testLog[line++], "\n[calling_PI_pulse] ************** Switching Configuration (SW <> HW) **************");
if (!strcmp(p_szGlobalState, "modeA")) {
strcpy(p_szGlobalState, "modeX");
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment