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

Function ti_pruss_event_map

freebsd/arm/ti/ti_pruss.c:363–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363static int
364ti_pruss_event_map( SYSCTL_HANDLER_ARGS )
365{
366 struct ti_pruss_softc *sc;
367 const int8_t irq = arg2;
368 int err;
369 char event[sizeof(NOT_SET_STR)];
370
371 sc = arg1;
372
373 if(sc->sc_irq_devs[irq].event == -1)
374 bcopy(NOT_SET_STR, event, sizeof(event));
375 else
376 snprintf(event, sizeof(event), "%d", sc->sc_irq_devs[irq].event);
377
378 err = sysctl_handle_string(oidp, event, sizeof(event), req);
379 if(err != 0)
380 return (err);
381
382 if (req->newptr) { // write event
383 if (strcmp(NOT_SET_STR, event) == 0) {
384 ti_pruss_interrupts_enable(sc, irq, false);
385 sc->sc_irq_devs[irq].event = -1;
386 } else {
387 if (sc->sc_irq_devs[irq].channel == -1) {
388 device_printf( sc->sc_pdev->si_drv1,
389 "corresponding channel not configured\n");
390 return (ENXIO);
391 }
392
393 const int8_t channelnr = sc->sc_irq_devs[irq].channel;
394 const int8_t eventnr = strtol( event, NULL, 10 ); // TODO: check if strol is valid
395 if (eventnr > TI_PRUSS_EVENTS || eventnr < 0) {
396 device_printf( sc->sc_pdev->si_drv1,
397 "Event number %d not valid (0 - %d)",
398 channelnr, TI_PRUSS_EVENTS -1);
399 return (EINVAL);
400 }
401
402 sc->sc_irq_devs[irq].channel = channelnr;
403 sc->sc_irq_devs[irq].event = eventnr;
404
405 // event[nr] <= channel
406 ti_pruss_map_write(sc, PRUSS_INTC_CMR_BASE,
407 eventnr, channelnr);
408 }
409 }
410 return (err);
411}
412
413static int
414ti_pruss_channel_map(SYSCTL_HANDLER_ARGS)

Callers

nothing calls this directly

Calls 7

snprintfFunction · 0.85
sysctl_handle_stringFunction · 0.85
strcmpFunction · 0.85
device_printfFunction · 0.85
strtolFunction · 0.85
ti_pruss_map_writeFunction · 0.85

Tested by

no test coverage detected