77 extern unsigned long __tick; |
77 extern unsigned long __tick; |
78 |
78 |
79 #define __BufferDebugDataIterator_case_t(TYPENAME) \ |
79 #define __BufferDebugDataIterator_case_t(TYPENAME) \ |
80 case TYPENAME##_ENUM :\ |
80 case TYPENAME##_ENUM :\ |
81 flags = ((__IEC_##TYPENAME##_t *)varp)->flags;\ |
81 flags = ((__IEC_##TYPENAME##_t *)varp)->flags;\ |
82 ptrvalue = &((__IEC_##TYPENAME##_t *)varp)->value; |
82 ptrvalue = &((__IEC_##TYPENAME##_t *)varp)->value;\ |
|
83 break; |
83 |
84 |
84 #define __BufferDebugDataIterator_case_p(TYPENAME)\ |
85 #define __BufferDebugDataIterator_case_p(TYPENAME)\ |
85 case TYPENAME##_P_ENUM :\ |
86 case TYPENAME##_P_ENUM :\ |
86 flags = ((__IEC_##TYPENAME##_p *)varp)->flags;\ |
87 flags = ((__IEC_##TYPENAME##_p *)varp)->flags;\ |
87 ptrvalue = ((__IEC_##TYPENAME##_p *)varp)->value; |
88 ptrvalue = ((__IEC_##TYPENAME##_p *)varp)->value;\ |
|
89 break; |
88 |
90 |
89 void BufferDebugDataIterator(void* varp, __IEC_types_enum vartype) |
91 void BufferDebugDataIterator(void* varp, __IEC_types_enum vartype) |
90 { |
92 { |
91 void *ptrvalue = NULL; |
93 void *ptrvalue = NULL; |
92 char flags = 0; |
94 char flags = 0; |
142 } |
144 } |
143 } |
145 } |
144 |
146 |
145 #define __RegisterDebugVariable_case_t(TYPENAME) \ |
147 #define __RegisterDebugVariable_case_t(TYPENAME) \ |
146 case TYPENAME##_ENUM :\ |
148 case TYPENAME##_ENUM :\ |
147 ((__IEC_##TYPENAME##_t *)varp)->flags |= __IEC_DEBUG_FLAG; |
149 ((__IEC_##TYPENAME##_t *)varp)->flags |= __IEC_DEBUG_FLAG;\ |
|
150 break; |
148 #define __RegisterDebugVariable_case_p(TYPENAME)\ |
151 #define __RegisterDebugVariable_case_p(TYPENAME)\ |
149 case TYPENAME##_P_ENUM :\ |
152 case TYPENAME##_P_ENUM :\ |
150 ((__IEC_##TYPENAME##_p *)varp)->flags |= __IEC_DEBUG_FLAG; |
153 ((__IEC_##TYPENAME##_p *)varp)->flags |= __IEC_DEBUG_FLAG;\ |
|
154 break; |
151 void RegisterDebugVariable(int idx) |
155 void RegisterDebugVariable(int idx) |
152 { |
156 { |
153 void *varp = NULL; |
157 void *varp = NULL; |
154 switch(__find_variable(idx, varp)){ |
158 switch(__find_variable(idx, &varp)){ |
155 ANY(__RegisterDebugVariable_case_t) |
159 ANY(__RegisterDebugVariable_case_t) |
156 ANY(__RegisterDebugVariable_case_p) |
160 ANY(__RegisterDebugVariable_case_p) |
157 default: |
161 default: |
158 break; |
162 break; |
159 } |
163 } |
160 } |
164 } |
161 |
165 |
162 #define __ResetDebugVariablesIterator_case_t(TYPENAME) \ |
166 #define __ResetDebugVariablesIterator_case_t(TYPENAME) \ |
163 case TYPENAME##_ENUM :\ |
167 case TYPENAME##_ENUM :\ |
164 ((__IEC_##TYPENAME##_t *)varp)->flags &= ~__IEC_DEBUG_FLAG; |
168 ((__IEC_##TYPENAME##_t *)varp)->flags &= ~__IEC_DEBUG_FLAG;\ |
|
169 break; |
165 |
170 |
166 #define __ResetDebugVariablesIterator_case_p(TYPENAME)\ |
171 #define __ResetDebugVariablesIterator_case_p(TYPENAME)\ |
167 case TYPENAME##_P_ENUM :\ |
172 case TYPENAME##_P_ENUM :\ |
168 ((__IEC_##TYPENAME##_p *)varp)->flags &= ~__IEC_DEBUG_FLAG;\ |
173 ((__IEC_##TYPENAME##_p *)varp)->flags &= ~__IEC_DEBUG_FLAG;\ |
|
174 break; |
169 |
175 |
170 void ResetDebugVariablesIterator(void* varp, __IEC_types_enum vartype) |
176 void ResetDebugVariablesIterator(void* varp, __IEC_types_enum vartype) |
171 { |
177 { |
172 /* force debug flag to 0*/ |
178 /* force debug flag to 0*/ |
173 switch(vartype){ |
179 switch(vartype){ |
195 int WaitDebugData(unsigned long *tick); |
201 int WaitDebugData(unsigned long *tick); |
196 /* Wait until debug data ready and return pointer to it */ |
202 /* Wait until debug data ready and return pointer to it */ |
197 int GetDebugData(unsigned long *tick, unsigned long *size, void **buffer){ |
203 int GetDebugData(unsigned long *tick, unsigned long *size, void **buffer){ |
198 int res = WaitDebugData(tick); |
204 int res = WaitDebugData(tick); |
199 *size = buffer_cursor - debug_buffer; |
205 *size = buffer_cursor - debug_buffer; |
200 *buffer = NULL; |
206 *buffer = debug_buffer; |
201 return res; |
207 return res; |
202 } |
208 } |
203 |
209 |