Ejemplo n.º 1
0
static int itomap2430_sharp01_panel_enable(void)
{

    DBGENTER(1);
    DBGLEAVE(1);
    return 0;
}
Ejemplo n.º 2
0
    void RRScheduler::addTask(AbsRTTask* task, const std::string &p)
    {
        DBGENTER(_RR_SCHED_DBG_LEV);
        AbsRTTask *mytask = dynamic_cast<AbsRTTask *>(task);

        if (mytask == 0) 
            throw RRSchedExc("Cannot add a AbsRTTask to RR");

        RRModel *model = new RRModel(mytask); 	

        if (find(task) != NULL) 
            throw RRSchedExc("Element already present");
	
        _tasks[task] = model;
        
        int slice = 0;
        
        DBGPRINT_2("Slice parameter: ", p); 
        if (p == "") slice = defaultSlice;
        else {
            stringstream ss(p);
            ss >> slice;
        }

        DBGPRINT_2("Slice set to: ", slice); 

        model->setRRSlice(slice);
        
    }
Ejemplo n.º 3
0
 RRScheduler::RRScheduler(int defSlice) : 
     Scheduler(), defaultSlice(defSlice), _rrEvt(this, &RRScheduler::round)
 {
     DBGENTER(_RR_SCHED_DBG_LEV);
     DBGPRINT_2("DEFAULT SLICE = ", defaultSlice);
     //register_handler(_rrEvt, this, &RRScheduler::round);
 }
Ejemplo n.º 4
0
 unsigned long int CPU::getFrequencySwitching() 
 {
     DBGENTER(_KERNEL_DBG_LEV);
     DBGPRINT("frequencySwitching=" << frequencySwitching);
     	   
     return frequencySwitching;
 }
Ejemplo n.º 5
0
    void Grub::releasing_ready()
    {
	DBGENTER(_SERVER_DBG_LEV);
	status = READY;
        _idleEvt.drop();
        DBGPRINT("FROM RELEASING TO READY");
    }
Ejemplo n.º 6
0
    void Server::onDispatch(Event *e)
    {
        DBGENTER(_SERVER_DBG_LEV);

        AbsRTTask *newExe = sched_->getFirst();

        DBGPRINT("Current situation");
        DBGPRINT_2("newExe: ", taskname(newExe));
        DBGPRINT_2("currExe_: ", taskname(currExe_));
        
        if (newExe != currExe_) {
            if (currExe_ != NULL) currExe_->deschedule();
            currExe_ = newExe;
            if (newExe != NULL) newExe->schedule();
            //sched_->notify(newExe);
        }

        DBGPRINT_2("Now Running: ", taskname(newExe));

        if (currExe_ == NULL) {
            sched_->notify(NULL);
            executing_releasing();
            kernel->suspend(this);
            kernel->dispatch();
        }
    }
Ejemplo n.º 7
0
    void RRScheduler::round(Event *)
    {
        DBGENTER(_RR_SCHED_DBG_LEV);
        RRModel* model = dynamic_cast<RRModel *>(_queue.front());
        if (model == 0) throw RRSchedExc("Cannot find task");

        if (model->isRoundExpired()) {
            DBGPRINT("Round expired");
            _queue.erase(model);
            if (model->isActive()) {
                model->setInsertTime(SIMUL.getTime());
                _queue.insert(model);
            }
        }
        
//         if it is not active... ?
        RRModel* first = dynamic_cast<RRModel *>(_queue.front());
//         if (first == 0) throw RRSchedExc("Cannot find task");

        if (first != 0) {
            Tick slice = first->getRRSlice();
            if (slice == 0) _rrEvt.drop();
            else {
                if (first != model || first->isRoundExpired()) {
                    _rrEvt.drop();
                    _rrEvt.post(SIMUL.getTime() + slice);
                }
            }
        }
        if (_kernel) {
            DBGPRINT("informing the kernel");
            _kernel->dispatch();
        }
        
    }
Ejemplo n.º 8
0
 void Server::addTask(AbsRTTask &task, const string &params)
 {
     DBGENTER(_SERVER_DBG_LEV);
     task.setKernel(this);
     tasks.push_back(&task);
     DBGPRINT_2("Calling sched->addTask, with params = ", params);
     sched_->addTask(&task, params);
 }
Ejemplo n.º 9
0
    void Grub::executing_releasing()
    {
	DBGENTER(_SERVER_DBG_LEV);
	updateBudget();
	status = RELEASING;
	if (SIMUL.getTime() < Tick(vtime.get_value())) 
	    _idleEvt.post(Tick(vtime.get_value()));
	else _idleEvt.post(SIMUL.getTime());
    }
Ejemplo n.º 10
0
void ThreInstr::schedule()
{
    DBGENTER(_INSTR_DBG_LEV);
    DBGPRINT("Scheduling ThreInstr named: " << getName());

    _endEvt.post(SIMUL.getTime());


}
Ejemplo n.º 11
0
    void Server::onSched(Event *)
    {
        DBGENTER(_SERVER_DBG_LEV);

        assert(status == READY);

        ready_executing();
        dispatch();
    }
