Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1436 → Rev 1435

/demos/trunk/pci6025e/test_dac.c
34,11 → 34,8
*
*/
 
#include <kernel/kern.h>
 
#include <drivers/shark_fb26.h>
#include <drivers/shark_keyb26.h>
 
#include <drivers/glib.h>
#include <drivers/keyb.h>
#include <drivers/pci6025e/dac.h>
 
#define TASK_VOLT_PERIOD 150E3
71,37 → 68,36
 
int main(int argc, char **argv)
{
int modenum;
KEY_EVT k;
HARD_TASK_MODEL m, d;
PID pid_m, pid_d;
 
sys_atrunlevel(close_event, NULL, RUNLEVEL_BEFORE_EXIT);
 
keyb_set_map(itaMap);
k.flag = CNTR_BIT;
k.scan = KEY_X;
k.ascii = 'x';
k.status = KEY_PRESSED;
keyb_hook(k, endfun, FALSE);
keyb_hook(k, endfun);
 
k.flag = CNTL_BIT;
k.status = KEY_PRESSED;
keyb_hook(k, endfun, FALSE);
keyb_hook(k, endfun);
 
k.flag = 0;
k.scan = 78;
k.ascii = 43;
k.status = KEY_PRESSED;
keyb_hook(k, inc, FALSE);
keyb_hook(k, inc);
 
k.flag = 0;
k.scan = 74;
k.ascii = 45;
k.status = KEY_PRESSED;
keyb_hook(k, dec, FALSE);
keyb_hook(k, dec);
 
k.flag = 0;
k.scan = KEY_V;
k.ascii = 'v';
k.status = KEY_PRESSED;
keyb_hook(k, change_dac, FALSE);
keyb_hook(k, change_dac);
 
hard_task_default_model(m);
hard_task_def_wcet(m, TASK_VOLT_WCET);
123,12 → 119,29
sys_end();
}
 
//Check if a NI board is on PCI bus
//Check if PCI bus is present
if(pci_init()==-1){
sys = 10;
sys_end();
}
//Check if a NI board is on PCI bus
if(!reMap()){
sys = 11;
sys_end();
}
 
if(grx_init()==-1){
sys = 20;
sys_end();
}
 
modenum = grx_getmode(800, 600, 16);
if(modenum == -1){
sys = 21;
sys_end();
}
grx_setmode(modenum);
 
drawInterface();
 
//Analog output section set up
283,25 → 296,24
 
void close_event(void *arg)
{
grx_close();
switch(sys){
case 0 : sys_shutdown_message("Regular End\n"); break;
case 1 : sys_shutdown_message("End fun invoked\n"); break;
case 10: sys_shutdown_message("Pci bus not found\n"); break;
case 11: sys_shutdown_message("No National board found\n"); break;
case 20: sys_shutdown_message("Cannot initialize graphic envirorment\n"); break;
case 21: sys_shutdown_message("Cannot start envirorment in 800x600x16\n"); break;
case 30: sys_shutdown_message("Cannot create task <voltage>\n"); break;
case 31: sys_shutdown_message("Canot create task <DAC Check>\n"); break;
case 40: sys_shutdown_message("Break on clock end event\n"); break;
default: sys_shutdown_message("Unkwon exit event\n"); break;
case 0 : cprintf("Regular End\n"); break;
case 1 : cprintf("End fun invoked\n"); break;
case 10: cprintf("Pci bus not found\n"); break;
case 11: cprintf("No National board found\n"); break;
case 20: cprintf("Cannot initialize graphic envirorment\n"); break;
case 21: cprintf("Cannot start envirorment in 800x600x16\n"); break;
case 30: cprintf("Cannot create task <voltage>\n"); break;
case 31: cprintf("Canot create task <DAC Check>\n"); break;
case 40: cprintf("Break on clock end event\n"); break;
default: cprintf("Unkwon exit event\n"); break;
}
}
 
void endfun(KEY_EVT *k)
{
close_event(NULL);
 
sys = 1;
sys_end();
}