Dummy program to demonstrate problems: working code

Dependencies:   SLCD mbed-rtos mbed

Fork of MNG_TC by Shreesha S

Revision:
1:df31097c8442
Parent:
0:b5b370873460
Child:
2:994e741028c7
--- a/MNG_TC.h	Wed Apr 15 10:43:22 2015 +0000
+++ b/MNG_TC.h	Sat Jun 06 04:27:40 2015 +0000
@@ -23,7 +23,7 @@
 // Add more entries above
 
 // size of short TM without CRC - in bytes
-#define TM_SHORT_SIZE 11
+#define TM_SHORT_SIZE 14
 #define TM_LONG_SIZE 131
 
 // TMID list
@@ -99,8 +99,10 @@
         tm_ptr->next_TM = NULL;
         tm_ptr->TM_string = new unsigned char[TM_SHORT_SIZE];
         // TMID
-        tm_ptr->TM_string[0] = (10 << 4) & 0xf0;
-        // fill EXEC CODE below
+        tm_ptr->TM_string[0] = 0xaf;
+        tm_ptr->TM_string[1] = 0xff;
+        tm_ptr->TM_string[2] = 0xff;
+        tm_ptr->TM_string[3] = 0xff;
     }
     
     TM_list* manage_process(TC_list *ptr_tc){
@@ -151,7 +153,7 @@
     // and update the total valid TC
     // and GENERATE L1_ACK_TM
     void TC_list_cleanup(){
-        printf("Inside cleanup\r\n");
+//        printf("Inside cleanup\r\n");
         TC_list *current_TC = TC_list_header;
         TC_list *previous_TC = NULL;
         
@@ -163,17 +165,22 @@
         generate_L1_ack_TM(l1_ack);
         
         int TC_count = 0;
+        
+        l1_ack->TM_string[4] = 0x01;
+        l1_ack->TM_string[5] = 0xff;
 
         while(current_TC != NULL){
+//            printf("Inside null\r\n");
             
+//            printf("TC_count = %u\r\npsc = %u\r\n", TC_count, current_TC->TC_string[0]);
             // don't care : crc pass or fail
-            l1_ack->TM_string[3+TC_count] = current_TC->packet_seq_count;
+            l1_ack->TM_string[6+TC_count] = current_TC->TC_string[0];
 
             if( current_TC->crc_pass ){
                 ++total_valid_TC;
 
                 // set the crc pass field
-                l1_ack->TM_string[2] |= ( 1 << (7-TC_count) );
+//                l1_ack->TM_string[2] |= ( 1 << (7-TC_count) );
 
                 // advance to the next node
                 previous_TC = current_TC;
@@ -182,42 +189,48 @@
             // crc fail
             else{
                 // unset the crc pass field
-                l1_ack->TM_string[2] &= ~( 1 << (7-TC_count) );
+//                l1_ack->TM_string[2] &= ~( 1 << (7-TC_count) );
 
                 // delete and advance to the next node
                 TC_list *next = current_TC->next_TC;
-                delete_TC(current_TC, previous_TC);
+//                delete_TC(current_TC, previous_TC);
                 current_TC = next;
                 all_crc_pass = false;
             }
             ++TC_count;
 
             // extend the linked list if TC_count > 7
-            if(TC_count > 7){
-                TC_count = 0;
-
-                l1_ack->next_TM = new TM_List;
-                l1_ack = l1_ack->next_TM;
-                generate_L1_ack_TM(l1_ack);
-            }
+//            if(TC_count > 7){
+//                TC_count = 0;
+//
+//                l1_ack->next_TM = new TM_List;
+//                l1_ack = l1_ack->next_TM;
+//                generate_L1_ack_TM(l1_ack);
+//            }
+        }
+        
+        for(int i = 0 ; i < 7 ; ++i){
+            l1_ack->TM_string[7+i] = 0x00;
         }
 
-        // SND_L1_ACK to GS
+//        printf("Sending data\r\n");
+        SND_TM(l1_ack, false, 1);
+//        printf("finished sending data\r\n");
 
         // delete the TM
-        l1_ack = l1_ack_head;
-        while(l1_ack != NULL){
-            TM_List *temp = l1_ack->next_TM;
-            delete l1_ack->TM_string;
-            delete l1_ack;
-            l1_ack = temp;
-        }
+//        l1_ack = l1_ack_head;
+//        while(l1_ack != NULL){
+//            TM_List *temp = l1_ack->next_TM;
+////            delete l1_ack->TM_string;
+////            delete l1_ack;
+//            l1_ack = temp;
+//        }
 
-        if(all_crc_pass == false){
-            // exit
-        }
-        printf("Completed cleanup\r\n");
-        printf("valid TC = %d\r\n", total_valid_TC);
+//        if(all_crc_pass == false){
+//            // exit
+//        }
+//        printf("Completed cleanup\r\n");
+//        printf("valid TC = %d\r\n", total_valid_TC);
     }
 
     // At this stage ALL NODES ARE CRC PASS