Ejemplo n.º 12
0
static void innovator1610_panel_cleanup(void)
{
	DBGENTER(1);

	omap_free_gpio(15);
	omap_free_gpio(14);

	DBGLEAVE(1);
}
Ejemplo n.º 13
0
    void Grub::ready_executing()
    {
	DBGENTER(_SERVER_DBG_LEV);
        status = EXECUTING;
	Tick extra = supervisor->get_capacity();
	//cout << "Extra: " << extra << endl;
	cap.set_value(cap.get_value() + double(extra));
	startAccounting();
    }
Ejemplo n.º 14
0
    void Grub::recharging_ready()
    {
	DBGENTER(_SERVER_DBG_LEV);
	cap.set_value(Q);
	d = SIMUL.getTime() + P;
	setAbsDead(d);
	vtime.set_value(SIMUL.getTime());
	status = READY;
    }
Ejemplo n.º 15
0
    void Grub::executing_recharging()
    {
	DBGENTER(_SERVER_DBG_LEV);
	updateBudget();
	status = RECHARGING;
	if (getDeadline() < SIMUL.getTime()) 
	    _rechargingEvt.post(SIMUL.getTime()); 
	else 
	    _rechargingEvt.post(getDeadline());
    }
Ejemplo n.º 16
0
static void innovator1610_panel_disable(void)
{
	DBGENTER(1);

	/* set GPIO13, GPIO14 and GPIO15 low */
	omap_set_gpio_dataout(14, 0);
	omap_set_gpio_dataout(15, 0);

	DBGLEAVE(1);
}
Ejemplo n.º 17
0
    void Grub::releasing_idle()
    {
	DBGENTER(_SERVER_DBG_LEV);
	if (double(SIMUL.getTime()) > vtime.get_value()) {
	    Tick extra = Tick(getUtil() * (double(SIMUL.getTime()) - vtime.get_value()));
	    supervisor->set_capacity(extra);
	}
	status = IDLE;
	supervisor->set_idle(this);
    }
Ejemplo n.º 18
0
    void Server::suspend(AbsRTTask *task)
    {
        DBGENTER(_SERVER_DBG_LEV);
        sched_->extract(task);
	
        if (getProcessor(task) != NULL) {
            task->deschedule();
            currExe_ = NULL;
            sched_->notify(NULL);
        }
    }
