MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / start_timer

Function start_timer

icicle-cortexm/fuzzware-native/timer.c:377–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377uc_err start_timer(uc_engine *uc, uint32_t id) {
378 struct TimerState* timers = &uc->fw->timers;
379 if(id >= MAX_TIMERS) {
380 perror("[TIMER ERROR] start_timer: Too high id passed\n");
381 exit(-1);
382 } else if(!timers->timers[id].in_use) {
383 perror("[TIMER ERROR] start_timer: Unused timer to be started\n");
384 exit(-1);
385 } else if(timers->timers[id].reload_val == 0) {
386 perror("[TIMER ERROR] start_timer: Invalid reload value 0\n");
387 exit(-1);
388 } else if(timers->timers[id].reload_val > MAX_RELOAD_VAL) {
389 perror("[TIMER ERROR] start_timer: Invalid, too large reload value\n");
390 exit(-1);
391 }
392
393 #ifdef DEBUG_TIMER
394 printf("[TIMER] start_timer(%d)\n", id);
395 puts("======= Timer state PRE ======= ");
396 print_timer_state();
397 fflush(stdout);
398 #endif
399
400 struct Timer *tim = &timers->timers[id];
401 if (!tim->is_active) {
402 tim->is_active = 1;
403
404 insert_active_timer(uc, tim);
405 }
406
407 #ifdef DEBUG_TIMER
408 puts("======= Timer state POST ======= ");
409 print_timer_state();
410 fflush(stdout);
411 #endif
412
413 return UC_ERR_OK;
414}
415
416uc_err stop_timer(uc_engine *uc, uint32_t id) {
417 struct TimerState* timers = &uc->fw->timers;

Callers 3

add_interrupt_triggerFunction · 0.85
initFunction · 0.85
hook_syst_mmio_writeFunction · 0.85

Calls 2

print_timer_stateFunction · 0.85
insert_active_timerFunction · 0.85

Tested by

no test coverage detected