Platform/ECM3532/M3/hw/power/ecm3532/src/eta_pwr_gov.c
/**
 *  compute load
 *
 *  computes load if current ticks are greater than
 *
 *  timeout, else update sleep time in current cycle
 *
 */
compute load
computes load if current ticks are greater than

timeout, else update sleep time in current cycle
compute load computes load if current ticks are greater than timeout else update sleep time in current cycle
static int
ecm3531_compute_load(void)
{
    int load = -1;
    if (ecm3531_pg.stop_cnt <= ecm3531_pg.elapsed_cnt) {
	ecm3531_pg.total_period = ecm3531_pg.elapsed_cnt -
				ecm3531_pg.start_cnt;
    if (ecm3531_pg.total_period > ecm3531_pg.sleep_cnt) {
	    ecm3531_pg.active_cnt = ecm3531_pg.total_period -
				                    ecm3531_pg.sleep_cnt;
    }
    else {
        ecm3531_pg.active_cnt = 0;
    }
	load = (ecm3531_pg.active_cnt * 100) / ecm3531_pg.total_period;
	ecm3531_pg.cpu_load = (ecm3531_pg.cpu_load << 8) | (load & 0xFF);
	ecm3531_pg.sleep_cnt = 0;
	ecm3531_pg.elapsed_cnt = 0;
    }
    return load;
}
static int ecm3531_compute_load ( void ) { int load = -1 ; if ( ecm3531_pg . stop_cnt <= ecm3531_pg . elapsed_cnt ) { ecm3531_pg . total_period = ecm3531_pg . elapsed_cnt - ecm3531_pg . start_cnt ; if ( ecm3531_pg . total_period > ecm3531_pg . sleep_cnt ) { ecm3531_pg . active_cnt = ecm3531_pg . total_period - ecm3531_pg . sleep_cnt ; } else { ecm3531_pg . active_cnt = 0 ; } load = ( ecm3531_pg . active_cnt * 100 ) / ecm3531_pg . total_period ; ecm3531_pg . cpu_load = ( ecm3531_pg . cpu_load << 8 ) | ( load & 0xFF ) ; ecm3531_pg . sleep_cnt = 0 ; ecm3531_pg . elapsed_cnt = 0 ; } return load ; }
compute load
  computes load if current ticks are greater than
compute load computes load if current ticks are greater than
/*
     * total period can be program period or it can be
     * more then program period based on sleep time
     * elapsed_cnt get increament with system tick
     *
     */