Commit 3368075a authored by Simon Evans's avatar Simon Evans Committed by Greg Kroah-Hartman

[PATCH] more typedef removal from usbvideo

This patch removes some more typedefs from usbvideo and related files

typedef struct { .. } RingQueue_t -> struct RingQueue
typedef struct { .. } usbvideo_sbuf_t -> struct usbvideo_sbuf
typedef struct { .. } usbvideo_frame_t -> struct usbvideo_frame
typedef struct { .. } usbvideo_statistics_t -> struct usbvideo_statistics
typedef struct { .. } usbvideo_cb_t -> struct usbvideo_cb
parent a3160899
...@@ -251,7 +251,7 @@ static videosize_t ibmcam_size_to_videosize(int size) ...@@ -251,7 +251,7 @@ static videosize_t ibmcam_size_to_videosize(int size)
*/ */
static ParseState_t ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */ static ParseState_t ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */
{ {
usbvideo_frame_t *frame; struct usbvideo_frame *frame;
ibmcam_t *icam; ibmcam_t *icam;
if ((uvd->curframe) < 0 || (uvd->curframe >= USBVIDEO_NUMFRAMES)) { if ((uvd->curframe) < 0 || (uvd->curframe >= USBVIDEO_NUMFRAMES)) {
...@@ -399,7 +399,7 @@ case IBMCAM_MODEL_4: ...@@ -399,7 +399,7 @@ case IBMCAM_MODEL_4:
*/ */
static ParseState_t ibmcam_parse_lines( static ParseState_t ibmcam_parse_lines(
struct uvd *uvd, struct uvd *uvd,
usbvideo_frame_t *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
{ {
unsigned char *f; unsigned char *f;
...@@ -664,7 +664,7 @@ static ParseState_t ibmcam_parse_lines( ...@@ -664,7 +664,7 @@ static ParseState_t ibmcam_parse_lines(
*/ */
static ParseState_t ibmcam_model2_320x240_parse_lines( static ParseState_t ibmcam_model2_320x240_parse_lines(
struct uvd *uvd, struct uvd *uvd,
usbvideo_frame_t *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
{ {
unsigned char *f, *la, *lb; unsigned char *f, *la, *lb;
...@@ -818,7 +818,7 @@ static ParseState_t ibmcam_model2_320x240_parse_lines( ...@@ -818,7 +818,7 @@ static ParseState_t ibmcam_model2_320x240_parse_lines(
static ParseState_t ibmcam_model3_parse_lines( static ParseState_t ibmcam_model3_parse_lines(
struct uvd *uvd, struct uvd *uvd,
usbvideo_frame_t *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
{ {
unsigned char *data; unsigned char *data;
...@@ -963,7 +963,7 @@ static ParseState_t ibmcam_model3_parse_lines( ...@@ -963,7 +963,7 @@ static ParseState_t ibmcam_model3_parse_lines(
*/ */
static ParseState_t ibmcam_model4_128x96_parse_lines( static ParseState_t ibmcam_model4_128x96_parse_lines(
struct uvd *uvd, struct uvd *uvd,
usbvideo_frame_t *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
{ {
const unsigned char *data_rv, *data_gv, *data_bv; const unsigned char *data_rv, *data_gv, *data_bv;
...@@ -1049,7 +1049,7 @@ static ParseState_t ibmcam_model4_128x96_parse_lines( ...@@ -1049,7 +1049,7 @@ static ParseState_t ibmcam_model4_128x96_parse_lines(
* History: * History:
* 1/21/00 Created. * 1/21/00 Created.
*/ */
void ibmcam_ProcessIsocData(struct uvd *uvd, usbvideo_frame_t *frame) void ibmcam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
{ {
ParseState_t newstate; ParseState_t newstate;
long copylen = 0; long copylen = 0;
...@@ -3921,7 +3921,7 @@ static struct usb_device_id id_table[] = { ...@@ -3921,7 +3921,7 @@ static struct usb_device_id id_table[] = {
*/ */
static int __init ibmcam_init(void) static int __init ibmcam_init(void)
{ {
usbvideo_cb_t cbTbl; struct usbvideo_cb cbTbl;
memset(&cbTbl, 0, sizeof(cbTbl)); memset(&cbTbl, 0, sizeof(cbTbl));
cbTbl.probe = ibmcam_probe; cbTbl.probe = ibmcam_probe;
cbTbl.setupOnOpen = ibmcam_setup_on_open; cbTbl.setupOnOpen = ibmcam_setup_on_open;
......
...@@ -488,7 +488,7 @@ static void konicawc_stop_data(struct uvd *uvd) ...@@ -488,7 +488,7 @@ static void konicawc_stop_data(struct uvd *uvd)
} }
static void konicawc_process_isoc(struct uvd *uvd, usbvideo_frame_t *frame) static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame)
{ {
struct konicawc *cam = (struct konicawc *)uvd->user_data; struct konicawc *cam = (struct konicawc *)uvd->user_data;
int maxline = cam->maxline; int maxline = cam->maxline;
...@@ -881,7 +881,7 @@ static struct usb_device_id id_table[] = { ...@@ -881,7 +881,7 @@ static struct usb_device_id id_table[] = {
static int __init konicawc_init(void) static int __init konicawc_init(void)
{ {
usbvideo_cb_t cbTbl; struct usbvideo_cb cbTbl;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
memset(&cbTbl, 0, sizeof(cbTbl)); memset(&cbTbl, 0, sizeof(cbTbl));
cbTbl.probe = konicawc_probe; cbTbl.probe = konicawc_probe;
......
...@@ -103,7 +103,7 @@ MODULE_PARM_DESC(hue_correction, "YUV colorspace regulation: 0-255 (default=128) ...@@ -103,7 +103,7 @@ MODULE_PARM_DESC(hue_correction, "YUV colorspace regulation: 0-255 (default=128)
* 02-Nov-2000 First (mostly dummy) version. * 02-Nov-2000 First (mostly dummy) version.
* 06-Nov-2000 Rewrote to dump all data into frame. * 06-Nov-2000 Rewrote to dump all data into frame.
*/ */
void ultracam_ProcessIsocData(struct uvd *uvd, usbvideo_frame_t *frame) void ultracam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
{ {
int n; int n;
...@@ -672,7 +672,7 @@ static struct usb_device_id id_table[] = { ...@@ -672,7 +672,7 @@ static struct usb_device_id id_table[] = {
*/ */
static int __init ultracam_init(void) static int __init ultracam_init(void)
{ {
usbvideo_cb_t cbTbl; struct usbvideo_cb cbTbl;
memset(&cbTbl, 0, sizeof(cbTbl)); memset(&cbTbl, 0, sizeof(cbTbl));
cbTbl.probe = ultracam_probe; cbTbl.probe = ultracam_probe;
cbTbl.setupOnOpen = ultracam_setup_on_open; cbTbl.setupOnOpen = ultracam_setup_on_open;
......
...@@ -70,7 +70,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd); ...@@ -70,7 +70,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd);
static int usbvideo_GetFrame(struct uvd *uvd, int frameNum); static int usbvideo_GetFrame(struct uvd *uvd, int frameNum);
static int usbvideo_NewFrame(struct uvd *uvd, int framenum); static int usbvideo_NewFrame(struct uvd *uvd, int framenum);
static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
usbvideo_frame_t *frame); struct usbvideo_frame *frame);
/*******************************/ /*******************************/
/* Memory management functions */ /* Memory management functions */
...@@ -127,13 +127,13 @@ static void usbvideo_rvfree(void *mem, unsigned long size) ...@@ -127,13 +127,13 @@ static void usbvideo_rvfree(void *mem, unsigned long size)
vfree(mem); vfree(mem);
} }
static void RingQueue_Initialize(RingQueue_t *rq) static void RingQueue_Initialize(struct RingQueue *rq)
{ {
assert(rq != NULL); assert(rq != NULL);
init_waitqueue_head(&rq->wqh); init_waitqueue_head(&rq->wqh);
} }
static void RingQueue_Allocate(RingQueue_t *rq, int rqLen) static void RingQueue_Allocate(struct RingQueue *rq, int rqLen)
{ {
/* Make sure the requested size is a power of 2 and /* Make sure the requested size is a power of 2 and
round up if necessary. This allows index wrapping round up if necessary. This allows index wrapping
...@@ -154,14 +154,14 @@ static void RingQueue_Allocate(RingQueue_t *rq, int rqLen) ...@@ -154,14 +154,14 @@ static void RingQueue_Allocate(RingQueue_t *rq, int rqLen)
assert(rq->queue != NULL); assert(rq->queue != NULL);
} }
static int RingQueue_IsAllocated(const RingQueue_t *rq) static int RingQueue_IsAllocated(const struct RingQueue *rq)
{ {
if (rq == NULL) if (rq == NULL)
return 0; return 0;
return (rq->queue != NULL) && (rq->length > 0); return (rq->queue != NULL) && (rq->length > 0);
} }
static void RingQueue_Free(RingQueue_t *rq) static void RingQueue_Free(struct RingQueue *rq)
{ {
assert(rq != NULL); assert(rq != NULL);
if (RingQueue_IsAllocated(rq)) { if (RingQueue_IsAllocated(rq)) {
...@@ -171,7 +171,7 @@ static void RingQueue_Free(RingQueue_t *rq) ...@@ -171,7 +171,7 @@ static void RingQueue_Free(RingQueue_t *rq)
} }
} }
int RingQueue_Dequeue(RingQueue_t *rq, unsigned char *dst, int len) int RingQueue_Dequeue(struct RingQueue *rq, unsigned char *dst, int len)
{ {
int rql, toread; int rql, toread;
...@@ -205,7 +205,7 @@ int RingQueue_Dequeue(RingQueue_t *rq, unsigned char *dst, int len) ...@@ -205,7 +205,7 @@ int RingQueue_Dequeue(RingQueue_t *rq, unsigned char *dst, int len)
EXPORT_SYMBOL(RingQueue_Dequeue); EXPORT_SYMBOL(RingQueue_Dequeue);
int RingQueue_Enqueue(RingQueue_t *rq, const unsigned char *cdata, int n) int RingQueue_Enqueue(struct RingQueue *rq, const unsigned char *cdata, int n)
{ {
int enqueued = 0; int enqueued = 0;
...@@ -237,13 +237,13 @@ int RingQueue_Enqueue(RingQueue_t *rq, const unsigned char *cdata, int n) ...@@ -237,13 +237,13 @@ int RingQueue_Enqueue(RingQueue_t *rq, const unsigned char *cdata, int n)
EXPORT_SYMBOL(RingQueue_Enqueue); EXPORT_SYMBOL(RingQueue_Enqueue);
static void RingQueue_InterruptibleSleepOn(RingQueue_t *rq) static void RingQueue_InterruptibleSleepOn(struct RingQueue *rq)
{ {
assert(rq != NULL); assert(rq != NULL);
interruptible_sleep_on(&rq->wqh); interruptible_sleep_on(&rq->wqh);
} }
void RingQueue_WakeUpInterruptible(RingQueue_t *rq) void RingQueue_WakeUpInterruptible(struct RingQueue *rq)
{ {
assert(rq != NULL); assert(rq != NULL);
if (waitqueue_active(&rq->wqh)) if (waitqueue_active(&rq->wqh))
...@@ -252,7 +252,7 @@ void RingQueue_WakeUpInterruptible(RingQueue_t *rq) ...@@ -252,7 +252,7 @@ void RingQueue_WakeUpInterruptible(RingQueue_t *rq)
EXPORT_SYMBOL(RingQueue_WakeUpInterruptible); EXPORT_SYMBOL(RingQueue_WakeUpInterruptible);
void RingQueue_Flush(RingQueue_t *rq) void RingQueue_Flush(struct RingQueue *rq)
{ {
assert(rq != NULL); assert(rq != NULL);
rq->ri = 0; rq->ri = 0;
...@@ -290,7 +290,7 @@ static void usbvideo_VideosizeToString(char *buf, int bufLen, videosize_t vs) ...@@ -290,7 +290,7 @@ static void usbvideo_VideosizeToString(char *buf, int bufLen, videosize_t vs)
* History: * History:
* 01-Feb-2000 Created. * 01-Feb-2000 Created.
*/ */
static void usbvideo_OverlayChar(struct uvd *uvd, usbvideo_frame_t *frame, static void usbvideo_OverlayChar(struct uvd *uvd, struct usbvideo_frame *frame,
int x, int y, int ch) int x, int y, int ch)
{ {
static const unsigned short digits[16] = { static const unsigned short digits[16] = {
...@@ -345,7 +345,7 @@ static void usbvideo_OverlayChar(struct uvd *uvd, usbvideo_frame_t *frame, ...@@ -345,7 +345,7 @@ static void usbvideo_OverlayChar(struct uvd *uvd, usbvideo_frame_t *frame,
* History: * History:
* 01-Feb-2000 Created. * 01-Feb-2000 Created.
*/ */
static void usbvideo_OverlayString(struct uvd *uvd, usbvideo_frame_t *frame, static void usbvideo_OverlayString(struct uvd *uvd, struct usbvideo_frame *frame,
int x, int y, const char *str) int x, int y, const char *str)
{ {
while (*str) { while (*str) {
...@@ -363,7 +363,7 @@ static void usbvideo_OverlayString(struct uvd *uvd, usbvideo_frame_t *frame, ...@@ -363,7 +363,7 @@ static void usbvideo_OverlayString(struct uvd *uvd, usbvideo_frame_t *frame,
* History: * History:
* 01-Feb-2000 Created. * 01-Feb-2000 Created.
*/ */
static void usbvideo_OverlayStats(struct uvd *uvd, usbvideo_frame_t *frame) static void usbvideo_OverlayStats(struct uvd *uvd, struct usbvideo_frame *frame)
{ {
const int y_diff = 8; const int y_diff = 8;
char tmp[16]; char tmp[16];
...@@ -542,7 +542,7 @@ static void usbvideo_ReportStatistics(const struct uvd *uvd) ...@@ -542,7 +542,7 @@ static void usbvideo_ReportStatistics(const struct uvd *uvd)
* purposes. * purposes.
*/ */
void usbvideo_DrawLine( void usbvideo_DrawLine(
usbvideo_frame_t *frame, struct usbvideo_frame *frame,
int x1, int y1, int x1, int y1,
int x2, int y2, int x2, int y2,
unsigned char cr, unsigned char cg, unsigned char cb) unsigned char cr, unsigned char cg, unsigned char cb)
...@@ -616,7 +616,7 @@ EXPORT_SYMBOL(usbvideo_DrawLine); ...@@ -616,7 +616,7 @@ EXPORT_SYMBOL(usbvideo_DrawLine);
*/ */
void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode) void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode)
{ {
usbvideo_frame_t *frame; struct usbvideo_frame *frame;
int num_cell = 0; int num_cell = 0;
int scan_length = 0; int scan_length = 0;
static int num_pass = 0; static int num_pass = 0;
...@@ -769,7 +769,7 @@ int usbvideo_register( ...@@ -769,7 +769,7 @@ int usbvideo_register(
const int num_cams, const int num_cams,
const int num_extra, const int num_extra,
const char *driverName, const char *driverName,
const usbvideo_cb_t *cbTbl, const struct usbvideo_cb *cbTbl,
struct module *md, struct module *md,
const struct usb_device_id *id_table) const struct usb_device_id *id_table)
{ {
...@@ -1640,7 +1640,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf, ...@@ -1640,7 +1640,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf,
struct uvd *uvd = file->private_data; struct uvd *uvd = file->private_data;
int noblock = file->f_flags & O_NONBLOCK; int noblock = file->f_flags & O_NONBLOCK;
int frmx = -1, i; int frmx = -1, i;
usbvideo_frame_t *frame; struct usbvideo_frame *frame;
if (!CAMERA_IS_OPERATIONAL(uvd) || (buf == NULL)) if (!CAMERA_IS_OPERATIONAL(uvd) || (buf == NULL))
return -EFAULT; return -EFAULT;
...@@ -1990,7 +1990,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd) ...@@ -1990,7 +1990,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd)
*/ */
static int usbvideo_NewFrame(struct uvd *uvd, int framenum) static int usbvideo_NewFrame(struct uvd *uvd, int framenum)
{ {
usbvideo_frame_t *frame; struct usbvideo_frame *frame;
int n; int n;
if (uvd->debug > 1) if (uvd->debug > 1)
...@@ -2064,7 +2064,7 @@ static int usbvideo_NewFrame(struct uvd *uvd, int framenum) ...@@ -2064,7 +2064,7 @@ static int usbvideo_NewFrame(struct uvd *uvd, int framenum)
* FLAGS_NO_DECODING set. Therefore, any regular build of any driver * FLAGS_NO_DECODING set. Therefore, any regular build of any driver
* based on usbvideo can use this feature at any time. * based on usbvideo can use this feature at any time.
*/ */
static void usbvideo_CollectRawData(struct uvd *uvd, usbvideo_frame_t *frame) static void usbvideo_CollectRawData(struct uvd *uvd, struct usbvideo_frame *frame)
{ {
int n; int n;
...@@ -2096,7 +2096,7 @@ static void usbvideo_CollectRawData(struct uvd *uvd, usbvideo_frame_t *frame) ...@@ -2096,7 +2096,7 @@ static void usbvideo_CollectRawData(struct uvd *uvd, usbvideo_frame_t *frame)
static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
{ {
usbvideo_frame_t *frame = &uvd->frame[frameNum]; struct usbvideo_frame *frame = &uvd->frame[frameNum];
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum); info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum);
...@@ -2226,7 +2226,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) ...@@ -2226,7 +2226,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
* line above then we just copy next line. Similarly, if we need to * line above then we just copy next line. Similarly, if we need to
* create a last line then preceding line is used. * create a last line then preceding line is used.
*/ */
void usbvideo_DeinterlaceFrame(struct uvd *uvd, usbvideo_frame_t *frame) void usbvideo_DeinterlaceFrame(struct uvd *uvd, struct usbvideo_frame *frame)
{ {
if ((uvd == NULL) || (frame == NULL)) if ((uvd == NULL) || (frame == NULL))
return; return;
...@@ -2297,7 +2297,7 @@ EXPORT_SYMBOL(usbvideo_DeinterlaceFrame); ...@@ -2297,7 +2297,7 @@ EXPORT_SYMBOL(usbvideo_DeinterlaceFrame);
* 09-Feb-2001 Created. * 09-Feb-2001 Created.
*/ */
static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
usbvideo_frame_t *frame) struct usbvideo_frame *frame)
{ {
int i, j, v4l_linesize; int i, j, v4l_linesize;
signed long adj; signed long adj;
......
...@@ -118,13 +118,13 @@ typedef unsigned long videosize_t; ...@@ -118,13 +118,13 @@ typedef unsigned long videosize_t;
#define RING_QUEUE_DEQUEUE_BYTES(rq,n) RING_QUEUE_ADVANCE_INDEX(rq,ri,n) #define RING_QUEUE_DEQUEUE_BYTES(rq,n) RING_QUEUE_ADVANCE_INDEX(rq,ri,n)
#define RING_QUEUE_PEEK(rq,ofs) ((rq)->queue[((ofs) + (rq)->ri) & ((rq)->length-1)]) #define RING_QUEUE_PEEK(rq,ofs) ((rq)->queue[((ofs) + (rq)->ri) & ((rq)->length-1)])
typedef struct { struct RingQueue {
unsigned char *queue; /* Data from the Isoc data pump */ unsigned char *queue; /* Data from the Isoc data pump */
int length; /* How many bytes allocated for the queue */ int length; /* How many bytes allocated for the queue */
int wi; /* That's where we write */ int wi; /* That's where we write */
int ri; /* Read from here until you hit write index */ int ri; /* Read from here until you hit write index */
wait_queue_head_t wqh; /* Processes waiting */ wait_queue_head_t wqh; /* Processes waiting */
} RingQueue_t; };
typedef enum { typedef enum {
ScanState_Scanning, /* Scanning for header */ ScanState_Scanning, /* Scanning for header */
...@@ -158,18 +158,16 @@ typedef enum { ...@@ -158,18 +158,16 @@ typedef enum {
Deinterlace_FillEvenLines Deinterlace_FillEvenLines
} Deinterlace_t; } Deinterlace_t;
struct usb_device;
#define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */ #define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */
#define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */ #define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */
/* This structure represents one Isoc request - URB and buffer */ /* This structure represents one Isoc request - URB and buffer */
typedef struct { struct usbvideo_sbuf {
char *data; char *data;
struct urb *urb; struct urb *urb;
} usbvideo_sbuf_t; };
typedef struct { struct usbvideo_frame {
char *data; /* Frame buffer */ char *data; /* Frame buffer */
unsigned long header; /* Significant bits from the header */ unsigned long header; /* Significant bits from the header */
...@@ -188,10 +186,10 @@ typedef struct { ...@@ -188,10 +186,10 @@ typedef struct {
long seqRead_Index; /* Amount of data that has been already read */ long seqRead_Index; /* Amount of data that has been already read */
void *user; /* Additional data that user may need */ void *user; /* Additional data that user may need */
} usbvideo_frame_t; };
/* Statistics that can be overlaid on screen */ /* Statistics that can be overlaid on screen */
typedef struct { struct usbvideo_statistics {
unsigned long frame_num; /* Sequential number of the frame */ unsigned long frame_num; /* Sequential number of the frame */
unsigned long urb_count; /* How many URBs we received so far */ unsigned long urb_count; /* How many URBs we received so far */
unsigned long urb_length; /* Length of last URB */ unsigned long urb_length; /* Length of last URB */
...@@ -199,7 +197,7 @@ typedef struct { ...@@ -199,7 +197,7 @@ typedef struct {
unsigned long header_count; /* How many frame headers we found */ unsigned long header_count; /* How many frame headers we found */
unsigned long iso_skip_count; /* How many empty ISO packets received */ unsigned long iso_skip_count; /* How many empty ISO packets received */
unsigned long iso_err_count; /* How many bad ISO packets received */ unsigned long iso_err_count; /* How many bad ISO packets received */
} usbvideo_statistics_t; };
struct s_usbvideo_t; struct s_usbvideo_t;
...@@ -236,16 +234,16 @@ struct uvd { ...@@ -236,16 +234,16 @@ struct uvd {
int curframe; int curframe;
int iso_packet_len; /* Videomode-dependent, saves bus bandwidth */ int iso_packet_len; /* Videomode-dependent, saves bus bandwidth */
RingQueue_t dp; /* Isoc data pump */ struct RingQueue dp; /* Isoc data pump */
usbvideo_frame_t frame[USBVIDEO_NUMFRAMES]; struct usbvideo_frame frame[USBVIDEO_NUMFRAMES];
usbvideo_sbuf_t sbuf[USBVIDEO_NUMSBUF]; struct usbvideo_sbuf sbuf[USBVIDEO_NUMSBUF];
volatile int remove_pending; /* If set then about to exit */ volatile int remove_pending; /* If set then about to exit */
struct video_picture vpic, vpic_old; /* Picture settings */ struct video_picture vpic, vpic_old; /* Picture settings */
struct video_capability vcap; /* Video capabilities */ struct video_capability vcap; /* Video capabilities */
struct video_channel vchan; /* May be used for tuner support */ struct video_channel vchan; /* May be used for tuner support */
usbvideo_statistics_t stats; struct usbvideo_statistics stats;
struct proc_dir_entry *procfs_vEntry; /* /proc/video/MYDRIVER/video2 */ struct proc_dir_entry *procfs_vEntry; /* /proc/video/MYDRIVER/video2 */
char videoName[32]; /* Holds name like "video7" */ char videoName[32]; /* Holds name like "video7" */
}; };
...@@ -255,32 +253,32 @@ struct uvd { ...@@ -255,32 +253,32 @@ struct uvd {
* services are registered. All of these default to NULL, except those * services are registered. All of these default to NULL, except those
* that default to usbvideo-provided methods. * that default to usbvideo-provided methods.
*/ */
typedef struct { struct usbvideo_cb {
void *(*probe)(struct usb_device *, unsigned int,const struct usb_device_id *); void *(*probe)(struct usb_device *, unsigned int,const struct usb_device_id *);
void (*userFree)(struct uvd *); void (*userFree)(struct uvd *);
void (*disconnect)(struct usb_device *, void *); void (*disconnect)(struct usb_device *, void *);
int (*setupOnOpen)(struct uvd *); int (*setupOnOpen)(struct uvd *);
void (*videoStart)(struct uvd *); void (*videoStart)(struct uvd *);
void (*videoStop)(struct uvd *); void (*videoStop)(struct uvd *);
void (*processData)(struct uvd *, usbvideo_frame_t *); void (*processData)(struct uvd *, struct usbvideo_frame *);
void (*postProcess)(struct uvd *, usbvideo_frame_t *); void (*postProcess)(struct uvd *, struct usbvideo_frame *);
void (*adjustPicture)(struct uvd *); void (*adjustPicture)(struct uvd *);
int (*getFPS)(struct uvd *); int (*getFPS)(struct uvd *);
int (*overlayHook)(struct uvd *, usbvideo_frame_t *); int (*overlayHook)(struct uvd *, struct usbvideo_frame *);
int (*getFrame)(struct uvd *, int); int (*getFrame)(struct uvd *, int);
int (*procfs_read)(char *page,char **start,off_t off,int count,int *eof,void *data); int (*procfs_read)(char *page,char **start,off_t off,int count,int *eof,void *data);
int (*procfs_write)(struct file *file,const char *buffer,unsigned long count,void *data); int (*procfs_write)(struct file *file,const char *buffer,unsigned long count,void *data);
int (*startDataPump)(struct uvd *uvd); int (*startDataPump)(struct uvd *uvd);
void (*stopDataPump)(struct uvd *uvd); void (*stopDataPump)(struct uvd *uvd);
int (*setVideoMode)(struct uvd *uvd, struct video_window *vw); int (*setVideoMode)(struct uvd *uvd, struct video_window *vw);
} usbvideo_cb_t; };
struct s_usbvideo_t { struct s_usbvideo_t {
int num_cameras; /* As allocated */ int num_cameras; /* As allocated */
struct usb_driver usbdrv; /* Interface to the USB stack */ struct usb_driver usbdrv; /* Interface to the USB stack */
char drvName[80]; /* Driver name */ char drvName[80]; /* Driver name */
struct semaphore lock; /* Mutex protecting camera structures */ struct semaphore lock; /* Mutex protecting camera structures */
usbvideo_cb_t cb; /* Table of callbacks (virtual methods) */ struct usbvideo_cb cb; /* Table of callbacks (virtual methods) */
struct video_device vdt; /* Video device template */ struct video_device vdt; /* Video device template */
struct uvd *cam; /* Array of camera structures */ struct uvd *cam; /* Array of camera structures */
int uses_procfs; /* Non-zero if we create /proc entries */ int uses_procfs; /* Non-zero if we create /proc entries */
...@@ -306,23 +304,23 @@ typedef struct s_usbvideo_t usbvideo_t; ...@@ -306,23 +304,23 @@ typedef struct s_usbvideo_t usbvideo_t;
#define VALID_CALLBACK(uvd,cbName) ((((uvd) != NULL) && \ #define VALID_CALLBACK(uvd,cbName) ((((uvd) != NULL) && \
((uvd)->handle != NULL)) ? GET_CALLBACK(uvd,cbName) : NULL) ((uvd)->handle != NULL)) ? GET_CALLBACK(uvd,cbName) : NULL)
int RingQueue_Dequeue(RingQueue_t *rq, unsigned char *dst, int len); int RingQueue_Dequeue(struct RingQueue *rq, unsigned char *dst, int len);
int RingQueue_Enqueue(RingQueue_t *rq, const unsigned char *cdata, int n); int RingQueue_Enqueue(struct RingQueue *rq, const unsigned char *cdata, int n);
void RingQueue_WakeUpInterruptible(RingQueue_t *rq); void RingQueue_WakeUpInterruptible(struct RingQueue *rq);
void RingQueue_Flush(RingQueue_t *rq); void RingQueue_Flush(struct RingQueue *rq);
static inline int RingQueue_GetLength(const RingQueue_t *rq) static inline int RingQueue_GetLength(const struct RingQueue *rq)
{ {
return (rq->wi - rq->ri + rq->length) & (rq->length-1); return (rq->wi - rq->ri + rq->length) & (rq->length-1);
} }
static inline int RingQueue_GetFreeSpace(const RingQueue_t *rq) static inline int RingQueue_GetFreeSpace(const struct RingQueue *rq)
{ {
return rq->length - RingQueue_GetLength(rq); return rq->length - RingQueue_GetLength(rq);
} }
void usbvideo_DrawLine( void usbvideo_DrawLine(
usbvideo_frame_t *frame, struct usbvideo_frame *frame,
int x1, int y1, int x1, int y1,
int x2, int y2, int x2, int y2,
unsigned char cr, unsigned char cg, unsigned char cb); unsigned char cr, unsigned char cg, unsigned char cb);
...@@ -338,7 +336,7 @@ int usbvideo_register( ...@@ -338,7 +336,7 @@ int usbvideo_register(
const int num_cams, const int num_cams,
const int num_extra, const int num_extra,
const char *driverName, const char *driverName,
const usbvideo_cb_t *cbTable, const struct usbvideo_cb *cbTable,
struct module *md, struct module *md,
const struct usb_device_id *id_table); const struct usb_device_id *id_table);
struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams); struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams);
...@@ -347,7 +345,7 @@ void usbvideo_Deregister(usbvideo_t **uvt); ...@@ -347,7 +345,7 @@ void usbvideo_Deregister(usbvideo_t **uvt);
int usbvideo_v4l_initialize(struct video_device *dev); int usbvideo_v4l_initialize(struct video_device *dev);
void usbvideo_DeinterlaceFrame(struct uvd *uvd, usbvideo_frame_t *frame); void usbvideo_DeinterlaceFrame(struct uvd *uvd, struct usbvideo_frame *frame);
/* /*
* This code performs bounds checking - use it when working with * This code performs bounds checking - use it when working with
...@@ -363,7 +361,7 @@ void usbvideo_DeinterlaceFrame(struct uvd *uvd, usbvideo_frame_t *frame); ...@@ -363,7 +361,7 @@ void usbvideo_DeinterlaceFrame(struct uvd *uvd, usbvideo_frame_t *frame);
* VIDEOSIZE_X(fr->request), total VIDEOSIZE_Y(frame->request) lines. * VIDEOSIZE_X(fr->request), total VIDEOSIZE_Y(frame->request) lines.
*/ */
static inline void RGB24_PUTPIXEL( static inline void RGB24_PUTPIXEL(
usbvideo_frame_t *fr, struct usbvideo_frame *fr,
int ix, int iy, int ix, int iy,
unsigned char vr, unsigned char vr,
unsigned char vg, unsigned char vg,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment