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

Function ti_mbox_write

freebsd/arm/ti/ti_mbox.c:245–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245static int
246ti_mbox_write(device_t dev, int chan, uint32_t data)
247{
248 int limit = 500;
249 struct ti_mbox_softc *sc;
250
251 if (chan < 0 || chan > 7)
252 return (EINVAL);
253 sc = device_get_softc(dev);
254 TI_MBOX_LOCK(sc);
255 /* XXX implement interrupt method */
256 while (ti_mbox_reg_read(sc, TI_MBOX_FIFOSTATUS(chan)) == 1 &&
257 limit--) {
258 DELAY(10);
259 }
260 if (limit == 0) {
261 device_printf(dev, "FIFOSTAUS%d stuck\n", chan);
262 TI_MBOX_UNLOCK(sc);
263 return (EAGAIN);
264 }
265 ti_mbox_reg_write(sc, TI_MBOX_MESSAGE(chan), data);
266
267 return (0);
268}

Callers

nothing calls this directly

Calls 5

device_get_softcFunction · 0.85
ti_mbox_reg_readFunction · 0.85
device_printfFunction · 0.85
ti_mbox_reg_writeFunction · 0.85
DELAYFunction · 0.50

Tested by

no test coverage detected