targets/plc_debug.c
changeset 386 2932b0dd437c
parent 335 c5f3f71e7260
child 394 5371e3d32f05
equal deleted inserted replaced
385:49cd52914a6f 386:2932b0dd437c
    65 {
    65 {
    66 }
    66 }
    67 
    67 
    68 extern int TryEnterDebugSection(void);
    68 extern int TryEnterDebugSection(void);
    69 extern void LeaveDebugSection(void);
    69 extern void LeaveDebugSection(void);
       
    70 extern long AtomicCompareExchange(long*, long, long);
       
    71 extern void InitiateDebugTransfer(void);
    70 
    72 
    71 extern int __tick;
    73 extern int __tick;
    72 void __publish_debug()
    74 void __publish_debug()
    73 {
    75 {
    74     /* Check there is no running debugger re-configuration */
    76     /* Check there is no running debugger re-configuration */
   150         BUFFER_FREE);
   152         BUFFER_FREE);
   151 }
   153 }
   152 
   154 
   153 void* IterDebugData(int* idx, const char **type_name)
   155 void* IterDebugData(int* idx, const char **type_name)
   154 {
   156 {
       
   157 	struct_plcvar* my_var;
       
   158 	USINT size;
   155     if(subscription_cursor < latest_subscription){
   159     if(subscription_cursor < latest_subscription){
   156         char* old_cursor = buffer_cursor;
   160         char* old_cursor = buffer_cursor;
   157         *idx = *subscription_cursor;
   161         *idx = *subscription_cursor;
   158         struct_plcvar* my_var = &variable_table[*(subscription_cursor++)];
   162         my_var = &variable_table[*(subscription_cursor++)];
   159         *type_name = __get_type_enum_name(my_var->type);
   163         *type_name = __get_type_enum_name(my_var->type);
   160         /* get variable size*/
   164         /* get variable size*/
   161         USINT size = __get_type_enum_size(my_var->type);
   165         size = __get_type_enum_size(my_var->type);
   162         /* compute next cursor position*/
   166         /* compute next cursor position*/
   163         buffer_cursor = buffer_cursor + size;
   167         buffer_cursor = buffer_cursor + size;
   164         if(old_cursor < debug_buffer + BUFFER_SIZE)
   168         if(old_cursor < debug_buffer + BUFFER_SIZE)
   165         {
   169         {
   166             return old_cursor;
   170             return old_cursor;