@@ -178,7 +178,7 @@ static inline void __time_critical_func(mc_respond_slow)(uint8_t ch) {
178178 pio_sm_put_blocking (pio0 , dat_writer_slow .sm , ch );
179179}
180180
181- static uint8_t Table [] = {
181+ static uint8_t EccTable [] = {
182182 0x00 , 0x87 , 0x96 , 0x11 , 0xa5 , 0x22 , 0x33 , 0xb4 ,0xb4 , 0x33 , 0x22 , 0xa5 , 0x11 , 0x96 , 0x87 , 0x00 ,
183183 0xc3 , 0x44 , 0x55 , 0xd2 , 0x66 , 0xe1 , 0xf0 , 0x77 ,0x77 , 0xf0 , 0xe1 , 0x66 , 0xd2 , 0x55 , 0x44 , 0xc3 ,
184184 0xd2 , 0x55 , 0x44 , 0xc3 , 0x77 , 0xf0 , 0xe1 , 0x66 ,0x66 , 0xe1 , 0xf0 , 0x77 , 0xc3 , 0x44 , 0x55 , 0xd2 ,
@@ -197,33 +197,6 @@ static uint8_t Table[] = {
197197 0x00 , 0x87 , 0x96 , 0x11 , 0xa5 , 0x22 , 0x33 , 0xb4 ,0xb4 , 0x33 , 0x22 , 0xa5 , 0x11 , 0x96 , 0x87 , 0x00
198198};
199199
200- void calcECC (uint8_t * ecc , const uint8_t * data )
201- {
202- int i , c ;
203-
204- ecc [0 ] = ecc [1 ] = ecc [2 ] = 0 ;
205-
206- for (i = 0 ; i < 0x80 ; i ++ ) {
207- c = Table [data [i ]];
208-
209- ecc [0 ] ^= c ;
210- if (c & 0x80 ) {
211- ecc [1 ] ^= ~i ;
212- ecc [2 ] ^= i ;
213- }
214- }
215- ecc [0 ] = ~ecc [0 ];
216- ecc [0 ] &= 0x77 ;
217-
218- ecc [1 ] = ~ecc [1 ];
219- ecc [1 ] &= 0x7f ;
220-
221- ecc [2 ] = ~ecc [2 ];
222- ecc [2 ] &= 0x7f ;
223-
224- return ;
225- }
226-
227200// keysource and key are self generated values
228201uint8_t keysource [] = { 0xf5 , 0x80 , 0x95 , 0x3c , 0x4c , 0x84 , 0xa9 , 0xc0 };
229202uint8_t dex_key [16 ] = { 0x17 , 0x39 , 0xd3 , 0xbc , 0xd0 , 0x2c , 0x18 , 0x07 , 0x4b , 0x17 , 0xf0 , 0xea , 0xc4 , 0x66 , 0x30 , 0xf9 };
0 commit comments