mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #418 from DrDoof/fix/crc16-psbank
crc16: leave the code bank as it was found
This commit is contained in:
3 files changed
+12
-6
No files matched your search
@@ -3,6 +3,8 @@
|
||||
;
|
||||
.globl _crc_value
|
||||
.globl _crc16
|
||||
.globl _crc16_bank1
|
||||
.globl __sdcc_banked_ret
|
||||
.equ BANK, 0x96
|
||||
; .equ DPS, 0x86
|
||||
; Variable in XMEM holding current CRC16 value, being updated
|
||||
@@ -18,7 +20,7 @@ _crc_value::
|
||||
.area HOME (CODE)
|
||||
.area CSEG (CODE)
|
||||
; .area BANK1 (CODE)
|
||||
_crc16:
|
||||
_crc16_bank1:
|
||||
mov BANK, #1
|
||||
push dph
|
||||
push dpl
|
||||
@@ -52,6 +54,10 @@ _crc16:
|
||||
|
||||
.area BANK1 (CODE)
|
||||
|
||||
_crc16:
|
||||
lcall _crc16_bank1
|
||||
ljmp __sdcc_banked_ret
|
||||
|
||||
crc16_table_l:
|
||||
.byte #0x00, #0xc1, #0x81, #0x40, #0x01, #0xc0, #0x80, #0x41
|
||||
.byte #0x01, #0xc0, #0x80, #0x41, #0x00, #0xc1, #0x81, #0x40
|
||||
|
||||
+3
-3
@@ -89,7 +89,7 @@ __xdata uint32_t last_session_use;
|
||||
|
||||
extern __xdata uint16_t crc_value;
|
||||
__xdata uint16_t crc_final;
|
||||
void crc16(__xdata uint8_t *v) __naked;
|
||||
void crc16_bank1(__xdata uint8_t *v) __naked;
|
||||
|
||||
|
||||
inline uint8_t is_separator(uint8_t c)
|
||||
@@ -518,7 +518,7 @@ uint8_t stream_upload(void)
|
||||
if (upload_settings.p[upload_settings.bptr] == boundary[bindex]) {
|
||||
if (!bindex)
|
||||
crc_final = crc_value;
|
||||
crc16(upload_settings.p + upload_settings.bptr);
|
||||
crc16_bank1(upload_settings.p + upload_settings.bptr);
|
||||
upload_settings.bptr++;
|
||||
bindex++;
|
||||
} else {
|
||||
@@ -527,7 +527,7 @@ uint8_t stream_upload(void)
|
||||
write_len += bindex;
|
||||
bindex = 0;
|
||||
}
|
||||
crc16(upload_settings.p + upload_settings.bptr);
|
||||
crc16_bank1(upload_settings.p + upload_settings.bptr);
|
||||
flash_buf[write_len++] = upload_settings.p[upload_settings.bptr++];
|
||||
if (write_len >= FLASH_PAGE_SIZE) {
|
||||
dbg_string("len: "); dbg_short(write_len); dbg_char(' ');
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ extern __xdata uint32_t flash_size;
|
||||
|
||||
extern __xdata uint16_t crc_value;
|
||||
__xdata struct machine_runtime machine_detected;
|
||||
void crc16(__xdata uint8_t *v) __naked;
|
||||
void crc16_bank1(__xdata uint8_t *v) __naked;
|
||||
void flash_default_config(void);
|
||||
void early_boot_handle_button(void);
|
||||
|
||||
@@ -2095,7 +2095,7 @@ void check_and_flash_update_image(void)
|
||||
flash_read_bulk(flash_buf);
|
||||
bptr = flash_buf;
|
||||
for (j = 0; j < FLASH_BUF_SIZE; j++) {
|
||||
crc16(bptr++);
|
||||
crc16_bank1(bptr++);
|
||||
}
|
||||
source += FLASH_BUF_SIZE;
|
||||
if (i%16 == 0) write_char('.');
|
||||
|
||||
Reference in new issue
Block a user