1 ;-------------------------------------------------------- 2 ; File Created by SDCC : free open source ANSI-C Compiler 3 ; Version 4.2.0 #13081 (Linux) 4 ;-------------------------------------------------------- 5 .module eeprom_io 6 .optsdcc -mmcs51 --model-small 7 8 ;-------------------------------------------------------- 9 ; Public variables in this module 10 ;-------------------------------------------------------- 11 .globl _i2c_write 12 .globl _i2c_read 13 .globl _eeprom_read_PARM_4 14 .globl _eeprom_read_PARM_3 15 .globl _eeprom_read_PARM_2 16 .globl _eeprom_read 17 ;-------------------------------------------------------- 18 ; special function registers 19 ;-------------------------------------------------------- 20 .area RSEG (ABS,DATA) 000000 21 .org 0x0000 22 ;-------------------------------------------------------- 23 ; special function bits 24 ;-------------------------------------------------------- 25 .area RSEG (ABS,DATA) 000000 26 .org 0x0000 27 ;-------------------------------------------------------- 28 ; overlayable register banks 29 ;-------------------------------------------------------- 30 .area REG_BANK_0 (REL,OVR,DATA) 000000 31 .ds 8 32 ;-------------------------------------------------------- 33 ; internal ram data 34 ;-------------------------------------------------------- 35 .area DSEG (DATA) 000000 36 _eeprom_read_PARM_2: 000000 37 .ds 1 000001 38 _eeprom_read_PARM_3: 000001 39 .ds 2 000003 40 _eeprom_read_PARM_4: 000003 41 .ds 1 42 ;-------------------------------------------------------- 43 ; overlayable items in internal ram 44 ;-------------------------------------------------------- 45 ;-------------------------------------------------------- 46 ; indirectly addressable internal ram data 47 ;-------------------------------------------------------- 48 .area ISEG (DATA) 49 ;-------------------------------------------------------- 50 ; absolute internal ram data 51 ;-------------------------------------------------------- 52 .area IABS (ABS,DATA) 53 .area IABS (ABS,DATA) 54 ;-------------------------------------------------------- 55 ; bit data 56 ;-------------------------------------------------------- 57 .area BSEG (BIT) 58 ;-------------------------------------------------------- 59 ; paged external ram data 60 ;-------------------------------------------------------- 61 .area PSEG (PAG,XDATA) 62 ;-------------------------------------------------------- 63 ; external ram data 64 ;-------------------------------------------------------- 65 .area XSEG (XDATA) 000000 66 _eeprom_read_cmd_65536_8: 000000 67 .ds 1 68 ;-------------------------------------------------------- 69 ; absolute external ram data 70 ;-------------------------------------------------------- 71 .area XABS (ABS,XDATA) 72 ;-------------------------------------------------------- 73 ; external initialized ram data 74 ;-------------------------------------------------------- 75 .area HOME (CODE) 76 .area GSINIT0 (CODE) 77 .area GSINIT1 (CODE) 78 .area GSINIT2 (CODE) 79 .area GSINIT3 (CODE) 80 .area GSINIT4 (CODE) 81 .area GSINIT5 (CODE) 82 .area GSINIT (CODE) 83 .area GSFINAL (CODE) 84 .area CSEG (CODE) 85 ;-------------------------------------------------------- 86 ; global & static initialisations 87 ;-------------------------------------------------------- 88 .area HOME (CODE) 89 .area GSINIT (CODE) 90 .area GSFINAL (CODE) 91 .area GSINIT (CODE) 92 ;-------------------------------------------------------- 93 ; Home 94 ;-------------------------------------------------------- 95 .area HOME (CODE) 96 .area HOME (CODE) 97 ;-------------------------------------------------------- 98 ; code 99 ;-------------------------------------------------------- 100 .area CSEG (CODE) 101 ;------------------------------------------------------------ 102 ;Allocation info for local variables in function 'eeprom_read' 103 ;------------------------------------------------------------ 104 ;eeprom_offset Allocated with name '_eeprom_read_PARM_2' 105 ;buf Allocated with name '_eeprom_read_PARM_3' 106 ;len Allocated with name '_eeprom_read_PARM_4' 107 ;i2c_addr Allocated to registers r7 108 ;cmd Allocated with name '_eeprom_read_cmd_65536_8' 109 ;------------------------------------------------------------ 110 ; eeprom_io.c:29: eeprom_read (unsigned char i2c_addr, unsigned char eeprom_offset, 111 ; ----------------------------------------- 112 ; function eeprom_read 113 ; ----------------------------------------- 000000 114 _eeprom_read: 000007 115 ar7 = 0x07 000006 116 ar6 = 0x06 000005 117 ar5 = 0x05 000004 118 ar4 = 0x04 000003 119 ar3 = 0x03 000002 120 ar2 = 0x02 000001 121 ar1 = 0x01 000000 122 ar0 = 0x00 000000 AF 82 [24] 123 mov r7,dpl 124 ; eeprom_io.c:36: cmd[0] = eeprom_offset; 000002 90r00r00 [24] 125 mov dptr,#_eeprom_read_cmd_65536_8 000005 E5*00 [12] 126 mov a,_eeprom_read_PARM_2 000007 F0 [24] 127 movx @dptr,a 128 ; eeprom_io.c:37: if (!i2c_write(i2c_addr, cmd, 1)) 000008 75*00r00 [24] 129 mov _i2c_write_PARM_2,#_eeprom_read_cmd_65536_8 00000B 75*01s00 [24] 130 mov (_i2c_write_PARM_2 + 1),#(_eeprom_read_cmd_65536_8 >> 8) 00000E 75*00 01 [24] 131 mov _i2c_write_PARM_3,#0x01 000011 8F 82 [24] 132 mov dpl,r7 000013 C0 07 [24] 133 push ar7 000015 12r00r00 [24] 134 lcall _i2c_write 000018 E5 82 [12] 135 mov a,dpl 00001A D0 07 [24] 136 pop ar7 137 ; eeprom_io.c:38: return 0; 00001C 70 03 [24] 138 jnz 00102$ 00001E F5 82 [12] 139 mov dpl,a 000020 22 [24] 140 ret 000021 141 00102$: 142 ; eeprom_io.c:40: return i2c_read(i2c_addr, buf, len); 000021 85*01*00 [24] 143 mov _i2c_read_PARM_2,_eeprom_read_PARM_3 000024 85*02*01 [24] 144 mov (_i2c_read_PARM_2 + 1),(_eeprom_read_PARM_3 + 1) 000027 85*03*00 [24] 145 mov _i2c_read_PARM_3,_eeprom_read_PARM_4 00002A 8F 82 [24] 146 mov dpl,r7 147 ; eeprom_io.c:41: } 00002C 02r00r00 [24] 148 ljmp _i2c_read 149 .area CSEG (CODE) 150 .area CONST (CODE) 151 .area CABS (ABS,CODE)