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

Function attach_tc

freebsd/arm/arm/mpcore_timer.c:279–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279static int
280attach_tc(struct arm_tmr_softc *sc)
281{
282 int rid;
283
284 if (arm_tmr_tc != NULL)
285 return (EBUSY);
286
287 rid = sc->memrid;
288 sc->gbl_mem = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid,
289 RF_ACTIVE);
290 if (sc->gbl_mem == NULL) {
291 device_printf(sc->dev, "could not allocate gbl mem resources\n");
292 return (ENXIO);
293 }
294 tmr_gbl_write_4(sc, GBL_TIMER_CTRL, 0x00000000);
295
296 arm_tmr_timecount.tc_frequency = sc->clkfreq;
297 arm_tmr_timecount.tc_priv = sc;
298 tc_init(&arm_tmr_timecount);
299 arm_tmr_tc = &arm_tmr_timecount;
300
301 tmr_gbl_write_4(sc, GBL_TIMER_CTRL, GBL_TIMER_CTRL_TIMER_ENABLE);
302
303 return (0);
304}
305
306static int
307attach_et(struct arm_tmr_softc *sc)

Callers 1

arm_tmr_attachFunction · 0.85

Calls 3

bus_alloc_resource_anyFunction · 0.85
device_printfFunction · 0.85
tc_initFunction · 0.85

Tested by

no test coverage detected