117,9 → 117,6 |
|
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCSWIN,(unsigned long)&win); |
|
/* Set the buffer */ |
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCSFBUF,(unsigned long)(fbuf)); |
|
/* IMPORTANT: Set the aperiodic elaboration task |
* This is a SHARK change on VIDIOCSYNC. When the |
* new frame is ready, the task elaborate_task_PID |
130,8 → 127,6 |
|
} |
|
/* Check if the frame grabber is ready */ |
int ready_to_grab = 1; |
|
/* Elaboration task, it is called when the frame |
grabber buffer is ready */ |
148,8 → 143,6 |
*(unsigned int *)(fbuf->base+50*320*3+50*3)); |
*/ |
|
ready_to_grab = 1; |
|
task_testcancel(); |
task_endcycle(); |
|
162,24 → 155,17 |
/* Send the grab command */ |
TASK grab_task(void *arg) { |
|
struct video_buffer *fbuf = (struct video_buffer *)(arg); |
int on; |
|
while(1) { |
|
if (ready_to_grab) { |
|
/* Grab */ |
on = 1; |
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCCAPTURE,(unsigned long)&on); |
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCSFBUF,(unsigned long)(fbuf)); |
|
/* Grab */ |
on = 1; |
VIDEODEV26_ioctl(FRAME_GRABBER_NUMBER,VIDIOCCAPTURE,(unsigned long)&on); |
|
ready_to_grab = 0; |
|
} else { |
|
/* Frame skipped */ |
|
} |
|
task_testcancel(); |
task_endcycle(); |
|
247,7 → 233,8 |
|
hard_task_default_model(gt); |
hard_task_def_mit(gt,40000); |
hard_task_def_wcet(gt,4000); |
hard_task_def_arg(gt,(void *)(&fbuf)); |
hard_task_def_wcet(gt,3000); |
hard_task_def_ctrl_jet(gt); |
|
grab_task_pid = task_create("GrabTask",grab_task,>,NULL); |
282,7 → 269,6 |
|
start_frame_grabber(elaborate_task_pid,channel,&fbuf); |
|
/* Activate periodic grabbing */ |
task_activate(grab_task_pid); |
|
while(keyb_getch(BLOCK) != ESC); |