6,6 → 6,7 |
*/ |
|
#include <drivers/bttv.h> |
#include <drivers/fg.h> |
#include <kernel/kern.h> |
#include <unistd.h> |
|
19,6 → 20,9 |
static struct video_mmap vmm; |
static void * fbuf_pointer; |
|
PID refresh_PID; |
HARD_TASK_MODEL ht_refresh; |
|
static void (*elaborate_frame_hook)(void * ptrframe); |
|
void dummy_elaborate_frame(void * ptrframe) |
33,9 → 37,13 |
if (vmm.frame == 0) { |
vmm.frame = 1; |
fbuf_pointer = btv.fbuffer; |
*(BYTE *)fbuf_pointer = 255; |
*(BYTE *)(fbuf_pointer+1) = 0; |
} else { |
vmm.frame = 0; |
fbuf_pointer = btv.fbuffer+gbufsize; |
*(BYTE *)fbuf_pointer = 0; |
*(BYTE *)(fbuf_pointer+1) = 255; |
} |
|
bttv_ioctl(&btv, VIDIOCMCAPTURE, &vmm); |
48,11 → 56,8 |
|
} |
|
int FG_init(unsigned int period, unsigned int wcet, unsigned int width, unsigned int height) { |
int FG_init(unsigned int period, unsigned int wcet, unsigned int width, unsigned int height, unsigned int color) { |
|
HARD_TASK_MODEL ht_refresh; |
PID refresh_PID; |
|
struct video_window vw; |
struct video_picture p; |
struct video_channel ch; |
77,8 → 82,14 |
bttv_ioctl(&btv, VIDIOCSWIN, &vw); |
|
bttv_ioctl(&btv, VIDIOCGPICT, &p); |
p.palette = VIDEO_PALETTE_GREY; //GREY mode 8 bpp |
p.depth = 8; |
if (color == FG_RGB24) { |
p.palette = VIDEO_PALETTE_RGB24; |
p.depth = 24; |
} |
if (color == FG_MONO) { |
p.palette = VIDEO_PALETTE_GREY; |
p.depth = 8; |
} |
bttv_ioctl(&btv, VIDIOCSPICT, &p); |
|
bttv_ioctl(&btv, VIDIOCGCHAN, &ch); |
96,12 → 107,23 |
|
sleep(1); |
|
task_activate(refresh_PID); |
|
return 0; |
|
} |
|
void FG_start_grabbing(void) |
{ |
|
task_activate(refresh_PID); |
} |
|
void FG_stop_grabbing(void) |
{ |
|
task_kill(refresh_PID); |
|
} |
|
void FG_close(void) |
{ |
|