mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Move the SFP handling out of the common area into BANK3
sfp.c takes handle_sfp, sfp_module_read, sfp_apply_quirks, sfp_get_info, sfp_read_field, sfp_print_info, setup_sfp_gpio, the quirk table and the module state that goes with them. Everything exported is __banked: handle_sfp() and sfp_print_info() are reached from cmd_parser.c in BANK2, the rest from the common area, and both are bank boundaries. The quirk table needed checking rather than assuming. Its entries are __code pointers, and a __code pointer carries no bank, so passing one to a function in a different bank hands it an offset read through the wrong window. That is safe here because strcmp() sits in the common segment at 0x51f and is reached with a plain lcall, so the bank register still says 3 while it runs. Verified in the built image: the table at 0x35580 holds 0x563c and 0x5644, which resolve to "QSFPTEK" and "QT-SFP+-T" inside BANK3. Common segment 13393 -> 8432 bytes, leaving 7492 free rather than 2531. BANK3 holds 5710, BANK1 is unchanged and BANK2 grows by 31 for the trampolines. All 34 machines in machine.h build and link, and the same walk over the generated assembly finds no plain lcall crossing a bank boundary.
This commit is contained in:
1 parent
7fa26e0ae3
commit
3dfd6a88c7
6 files changed
+243
-188
No files matched your search
@@ -185,10 +185,8 @@ void tcpip_output(void);
|
||||
uint8_t read_flash(uint8_t bank, __code uint8_t *addr);
|
||||
void get_random_32(void);
|
||||
void read_reg_timer(__xdata uint32_t * tmr);
|
||||
bool sfp_print_info(uint8_t sfp);
|
||||
bool gpio_pin_test(uint8_t pin);
|
||||
void set_sys_led_state(uint8_t state);
|
||||
void sds_read(uint8_t sds_id, uint8_t page, uint8_t reg);
|
||||
void sds_write_v(uint8_t sds_id, uint8_t page, uint8_t reg, uint16_t v);
|
||||
void handle_sfp(void);
|
||||
#endif
|
||||
Reference in new issue
Block a user