mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
crc16: banked wrapper for cross-bank callers
The lookup tables live in BANK1, so the routine switches the code bank to reach them with movc and never switches it back. That is the contract the __naked declaration already implied: same bank or common segment only. The name now says it. crc16_bank1 is the routine unchanged. crc16 becomes a __banked wrapper in BANK1, so a caller from another bank has its own bank put back by __sdcc_banked_ret. The two existing call sites take the direct path and pay nothing.
This commit is contained in:
1 parent
dd09be9dd0
commit
53f12a42c5
3 files changed
+12
-6
No files matched your search
+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