Commit 52fe87d5 authored by yoogx's avatar yoogx
Browse files

* Correct initialisation of the system

        For openaadl/ocarina#96
parent 3f5cf34e
...@@ -40,9 +40,6 @@ void __po_hi_instrumentation_vcd_init (void); ...@@ -40,9 +40,6 @@ void __po_hi_instrumentation_vcd_init (void);
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...) \ #define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...) \
{ \ { \
extern enum tagVCD VCD_state; \ extern enum tagVCD VCD_state; \
if (VCD_state == VCD_UNCHECKED) { \
VCD_state = NULL == getenv("VCD_ENABLED")?VCD_DISABLED:VCD_ENABLED; \
} \
if (VCD_state == VCD_ENABLED) { \ if (VCD_state == VCD_ENABLED) { \
extern int __po_hi_vcd_file; \ extern int __po_hi_vcd_file; \
extern __po_hi_time_t __po_hi_vcd_start_time; \ extern __po_hi_time_t __po_hi_vcd_start_time; \
......
...@@ -20,10 +20,6 @@ ...@@ -20,10 +20,6 @@
#include <stdlib.h> #include <stdlib.h>
#if defined(__PO_HI_USE_VCD) && defined(__unix__)
enum tagVCD VCD_state;
#endif
int __po_hi_compute_miss (__po_hi_uint8_t rate) int __po_hi_compute_miss (__po_hi_uint8_t rate)
{ {
int v; int v;
...@@ -52,7 +48,8 @@ unsigned long __po_hi_swap_byte (unsigned long value) ...@@ -52,7 +48,8 @@ unsigned long __po_hi_swap_byte (unsigned long value)
return (vn.ni); return (vn.ni);
} }
#ifdef __PO_HI_USE_VCD #if defined(__PO_HI_USE_VCD) && defined(__unix__)
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -67,6 +64,8 @@ unsigned long __po_hi_swap_byte (unsigned long value) ...@@ -67,6 +64,8 @@ unsigned long __po_hi_swap_byte (unsigned long value)
#include <deployment.h> #include <deployment.h>
enum tagVCD VCD_state = VCD_UNCHECKED;
int __po_hi_vcd_file; int __po_hi_vcd_file;
int __po_hi_vcd_init = 0; int __po_hi_vcd_init = 0;
__po_hi_time_t __po_hi_vcd_start_time; __po_hi_time_t __po_hi_vcd_start_time;
...@@ -90,6 +89,14 @@ void __po_hi_instrumentation_vcd_init () ...@@ -90,6 +89,14 @@ void __po_hi_instrumentation_vcd_init ()
int size_to_write = 0; int size_to_write = 0;
time_t current_time; time_t current_time;
if (VCD_state == VCD_UNCHECKED) {
VCD_state = NULL == getenv("VCD_ENABLED")?VCD_DISABLED:VCD_ENABLED;
}
if (VCD_state != VCD_ENABLED) {
return;
}
if (__po_hi_vcd_init == 0) if (__po_hi_vcd_init == 0)
{ {
__po_hi_vcd_init = 1; __po_hi_vcd_init = 1;
......
Markdown is supported
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