working

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Files at this revision

API Documentation at this revision

Comitter:
shreeshas95
Date:
Fri Jan 29 17:09:41 2016 +0000
Parent:
101:bece931236a2
Child:
103:b55559925dc1
Commit message:
Changed Structures.h: removed Base_tm functions and corresponding errors everywhere

Changed in this revision

COM_MNG_TMTC.h Show annotated file Show diff for this revision Revisions of this file
COM_SND_TM.h Show annotated file Show diff for this revision Revisions of this file
OBSRS.h Show annotated file Show diff for this revision Revisions of this file
Structures.h Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Tue Jan 26 13:15:01 2016 +0000
+++ b/COM_MNG_TMTC.h	Fri Jan 29 17:09:41 2016 +0000
@@ -40,12 +40,7 @@
 // typeof tc_ptr: Base_tc
 // typeof temp_xxxx: uint8_t
 #define fill_l1_ack(tm_ptr) {\
-    uint8_t temp8;\
     tm_ptr->next_TM = NULL;\
-    temp8 = TMID_ACK_L1;\
-    PUTtmid(tm_ptr->fields, temp8);\
-    temp8 = SHORT_TM_CODE;\
-    PUTshort_or_long_tm(tm_ptr->fields, temp8);\
     tm_ptr->TM_string[0] = TMID_ACK_L1 << 4;\
     /*PENDING: PA TEMPERATURE*/\
     tm_ptr->TM_string[1] = gTOTAL_INCORRECT_SIZE_TC & 0xFF;\
@@ -71,7 +66,7 @@
 #define detect_ack(tm_ptr, temp_ack, tc_psc) {\
     if( tm_ptr != NULL ){\
         int length = TM_SHORT_SIZE;\
-        if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\
+        if( GETshort_or_long_tm(tm_ptr) == SHORT_TM_CODE ){\
             length = TM_SHORT_SIZE;\
         }\
         else{\
@@ -309,10 +304,6 @@
             /*Increment TM_PSC for every new TM pointer created*/\
             Base_tm *temp_tm = new Long_tm;\
             temp_tm->next_TM = NULL;\
-            uint8_t temp8 = LONG_TM_CODE;\
-            PUTshort_or_long_tm(temp_tm->fields, temp8);\
-            temp8 = TMID_TCL;\
-            PUTtmid((temp_tm->fields), temp8);\
             temp_tm->TM_string[0] = 0x38;\
             /*Frame type(1) = 0; TMID = 0111; Spare = 000*/\
             temp_tm->TM_string[1] = TC_PSC;\
@@ -1102,10 +1093,6 @@
     ackl234new->next_TM = NULL;\
     /*return telemetry pointer here*/\
     tm_ptr = ackl234new;\
-    temp8 = SHORT_TM_CODE;\
-    PUTshort_or_long_tm(ackl234new->fields, temp8);\
-    temp8 = TMID_ACK_L234;\
-    PUTtmid((ackl234new->fields), temp8);\
     ackl234new->TM_string[0] = TMID_ACK_L234 << 4;\
     ackl234new->TM_string[1] = GETpacket_seq_count(tc_ptr);\
     ackl234new->TM_string[2] = 0xA0;\
@@ -1122,11 +1109,6 @@
             ackl234old->next_TM = NULL;\
             /*APPEND TO ACK L234 NEW HERE*/\
             ackl234new->next_TM = ackl234old;\
-            uint8_t temp82 = TM_SHORT_SIZE;\
-            PUTshort_or_long_tm(ackl234old->fields, temp82);\
-            /*TMID FOR SHORT TM*/\
-            uint8_t y = (gLAST_TM[0] & 0xF0) >> 4;\
-            PUTtmid((ackl234old->fields), y);\
             for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\
                 ackl234old->TM_string[i] = gLAST_TM[i];\
             }\
@@ -1136,11 +1118,6 @@
             tempLongTM->next_TM = NULL;\
             /*APPEND TO ACK L234 NEW HERE*/\
             ackl234new->next_TM = tempLongTM;\
-            uint8_t temp82 = TM_LONG_SIZE;\
-            PUTshort_or_long_tm(tempLongTM->fields, temp82);\
-            /*TMID FOR LONG TM*/\
-            uint8_t y = (gLAST_TM[0] & 0x78) >> 3;\
-            PUTtmid((tempLongTM->fields), y);\
             for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){\
                 tempLongTM->TM_string[i] = gLAST_TM[i];\
             }\
