Hilscher netX microcontroller driver  V0.0.5.0
Documentation of the netX driver package
netx_drv.c
Go to the documentation of this file.
1 /*!************************************************************************/
21 /* Includes ------------------------------------------------------------------*/
22 #include "netx_drv.h"
23 #include "stdio.h"
24 
32 #ifndef NDEBUG
33 
37 uint32_t volatile g_ulQueueCounter = 0;
38 
42 uint32_t volatile g_ulRunFlag = 0;
43 
48 
49 /*lint -save -e606 */
50 
54 char const * const g_pabDrvTraceKeySrings[] = { "", "\x1B[35mDATA\x1B[0m", "\x1B[34mMODE\x1B[0m", "\x1B[32mBORDER\x1B[0m", "\x1B[32mCOUNTER\x1B[0m",
55  "\x1B[32mITERATION\x1B[0m", "\x1B[32mLENGTH\x1B[0m", "\x1B[31mIRQ\x1B[0m", "\x1B[33mMSK\x1B[0m", "\x1B[36mSTATE\x1B[0m", "\x1B[36mINFO\x1B[0m",
56  "\x1B[0m11\x1B[0m", "\x1B[0m12\x1B[0m", "\x1B[0m13\x1B[0m", "\x1B[32mCOUNT\x1B[0m" };
57 /*lint -restore */
58 
60 
65 void TRACE(uint32_t ulKey, uint32_t ulValue)
66 {
67  if(!g_ulRunFlag)
68  {
69  g_atTraceQueue[g_ulQueueCounter].key = (DRV_TRACE_KEY_E) ulKey;
70  g_atTraceQueue[g_ulQueueCounter].val = ulValue;
73  {
74  g_ulQueueCounter = 0;
75  }
76  }
77 }
78 
82 void TRACE_RESET(void)
83 {
84  g_ulQueueCounter = 0;
85  uint32_t i;
86  for(i = 0; i < ulTraceQueueSize; i++)
87  {
88  g_atTraceQueue[i].key = (DRV_TRACE_KEY_E) 0;
89  g_atTraceQueue[i].val = 0;
90  }
91  UNUSED(g_atTraceQueue);
92 }
93 
94 #ifdef DRV_TRACE_PRINTER
95 
98 void TRACE_PRINT(void)
99 {
100  TRACE_PAUSE();
101  size_t i;
102  for(i = g_ulQueueCounter; i < ulTraceQueueSize; i++)
103  {
104  printf("%3d: %#010lX %s\n", i, g_atTraceQueue[i].val, g_pabDrvTraceKeySrings[g_atTraceQueue[i].key]);
105  }
106  for(i = 0; i < g_ulQueueCounter; i++)
107  {
108  printf("%3d: %#010lX %4s\n", i, g_atTraceQueue[i].val, g_pabDrvTraceKeySrings[g_atTraceQueue[i].key]);
109  }
110  TRACE_RUN();
111 }
112 #endif /* DRV_TRACE_PRINTER */
113 
114 #endif /* NDEBUG */
115 /* End of group trace */
116 
void TRACE(uint32_t ulKey, uint32_t ulValue)
The trace function stores the given key and the given value in a cyclic list.
Definition: netx_drv.c:65
DRV_TRACE_KEY_E
Enumerates the keys used for the trace function.
Definition: netx_drv.h:252
uint32_t volatile g_ulRunFlag
references the running flag of the tracer.
Definition: netx_drv.c:42
__STATIC_FORCEINLINE void TRACE_PAUSE(void)
Stop the trace.
Definition: netx_drv.h:323
char const *const g_pabDrvTraceKeySrings[]
References the string array of the keys.
Definition: netx_drv.c:54
void TRACE_RESET(void)
The trace reset is doing what its name tells. It resets the trace.
Definition: netx_drv.c:82
uint32_t volatile g_ulQueueCounter
references the counter that points to the next queue element.
Definition: netx_drv.c:37
size_t u_DRV_TRACE_KEY_STRINGS
Definition: netx_drv.c:59
__STATIC_FORCEINLINE void TRACE_RUN(void)
Start the trace.
Definition: netx_drv.h:333
volatile DRV_TRACE_QUEUE_ELEMENT_T g_atTraceQueue[ulTraceQueueSize]
References the queue used for the debug trace functionality.
Definition: netx_drv.c:47
This file contains all the functions prototypes for the peripheral module driver. ...
Trace structure used for debug tracing of the drivers.
Definition: netx_drv.h:274
DRV_TRACE_KEY_E volatile key
Definition: netx_drv.h:276
#define UNUSED(x)
If there is the need to outsmart the compiler or linter.
Definition: netx_drv_def.h:40
uint32_t volatile val
Definition: netx_drv.h:277
#define ulTraceQueueSize
Defines the queue for the trace functionality.
Definition: netx_drv.h:308