mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Add phy_write() with bit_mask lookup inside the function.
Move the lookup saves a lot of instructions for every phy_write() call. Assembly diff for one change. < ; rtl837x_phy.c:240: phy_write_mask(bit_mask[port], 0x07, 0x00, 0x3200); // Enable AN < mov dpl,r5 < mov dph,r6 --- > ; rtl837x_phy.c:240: phy_write(port, 0x07, 0x00, 0x3200); // Enable AN > mov _phy_write_PARM_2,#0x07 1345,1359c1019,1024 < movc a,@a+dptr < mov r5,a < inc dptr < clr a < movc a,@a+dptr < mov r6,a < mov _phy_write_mask_PARM_2,#0x07 < clr a < mov _phy_write_mask_PARM_3,a < mov (_phy_write_mask_PARM_3 + 1),a < mov _phy_write_mask_PARM_4,a < mov (_phy_write_mask_PARM_4 + 1),#0x32 < mov dpl, r5 < mov dph, r6 < lcall _phy_write_mask --- > mov _phy_write_PARM_3,a > mov (_phy_write_PARM_3 + 1),a > mov _phy_write_PARM_4,a > mov (_phy_write_PARM_4 + 1),#0x32 > mov dpl, r7 > lcall _phy_write Replace all phy_write_mask(bit_mask[<var>], ...) to phy phy_write(<var>, ...).
This commit is contained in:
@@ -61,6 +61,7 @@ void print_byte(uint8_t a);
|
||||
void print_sfr_data(void);
|
||||
void print_phy_data(void);
|
||||
void phy_write_mask(uint16_t phy_mask, uint8_t dev_id, uint16_t reg, uint16_t v);
|
||||
void phy_write(uint8_t phy_id, uint8_t dev_id, uint16_t reg, uint16_t v);
|
||||
void phy_read(uint8_t phy_id, uint8_t dev_id, uint16_t reg);
|
||||
void reg_read(uint16_t reg_addr);
|
||||
void reg_read_m(uint16_t reg_addr);
|
||||
|
||||
Reference in New Issue
Block a user