sd 32 update
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE by
DefinitionsAndGlobals.h
00001 // **************DEFINITIONS********************* 00002 // COM_RX 00003 #define RX_TIMEOUT_LIMIT 0.5 00004 // #define COM_RX_UART_TX PTE20 00005 // #define COM_RX_UART_RX PTE21 00006 00007 // For serial port printing(SET BAUD RATE 1200) 00008 #define COM_RX_UART_TX USBTX 00009 #define COM_RX_UART_RX USBRX 00010 00011 // COMMON SPI 00012 #define SPI_MOSI PTE1 00013 #define SPI_MISO PTE3 00014 #define SPI_CLK PTE2 00015 #define SPI_CS_ADF PTA15 00016 #define SPI_CS_SDC PTE22 00017 #define SPI_CS_RTC PTE29 00018 00019 // COM_TX 00020 #define COM_TX_CONFIG_LIMIT 3 00021 #define COM_TX_TICKER_LIMIT 32 00022 00023 // ADF INTERRUPUT 00024 #define ADF_IRQ PTA14 00025 00026 // TC LIST 00027 #define TCL_STATE_INCOMPLETE 0x00 00028 #define TCL_STATE_ABORTED 0x03 00029 #define TCL_STATE_EXECUTING 0x04 00030 #define TCL_STATE_COMPLETED 0x05 00031 #define TCL_STATE_EXCEEDED_LIMIT 0x06 00032 00033 // LIST OF FLAGS 00034 #define UART_INT_FLAG 0x0001 00035 #define NEW_TC_RECEIVED 0x0002 00036 #define COM_SESSION_FLAG 0x0004 00037 #define COM_RX_FLAG 0x0008 00038 #define COM_MNG_TMTC_RUNNING_FLAG 0x0010 00039 #define COM_SESSION_VALIDITY 0x0020 00040 #define ALL_CRC_PASS_FLAG 0x0040 00041 #define COM_PA_HOT_FLAG 0x0080 00042 #define COM_TX_FLAG 0x0100 00043 #define COM_SESSION_TIMEOUT_FLAG 0x0200 00044 00045 // COM_MNG_TMTC THREAD 00046 #define SESSION_TIME_LIMIT 1500 00047 #define COM_MNG_TMTC_SIGNAL_UART_INT 0x01 00048 #define COM_MNG_TMTC_SIGNAL_ADF_NSD 0x02 00049 #define COM_MNG_TMTC_SIGNAL_ADF_SD 0x03 00050 00051 // COM_MNG_TMTC 00052 #define COM_PA_COOLING_TIME_LIMIT 20 00053 #define COM_MAX_TC_LIMIT 200 00054 #define TM_ACK_CODE_INDEX 2 00055 #define CRC_FAIL_NACK_CODE 0x01 00056 00057 // call sign 00058 #define PSC_CALLSIGN 0x00 00059 #define APID_CALLSIGN 0x00 00060 00061 // max value of telecommands in a tcl 00062 #define TCL_OVERFLOW_CONSTANT 256 00063 #define TM_OVERFLOW_CONSTANT 256 00064 00065 // starting value of packet sequence count at each pass 00066 #define PSC_START_VALUE 1 00067 00068 // APID list 00069 #define APID_COM 0 00070 #define APID_BAE 1 00071 #define APID_CDMS 2 00072 #define APID_SPEED 3 00073 00074 //SERVICE 00075 #define SERVICE_OBOSC 0xB 00076 #define SERVICE_OBSRS 0xF 00077 00078 // HIGH PRIORITY TC - priority list 00079 // not correct values here 00080 #define HPTC1 5 00081 #define HPTC2 6 00082 // Add more entries above 00083 00084 // SIZE of tc in bytes 00085 #define TC_SHORT_SIZE 11 00086 #define TC_LONG_SIZE 135 00087 00088 // TMID list 00089 #define TMID_ACK_L1 0xA 00090 #define TMID_ACK_L234 0xB 00091 #define TMID_TCL 0x7 00092 #define TMID_CALL_SIGN 0xE 00093 00094 // OBOSC SERVICE SUBTYPE 00095 #define OBOSC_TCL_MAX_SHORT_SIZE 11 00096 #define OBOSC_LONG_TC_FIRST_HALF_SIZE 67 00097 #define OBOSC_LONG_TC_SECOND_HALF_SIZE 68 00098 #define OBOSC_TCL_TAG_LONG_FIRST_HALF 0x10 00099 #define OBOSC_TCL_TAG_LONG_SECOND_HALF 0x11 00100 00101 #define OBOSC_SUB_DISABLE 0x01 00102 #define OBOSC_SUB_RETRY 0x05 00103 #define OBOSC_SUB_REP_TCLD 0x06 00104 #define OBOSC_SUB_REP_LE 0x0F 00105 #define OBOSC_SUB_RESET 0x07 00106 00107 // PAYLOAD 00108 #define PAYLOAD_BUFFER_LENGTH 2190 00109 00110 // ****************GLOBAL VARIABLES****************** 00111 // DEBUG 00112 Serial gPC( USBTX, USBRX ); 00113 DigitalOut gLEDR(LED_RED); 00114 DigitalOut gLEDG(LED_GREEN); 00115 00116 // COM_RX 00117 RawSerial RX1M( COM_RX_UART_TX, COM_RX_UART_RX ); 00118 COM_RX_DATA_NODE *gRX_HEAD_DATA_NODE = NULL; 00119 COM_RX_DATA_NODE *gRX_CURRENT_DATA_NODE = NULL; 00120 // uint8_t *gRX_CURRENT_PTR = NULL; 00121 uint32_t gRX_COUNT = 0; 00122 uint16_t gTOTAL_INCORRECT_SIZE_TC = 0x00; 00123 uint16_t gTOTAL_CRC_FAIL_TC = 0x00; 00124 uint16_t gTOTAL_REPEATED_TC = 0x00; 00125 00126 // COMMON SPI 00127 //SPI spi( SPI_MOSI, SPI_MISO, SPI_CLK ); 00128 DigitalOut gCS_ADF(SPI_CS_ADF); 00129 DigitalOut gCS_SDC(SPI_CS_SDC); 00130 DigitalOut gCS_RTC(SPI_CS_RTC); 00131 Mutex SPI_mutex; 00132 00133 // TC LIST 00134 Base_tc* gHEAD_NODE_TCL = NULL; 00135 Base_tc* gLAST_NODE_TCL = NULL; 00136 uint8_t gMASTER_STATE = TCL_STATE_INCOMPLETE; 00137 uint16_t gFLAGS = 0x0000; 00138 00139 // COM_MNG_TMTC THREAD 00140 Thread* gCOM_MNG_TMTC_THREAD = NULL; 00141 Timeout gRX_TIMEOUT; 00142 Timeout gSESSION_TIMEOUT; 00143 00144 // COM_MNG_TMTC 00145 00146 // PA cooling timeout 00147 Timeout gCOM_PA_COOLING_TIMEOUT; 00148 00149 // GS code for verification 00150 const uint8_t gGSCODE[] = {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 00151 00152 uint8_t gTOTAL_VALID_TC = 0x00; 00153 // USE LAST_L1_ACK FOR GENERATING REPORT 00154 uint8_t gLAST_TM[TM_LONG_SIZE]; 00155 uint8_t gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE; 00156 00157 // SCIENCE_THREAD 00158 Thread* gSCIENCE_THREAD = NULL; 00159 uint8_t gPAYLOAD_BUFFER[PAYLOAD_BUFFER_LENGTH]; 00160 00161 // CALL SIGN TM 00162 const uint8_t gCALL_SIGN_STRING[TM_SHORT_SIZE] = {0xE0, 0x00, 0x00, 0x00, 0x56, 0x55, 0x32, 0x4E, 0x43, 0x46, 0x00, 0xAC, 0x11};
Generated on Tue Jul 12 2022 10:59:21 by 1.7.2