144,24 → 144,14 |
/* Check if the frame grabber is ready */ |
volatile int ready_to_grab = 1; |
|
void grab_command(void *arg) { |
|
SYS_FLAGS f; |
|
f = kern_fsave(); |
|
int on = 1; |
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCCAPTURE,(unsigned long)&on); |
|
kern_frestore(f); |
|
} |
|
/* Elaboration task, it is called when the frame |
grabber buffer is ready */ |
TASK elaborate_task(void *arg) { |
|
struct video_buffer *fbuf = (struct video_buffer *)(arg); |
#ifdef MAX_SPEED |
int on; |
#endif |
|
while(1) { |
|
175,7 → 165,8 |
ready_to_grab = 1; |
|
#ifdef MAX_SPEED |
grab_command(NULL); |
on = 1; |
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCCAPTURE,(unsigned long)&on); |
#endif |
|
task_testcancel(); |
190,13 → 181,20 |
/* Send the grab command */ |
TASK grab_task(void *arg) { |
|
int on; |
|
while(1) { |
|
if (ready_to_grab) { |
|
task_nopreempt(); |
|
/* Grab */ |
grab_command(NULL); |
on = 1; |
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCCAPTURE,(unsigned long)&on); |
|
task_preempt(); |
|
//cprintf("G"); |
|
ready_to_grab = 0; |
253,11 → 251,14 |
{ |
|
HARD_TASK_MODEL gt; |
SOFT_TASK_MODEL et; |
HARD_TASK_MODEL et; |
PID grab_task_pid,elaborate_task_pid; |
|
struct video_buffer fbuf; |
int channel = 0; |
#ifdef MAX_SPEED |
int on; |
#endif |
|
if (argc < 2) { |
sys_shutdown_message("ERROR: Enter the input channel [ex> %s 0]\n",argv[0]); |
266,12 → 267,12 |
|
channel = atoi(argv[1]); |
|
soft_task_default_model(et); |
soft_task_def_period(et,FG_PERIOD); |
soft_task_def_arg(et,(void *)(&fbuf)); |
soft_task_def_met(et,FG_WCET); |
soft_task_def_aperiodic(et); |
soft_task_def_ctrl_jet(et); |
hard_task_default_model(et); |
hard_task_def_mit(et,FG_PERIOD); |
hard_task_def_arg(et,(void *)(&fbuf)); |
hard_task_def_wcet(et,FG_WCET); |
hard_task_def_aperiodic(et); |
hard_task_def_ctrl_jet(et); |
|
hard_task_default_model(gt); |
hard_task_def_mit(gt,FG_PERIOD); |
315,7 → 316,8 |
task_activate(grab_task_pid); |
#else |
/* Grab */ |
grab_command(NULL); |
on = 1; |
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCCAPTURE,(unsigned long)&on); |
#endif |
|
while(keyb_getch(BLOCK) != ESC); |