MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pcf2123_rtc_attach

Function pcf2123_rtc_attach

freebsd/mips/atheros/pcf2123_rtc.c:72–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72static int
73pcf2123_rtc_attach(device_t dev)
74{
75 struct pcf2123_rtc_softc *sc;
76 struct spi_command cmd;
77 unsigned char rxBuf[3];
78 unsigned char txBuf[3];
79 int err;
80
81 sc = device_get_softc(dev);
82 sc->dev = dev;
83
84 clock_register(dev, 1000000);
85
86 memset(&cmd, 0, sizeof(cmd));
87 memset(rxBuf, 0, sizeof(rxBuf));
88 memset(txBuf, 0, sizeof(txBuf));
89
90 /* Make sure Ctrl1 and Ctrl2 are zeroes */
91 txBuf[0] = PCF2123_WRITE(PCF2123_REG_CTRL1);
92 cmd.rx_cmd = rxBuf;
93 cmd.tx_cmd = txBuf;
94 cmd.rx_cmd_sz = sizeof(rxBuf);
95 cmd.tx_cmd_sz = sizeof(txBuf);
96 err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd);
97 DELAY(PCF2123_DELAY);
98
99 return (0);
100}
101
102static int
103pcf2123_rtc_gettime(device_t dev, struct timespec *ts)

Callers

nothing calls this directly

Calls 5

device_get_softcFunction · 0.85
clock_registerFunction · 0.85
memsetFunction · 0.85
device_get_parentFunction · 0.85
DELAYFunction · 0.50

Tested by

no test coverage detected