Repository for CDMS code
Dependencies: SimpleDMA mbed-rtos mbed eeprom
Fork of COM_MNG_TMTC_SIMPLE by
FMS_all.h@215:570251b23c7b, 2016-07-03 (annotated)
- Committer:
- chaithanyarss
- Date:
- Sun Jul 03 09:47:05 2016 +0000
- Revision:
- 215:570251b23c7b
- Parent:
- 209:63e9c8f8b5d2
- Child:
- 218:c63cdba0550f
Reset added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ee12b079 | 209:63e9c8f8b5d2 | 1 | |
ee12b079 | 209:63e9c8f8b5d2 | 2 | void P_PL_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 3 | void P_PL_MAIN(); |
ee12b079 | 209:63e9c8f8b5d2 | 4 | void P_COM_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 5 | void P_CDMS_HK_MAIN(); |
ee12b079 | 209:63e9c8f8b5d2 | 6 | void P_PL_RCV_SC_DATA(); |
ee12b079 | 209:63e9c8f8b5d2 | 7 | void P_CDMS_INIT_SD(); |
ee12b079 | 209:63e9c8f8b5d2 | 8 | void CDMS_SD_SW_ON(); |
ee12b079 | 209:63e9c8f8b5d2 | 9 | void CDMS_SD_SW_OFF(); |
ee12b079 | 209:63e9c8f8b5d2 | 10 | void SW_ON_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 11 | void SW_OFF_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 12 | void SW_ON_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 13 | void SW_OFF_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 14 | void SW_ON_PL_EPS(); |
ee12b079 | 209:63e9c8f8b5d2 | 15 | void SW_OFF_PL_EPS(); |
ee12b079 | 209:63e9c8f8b5d2 | 16 | void SW_ON_V_A_EN(); |
ee12b079 | 209:63e9c8f8b5d2 | 17 | void SW_OFF_V_A_EN(); |
ee12b079 | 209:63e9c8f8b5d2 | 18 | void RST_SD(); |
ee12b079 | 209:63e9c8f8b5d2 | 19 | void RST_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 20 | void RST_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 21 | void RST_HK_COUNTER(); |
ee12b079 | 209:63e9c8f8b5d2 | 22 | uint8_t CDMS_RD_SD_HK(uint8_t *); |
chaithanyarss | 215:570251b23c7b | 23 | void RESET_CDMS(); |
ee12b079 | 209:63e9c8f8b5d2 | 24 | void CDMS_INTERNAL_RESET(); |
ee12b079 | 209:63e9c8f8b5d2 | 25 | |
ee12b079 | 209:63e9c8f8b5d2 | 26 | void P_PL_INIT() |
ee12b079 | 209:63e9c8f8b5d2 | 27 | { |
ee12b079 | 209:63e9c8f8b5d2 | 28 | |
ee12b079 | 209:63e9c8f8b5d2 | 29 | } |
ee12b079 | 209:63e9c8f8b5d2 | 30 | |
ee12b079 | 209:63e9c8f8b5d2 | 31 | void P_PL_MAIN() |
ee12b079 | 209:63e9c8f8b5d2 | 32 | { |
ee12b079 | 209:63e9c8f8b5d2 | 33 | |
ee12b079 | 209:63e9c8f8b5d2 | 34 | } |
ee12b079 | 209:63e9c8f8b5d2 | 35 | |
ee12b079 | 209:63e9c8f8b5d2 | 36 | void P_COM_INIT() |
ee12b079 | 209:63e9c8f8b5d2 | 37 | { |
ee12b079 | 209:63e9c8f8b5d2 | 38 | |
ee12b079 | 209:63e9c8f8b5d2 | 39 | } |
ee12b079 | 209:63e9c8f8b5d2 | 40 | |
ee12b079 | 209:63e9c8f8b5d2 | 41 | void P_CDMS_HK_MAIN() |
ee12b079 | 209:63e9c8f8b5d2 | 42 | { |
ee12b079 | 209:63e9c8f8b5d2 | 43 | //FCTN_CDMS_HK_MAIN(); |
ee12b079 | 209:63e9c8f8b5d2 | 44 | } |
ee12b079 | 209:63e9c8f8b5d2 | 45 | |
ee12b079 | 209:63e9c8f8b5d2 | 46 | void P_PL_RCV_SC_DATA() |
ee12b079 | 209:63e9c8f8b5d2 | 47 | { |
ee12b079 | 209:63e9c8f8b5d2 | 48 | |
ee12b079 | 209:63e9c8f8b5d2 | 49 | } |
ee12b079 | 209:63e9c8f8b5d2 | 50 | |
ee12b079 | 209:63e9c8f8b5d2 | 51 | void P_CDMS_INIT_SD() |
ee12b079 | 209:63e9c8f8b5d2 | 52 | { |
ee12b079 | 209:63e9c8f8b5d2 | 53 | FCTN_CDMS_SD_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 54 | } |
ee12b079 | 209:63e9c8f8b5d2 | 55 | |
ee12b079 | 209:63e9c8f8b5d2 | 56 | void CDMS_SD_SW_ON() |
ee12b079 | 209:63e9c8f8b5d2 | 57 | { |
ee12b079 | 209:63e9c8f8b5d2 | 58 | SD_SW_EN_DS = 0; //powering on SD |
ee12b079 | 209:63e9c8f8b5d2 | 59 | } |
ee12b079 | 209:63e9c8f8b5d2 | 60 | |
ee12b079 | 209:63e9c8f8b5d2 | 61 | void CDMS_SD_SW_OFF() |
ee12b079 | 209:63e9c8f8b5d2 | 62 | { |
ee12b079 | 209:63e9c8f8b5d2 | 63 | SD_SW_EN_DS = 0; //powering on SD |
ee12b079 | 209:63e9c8f8b5d2 | 64 | } |
ee12b079 | 209:63e9c8f8b5d2 | 65 | |
ee12b079 | 209:63e9c8f8b5d2 | 66 | void SW_ON_BAE() |
ee12b079 | 209:63e9c8f8b5d2 | 67 | { |
ee12b079 | 209:63e9c8f8b5d2 | 68 | BAE_SW_EN_DS = 0; //Power ON BAE |
ee12b079 | 209:63e9c8f8b5d2 | 69 | } |
ee12b079 | 209:63e9c8f8b5d2 | 70 | |
ee12b079 | 209:63e9c8f8b5d2 | 71 | void SW_OFF_BAE() |
ee12b079 | 209:63e9c8f8b5d2 | 72 | { |
ee12b079 | 209:63e9c8f8b5d2 | 73 | BAE_SW_EN_DS = 1; //Switch OFF BAE |
ee12b079 | 209:63e9c8f8b5d2 | 74 | } |
ee12b079 | 209:63e9c8f8b5d2 | 75 | |
ee12b079 | 209:63e9c8f8b5d2 | 76 | void SW_ON_PL_BEE() |
ee12b079 | 209:63e9c8f8b5d2 | 77 | { |
ee12b079 | 209:63e9c8f8b5d2 | 78 | PL_SW_EN_DS = 0; //Power ON PL |
ee12b079 | 209:63e9c8f8b5d2 | 79 | } |
ee12b079 | 209:63e9c8f8b5d2 | 80 | |
ee12b079 | 209:63e9c8f8b5d2 | 81 | void SW_OFF_PL_BEE() |
ee12b079 | 209:63e9c8f8b5d2 | 82 | { |
ee12b079 | 209:63e9c8f8b5d2 | 83 | PL_SW_EN_DS = 1; // switching OFF PL |
ee12b079 | 209:63e9c8f8b5d2 | 84 | } |
ee12b079 | 209:63e9c8f8b5d2 | 85 | |
ee12b079 | 209:63e9c8f8b5d2 | 86 | void SW_ON_PL_EPS() |
ee12b079 | 209:63e9c8f8b5d2 | 87 | { |
ee12b079 | 209:63e9c8f8b5d2 | 88 | |
ee12b079 | 209:63e9c8f8b5d2 | 89 | } |
ee12b079 | 209:63e9c8f8b5d2 | 90 | |
ee12b079 | 209:63e9c8f8b5d2 | 91 | void SW_OFF_PL_EPS() |
ee12b079 | 209:63e9c8f8b5d2 | 92 | { |
ee12b079 | 209:63e9c8f8b5d2 | 93 | |
ee12b079 | 209:63e9c8f8b5d2 | 94 | } |
ee12b079 | 209:63e9c8f8b5d2 | 95 | |
ee12b079 | 209:63e9c8f8b5d2 | 96 | void SW_ON_V_A_EN() |
ee12b079 | 209:63e9c8f8b5d2 | 97 | { |
ee12b079 | 209:63e9c8f8b5d2 | 98 | |
ee12b079 | 209:63e9c8f8b5d2 | 99 | } |
ee12b079 | 209:63e9c8f8b5d2 | 100 | |
ee12b079 | 209:63e9c8f8b5d2 | 101 | void SW_OFF_V_A_EN() |
ee12b079 | 209:63e9c8f8b5d2 | 102 | { |
ee12b079 | 209:63e9c8f8b5d2 | 103 | |
ee12b079 | 209:63e9c8f8b5d2 | 104 | } |
ee12b079 | 209:63e9c8f8b5d2 | 105 | |
ee12b079 | 209:63e9c8f8b5d2 | 106 | void RST_SD() |
ee12b079 | 209:63e9c8f8b5d2 | 107 | { |
ee12b079 | 209:63e9c8f8b5d2 | 108 | SD_SW_EN_DS = 1; //switching off SD card |
ee12b079 | 209:63e9c8f8b5d2 | 109 | wait_ms(10); |
ee12b079 | 209:63e9c8f8b5d2 | 110 | SD_SW_EN_DS = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 111 | FCTN_CDMS_SD_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 112 | } |
ee12b079 | 209:63e9c8f8b5d2 | 113 | |
ee12b079 | 209:63e9c8f8b5d2 | 114 | void RST_BAE() |
ee12b079 | 209:63e9c8f8b5d2 | 115 | { |
ee12b079 | 209:63e9c8f8b5d2 | 116 | BAE_SW_EN_DS = 1; //Switch OFF BAE |
ee12b079 | 209:63e9c8f8b5d2 | 117 | wait_ms(10); |
ee12b079 | 209:63e9c8f8b5d2 | 118 | BAE_SW_EN_DS = 0; //Switch ON BAE |
ee12b079 | 209:63e9c8f8b5d2 | 119 | } |
ee12b079 | 209:63e9c8f8b5d2 | 120 | |
ee12b079 | 209:63e9c8f8b5d2 | 121 | void RST_PL_BEE() |
ee12b079 | 209:63e9c8f8b5d2 | 122 | { |
ee12b079 | 209:63e9c8f8b5d2 | 123 | PL_SW_EN_DS = 1; // switching OFF PL |
ee12b079 | 209:63e9c8f8b5d2 | 124 | wait_ms(10); |
ee12b079 | 209:63e9c8f8b5d2 | 125 | PL_SW_EN_DS = 0; // Switch ON PL |
ee12b079 | 209:63e9c8f8b5d2 | 126 | } |
ee12b079 | 209:63e9c8f8b5d2 | 127 | |
ee12b079 | 209:63e9c8f8b5d2 | 128 | void RST_HK_COUNTER() |
ee12b079 | 209:63e9c8f8b5d2 | 129 | { |
ee12b079 | 209:63e9c8f8b5d2 | 130 | firstCount = true; |
ee12b079 | 209:63e9c8f8b5d2 | 131 | } |
ee12b079 | 209:63e9c8f8b5d2 | 132 | |
ee12b079 | 209:63e9c8f8b5d2 | 133 | uint8_t CDMS_RD_SD_HK(uint8_t *sd_statusbits) |
ee12b079 | 209:63e9c8f8b5d2 | 134 | { |
ee12b079 | 209:63e9c8f8b5d2 | 135 | uint8_t p; |
ee12b079 | 209:63e9c8f8b5d2 | 136 | uint8_t ACK; |
ee12b079 | 209:63e9c8f8b5d2 | 137 | if(SD_SW_EN_DS != DEVICE_POWERED) |
ee12b079 | 209:63e9c8f8b5d2 | 138 | { |
ee12b079 | 209:63e9c8f8b5d2 | 139 | ACK = 0x89; |
ee12b079 | 209:63e9c8f8b5d2 | 140 | SD_RD_ERROR = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 141 | //Generate TM |
ee12b079 | 209:63e9c8f8b5d2 | 142 | } |
ee12b079 | 209:63e9c8f8b5d2 | 143 | else |
ee12b079 | 209:63e9c8f8b5d2 | 144 | { |
ee12b079 | 209:63e9c8f8b5d2 | 145 | p = disk_read_statusbits(sd_statusbits); |
ee12b079 | 209:63e9c8f8b5d2 | 146 | if(p == 0) |
ee12b079 | 209:63e9c8f8b5d2 | 147 | ACK = 0xA0; |
ee12b079 | 209:63e9c8f8b5d2 | 148 | else |
ee12b079 | 209:63e9c8f8b5d2 | 149 | ACK = 0x89; |
ee12b079 | 209:63e9c8f8b5d2 | 150 | } |
ee12b079 | 209:63e9c8f8b5d2 | 151 | return ACK; |
ee12b079 | 209:63e9c8f8b5d2 | 152 | } |
ee12b079 | 209:63e9c8f8b5d2 | 153 | |
chaithanyarss | 215:570251b23c7b | 154 | void RESET_CDMS() |
chaithanyarss | 215:570251b23c7b | 155 | { |
chaithanyarss | 215:570251b23c7b | 156 | |
chaithanyarss | 215:570251b23c7b | 157 | } |
chaithanyarss | 215:570251b23c7b | 158 | |
ee12b079 | 209:63e9c8f8b5d2 | 159 | void CDMS_INTERNAL_RESET() |
ee12b079 | 209:63e9c8f8b5d2 | 160 | { |
chaithanyarss | 215:570251b23c7b | 161 | |
ee12b079 | 209:63e9c8f8b5d2 | 162 | } |