Repository for testing ADF code of COM_TMTC_SIMPLE

Dependencies:   mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Revision:
0:f016e9e8d48b
Child:
1:a0055b3280c8
diff -r 000000000000 -r f016e9e8d48b DefinitionsAndGlobals.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DefinitionsAndGlobals.h	Tue Dec 01 10:56:10 2015 +0000
@@ -0,0 +1,108 @@
+// **************DEFINITIONS*********************
+// COM_RX
+    #define RX_TIMEOUT_LIMIT 2.0
+    #define COM_RX_UART_TX PTE22
+    #define COM_RX_UART_RX PTE23
+
+// COMMON SPI
+    #define SPI_MOSI PTE1
+    #define SPI_MISO PTE3
+    #define SPI_CLK PTE2
+
+// TC LIST
+    #define TCL_STATE_IDLE 0x00
+    #define TCL_STATE_EXECUTING 0x01
+    #define TCL_STATE_COMPLETED 0x03
+    #define TCL_STATE_ABORTED 0x02
+    /*
+    0: IDLE OR WAITING FOR TCL COMPLETION
+    1: EXECUTING AFTER COMPLETION OF TCL
+    2: COMPLETED EXECUTION OF TCL
+    3: IDLE DUE TO ABORT ON NACK
+    */
+
+// LIST OF FLAGS
+    #define UART_INT_FLAG 0x01
+    #define NEW_TC_RECEIVED 0x02
+    #define START_SESSION 0x03
+    #define END_SESSION 0x04
+    #define ALL_CRC_PASS_FLAG 0x05
+    #define EXECUTE_OBOSC_FLAG 0x06
+
+// COM_MNG_TMTC THREAD
+    #define SESSION_TIME_LIMIT 1200
+    #define COM_MNG_TMTC_SIGNAL_UART_INT 0x01
+    #define COM_MNG_TMTC_SIGNAL_ADF_NSD 0x02
+    #define COM_MNG_TMTC_SIGNAL_ADF_SD 0x03
+
+// COM_MNG_TMTC
+    // starting value of packet sequence count at each pass 
+    #define PSC_START_VALUE 1
+    
+    // APID list
+    #define APID_CALLSIGN 0
+    #define APID_BAE 1
+    #define APID_CDMS 2
+    #define APID_SPEED 3
+    
+    // HIGH PRIORITY TC - priority list
+    // not correct values here
+    #define HPTC1 5
+    #define HPTC2 6
+    // Add more entries above
+    
+    // SIZE of tc in bytes
+    #define TC_SHORT_SIZE 11
+    #define TC_LONG_SIZE 135
+    
+    // TMID list
+    #define TMID_ACK_L1 0xA
+
+// OBOSC SERVICE SUBTYPE
+    #define OBOSC_SUB_DISABLE 0x01
+    #define OBOSC_SUB_RETRY 0x05
+    #define OBOSC_SUB_REP_TCL_D 0x06
+    #define OBOSC_SUB_REP_TCL 0x08
+    #define OBOSC_SUB_REP_LE 0x0F
+    #define OBOSC_SUB_RESET 0x07
+    
+    
+    
+// ****************GLOBAL VARIABLES******************
+// DEBUG
+Serial gPC( USBTX, USBRX );
+DigitalOut gLEDR(LED_RED);
+DigitalOut gLEDG(LED_GREEN);
+
+// COM_RX
+RawSerial RX1M( COM_RX_UART_TX, COM_RX_UART_RX );
+COM_RX_DATA_NODE *gRX_HEAD_DATA_NODE = NULL;
+COM_RX_DATA_NODE *gRX_CURRENT_DATA_NODE = NULL;
+uint8_t *gRX_CURRENT_PTR = NULL;
+uint32_t gRX_COUNT = 0;
+uint16_t gTOTAL_INCORRECT_SIZE_TC = 0x00;
+uint16_t gTOTAL_CRC_FAIL_TC = 0x00;
+
+
+// COMMON SPI
+SPI spi( SPI_MOSI, SPI_MISO, SPI_CLK );
+Mutex SPI_mutex;
+
+// TC LIST
+Base_tc* gHEAD_NODE_TCL = NULL;
+Base_tc* gLAST_NODE_TCL = NULL;
+uint8_t gMASTER_STATE = TCL_STATE_IDLE;
+uint8_t gFLAGS = 0x00;
+
+// COM_MNG_TMTC THREAD
+Thread* gCOM_MNG_TMTC_THREAD = NULL;
+Timeout gRX_TIMEOUT;
+Timeout gSESSION_TIMEOUT;
+
+// COM_MNG_TMTC
+uint8_t gTOTAL_VALID_TC = 0x00;
+// USE LAST_L1_ACK FOR GENERATING REPORT
+uint8_t gLAST_L1_ACK[TM_SHORT_SIZE];
+uint8_t gLAST_L1_ACK_BUFFER[TM_SHORT_SIZE];
+uint8_t gOBOSC_PSC = PSC_START_VALUE;
+Base_tc* gOBOSC_HEAD = NULL;
\ No newline at end of file