
Compression code changed and RLY_TMTC pointers managed
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Revision 209:63e9c8f8b5d2, committed 2016-07-02
- Comitter:
- ee12b079
- Date:
- Sat Jul 02 14:54:52 2016 +0000
- Parent:
- 205:d2ac4580960d
- Child:
- 210:f4acf895b598
- Commit message:
- Merging in process
Changed in this revision
--- a/DefinitionsAndGlobals.h Sat Jul 02 14:25:11 2016 +0000 +++ b/DefinitionsAndGlobals.h Sat Jul 02 14:54:52 2016 +0000 @@ -22,18 +22,17 @@ #define COM_TX_CONFIG_LIMIT 3 #define COM_TX_TICKER_LIMIT 32 -// ADF INTERRUPUT +// ADF INTERRUPT #define ADF_IRQ PTA14 - //I2C - Payload to CDMS (need to change while using CDMS hardware); -I2C master(PIN32,PIN31); -DigitalIn PYLD_I2C_Int(PTC13); -DigitalOut PYLD_I2C_GPIO(PTC1); - + I2C master(PIN32,PIN31); + DigitalIn PL_I2C_Intr(PTC13); + DigitalOut PL_I2C_GPIO(PTC1); + //I2C - CDMS to BAE -DigitalIn BAE_I2C_GPIO(PIN39); -DigitalOut CDMS_I2C_GPIO(PIN67); + DigitalIn BAE_I2C_GPIO(PIN39); + DigitalOut CDMS_I2C_GPIO(PIN67); // TC LIST #define TCL_STATE_INCOMPLETE 0x00 @@ -53,6 +52,15 @@ #define COM_PA_HOT_FLAG 0x0080 #define COM_TX_FLAG 0x0100 #define COM_SESSION_TIMEOUT_FLAG 0x0200 + #define COM_AUTO_POWER_OFF_BAE_FLAG 0x0400 + #define BAE_SW_EN_FLAG 0x0800 + #define RF_SW_STATUS_FLAG 0x1000 + #define COM_INIT_STATUS_FLAG 0x2000 + #define COM_TX_STATUS_FLAG 0x4000 + +//RF relay STATUS + #define RF_COM_TX 0 + #define RF_BCN 1 // COM_MNG_TMTC THREAD #define SESSION_TIME_LIMIT 1500 @@ -122,7 +130,22 @@ #define PAY_SPI_MISO PTE19 #define PAY_SPI_CLK PTE17 #define PAY_SPI_CS PTE16 + +//BEACON + #define BCN_APID_SOURCE 0x41 + #define BCN_SERVICE 0x81 +//BAE + #define BAE_APID_SOURCE 0x81 + #define BAE_SERVICE 0x81 + #define BAE_POWER_ON_PID 0x13 + #define BAE_POWER_OFF_PID 0x23 + #define BAE_RESET_PID 0x33 + +//RF RELAY + #define RF_RELAY_CNTRL_TX PTA7 + #define RF_RELAY_CNTRL_BCN PTA12 + // ****************GLOBAL VARIABLES****************** // DEBUG @@ -147,6 +170,17 @@ DigitalOut gCS_RTC(SPI_CS_RTC); Mutex SPI_mutex; +//I2C +Mutex BAE_I2C_mutex; + +//RF Relay +DigitalOut RF_SW_CNTRL_BCN(RF_RELAY_CNTRL_BCN); +DigitalOut RF_SW_CNTRL_TX(RF_RELAY_CNTRL_TX); + +//COM_RX +DigitalOut COM_RX_CNTRL(PIN72); +DigitalOut COM_TX_CNTRL(PIN56); + // TC LIST Base_tc* gHEAD_NODE_TCL = NULL; Base_tc* gLAST_NODE_TCL = NULL; @@ -160,6 +194,8 @@ // COM_MNG_TMTC + + // PA cooling timeout Timeout gCOM_PA_COOLING_TIMEOUT; @@ -177,16 +213,90 @@ uint8_t gPAYLOAD_BUFFER[PAYLOAD_BUFFER_LENGTH] = {0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x41}; RtosTimer *PL_wo_dma; + // CALL SIGN TM const uint8_t gCALL_SIGN_STRING[TM_SHORT_SIZE] = {0xE0, 0x00, 0x00, 0x00, 0x56, 0x55, 0x32, 0x4E, 0x43, 0x46, 0x00, 0xAC, 0x11}; // CDMS HK +uint8_t CDMS_STANDBY; +uint8_t CDMS_HEALTH_DATA[128]; +uint8_t CDMS_RAM[59]; +uint16_t GPIO_STATUS; +uint8_t CDMS_HK_MAIN_STATUS; +uint8_t COMRX_STATUS; +uint8_t RTC_FAULTCOUNT; +uint16_t SD_FAULTCOUNT; +uint8_t SD_STATUS; +uint8_t BAE_FAULTCOUNT; +uint8_t BAE_STATUS; +uint8_t PL_STATUS; +uint16_t PL_FAULTCOUNT; +bool BAE_HK_I2C; +uint8_t RTC_STATUS; +float RSSI_volatge; + CDMS_HK_actual actual_data; CDMS_HK_quant quant_data; CDMS_HK_min_max min_max_data; bool firstCount=true; +//GPIO PINS +DigitalIn V_A_PGOOD (PIN88); +DigitalIn V_B_PGOOD_1 (PIN6); +DigitalIn V_B_PGOOD_2 (PIN7); +DigitalIn V_C_PGOOD (PIN54); +DigitalIn COMRX_OC_FAULT (PIN68); +DigitalIn COMTX_OC_FAULT (PIN69); +DigitalIn BAE_OC_FAULT (PIN92); +DigitalIn PL_GPIO_1_STATUS (PIN71); +DigitalIn PL_GPIO_2_STATUS (PIN81); +DigitalIn PL_GPIO_3_STATUS (PIN80); +DigitalIn PL_BEE_SW_OC_FAULT (PIN4); +DigitalIn PL_EPS_LATCH_SW_OC_FAULT (); +DigitalIn V_C_EN_STATUS (); +DigitalIn V_D_EN_STATUS (); + + +DigitalIn SD_OC_FAULT (PIN90); +DigitalOut SD_SW_EN_DS (PIN97); +DigitalOut BAE_SW_EN_DS (PIN47); +DigitalOut PL_SW_EN_DS (PIN73); + //SD HK uint32_t FSC_CURRENT[6]; uint32_t FSC_LAST[6]; -uint8_t SD_SW_EN_DS; \ No newline at end of file +uint8_t SD_RD_ERROR; + +//Time's +uint32_t TIME_LATEST_RTC; +uint32_t TIME_LATEST_I2C_BAE; +uint32_t TIME_LATEST_I2C_SPEED; +uint32_t TIME_LATEST_SD_WR; +uint32_t TIME_LATEST_SD_RD; +uint32_t TIME_LATEST_SPI_SPEED; + +//Counter's +uint16_t CDMS_I2C_ERR_SPEED_COUNTER; +uint16_t CDMS_I2C_ERR_BAE_COUNTER; +uint16_t CDMS_HK_MAIN_COUNTER; +uint16_t COMRX_RESET_COUNTER; +uint16_t PL_MAIN_COUNTER; +uint16_t PL_RCV_SC_DATA_COUNTER; + +//CDMS RAM parameters +uint8_t PL_INIT_STATUS; +uint8_t PL_MAIN_STATUS; +uint8_t PL_LOW_POWER; +uint8_t PL_STATE; +uint8_t PL_RCV_SC_DATA_STATUS; +uint8_t COM_SESSION; +uint8_t COM_RX; +uint8_t RF_SW_STATUS; +uint8_t COM_TX; +uint8_t COM_TX_STATUS; +uint8_t COM_MNG_TMTC; +uint8_t CDMS_STANDBY_HK; +uint8_t CDMS_STANDBY_PL; +uint8_t CDMS_INIT_STATUS; +uint8_t CDMS_HK_STATUS; +uint8_t CDMS_RTC_BL; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FMS_all.h Sat Jul 02 14:54:52 2016 +0000 @@ -0,0 +1,156 @@ + +void P_PL_INIT(); +void P_PL_MAIN(); +void P_COM_INIT(); +void P_CDMS_HK_MAIN(); +void P_PL_RCV_SC_DATA(); +void P_CDMS_INIT_SD(); +void CDMS_SD_SW_ON(); +void CDMS_SD_SW_OFF(); +void SW_ON_BAE(); +void SW_OFF_BAE(); +void SW_ON_PL_BEE(); +void SW_OFF_PL_BEE(); +void SW_ON_PL_EPS(); +void SW_OFF_PL_EPS(); +void SW_ON_V_A_EN(); +void SW_OFF_V_A_EN(); +void RST_SD(); +void RST_BAE(); +void RST_PL_BEE(); +void RST_HK_COUNTER(); +uint8_t CDMS_RD_SD_HK(uint8_t *); +void CDMS_INTERNAL_RESET(); + +void P_PL_INIT() +{ + +} + +void P_PL_MAIN() +{ + +} + +void P_COM_INIT() +{ + +} + +void P_CDMS_HK_MAIN() +{ + //FCTN_CDMS_HK_MAIN(); +} + +void P_PL_RCV_SC_DATA() +{ + +} + +void P_CDMS_INIT_SD() +{ + FCTN_CDMS_SD_INIT(); +} + +void CDMS_SD_SW_ON() +{ + SD_SW_EN_DS = 0; //powering on SD +} + +void CDMS_SD_SW_OFF() +{ + SD_SW_EN_DS = 0; //powering on SD +} + +void SW_ON_BAE() +{ + BAE_SW_EN_DS = 0; //Power ON BAE +} + +void SW_OFF_BAE() +{ + BAE_SW_EN_DS = 1; //Switch OFF BAE +} + +void SW_ON_PL_BEE() +{ + PL_SW_EN_DS = 0; //Power ON PL +} + +void SW_OFF_PL_BEE() +{ + PL_SW_EN_DS = 1; // switching OFF PL +} + +void SW_ON_PL_EPS() +{ + +} + +void SW_OFF_PL_EPS() +{ + +} + +void SW_ON_V_A_EN() +{ + +} + +void SW_OFF_V_A_EN() +{ + +} + +void RST_SD() +{ + SD_SW_EN_DS = 1; //switching off SD card + wait_ms(10); + SD_SW_EN_DS = 0; + FCTN_CDMS_SD_INIT(); +} + +void RST_BAE() +{ + BAE_SW_EN_DS = 1; //Switch OFF BAE + wait_ms(10); + BAE_SW_EN_DS = 0; //Switch ON BAE +} + +void RST_PL_BEE() +{ + PL_SW_EN_DS = 1; // switching OFF PL + wait_ms(10); + PL_SW_EN_DS = 0; // Switch ON PL +} + +void RST_HK_COUNTER() +{ + firstCount = true; +} + +uint8_t CDMS_RD_SD_HK(uint8_t *sd_statusbits) +{ + uint8_t p; + uint8_t ACK; + if(SD_SW_EN_DS != DEVICE_POWERED) + { + ACK = 0x89; + SD_RD_ERROR = 1; + //Generate TM + } + else + { + p = disk_read_statusbits(sd_statusbits); + if(p == 0) + ACK = 0xA0; + else + ACK = 0x89; + } + return ACK; +} + +void CDMS_INTERNAL_RESET() +{ + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/P_COM_INIT.h Sat Jul 02 14:54:52 2016 +0000 @@ -0,0 +1,11 @@ +#define P_COM_INIT {\ + gFLAGS = gFLAGS | COM_INIT_STATUS_FLAG;\ + RF_SW_CNTRL_BCN = 1;\ + Thread::wait(25);\ + RF_SW_CNTRL_BCN = 0;\ + gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\ + //COM_RX_CNTRL = 0;\ + Thread::wait(200);\ + COM_RX_CNTRL = 1;\ + gFLAGS = gFLAGS & (~COM_INIT_STATUS_FLAG);\ +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RESET_functions.h Sat Jul 02 14:54:52 2016 +0000 @@ -0,0 +1,39 @@ +DigitalOut pwr_comrx (PIN72); + +void RESET_COMRX(); +void RESET_RTC(); + +void RESET_COMRX() +{ + pwr_comrx = 0; + wait_ms(10); + pwr_comrx =1; +} + +void RESET_RTC() +{ + gCS_RTC=1; + gCS_RTC=0; + spi.write(0x81); //register address with write flag + spi.write(0x80);//enabling stop bit in the seconds register + + gCS_RTC=1; + gCS_RTC=0; + spi.write(0x81); + spi.write(0x00);//disabling the stop bit to restart the oscillator + + wait(4000); + //clearing the halt bit + gCS_RTC=1; + gCS_RTC=0; + spi.write(0x8C); + spi.write(0x00); + + //clearing the OF bit + gCS_RTC=1; + gCS_RTC=0; + spi.write(0x8F); + spi.write(0x00); +} + +
--- a/Structures.h Sat Jul 02 14:25:11 2016 +0000 +++ b/Structures.h Sat Jul 02 14:54:52 2016 +0000 @@ -33,6 +33,7 @@ #define TC_STATE_UNEXECUTED 0x00 #define TC_STATE_SUCCESSFULLY_EXECUTED 0x01 #define TC_STATE_EXECUTION_FAILED 0x02 +#define TC_STATE_EXECUTION_UNKNOWN 0x03 #define TC_STATE_DISABLED 0x04 #define TC_STATE_MARKED_RETRY 0x05
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEST_PL.h Sat Jul 02 14:54:52 2016 +0000 @@ -0,0 +1,512 @@ +//F11 to exit full screen mode +/*--------------------------------------------------------------------------- + Testing PL_MAIN +----------------------------------------------------------------------------*/ + + +/* Testing as per the flow chart */ +/* columns of the array schedule1[][] correspond to Year,Month,Day,Hours,Minutes,Seconds,SID and EXEC_STATUS in integer formats*/ +Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr); + +extern uint8_t schedule1[32][8]= + { + {0,1,1,0,0,15,3,3}, + {0,1,1,0,0,45,2,3}, + {0,1,1,0,1,00,1,3}, + {0,1,1,0,1,25,0,3}, + {0,1,1,0,2,10,3,3}, + {0,1,1,0,1,50,2,3}, + {0,1,1,0,2, 0,2,3}, + {0,1,1,0,2,10,2,3}, + {0,1,1,0,2,20,2,0}, + {0,1,1,0,2,30,2,3}, + + {0,1,1,0,2,50,0,1}, + {0,1,1,0,4,10,3,3}, + {0,1,1,0,5,30,3,3}, + {0,1,1,0,4,15,2,3}, + {0,1,1,0,4,10,1,0}, + {0,1,1,0,3,10,2,3}, + {0,1,1,0,4,10,3,3}, + {0,1,1,0,5,10,0,3}, + {0,1,1,0,6,10,1,3}, + {0,1,1,0,6,20,1,2}, + + {0,1,1,0,1,40,2,3}, + {0,1,1,0,1,20,3,1}, + {0,1,1,0,1,30,3,3}, + {0,1,1,0,1,10,2,1}, + {0,1,1,0,0, 0,0,0}, + {0,1,1,0,0, 0,0,0}, + {0,1,1,0,0, 0,0,0}, + {0,1,1,0,0, 0,0,0}, + {0,1,1,0,0, 0,0,0}, + {0,1,1,0,0, 0,0,0}, + + {0,1,1,0,0, 0,0,0}, + {0,1,1,0,0, 0,0,0}, + }; + +void convert(Base_tc* test_tc) +{ + for(uint8_t k=3;k<=127;k+=4) + { + /*-----------1st byte of a block----------*/ + test_tc->TC_string[k] &= 0x00; + //setting Year (2 bits) + //test_tc->TC_string[k] &= (~0xC0); + test_tc->TC_string[k] |= ((schedule1[(k-3)/4][0] & 0x03)<<6); + + //setting Month (4 bits) + //test_tc->TC_string[k] &= (~0x3C); + test_tc->TC_string[k] |= ((schedule1[(k-3)/4][1] & 0x0F)<<2); + + //setting first two bits(MSB) of Day + //test_tc->TC_string[k] &= (~0x03); + test_tc->TC_string[k] |= ((schedule1[(k-3)/4][2] & 0x18)>>3); + /*------------end of 1st byte-------------*/ + + /*-----------2nd byte of a block----------*/ + test_tc->TC_string[k+1] &= 0x00000000; + //setting remaining 3 bits of Day + //test_tc->TC_string[k+1] &= (~0xE0); + test_tc->TC_string[k+1] |= ((schedule1[(k-3)/4][2] & 0x07)<<5); + + //setting Hours (5 bits) + //test_tc->TC_string[k+1] &= (~0x1F); + test_tc->TC_string[k+1] |= ((schedule1[(k-3)/4][3] & 0x1F)); + /*------------end of 2nd byte-------------*/ + + /*-----------3rd byte of a block----------*/ + test_tc->TC_string[k+2] &= 0x00000000; + //setting Minutes (6 bits) + //test_tc->TC_string[k+2] &= (~0xFC); + test_tc->TC_string[k+2] |= ((schedule1[(k-3)/4][4] & 0x3F)<<2); + + //setting first 2 bits(MSB) of Seconds + //test_tc->TC_string[k+2] &= (~0x03); + test_tc->TC_string[k+2] |= ((schedule1[(k-3)/4][5] & 0x30)>>4); + /*------------end of 3rd byte-------------*/ + + /*-----------4th byte of a block----------*/ + test_tc->TC_string[k+3] &= 0x00; + //setting remaining 4 bits of Seconds + //test_tc->TC_string[k+3] &= (~0xF0); + test_tc->TC_string[k+3] |= ((schedule1[(k-3)/4][5] & 0x0F)<<4); + + //setting STATE_ID (2 bits) + //test_tc->TC_string[k+3] &= (~0x0C); + test_tc->TC_string[k+3] |= ((schedule1[(k-3)/4][6] & 0x03)<<2); + + //setting EXEC_STATUS (2 bits) + //test_tc->TC_string[k+3] &= (~0x03); + test_tc->TC_string[k+3] |= ((schedule1[(k-3)/4][7] & 0x03)); + /*------------end of 4th byte-------------*/ + } +} +/*void test_schedule_1(Base_tm *test_tm_ptr) +{ + Base_tc *test_tc = new Long_tc; + test_tc->next_TC = NULL; + test_tc->TC_string[0] = 0x01; + test_tc->TC_string[1] = 0xB2; + test_tc->TC_string[2] = 0x71; + convert(test_tc); + test_tc->TC_string[131] = 0x00; + test_tc->TC_string[132] = 0x00; + uint16_t crc16 = crc16_gen(test_tc->TC_string,133); + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8; + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF); + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc); +} + +void test_schedule_2(Base_tm *test_tm_ptr) +{ + Base_tc *test_tc = new Long_tc; + test_tc->next_TC = NULL; + test_tc->TC_string[0] = 0x01; + test_tc->TC_string[1] = 0xB2; + test_tc->TC_string[2] = 0x72; + convert(test_tc); + test_tc->TC_string[131] = 0x00; + test_tc->TC_string[132] = 0x00; + uint16_t crc16 = crc16_gen(test_tc->TC_string,133); + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8; + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF); + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc); +} + +void test_schedule_3(Base_tm *test_tm_ptr) +{ + Base_tc *test_tc = new Long_tc; + test_tc->next_TC = NULL; + test_tc->TC_string[0] = 0x01; + test_tc->TC_string[1] = 0xB2; + test_tc->TC_string[2] = 0x73; + convert(test_tc); + test_tc->TC_string[131] = 0x00; + test_tc->TC_string[132] = 0x00; + uint16_t crc16 = crc16_gen(test_tc->TC_string,133); + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8; + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF); + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc); +} + +void test_schedule_4(Base_tm *test_tm_ptr) +{ + Base_tc *test_tc = new Long_tc; + test_tc->next_TC = NULL; + test_tc->TC_string[0] = 0x01; + test_tc->TC_string[1] = 0xB2; + test_tc->TC_string[2] = 0x74; + convert(test_tc); + test_tc->TC_string[131] = 0x00; + test_tc->TC_string[132] = 0x00; + uint16_t crc16 = crc16_gen(test_tc->TC_string,133); + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8; + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF); + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc); +} + +void test_schedule_5(Base_tm *test_tm_ptr) +{ + Base_tc *test_tc = new Long_tc; + test_tc->next_TC = NULL; + test_tc->TC_string[0] = 0x01; + test_tc->TC_string[1] = 0xB2; + test_tc->TC_string[2] = 0x75; + convert(test_tc); + test_tc->TC_string[131] = 0x00; + test_tc->TC_string[132] = 0x00; + uint16_t crc16 = crc16_gen(test_tc->TC_string,133); + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8; + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF); + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc); +} + +void test_schedule_6(Base_tm *test_tm_ptr) +{ + Base_tc *test_tc = new Long_tc; + test_tc->next_TC = NULL; + test_tc->TC_string[0] = 0x01; + test_tc->TC_string[1] = 0xB2; + test_tc->TC_string[2] = 0x76; + convert(test_tc); + test_tc->TC_string[131] = 0x00; + test_tc->TC_string[132] = 0x00; + uint16_t crc16 = crc16_gen(test_tc->TC_string,133); + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8; + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF); + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc); +} + +void test_schedule_F(Base_tm *test_tm_ptr) +{ + Base_tc *test_tc = new Long_tc; + test_tc->next_TC = NULL; + test_tc->TC_string[0] = 0x01; + test_tc->TC_string[1] = 0xB2; + test_tc->TC_string[2] = 0x7F; + convert(test_tc); + test_tc->TC_string[131] = 0x00; + test_tc->TC_string[132] = 0x00; + uint16_t crc16 = crc16_gen(test_tc->TC_string,133); + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8; + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF); + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc); +}*/ +#define test_schedule_1(test_tm_ptr) {\ + Base_tc *test_tc = NULL;\ + if(!(test_tc = new Long_tc))\ + {\ + gPC.printf("\n\rError: out of memory");\ + return;\ + }\ + test_tc->next_TC = NULL;\ + test_tc->TC_string[0] = 0x01;\ + test_tc->TC_string[1] = 0xB2;\ + test_tc->TC_string[2] = 0x71;\ + convert(test_tc);\ + test_tc->TC_string[131] = 0x00;\ + test_tc->TC_string[132] = 0x00;\ + uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\ + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ +} +#define test_schedule_2(test_tm_ptr) {\ + Base_tc *test_tc = new Long_tc;\ + test_tc->next_TC = NULL;\ + test_tc->TC_string[0] = 0x01;\ + test_tc->TC_string[1] = 0xB2;\ + test_tc->TC_string[2] = 0x72;\ + convert(test_tc);\ + test_tc->TC_string[131] = 0x00;\ + test_tc->TC_string[132] = 0x00;\ + uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\ + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ +} +#define test_schedule_3(test_tm_ptr) {\ + Base_tc *test_tc = new Long_tc;\ + test_tc->next_TC = NULL;\ + test_tc->TC_string[0] = 0x01;\ + test_tc->TC_string[1] = 0xB2;\ + test_tc->TC_string[2] = 0x73;\ + convert(test_tc);\ + test_tc->TC_string[131] = 0x00;\ + test_tc->TC_string[132] = 0x00;\ + uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\ + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ +} +#define test_schedule_4(test_tm_ptr) {\ + Base_tc *test_tc = new Long_tc;\ + test_tc->next_TC = NULL;\ + test_tc->TC_string[0] = 0x01;\ + test_tc->TC_string[1] = 0xB2;\ + test_tc->TC_string[2] = 0x74;\ + convert(test_tc);\ + test_tc->TC_string[131] = 0x00;\ + test_tc->TC_string[132] = 0x00;\ + uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\ + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ +} +#define test_schedule_5(test_tm_ptr) {\ + Base_tc *test_tc = new Long_tc;\ + test_tc->next_TC = NULL;\ + test_tc->TC_string[0] = 0x01;\ + test_tc->TC_string[1] = 0xB2;\ + test_tc->TC_string[2] = 0x75;\ + convert(test_tc);\ + test_tc->TC_string[131] = 0x00;\ + test_tc->TC_string[132] = 0x00;\ + uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\ + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ +} +#define test_schedule_6(test_tm_ptr) {\ + Base_tc *test_tc = new Long_tc;\ + test_tc->next_TC = NULL;\ + test_tc->TC_string[0] = 0x01;\ + test_tc->TC_string[1] = 0xB2;\ + test_tc->TC_string[2] = 0x76;\ + convert(test_tc);\ + test_tc->TC_string[131] = 0x00;\ + test_tc->TC_string[132] = 0x00;\ + uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\ + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ +} +#define test_schedule_F(test_tm_ptr) {\ + Base_tc *test_tc = NULL;\ + if(!(test_tc = new Long_tc))\ + {\ + gPC.printf("\n\rError: out of memory");\ + return;\ + }\ + test_tc->next_TC = NULL;\ + test_tc->TC_string[0] = 0x01;\ + test_tc->TC_string[1] = 0xB2;\ + test_tc->TC_string[2] = 0x7F;\ + for(uint8_t i=3;i<133;i++)\ + {\ + test_tc->TC_string[i] = 0;\ + }\ + uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\ + test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ + test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ + test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ +} +void send_verify_0xF(Base_tm* test_tm_ptr) +{ + uint32_t temp_blk[4] = {0}; + uint8_t j=0,tm_data_err_count=0; + Base_tm* temp_ptr; + test_schedule_F(test_tm_ptr); + //gPC.printf("\n\r----------------------------------------------------------------------------------"); + //gPC.printf("\n\rTC_Schedule_Report(0xF):\n"); + temp_ptr=test_tm_ptr; + while(temp_ptr!=NULL) + { + /*gPC.printf("\n\rTM[0] = %02X",temp_ptr->TM_string[0]); + gPC.printf("\tTM[1] = %02X",temp_ptr->TM_string[1]); + gPC.printf("\tTM[2] = %02X",temp_ptr->TM_string[2]); + gPC.printf("\tTM[3] = %02X",temp_ptr->TM_string[3]);*/ + for(uint8_t i=0;i<=112;i+=16) + { + temp_blk[0] &= 0x00000000; + temp_blk[0] |= (((uint32_t)(temp_ptr->TM_string[i+4]))&0x000000FF)<<24; + temp_blk[0] |= (((uint32_t)(temp_ptr->TM_string[i+5]))&0x000000FF)<<16; + temp_blk[0] |= (((uint32_t)(temp_ptr->TM_string[i+6]))&0x000000FF)<<8; + temp_blk[0] |= (((uint32_t)(temp_ptr->TM_string[i+7]))&0x000000FF); + + temp_blk[1] &= 0x00000000; + temp_blk[1] |= (((uint32_t)(temp_ptr->TM_string[i+8]))&0x000000FF)<<24; + temp_blk[1] |= (((uint32_t)(temp_ptr->TM_string[i+9]))&0x000000FF)<<16; + temp_blk[1] |= (((uint32_t)(temp_ptr->TM_string[i+10]))&0x000000FF)<<8; + temp_blk[1] |= (((uint32_t)(temp_ptr->TM_string[i+11]))&0x000000FF); + + temp_blk[2] &= 0x00000000; + temp_blk[2] |= (((uint32_t)(temp_ptr->TM_string[i+12]))&0x000000FF)<<24; + temp_blk[2] |= (((uint32_t)(temp_ptr->TM_string[i+13]))&0x000000FF)<<16; + temp_blk[2] |= (((uint32_t)(temp_ptr->TM_string[i+14]))&0x000000FF)<<8; + temp_blk[2] |= (((uint32_t)(temp_ptr->TM_string[i+15]))&0x000000FF); + + temp_blk[3] &= 0x00000000; + temp_blk[3] |= (((uint32_t)(temp_ptr->TM_string[i+16]))&0x000000FF)<<24; + temp_blk[3] |= (((uint32_t)(temp_ptr->TM_string[i+17]))&0x000000FF)<<16; + temp_blk[3] |= (((uint32_t)(temp_ptr->TM_string[i+18]))&0x000000FF)<<8; + temp_blk[3] |= (((uint32_t)(temp_ptr->TM_string[i+19]))&0x000000FF); + + if(temp_blk[0]!=pl_block[(i/4)+j]) + tm_data_err_count++; + if(temp_blk[1]!=pl_block[(i/4)+j+1]) + tm_data_err_count++; + if(temp_blk[2]!=pl_block[(i/4)+j+2]) + tm_data_err_count++; + if(temp_blk[3]!=pl_block[(i/4)+j+3]) + tm_data_err_count++; + //gPC.printf("\n\r%03d-0x%08X\t%03d-0x%08X",(i/4)+j,temp_blk[0],(i/4)+1+j,temp_blk[1]); + //gPC.printf("\t%03d-0x%08X\t%03d-0x%08X\n",(i/4)+2+j,temp_blk[2],(i/4)+3+j,temp_blk[3]); + } + j+=32; + //gPC.printf("\n"); + temp_ptr = temp_ptr->next_TM; + } + if(tm_data_err_count!=0) + { + gPC.printf("\n\rTM Data(0xF) not matching pl_block!!!"); + gPC.printf("\n\rNumber of mismatches = %d",tm_data_err_count); + } + else if(tm_data_err_count==0) + { + gPC.printf("\n\rNo errors in TM Data(0xF)"); + } + //gPC.printf("\n\r----------------------------------------------------------------------------------"); +} +void verify_extracted(uint8_t c) +{ + uint8_t wrong_extracted=0; + uint8_t temp_extracted[8] = {0}; + for(uint8_t z=(32*(c-1));z<(32*c);z++) + { + temp_extracted[0] = (uint8_t)((pl_block[z]&0xC0000000)>>30); + temp_extracted[1] = (uint8_t)((pl_block[z]&0x3C000000)>>26); + temp_extracted[2] = (uint8_t)((pl_block[z]&0x03E00000)>>21); + temp_extracted[3] = (uint8_t)((pl_block[z]&0x001F0000)>>16); + temp_extracted[4] = (uint8_t)((pl_block[z]&0x0000FC00)>>10); + temp_extracted[5] = (uint8_t)((pl_block[z]&0x000003F0)>>4); + temp_extracted[6] = (uint8_t)((pl_block[z]&0x0000000C)>>2); + temp_extracted[7] = (uint8_t)((pl_block[z]&0x00000003)); + + for(uint8_t y=0;y<8;y++) + { + if(temp_extracted[y]!=schedule1[z-(32*(c-1))][y]) + wrong_extracted++; + } + } + if(wrong_extracted!=0) + { + gPC.printf("\n\rExtracted values do not match input values!!!"); + gPC.printf("\n\rNumber of wrong extracted values = %d",wrong_extracted); + wrong_extracted = 0; + } + else if(wrong_extracted==0) + gPC.printf("\n\rExtracted values are correct(0x%d)",c); +} +void test_pl_main() +{ + //uint32_t temp_pl_block[192] = {0}; + uint8_t wrong_modify=0,z; + Base_tm* test_tm_ptr; + //Base_tm* temp; + //for(z=0;z<192;z++) + // pl_block[z] = 0xFFFFFFFF; + //testing 0xF + send_verify_0xF(test_tm_ptr); + //for(z=0;z<192;z++) + // temp_pl_block[z] = pl_block[z]; + + //testing TC = 0x1,0x2...0x6 + uint8_t w =1; + for(uint8_t v=1;w<7;w++) + { + /*switch(v) + { + case 1: test_schedule_1(test_tm_ptr); + break; + case 2: test_schedule_2(test_tm_ptr); + break; + case 3: test_schedule_3(test_tm_ptr); + break; + case 4: test_schedule_4(test_tm_ptr); + break; + case 5: test_schedule_5(test_tm_ptr); + break; + case 6: test_schedule_6(test_tm_ptr); + break; + }*/ + if(v==1) + { + test_schedule_1(test_tm_ptr); + } + else if(v==2) + { + test_schedule_2(test_tm_ptr); + } + else if(v==3) + { + test_schedule_3(test_tm_ptr); + } + else if(v==4) + { + test_schedule_4(test_tm_ptr); + } + else if(v==5) + { + test_schedule_5(test_tm_ptr); + } + else if(v==6) + { + test_schedule_6(test_tm_ptr); + } + /*for(z=0;z<192;z++) + { + if((z>=((v-1)*32)) && (z<=((v*32)-1))) + z++; + else + { + if(temp_pl_block[z]!=pl_block[z]) + wrong_modify++; + } + } + if(wrong_modify!=0) + { + gPC.printf("\n\rWrong values of pl_block modified by TC = 0x%d",v); + gPC.printf("\n\rNumber of wrong modifications = %d",wrong_modify); + wrong_modify = 0; + } + else if(wrong_modify==0) + { + gPC.printf("\n\rTC(0x%d) updated pl_block correctly",v); + for(uint8_t i=0;i<=188;i+=4) + { + //gPC.printf("\n\r%03d-0x%08X\t%03d-0x%08X",(i),pl_block[i],(i)+1,pl_block[(i)+1]); + //gPC.printf("\t%03d-0x%08X\t%03d-0x%08X\n",(i)+2,pl_block[(i)+2],(i)+3,pl_block[(i)+3]); + } + }*/ + send_verify_0xF(test_tm_ptr); + verify_extracted(v); + //for(z=0;z<192;z++) + // temp_pl_block[z] = pl_block[z]; + wait(1); + } + gPC.printf("\n\rTesting TC_TM block processing complete"); +} \ No newline at end of file
--- a/cdms_rtc.h Sat Jul 02 14:25:11 2016 +0000 +++ b/cdms_rtc.h Sat Jul 02 14:54:52 2016 +0000 @@ -4,137 +4,118 @@ gCS_RTC=1; spi.format(8,0); spi.frequency(1000000); - //clearing the halt bit + //clearing the halt bit gCS_RTC=1; gCS_RTC=0; spi.write(0x8C); spi.write(0x00); - - //clearing the OF bit + + //clearing the OF bit gCS_RTC=1; gCS_RTC=0; spi.write(0x8F); spi.write(0x00); - + //century bits gCS_RTC=1; gCS_RTC=0; spi.write(0x80|0x03); spi.write(0x00); - - //Kick starting the oscillator + + //Kick starting the oscillator gCS_RTC=1; gCS_RTC=0; spi.write(0x81); //register address with write flag - spi.write(0x80);//enabling stop bit in the seconds register - + spi.write(0x80); //enabling stop bit in the seconds register + gCS_RTC=1; gCS_RTC=0; spi.write(0x81); - spi.write(0x00);//disabling the stop bit to restart the oscillator - + spi.write(0x00); //disabling the stop bit to restart the oscillator + + + gCS_RTC=1; + gCS_RTC=0; + spi.write(0x80); + spi.write(0x01); // set milliseconds value to 00 + gCS_RTC=1; + + gCS_RTC=0; + spi.write(0x81); + spi.write(0x01); //set seconds value to 00 + gCS_RTC=1; + + gCS_RTC=0; + spi.write(0x82); + spi.write(0x01);//set minutes value to 00 + gCS_RTC=1; + + gCS_RTC=0; + spi.write(0x83); + spi.write(0x23); //set the hours to 01 + gCS_RTC=1; + + gCS_RTC=0; + spi.write(0x84); + spi.write(0x01); //set day of the week to 01 + gCS_RTC=1; + + gCS_RTC=0; + spi.write(0x85); + spi.write(0x31); //set date of the month to 01 + gCS_RTC=1; + + gCS_RTC=0; + spi.write(0x86); + spi.write(0x12); //set month to 01 + gCS_RTC=1; + + gCS_RTC=0; + spi.write(0x87); + spi.write(0x01); //set year to 00(2000) + gCS_RTC=1; + gPC.puts("\r\nrtc initalised\r\n"); + SPI_mutex.unlock(); +} + +uint64_t FCTN_CDMS_RD_RTC() +{ + SPI_mutex.lock(); + uint8_t response; + + gCS_RTC=1; + gCS_RTC=0; + spi.write(0x0F); + response = (spi.write(0x00))&0x04; gCS_RTC=1; gCS_RTC=0; - spi.write(0x80); - spi.write(0x01); // set milliseconds value to 00 - gCS_RTC=1; - - gCS_RTC=0; - spi.write(0x81); - spi.write(0x01); //set seconds value to 00 - gCS_RTC=1; - - gCS_RTC=0; - spi.write(0x82); - spi.write(0x01);//set minutes value to 00 - gCS_RTC=1; - - gCS_RTC=0; - spi.write(0x83); - spi.write(0x23); //set the hours to 01 - gCS_RTC=1; - - gCS_RTC=0; - spi.write(0x84); - spi.write(0x01); //set day of the week to 01 - gCS_RTC=1; - - gCS_RTC=0; - spi.write(0x85); - spi.write(0x31); //set date of the month to 01 - gCS_RTC=1; - - gCS_RTC=0; - spi.write(0x86); - spi.write(0x12); //set month to 01 - gCS_RTC=1; - - gCS_RTC=0; - spi.write(0x87); - spi.write(0x01); //set year to 00(2000) - gCS_RTC=1; - gPC.puts("\n\r rtc initalised \n"); - SPI_mutex.unlock(); -} - -uint64_t FCTN_CDMS_RD_RTC() -{ - SPI_mutex.lock(); - uint8_t response; - //gPC.printf("\n\r Entered rtc\n"); + spi.write(0x00); //reading centiseconds register + response = spi.write(0x00); // read the value by sending dummy byte + uint8_t centiseconds = ((response&0xF0)>>4)*10+(response&0x0F)*1; + + response =spi.write(0x00); + uint8_t seconds = ((response&0x70)>>4)*10+(response&0x0F)*1; + + response =spi.write(0x00); + uint8_t minutes = ((response&0x70)>>4)*10+(response&0x0F)*1; + + response=spi.write(0x00); + uint8_t hours = ((response&0x30)>>4)*10+(response&0x0F)*1; + + uint8_t day =spi.write(0x00); + + response =spi.write(0x00); + uint8_t date = ((response&0x30)>>4)*10+(response&0x0F)*1; + + response =spi.write(0x00); + uint8_t month = ((response&0x10)>>4)*10+(response&0x0F)*1; + + response =spi.write(0x00); + uint8_t year = ((response&0xF0)>>4)*10+(response&0x0F)*1; + year = (year == 17)?0x00:(year == 18)?0x01:(year == 19)?0x02:(year == 20)?0x03:0x00; gCS_RTC=1; - gCS_RTC=0; - spi.write(0x00); //reading milliseconds register - response = spi.write(0x00); // read the value by sending dummy byte - uint8_t centiseconds = (uint8_t(response&0xF0)>>4)*10+uint8_t(response&0x0F)*1; - - gCS_RTC=1; - gCS_RTC=0; - spi.write(0x01); //reading seconds register - response =spi.write(0x01); - uint8_t seconds = ((response&0x70)>>4)*10+(response&0x0F)*1; - - gCS_RTC=1; - gCS_RTC=0; - spi.write(0x02); //reading minutes register - response =spi.write(0x01); - uint8_t minutes = ((response&0xF0)>>4)*10+(response&0x0F)*1; - - gCS_RTC=1; - gCS_RTC=0; - spi.write(0x03); //reading hours register - response=spi.write(0x01); - uint8_t hours = ((response&0x30)>>4)*10+(response&0x0F)*1; - - gCS_RTC=1; - gCS_RTC=0; - spi.write(0x04); //reading day's register - uint8_t day =spi.write(0x01); - - gCS_RTC=1; - gCS_RTC=0; - spi.write(0x05); //reading date register - response =spi.write(0x01); - uint8_t date = ((response&0x30)>>4)*10+(response&0x0F)*1; - - gCS_RTC=1; - gCS_RTC=0; - spi.write(0x06); //reading month registe - response =spi.write(0x01); - uint8_t month = ((response&0x10)>>4)*10+(response&0x0F)*1; - - gCS_RTC=1; - gCS_RTC=0; - spi.write(0x07); //reading year's registe - response =spi.write(0x01); - uint8_t year = ((response&0xF0)>>4)*10+(response&0x0F)*1; - gCS_RTC=1; - //sprintf(Time_stamp,"%02d%02d%02d%02d%02d%02d%02d%02d",year, month, date, day, hours, minutes, seconds, milliseconds ); - uint8_t Time_stamp[8] = {year, month, date, day, hours, minutes, seconds, centiseconds}; - for(int i= 0; i<8;i++); - //printf("%d\t",Time_stamp[i]); - //printf("read\r\n"); + uint64_t time; time = 0; time = time|(((uint64_t)(centiseconds&0x7F))); @@ -145,8 +126,8 @@ time = time|(((uint64_t)(month&0x07))<<29); time = time|(((uint64_t)(year&0x03))<<33); time = (time&0x00000007FFFFFFFF); - //gPC.printf("\n\r%x%x", (int)(time >> 32), (int)(time)); - //gPC.printf("\n\r0x%016llx\n\r", time); - return time; - SPI_mutex.unlock(); -} \ No newline at end of file + + SPI_mutex.unlock(); + return time; +} +
--- a/cdms_sd.h Sat Jul 02 14:25:11 2016 +0000 +++ b/cdms_sd.h Sat Jul 02 14:54:52 2016 +0000 @@ -1,6 +1,3 @@ - - - //SPI spi(PTE1, PTE3, PTE2); // MOSI,MISO, CLOCK microcontroller(in order) //DigitalOut cs_sd(PTE22); @@ -34,6 +31,7 @@ uint32_t LOG_FIRST =5001; uint32_t LOG_LAST=6000; uint32_t SD_MNG_SECT=7000; +uint16_t SD_LIB_WRITES = 0; extern uint8_t SD_INIT_FLAGS; @@ -43,8 +41,9 @@ int disk_write(const uint8_t *, uint64_t); int disk_read(uint8_t *, uint64_t); int disk_erase(int,int); +int disk_read_statusbits(uint8_t *); -uint32_t FCTN_SD_MNG(uint8_t); +void FCTN_SD_MNG(); int INCREMENT_SD_LIB(uint8_t); @@ -63,7 +62,6 @@ #define SDCARD_V2 2 #define SDCARD_V2HC 3 - int cdv; uint64_t sd_sectors(); uint64_t sectors; @@ -86,9 +84,7 @@ return 0; } - - -void FCTN_SD_MNGR(void) +void FCTN_SD_MNGR() { uint32_t fsc; uint32_t start_fsc; @@ -99,7 +95,7 @@ start_fsc=(uint32_t)(buffer[4]<<24)+(uint32_t)(buffer[5]<<16)+(uint32_t)(buffer[6]<<8)+(uint32_t)buffer[7]; FSC_CURRENT[1] = fsc; FSC_LAST[1] = start_fsc; - + fsc=(uint32_t)(buffer[8]<<24)+(uint32_t)(buffer[9]<<16)+(uint32_t)(buffer[10]<<8)+(uint32_t)buffer[11]; start_fsc=(uint32_t)(buffer[12]<<24)+(uint32_t)(buffer[13]<<16)+(uint32_t)(buffer[14]<<8)+(uint32_t)buffer[15]; FSC_CURRENT[2] = fsc; @@ -109,12 +105,12 @@ start_fsc=(uint32_t)(buffer[20]<<24)+(uint32_t)(buffer[21]<<16)+(uint32_t)(buffer[22]<<8)+(uint32_t)buffer[23]; FSC_CURRENT[3] = fsc; FSC_LAST[3] = start_fsc; - + fsc=(uint32_t)(buffer[24]<<24)+(uint32_t)(buffer[25]<<16)+(uint32_t)(buffer[26]<<8)+(uint32_t)buffer[27]; start_fsc=(uint32_t)(buffer[28]<<24)+(uint32_t)(buffer[29]<<16)+(uint32_t)(buffer[30]<<8)+(uint32_t)buffer[31]; FSC_CURRENT[4] = fsc; FSC_LAST[4] = start_fsc; - + fsc=(uint32_t)(buffer[32]<<24)+(uint32_t)(buffer[33]<<16)+(uint32_t)(buffer[34]<<8)+(uint32_t)buffer[35]; start_fsc=(uint32_t)(buffer[36]<<24)+(uint32_t)(buffer[37]<<16)+(uint32_t)(buffer[38]<<8)+(uint32_t)buffer[39]; FSC_CURRENT[5] = fsc; @@ -125,8 +121,10 @@ { uint32_t fsc; uint32_t start_fsc; + int i; uint8_t buffer[512]; - int i; + SD_MNG_SECT += SD_LIB_WRITES/(int)0xFFFF; + SD_LIB_WRITES = SD_LIB_WRITES%(int)0xFFFF; disk_read(buffer,SD_MNG_SECT); if(sid==0x01) { @@ -145,9 +143,14 @@ buffer[6]=(uint8_t) (start_fsc>>8 & 0xFF); buffer[7]=(uint8_t) (start_fsc & 0xFF); } + i = disk_write(buffer,SD_MNG_SECT); - FCTN_SD_MNGR(); - return i; + if(i == 0) + { + FSC_CURRENT[1] = fsc; + FSC_LAST[1] = start_fsc; + return i; + } } if(sid==0x02) { @@ -167,8 +170,12 @@ buffer[15]=(uint8_t) (start_fsc & 0xFF); } i = disk_write(buffer,SD_MNG_SECT); - FCTN_SD_MNGR(); - return i; + if(i == 0) + { + FSC_CURRENT[2] = fsc; + FSC_LAST[2] = start_fsc; + return i; + } } if(sid==0x03) { @@ -188,8 +195,12 @@ buffer[23]=(uint8_t) (start_fsc & 0xFF); } i = disk_write(buffer,SD_MNG_SECT); - FCTN_SD_MNGR(); - return i; + if(i == 0) + { + FSC_CURRENT[3] = fsc; + FSC_LAST[3] = start_fsc; + return i; + } } if(sid==0x04) { @@ -209,8 +220,12 @@ buffer[31]=(uint8_t) (start_fsc & 0xFF); } i = disk_write(buffer,SD_MNG_SECT); - FCTN_SD_MNGR(); - return i; + if(i == 0) + { + FSC_CURRENT[4] = fsc; + FSC_LAST[4] = start_fsc; + return i; + } } if(sid==0x05) { @@ -230,8 +245,12 @@ buffer[39]=(uint8_t) (start_fsc & 0xFF); } i = disk_write(buffer,SD_MNG_SECT); - FCTN_SD_MNGR(); - return i; + if(i == 0) + { + FSC_CURRENT[5] = fsc; + FSC_LAST[5] = start_fsc; + return i; + } } return -1; } @@ -247,7 +266,10 @@ block_number=SD_SCP_FIRST+fsc; result= disk_write(buffer,block_number); if(result == 0) - INCREMENT_SD_LIB(sid); + { + if(INCREMENT_SD_LIB(sid) == 0) + SD_LIB_WRITES++; + } return result; } if(sid==0x02) @@ -256,7 +278,10 @@ block_number= SD_SFF_AT_FIRST+fsc; result= disk_write(buffer,block_number); if(result == 0) - INCREMENT_SD_LIB(sid); + { + if(INCREMENT_SD_LIB(sid) == 0) + SD_LIB_WRITES++; + } return result; } if(sid==0x03) @@ -265,7 +290,10 @@ block_number= SD_SFF_BT_FIRST +fsc; result= disk_write(buffer,block_number); if(result == 0) - INCREMENT_SD_LIB(sid); + { + if(INCREMENT_SD_LIB(sid) == 0) + SD_LIB_WRITES++; + } return result; } if(sid==0x04) @@ -274,7 +302,10 @@ block_number=SD_HK_ARCH_FIRST +fsc; result= disk_write(buffer,block_number); if(result == 0) - INCREMENT_SD_LIB(sid); + { + if(INCREMENT_SD_LIB(sid) == 0) + SD_LIB_WRITES++; + } return result; } if(sid==0x05) @@ -283,7 +314,10 @@ block_number= LOG_FIRST +fsc; result= disk_write(buffer,block_number); if(result == 0) - INCREMENT_SD_LIB(sid); + { + if(INCREMENT_SD_LIB(sid) == 0) + SD_LIB_WRITES++; + } return result; } return 1; @@ -292,10 +326,10 @@ uint8_t SD_READ(uint8_t* buffer,uint32_t fsc,uint8_t sid) { FCTN_SD_MNGR(); + uint32_t block_number; + int result; if(SD_SW_EN_DS == 1) return 0x89; - uint32_t block_number; - int result; if(sid==0x01) { if(!(FSC_LAST[1]<=fsc && fsc<=FSC_CURRENT[1])){ @@ -609,11 +643,14 @@ if (cmd(24, block_number * cdv) != 0) { return 1; } - - // send the data block - write(buffer, 512); - //gPC.printf("Written Successfully bro \n"); - return 0; + + uint64_t temp; + int r = write(buffer, 512); + if(r == 0 ){ + temp = FCTN_CDMS_RD_RTC(); + TIME_LATEST_SD_RD = temp >> 7; + } + return r; } int write(const uint8_t*buffer, uint32_t length) @@ -651,11 +688,14 @@ { // set read address for single block (CMD17) if (cmd(17, block_number * cdv) != 0) { + SD_RD_ERROR = 1; return 1; } // receive the data read(buffer, 512); + uint64_t temp = FCTN_CDMS_RD_RTC(); + TIME_LATEST_SD_RD = temp >> 7; return 0; } @@ -691,4 +731,15 @@ } return 0; //normal return +} + +int disk_read_statusbits(uint8_t *buffer) +{ + if (cmd(17, 0) != 0) { + SD_RD_ERROR = 1; + return -1; + } + + // receive the data + return read(buffer,64); } \ No newline at end of file
--- a/i2c.h Sat Jul 02 14:25:11 2016 +0000 +++ b/i2c.h Sat Jul 02 14:54:52 2016 +0000 @@ -7,78 +7,156 @@ bool read_ack = false; const int addr_pl = 0x20<<1; //PL address const int addr_bae = 0x20; ///bae address -uint8_t rcv_isr = 0; +//uint8_t rcv_isr = 0; int count = 0; char PL_I2C_DATA[134];//Payload i2c array uint8_t PL_TM_SIZE;//size of data to bev read from i2c - -void FCTN_I2C_WRITE_PL(char *data2,uint8_t tc_len2) -{ - write_ack = master.write(addr_pl|0x00,data2,tc_len2);//address to be defined in payload - if(write_ack == 0) - {gPC.printf("\n\rData sent to PL \n");} - if(write_ack == 1) - { - gPC.printf("\n\rdata not sent\n"); - } -} +uint32_t pdirr1; +uint32_t pdirw1; -void FCTN_I2C_READ_PL(char *data,int length) -{ - PYLD_I2C_GPIO = 1; - //t_read.start(); +void I2C_busreset() +{ + PORTE->PCR[1] &= 0xfffffffb; //Enabling high slew rates for SDA and SCL lines + PORTE->PCR[0] &= 0xfffffffb; //Enabling high slew rates for SDA and SCL lines + I2C0->C1 &= 0x7f; //Disabling I2C module + SIM->SCGC4 &= 0xffffffbf; //Disabling clock to I2C module + SIM->SCGC4 |= 0x00000040; //Enabling clock to I2C module + I2C0->C1 |= 0x80; //Enabling I2C module + PORTE->PCR[1] |= 0x00000004; //Disabling high slew rates for SDA and SCL lines + PORTE->PCR[0] |= 0x00000004; //Disabling high slew rates for SDA and SCL lines + Thread::wait(1); //Wait for all I2C registers to be updates to their their values +} +bool FCTN_I2C_READ_PL(char *data,int length) // Returns 0 for success +{ + PL_I2C_GPIO = 1; read_ack = master.read(addr_pl|1,data,length); - //t_read.stop(); - - if(read_ack == 0) - gPC.printf("\n\rData received from PL \n"); - if (read_ack == 1) + Thread::wait(1); //as per tests Thread::wait not required on master side. But its safe to give 1ms + pdirr1=PTE->PDIR; + uint8_t i2c_count = 0; + if(read_ack == 0) //if read_ack says success, it may or may not be successful.Hence we check SCL and SDA + { + while(((pdirr1 & 0x03000000)!=0x03000000)&& i2c_count<10)//checking SCL and SDA for time=10ms + { + Thread::wait(1); + pdirr1=PTE->PDIR; + i2c_count++; + } + if(((pdirr1 & 0x03000000)==0x03000000))//if SCL and SDA are both high + { + gPC.printf("\n\rData received from BAE"); + } + else + { + I2C_busreset(); + read_ack = 1; + } + } + else if (read_ack == 1) { - gPC.printf("\n \r data not received \n"); + I2C_busreset(); } - PYLD_I2C_GPIO = 0; + PL_I2C_GPIO = 0; + i2c_count = 0; + return read_ack; + } - -int FCTN_I2C_READ(char *data,int length) +bool FCTN_I2C_WRITE_PL(char *data2,uint8_t tc_len2) // Returns 0 for success +{ + write_ack = master.write(addr_pl|0x00,data2,tc_len2);//address to be defined in payload + Thread::wait(1); //As per the tests Thread::wait is not required on master side but its safe to give 1ms + pdirw1=PTE->PDIR; + uint8_t i2c_count = 0; + if(write_ack == 0) + { + while(((pdirw1 & 0x03000000)!=0x03000000)&& i2c_count<10) + { + Thread::wait(1); + pdirw1=PTE->PDIR; + i2c_count++; + } + if(((pdirw1 & 0x03000000)==0x03000000)) + { + gPC.printf("\n\r Data sent"); + } + else + { + I2C_busreset(); + write_ack = 1; + } + } + if (write_ack == 1) + { + I2C_busreset(); + } + i2c_count = 0; + return write_ack; +} +bool FCTN_I2C_READ(char *data,int length) // Returns 0 for success { CDMS_I2C_GPIO = 1; - //t_read.start(); read_ack = master.read(addr_bae|1,data,length); - //t_read.stop(); - - if(read_ack == 0) - gPC.printf("\n\rData received from BAE \n"); - if (read_ack == 1) + Thread::wait(1); //as per tests Thread::wait not required on master side. But its safe to give 1ms + pdirr1=PTE->PDIR; + uint8_t i2c_count = 0; + if(read_ack == 0) //if read_ack says success, it may or may not be successful.Hence we check SCL and SDA { - gPC.printf("\n \r data not received \n"); + while(((pdirr1 & 0x03000000)!=0x03000000)&& i2c_count<10)//checking SCL and SDA for time=10ms + { + Thread::wait(1); + pdirr1=PTE->PDIR; + i2c_count++; + } + if(((pdirr1 & 0x03000000)==0x03000000))//if SCL and SDA are both high + { + gPC.printf("\n\rData received from BAE"); + } + else + { + I2C_busreset(); + read_ack = 1; + } } -//if(read_ack == 1) -//pc.printf("\n \r data not received \n"); - + else if (read_ack == 1) + { + I2C_busreset(); + } CDMS_I2C_GPIO = 0; - //gPC.printf("\n\r %d \n",t.read_us()); - //t.reset(); + i2c_count = 0; return read_ack; } -void FCTN_I2C_WRITE(char *data,uint8_t tc_len2) -{ +bool FCTN_I2C_WRITE(char *data,int tc_len2) // Returns 0 for success +{ CDMS_I2C_GPIO = 1; - //t.start(); - write_ack = master.write(addr_bae|0x00,data,tc_len2); - //t.stop(); - //if(write_ack == 0) - //gPC.printf("\n\r data not sent \n"); - -if (write_ack == 1) + write_ack = master.write(addr_bae|0x00,data,tc_len2); + Thread::wait(1); //As per the tests Thread::wait is not required on master side but its safe to give 1ms + pdirw1=PTE->PDIR; + uint8_t i2c_count = 0; + if(write_ack == 0) { -// led2 = 1; - gPC.printf("\n\r data not sent \n"); -// led2 = 0; + while(((pdirw1 & 0x03000000)!=0x03000000)&& i2c_count<10) + { + Thread::wait(1); + pdirw1=PTE->PDIR; + i2c_count++; + } + if(((pdirw1 & 0x03000000)==0x03000000)) + { + gPC.printf("\n\r Data sent"); + } + else + { + I2C_busreset(); + write_ack = 1; + } + } + if (write_ack == 1) + { + I2C_busreset(); } CDMS_I2C_GPIO = 0; - //gPC.printf("\n\r %d \n",t.read_us()); - //t.reset(); + i2c_count = 0; + return write_ack; } \ No newline at end of file