Repo for COM_MNG_TMTC_SIMPLE for integration with adf

Dependencies:   mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Committer:
shekhar
Date:
Thu Dec 31 09:53:39 2015 +0000
Revision:
9:9dbd59a6cc30
Parent:
8:d1951bbdcdd8
Final codes for adf.h and COM_SND_TM.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shekhar 8:d1951bbdcdd8 1
shreeshas95 0:f016e9e8d48b 2 // **************DEFINITIONS*********************
shreeshas95 0:f016e9e8d48b 3 // COM_RX
shekhar 8:d1951bbdcdd8 4 #define RX_TIMEOUT_LIMIT 1.0
shekhar 8:d1951bbdcdd8 5 #define COM_RX_UART_TX PTE20
shekhar 8:d1951bbdcdd8 6 #define COM_RX_UART_RX PTE21
shreeshas95 0:f016e9e8d48b 7
shreeshas95 0:f016e9e8d48b 8 // COMMON SPI
shreeshas95 0:f016e9e8d48b 9 #define SPI_MOSI PTE1
shreeshas95 0:f016e9e8d48b 10 #define SPI_MISO PTE3
shreeshas95 0:f016e9e8d48b 11 #define SPI_CLK PTE2
shreeshas95 1:a0055b3280c8 12 #define SPI_CS_ADF PTA15
shreeshas95 2:2caf2a9a13aa 13 #define SPI_CS_SDC PTE22
shreeshas95 2:2caf2a9a13aa 14 #define SPI_CS_RTC PTE29
shreeshas95 4:104dd82c99b8 15
shreeshas95 2:2caf2a9a13aa 16 // ADF INTERRUPUT
shreeshas95 2:2caf2a9a13aa 17 #define ADF_IRQ PTA14
shreeshas95 0:f016e9e8d48b 18
shreeshas95 0:f016e9e8d48b 19 // TC LIST
shreeshas95 2:2caf2a9a13aa 20 #define TCL_STATE_INCOMPLETE 0x00
shekhar 8:d1951bbdcdd8 21 #define TCL_STATE_EXECUTING 0x01
shekhar 8:d1951bbdcdd8 22 #define TCL_STATE_COMPLETED 0x03
shekhar 8:d1951bbdcdd8 23 #define TCL_STATE_ABORTED 0x02
shekhar 8:d1951bbdcdd8 24 /*
shekhar 8:d1951bbdcdd8 25 0: IDLE OR WAITING FOR TCL COMPLETION
shekhar 8:d1951bbdcdd8 26 1: EXECUTING AFTER COMPLETION OF TCL
shekhar 8:d1951bbdcdd8 27 2: COMPLETED EXECUTION OF TCL
shekhar 8:d1951bbdcdd8 28 3: IDLE DUE TO ABORT ON NACK
shekhar 8:d1951bbdcdd8 29 */
shreeshas95 0:f016e9e8d48b 30
shreeshas95 0:f016e9e8d48b 31 // LIST OF FLAGS
shreeshas95 2:2caf2a9a13aa 32 #define UART_INT_FLAG 0x0001
shreeshas95 2:2caf2a9a13aa 33 #define NEW_TC_RECEIVED 0x0002
shreeshas95 2:2caf2a9a13aa 34 #define COM_SESSION_FLAG 0x0004
shreeshas95 2:2caf2a9a13aa 35 #define COM_RX_FLAG 0x0008
shreeshas95 2:2caf2a9a13aa 36 #define COM_MNG_TMTC_RUNNING_FLAG 0x0010
shreeshas95 2:2caf2a9a13aa 37 #define COM_SESSION_VALIDITY 0x0020
shreeshas95 2:2caf2a9a13aa 38 #define ALL_CRC_PASS_FLAG 0x0040
shreeshas95 2:2caf2a9a13aa 39 #define COM_PA_HOT_FLAG 0x0080
shreeshas95 2:2caf2a9a13aa 40 #define COM_TX_FLAG 0x0100
shreeshas95 0:f016e9e8d48b 41
shreeshas95 0:f016e9e8d48b 42 // COM_MNG_TMTC THREAD
shekhar 8:d1951bbdcdd8 43 #define SESSION_TIME_LIMIT 1200
shreeshas95 0:f016e9e8d48b 44 #define COM_MNG_TMTC_SIGNAL_UART_INT 0x01
shreeshas95 0:f016e9e8d48b 45 #define COM_MNG_TMTC_SIGNAL_ADF_NSD 0x02
shreeshas95 0:f016e9e8d48b 46 #define COM_MNG_TMTC_SIGNAL_ADF_SD 0x03
shreeshas95 0:f016e9e8d48b 47
shreeshas95 0:f016e9e8d48b 48 // COM_MNG_TMTC
shreeshas95 2:2caf2a9a13aa 49 #define COM_PA_COOLING_TIME_LIMIT 20
shekhar 8:d1951bbdcdd8 50
shreeshas95 2:2caf2a9a13aa 51 // call sign
shreeshas95 2:2caf2a9a13aa 52 #define PSC_CALLSIGN 0x00
shreeshas95 2:2caf2a9a13aa 53 #define APID_CALLSIGN 0x00
shekhar 8:d1951bbdcdd8 54
shreeshas95 2:2caf2a9a13aa 55 // max value of telecommands in a tcl
shreeshas95 2:2caf2a9a13aa 56 #define TCL_OVERFLOW_CONSTANT 256
shreeshas95 2:2caf2a9a13aa 57
shekhar 8:d1951bbdcdd8 58 // starting value of packet sequence count at each pass
shreeshas95 0:f016e9e8d48b 59 #define PSC_START_VALUE 1
shekhar 8:d1951bbdcdd8 60
shreeshas95 0:f016e9e8d48b 61 // APID list
shreeshas95 0:f016e9e8d48b 62 #define APID_BAE 1
shreeshas95 0:f016e9e8d48b 63 #define APID_CDMS 2
shreeshas95 0:f016e9e8d48b 64 #define APID_SPEED 3
shekhar 8:d1951bbdcdd8 65
shreeshas95 0:f016e9e8d48b 66 // HIGH PRIORITY TC - priority list
shreeshas95 0:f016e9e8d48b 67 // not correct values here
shreeshas95 0:f016e9e8d48b 68 #define HPTC1 5
shreeshas95 0:f016e9e8d48b 69 #define HPTC2 6
shreeshas95 0:f016e9e8d48b 70 // Add more entries above
shekhar 8:d1951bbdcdd8 71
shreeshas95 0:f016e9e8d48b 72 // SIZE of tc in bytes
shreeshas95 0:f016e9e8d48b 73 #define TC_SHORT_SIZE 11
shreeshas95 0:f016e9e8d48b 74 #define TC_LONG_SIZE 135
shekhar 8:d1951bbdcdd8 75
shreeshas95 0:f016e9e8d48b 76 // TMID list
shreeshas95 0:f016e9e8d48b 77 #define TMID_ACK_L1 0xA
shreeshas95 0:f016e9e8d48b 78
shreeshas95 0:f016e9e8d48b 79 // OBOSC SERVICE SUBTYPE
shreeshas95 0:f016e9e8d48b 80 #define OBOSC_SUB_DISABLE 0x01
shreeshas95 0:f016e9e8d48b 81 #define OBOSC_SUB_RETRY 0x05
shekhar 8:d1951bbdcdd8 82 #define OBOSC_SUB_REP_TCL_D 0x06
shekhar 8:d1951bbdcdd8 83 #define OBOSC_SUB_REP_TCL 0x08
shreeshas95 0:f016e9e8d48b 84 #define OBOSC_SUB_REP_LE 0x0F
shreeshas95 0:f016e9e8d48b 85 #define OBOSC_SUB_RESET 0x07
shekhar 8:d1951bbdcdd8 86
shreeshas95 3:6c81fc8834e2 87 // PAYLOAD
shreeshas95 3:6c81fc8834e2 88 #define PAYLOAD_BUFFER_LENGTH 2190
shekhar 8:d1951bbdcdd8 89
shreeshas95 0:f016e9e8d48b 90 // ****************GLOBAL VARIABLES******************
shreeshas95 0:f016e9e8d48b 91 // DEBUG
shekhar 8:d1951bbdcdd8 92 //Serial gPC( USBTX, USBRX );
shekhar 8:d1951bbdcdd8 93 //DigitalOut gLEDR(LED_RED);
shekhar 8:d1951bbdcdd8 94 //DigitalOut gLEDG(LED_GREEN);
shreeshas95 0:f016e9e8d48b 95
shreeshas95 0:f016e9e8d48b 96 // COM_RX
shekhar 8:d1951bbdcdd8 97 //RawSerial RX1M( COM_RX_UART_TX, COM_RX_UART_RX );
shreeshas95 0:f016e9e8d48b 98 COM_RX_DATA_NODE *gRX_HEAD_DATA_NODE = NULL;
shreeshas95 0:f016e9e8d48b 99 COM_RX_DATA_NODE *gRX_CURRENT_DATA_NODE = NULL;
shreeshas95 2:2caf2a9a13aa 100 // uint8_t *gRX_CURRENT_PTR = NULL;
shreeshas95 0:f016e9e8d48b 101 uint32_t gRX_COUNT = 0;
shreeshas95 0:f016e9e8d48b 102 uint16_t gTOTAL_INCORRECT_SIZE_TC = 0x00;
shreeshas95 0:f016e9e8d48b 103 uint16_t gTOTAL_CRC_FAIL_TC = 0x00;
shreeshas95 2:2caf2a9a13aa 104 uint16_t gTOTAL_REPEATED_TC = 0x00;
shreeshas95 0:f016e9e8d48b 105
shreeshas95 0:f016e9e8d48b 106 // COMMON SPI
shekhar 8:d1951bbdcdd8 107 //SPI spi( SPI_MOSI, SPI_MISO, SPI_CLK );
shekhar 8:d1951bbdcdd8 108 //DigitalOut gCS_ADF(SPI_CS_ADF);
shekhar 8:d1951bbdcdd8 109 //DigitalOut gCS_SDC(SPI_CS_SDC);
shekhar 8:d1951bbdcdd8 110 //DigitalOut gCS_RTC(SPI_CS_RTC);
shekhar 8:d1951bbdcdd8 111 //Mutex SPI_mutex;
shreeshas95 0:f016e9e8d48b 112
shreeshas95 0:f016e9e8d48b 113 // TC LIST
shreeshas95 0:f016e9e8d48b 114 Base_tc* gHEAD_NODE_TCL = NULL;
shreeshas95 0:f016e9e8d48b 115 Base_tc* gLAST_NODE_TCL = NULL;
shreeshas95 2:2caf2a9a13aa 116 uint8_t gMASTER_STATE = TCL_STATE_INCOMPLETE;
shreeshas95 2:2caf2a9a13aa 117 uint16_t gFLAGS = 0x0000;
shreeshas95 0:f016e9e8d48b 118
shreeshas95 0:f016e9e8d48b 119 // COM_MNG_TMTC THREAD
shekhar 8:d1951bbdcdd8 120 //Thread* gCOM_MNG_TMTC_THREAD = NULL;
shekhar 8:d1951bbdcdd8 121 //Timeout gRX_TIMEOUT;
shekhar 8:d1951bbdcdd8 122 //Timeout gSESSION_TIMEOUT;
shreeshas95 0:f016e9e8d48b 123
shreeshas95 0:f016e9e8d48b 124 // COM_MNG_TMTC
shreeshas95 2:2caf2a9a13aa 125
shreeshas95 2:2caf2a9a13aa 126 // PA cooling timeout
shekhar 8:d1951bbdcdd8 127 //Timeout gCOM_PA_COOLING_TIMER;
shreeshas95 2:2caf2a9a13aa 128
shreeshas95 2:2caf2a9a13aa 129 // GS code for verification
shreeshas95 2:2caf2a9a13aa 130 const uint8_t gGSCODE[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
shreeshas95 2:2caf2a9a13aa 131
shreeshas95 0:f016e9e8d48b 132 uint8_t gTOTAL_VALID_TC = 0x00;
shreeshas95 0:f016e9e8d48b 133 // USE LAST_L1_ACK FOR GENERATING REPORT
shekhar 8:d1951bbdcdd8 134 uint8_t gLAST_L1_ACK[TM_SHORT_SIZE];
shekhar 8:d1951bbdcdd8 135 uint8_t gLAST_L1_ACK_BUFFER[TM_SHORT_SIZE];
shekhar 8:d1951bbdcdd8 136 uint8_t gOBOSC_PSC = PSC_START_VALUE;
shekhar 8:d1951bbdcdd8 137 Base_tc* gOBOSC_HEAD = NULL;
shreeshas95 3:6c81fc8834e2 138
shreeshas95 3:6c81fc8834e2 139 // SCIENCE_THREAD
shekhar 8:d1951bbdcdd8 140 //Thread* gSCIENCE_THREAD = NULL;
shreeshas95 4:104dd82c99b8 141 uint8_t gPAYLOAD_BUFFER[PAYLOAD_BUFFER_LENGTH];