Ejemplo n.º 19
0
static int innovator1610_panel_enable(void)
{
	DBGENTER(1);

	/* set GPIO14 and GPIO15 high */
	omap_set_gpio_dataout(14, 1);
	omap_set_gpio_dataout(15, 1);

	DBGLEAVE(1);
	return 0;
}
Ejemplo n.º 20
0
static void client_exec_cleanup_file(fireexecd_client_t *cli, const char *path) {
  // backups to restore process after script execution
  char **envtmp = environ;
  uid_t euid = geteuid();
  uid_t ruid = getuid();

  DBGENTER(cli?cli->pid:0, "client_exec_cleanup_file");
  if (!path) {
    DBGERR("[n/a]\t\e[01;40;101mERROR:\e[0;0m asked to execute a cleanup file, but no path was provided. Aborting.\n");
    DBGLEAVE(cli?cli->pid:0, "client_exec_cleanup_file");
    goto unlink;
  }
Ejemplo n.º 21
0
    void Server::onEnd(AbsRTTask *t)
    {
        DBGENTER(_SERVER_DBG_LEV);

        assert(status == EXECUTING);
        sched_->extract(t);

        currExe_ = NULL;

        sched_->notify(NULL); // round robin case

        dispatch();
    }
Ejemplo n.º 22
0
    void RRScheduler::addTask(AbsRTTask *task) throw(RRSchedExc)
    {
        DBGENTER(_RR_SCHED_DBG_LEV);

        RRModel *model = new RRModel(task); 	

        if (find(task) != NULL) 
            throw RRSchedExc("Element already present");
	
        _tasks[task] = model;
        
        model->setRRSlice(defaultSlice);
        DBGPRINT_2("Default slice set: ", defaultSlice); 
        
    }
Ejemplo n.º 23
0
    void Server::onDesched(Event *)
    {
        DBGENTER(_SERVER_DBG_LEV);

        // I cannot assume it is still executing, maybe it is already
        // in recharging status (bacause of previous onEnd(task))
        if (status == EXECUTING) {
            executing_ready();

            // signal the task
            currExe_->deschedule();
            currExe_ = NULL;
            sched_->notify(NULL);
        }   
    }
Ejemplo n.º 24
0
    void Grub::idle_ready()
    {
	//cout << "IDLE-READY" << endl;
	DBGENTER(_SERVER_DBG_LEV);
        assert (status == IDLE);
        status = READY;
        cap.set_value(Q);
	d = SIMUL.getTime() + P;
	DBGPRINT_2("new deadline ",d);
        setAbsDead(d);
	vtime.set_value(SIMUL.getTime());
	supervisor->set_active(this);
        DBGPRINT_2("Going to READY at ", SIMUL.getTime());
	//cout << "IDLE-READY end" << endl;
    }
Ejemplo n.º 25
0
    void Server::onRecharging(Event *)
    {
        DBGENTER(_SERVER_DBG_LEV);

        assert(status == RECHARGING);

        if (sched_->getFirst() != NULL) {
            recharging_ready();
            kernel->onArrival(this);
        }
        else {
            recharging_idle();
            currExe_ = NULL;
            sched_->notify(NULL);
        }
    }
Ejemplo n.º 26
0
    void WaitInstr::onEnd() 
    {
        DBGENTER(_INSTR_DBG_LEV);

        _father->onInstrEnd();

        RTKernel *k = dynamic_cast<RTKernel *>(_father->getKernel());

        if (k == NULL) throw BaseExc("Kernel not found!");

        k->requestResource(_father, _res, _numberOfRes);

        _waitEvt.process();

        

    }
Ejemplo n.º 27
0
    void RRScheduler::notify(AbsRTTask* task)
    {
        DBGENTER(_RR_SCHED_DBG_LEV);
        _rrEvt.drop();

        if (task != NULL) {
            RRModel* model = dynamic_cast<RRModel *>(find(task));
            if (model == 0) throw RRSchedExc("Cannot find task");
            if (model->getRRSlice() > 0) {
                _rrEvt.post(SIMUL.getTime() + model->getRRSlice());
                DBGPRINT_2("rrEvt post at time ", 
                           SIMUL.getTime() + model->getRRSlice());
            }
        }
      
        
    }
Ejemplo n.º 28
0
    void SignalInstr::onEnd() 
    {
        DBGENTER(_INSTR_DBG_LEV);

        _endEvt.drop();               
        _signalEvt.process();         
        _father->onInstrEnd();        

        RTKernel *k = dynamic_cast<RTKernel *>(_father->getKernel());

        if (k == 0) {
            throw BaseExc("SignalInstr has no kernel set!");
        }
        
        else k->releaseResource(_father, _res, _numberOfRes); 
  
        
    }
Ejemplo n.º 29
0
fireexecd_client_t *client_new(pid_t pid,
                               const char *cmdpath,
                               const char *profile,
                               const char *name) {
  DBGENTER(pid, "client_new");
  fireexecd_client_t *cli = malloc(sizeof(fireexecd_client_t));
  if(!cli) {
    DBGLEAVE(pid, "client_new");
    return NULL;
  }

  cli->cmdpath = strdup(cmdpath);
  if(!cli->cmdpath) {
    free(cli);
    DBGLEAVE(pid, "client_new");
    return NULL;
  }

  cli->profile = profile ? strdup(profile) : NULL;
  if(profile && !cli->profile) {
    free(cli->cmdpath);
    free(cli);
    DBGLEAVE(pid, "client_new");
    return NULL;
  }

  cli->name = name ? strdup(name) : NULL;
  if(name && !cli->name) {
    free(cli->profile);
    free(cli->cmdpath);
    free(cli);
    DBGLEAVE(pid, "client_new");
    return NULL;
  }

  cli->pid = pid;
  cli->handler = 0;
  cli->regtime = 0;
  cli->status = UNDEFINED;
  cli->pol = EXECHELP_DEFAULT_POLICY;

  DBGLEAVE(pid, "client_new");
  return cli;
}
Ejemplo n.º 30
0
    Server::Server(const string &name, const string &s) :
        Entity(name),
        arr(0),
        last_arr(0),
        status(IDLE),
        dline(0),
        abs_dline(0),
        tasks(),
        last_exec_time(0),
        kernel(0),
        sched_(0),
        currExe_(0),
        _bandExEvt(Event::_DEFAULT_PRIORITY + 4),
        _dlineMissEvt(Event::_DEFAULT_PRIORITY + 6),
        _rechargingEvt(Event::_DEFAULT_PRIORITY - 1),
	_dispatchEvt(Event::_DEFAULT_PRIORITY + 5)
    {
        DBGENTER(_SERVER_DBG_LEV);
        string s_name = parse_util::get_token(s);
        // only for passing to the factory
        vector<string> p = parse_util::split_param(parse_util::get_param(s));
        // create the scheduler

        DBGPRINT_2("SCHEDULER: ", s_name);
        DBGPRINT("PARAMETERS: ");
        for (int i=0; i<p.size(); ++i) DBGPRINT(p[i]);

        auto_ptr<Scheduler> curr = FACT(Scheduler).create(s_name, p);
        sched_ = curr.release();
        if (!sched_) throw ParseExc("Server::Server()", s);

        sched_->setKernel(this);

        // register all event handlers
        register_handler(_bandExEvt, this, &Server::onBudgetExhausted); 
        register_handler(_dlineMissEvt, this, &Server::onDlineMiss);
        register_handler(_rechargingEvt, this, &Server::onRecharging); 
        register_handler(_schedEvt, this, &Server::onSched); 
        register_handler(_deschedEvt, this, &Server::onDesched); 
        register_handler(_dispatchEvt, this, &Server::onDispatch); 
    }