@@ -1166,10 +1143,6 @@
     Base_tm* call_sign_tm = new Short_tm;\
     call_sign_tm->next_TM = NULL;\
     tm_ptr = call_sign_tm;\
-    uint8_t temp8 = TMID_CALL_SIGN;\
-    PUTtmid(call_sign_tm->fields, temp8);\
-    temp8 = SHORT_TM_CODE;\
-    PUTshort_or_long_tm(call_sign_tm->fields, temp8);\
     for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\
         call_sign_tm->TM_string[i] = gCALL_SIGN_STRING[i];\
     }\
@@ -1217,7 +1190,7 @@
                             obosc_tm_current = obosc_tm_head;\
                             while( obosc_tm_current != NULL ){\
                                 int length = TM_SHORT_SIZE;\
-                                if( GETshort_or_long_tm(obosc_tm_current->fields) == SHORT_TM_CODE ){\
+                                if( GETshort_or_long_tm(obosc_tm_current) == SHORT_TM_CODE ){\
                                     length = TM_SHORT_SIZE;\
                                 }\
                                 else{\
@@ -1290,7 +1263,7 @@
                         tm_ptr = tm_ptr_head;\
                         while( tm_ptr != NULL ){\
                             int length = TM_SHORT_SIZE;\
-                            if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\
+                            if( GETshort_or_long_tm(tm_ptr) == SHORT_TM_CODE ){\
                                 length = TM_SHORT_SIZE;\
                             }\
                             else{\
@@ -1389,7 +1362,7 @@
                             }\
                             /*update last executed L1_ack*/\
                             if( put_tm_here != NULL ){\
-                                if( GETshort_or_long_tm(put_tm_here->fields) == SHORT_TM_CODE ){\
+                                if( GETshort_or_long_tm(put_tm_here) == SHORT_TM_CODE ){\
                                     for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){\
                                         gLAST_TM[i] = put_tm_here->TM_string[i];\
                                         gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\
@@ -1425,7 +1398,7 @@
                             tm_ptr = tm_ptr_head;\
                             while( tm_ptr != NULL ){\
                                 int length = TM_SHORT_SIZE;\
-                                if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\
+                                if( GETshort_or_long_tm(tm_ptr) == SHORT_TM_CODE ){\
                                     length = TM_SHORT_SIZE;\
                                 }\
                                 else{\
@@ -1500,7 +1473,7 @@
                             }\
                             /*update last executed L1_ack*/\
                             if( put_tm_here != NULL ){\
-                                if( GETshort_or_long_tm(put_tm_here->fields) == SHORT_TM_CODE ){\
+                                if( GETshort_or_long_tm(put_tm_here) == SHORT_TM_CODE ){\
                                     for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){\
                                         gLAST_TM[i] = put_tm_here->TM_string[i];\
                                         gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\
@@ -1537,7 +1510,7 @@
                             tm_ptr = tm_ptr_head;\
                             while( tm_ptr != NULL ){\
                                 int length = TM_SHORT_SIZE;\
-                                if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\
+                                if( GETshort_or_long_tm(tm_ptr) == SHORT_TM_CODE ){\
                                     length = TM_SHORT_SIZE;\
                                 }\
                                 else{\
--- a/COM_SND_TM.h	Tue Jan 26 13:15:01 2016 +0000
+++ b/COM_SND_TM.h	Fri Jan 29 17:09:41 2016 +0000
@@ -103,7 +103,7 @@
         type0_no = 0;
         type1_no = 0;
         while(head != NULL){
-            switch( GETshort_or_long_tm(head->fields) ){
+            switch( GETshort_or_long_tm(head) ){
                 case 0:
                     type0_no++;
                     break;
@@ -128,11 +128,11 @@
     }
  
 #define next_type_structure(ptr){\
-        unsigned char temp = GETshort_or_long_tm(ptr->fields);\
+        unsigned char temp = GETshort_or_long_tm(ptr);\
         if((temp == 0) && (ptr->next_TM != NULL) ){\
             do{\
                 ptr = ptr->next_TM;\
-                temp =  GETshort_or_long_tm(ptr->fields);\
+                temp =  GETshort_or_long_tm(ptr);\
             }\
             while(temp == 1 && ptr->next_TM != NULL);\
             if(temp == 1){\
@@ -142,7 +142,7 @@
         else if((temp == 1) && (ptr->next_TM != NULL)){\
             do{\
                 ptr = ptr->next_TM;\
-                temp = GETshort_or_long_tm(ptr->fields);\
+                temp = GETshort_or_long_tm(ptr);\
             }\
             while(temp == 0 && ptr->next_TM != NULL);\
             if(temp == 0){\
@@ -165,7 +165,7 @@
     #define first_type_structure( type,return_ptr) {\
         Base_tm* temp_ptr = head_ptr;\
         if(type == 0){\
-            while(GETshort_or_long_tm(temp_ptr->fields) == 1){\
+            while(GETshort_or_long_tm(temp_ptr) == 1){\
                 temp_ptr = temp_ptr->next_TM;\
                 if(temp_ptr == NULL){\
                     return_ptr = NULL ;\
@@ -173,7 +173,7 @@
             }\
         }\
         else if(type == 1){\
-            while(GETshort_or_long_tm(temp_ptr->fields) == 0){\
+            while(GETshort_or_long_tm(temp_ptr) == 0){\
                 temp_ptr = temp_ptr->next_TM;\
                 if(temp_ptr == NULL){\
                     return_ptr = NULL;\
--- a/OBSRS.h	Tue Jan 26 13:15:01 2016 +0000
+++ b/OBSRS.h	Fri Jan 29 17:09:41 2016 +0000
@@ -88,11 +88,6 @@
     Base_tm *ackl234new = new Short_tm;\
     ackl234new->next_TM = NULL;\
     /*return telemetry pointer here*/\
-    uint8_t temp8;\
-    temp8 = SHORT_TM_CODE;\
-    PUTshort_or_long_tm(ackl234new->fields, temp8);\
-    temp8 = TMID_ACK_L234;\
-    PUTtmid((ackl234new->fields), temp8);\
     ackl234new->TM_string[0] = TMID_ACK_L234 << 4;\
     ackl234new->TM_string[1] = 0x12;\
     ackl234new->TM_string[2] = ack_code;         /* Ack code ....to be chnaged accordind to situation */\
--- a/Structures.h	Tue Jan 26 13:15:01 2016 +0000
+++ b/Structures.h	Fri Jan 29 17:09:41 2016 +0000
@@ -97,23 +97,15 @@
 };
 
 // TELEMETRY:
-// MASKS
-#define SHORT_LONG_TM_MASK 0x10
-#define TMID_MASK 0x0F
+// MASK
+#define SHORT_LONG_TM_MASK 0x80
 
-//x should be 'fields' variable defined in the Base_tm
-#define GETshort_or_long_tm(x) ((x & SHORT_LONG_TM_MASK) >> 4)
-#define GETtmid(x) (x & TMID_MASK)
-
-//x should be 'fields' variable defines in the Base_tm
-//y should be an 8-bit number with relevent data at LSB
-#define PUTshort_or_long_tm(x,y) x = (x & ~(SHORT_LONG_TM_MASK)) | ((y<<4) & SHORT_LONG_TM_MASK)
-#define PUTtmid(x,y) x = (x & ~(TMID_MASK)) | (y & TMID_MASK)
+//x should be 'Base tm' pointer
+#define GETshort_or_long_tm(x) ((x->TM_string[0] & SHORT_LONG_TM_MASK) >> 7)
 
 // PARENT TELEMETRY CLASS
 class Base_tm{
 public:
-    uint8_t fields;
     uint8_t *TM_string;
     Base_tm *next_TM;
     
@@ -129,7 +121,6 @@
     Long_tm(){
         TM_string = fix_str;
         // type 0
-        fields = 0;
     }
     
     ~Long_tm(){}
@@ -144,7 +135,6 @@
     Short_tm(){
         TM_string = fix_str;
         // type 1
-        fields = 0x10;
     }
     
     ~Short_tm(){}