Lines Matching defs:regaddr
64 static void at24_writedatabyte(unsigned long regaddr, unsigned char byte);
65 static int at24_sendfullcmd(unsigned long regaddr, unsigned char cmd, unsigned char addr);
66 static int at24_sendcmd(unsigned long regaddr, unsigned char cmd);
67 static unsigned char at24_readdatabit(unsigned long regaddr);
68 static unsigned char at24_readdatabyte(unsigned long regaddr);
69 static int at24_waitforack(unsigned long regaddr);
70 static int at24_waitfornack(unsigned long regaddr);
71 static void at24_setlines(unsigned long regaddr, unsigned char clock, unsigned char data);
72 static void at24_start(unsigned long regaddr);
73 static unsigned char at24_readb(unsigned long regaddr, unsigned char addr);
207 static void at24_writedatabyte(unsigned long regaddr, unsigned char byte)
212 at24_setlines(regaddr, 0, (byte >> (7-i))&0x01);
213 at24_setlines(regaddr, 1, (byte >> (7-i))&0x01);
214 at24_setlines(regaddr, 0, (byte >> (7-i))&0x01);
218 static int at24_sendfullcmd(unsigned long regaddr, unsigned char cmd, unsigned char addr)
220 if (at24_sendcmd(regaddr, cmd)) {
221 at24_writedatabyte(regaddr, addr);
222 return at24_waitforack(regaddr);
227 static int at24_sendcmd(unsigned long regaddr, unsigned char cmd)
232 at24_start(regaddr);
233 at24_writedatabyte(regaddr, cmd);
234 if (at24_waitforack(regaddr))
240 static unsigned char at24_readdatabit(unsigned long regaddr)
244 at24_setlines(regaddr, 0, 1);
245 at24_setlines(regaddr, 1, 1);
246 val = (inb(regaddr) & AT24_DATA)?1:0;
247 at24_setlines(regaddr, 1, 1);
248 at24_setlines(regaddr, 0, 1);
252 static unsigned char at24_readdatabyte(unsigned long regaddr)
259 data |= at24_readdatabit(regaddr);
265 static int at24_waitforack(unsigned long regaddr)
270 if ((at24_readdatabit(regaddr) & 0x01) == 0x00)
276 static int at24_waitfornack(unsigned long regaddr)
280 if ((at24_readdatabit(regaddr) & 0x01) == 0x01)
286 static void at24_setlines(unsigned long regaddr, unsigned char clock, unsigned char data)
294 outb(val, regaddr);
298 static void at24_start(unsigned long regaddr)
300 at24_setlines(regaddr, 0, 1);
301 at24_setlines(regaddr, 1, 1);
302 at24_setlines(regaddr, 1, 0);
303 at24_setlines(regaddr, 0, 1);
306 static unsigned char at24_readb(unsigned long regaddr, unsigned char addr)
310 if (at24_sendfullcmd(regaddr, AT24_WRITE, addr)) {
311 if (at24_sendcmd(regaddr, AT24_READ)) {
312 data = at24_readdatabyte(regaddr);
313 if (!at24_waitfornack(regaddr))