Commit 6c645061 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linuxusb.bkbits.net/linus-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 19be573c febf5939
Revised: 2001-Dec-06. Revised: 2002-Feb-09.
This is the documentation of (hopefully) all possible error codes (and This is the documentation of (hopefully) all possible error codes (and
their interpretation) that can be returned from the host controller drivers their interpretation) that can be returned from usbcore.
and from usbcore.
Some of them are returned by the Host Controller Drivers (HCDs), which
device drivers only see through usbcore. As a rule, all the HCDs should
behave the same except for transfer speed dependent behaviors.
************************************************************************** **************************************************************************
...@@ -19,9 +22,9 @@ USB-specific: ...@@ -19,9 +22,9 @@ USB-specific:
-ENODEV specified USB-device or bus doesn't exist -ENODEV specified USB-device or bus doesn't exist
-ENXIO a control or interrupt URB is already queued to this endpoint; or -ENXIO a control or interrupt URB is already queued to this endpoint;
a bulk URB is already queued to this endpoint and or (UHCI only) a bulk URB is already queued to this endpoint
USB_QUEUE_BULK wasn't used (UHCI HCDs only) and USB_QUEUE_BULK wasn't used
-EINVAL a) Invalid transfer type specified (or not supported) -EINVAL a) Invalid transfer type specified (or not supported)
b) Invalid interrupt interval (0<=n<256) b) Invalid interrupt interval (0<=n<256)
...@@ -34,7 +37,8 @@ USB-specific: ...@@ -34,7 +37,8 @@ USB-specific:
-EFBIG too much ISO frames requested (currently uhci>900) -EFBIG too much ISO frames requested (currently uhci>900)
-EPIPE specified pipe-handle is already stalled -EPIPE Specified endpoint is stalled. For non-control endpoints,
reset this status with usb_clear_halt().
-EMSGSIZE endpoint message size is zero, do interface/alternate setting -EMSGSIZE endpoint message size is zero, do interface/alternate setting
...@@ -50,19 +54,29 @@ USB-specific: ...@@ -50,19 +54,29 @@ USB-specific:
* or in iso_frame_desc[n].status (for ISO) * * or in iso_frame_desc[n].status (for ISO) *
************************************************************************** **************************************************************************
USB device drivers may only test urb status values in completion handlers.
This is because otherwise there would be a race between HCDs updating
these values on one CPU, and device drivers testing them on another CPU.
A transfer's actual_length may be positive even when an error has been
reported. That's because transfers often involve several packets, so that
one or more packets could finish before an error stops further endpoint I/O.
0 Transfer completed successfully 0 Transfer completed successfully
-ENOENT URB was canceled by usb_unlink_urb -ENOENT URB was synchronously unlinked by usb_unlink_urb
-EINPROGRESS URB still pending, no results yet -EINPROGRESS URB still pending, no results yet
(actually no error until now;-) (That is, if drivers see this it's a bug.)
-EPROTO a) bitstuff error -EPROTO (*) a) bitstuff error
b) unknown USB error b) unknown USB error
-EILSEQ CRC mismatch -EILSEQ (*) CRC mismatch
-EPIPE endpoint stalled -EPIPE Endpoint stalled. For non-control endpoints,
reset this status with usb_clear_halt().
-ECOMM During an IN transfer, the host controller -ECOMM During an IN transfer, the host controller
received data from an endpoint faster than it received data from an endpoint faster than it
...@@ -72,24 +86,35 @@ USB-specific: ...@@ -72,24 +86,35 @@ USB-specific:
could not retrieve data from system memory fast could not retrieve data from system memory fast
enough to keep up with the USB data rate enough to keep up with the USB data rate
-EOVERFLOW The amount of data returned by the endpoint was -EOVERFLOW (*) The amount of data returned by the endpoint was
greater than either the max packet size of the greater than either the max packet size of the
endpoint or the remaining buffer size. "Babble". endpoint or the remaining buffer size. "Babble".
-EREMOTEIO The endpoint returned less than max packet size -EREMOTEIO The endpoint returned less than max packet size
and that amount did not fill the specified buffer and that amount did not fill the specified buffer
-ETIMEDOUT transfer timed out, NAK (and USB_DISBLE_SPD was not set in transfer_flags)
-ENODEV device was removed -ETIMEDOUT transfer timed out, NAK
-EREMOTEIO short packet detected -ENODEV Device was removed. Often preceded by a burst of
other errors, since the hub driver does't detect
device removal events immediately.
-EXDEV ISO transfer only partially completed -EXDEV ISO transfer only partially completed
look at individual frame status for details look at individual frame status for details
-EINVAL ISO madness, if this happens: Log off and go home -EINVAL ISO madness, if this happens: Log off and go home
-ECONNRESET the URB is being unlinked asynchronously -ECONNRESET URB was asynchronously unlinked by usb_unlink_urb
-ESHUTDOWN The host controller has been disabled due to some
problem that could not be worked around.
(*) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate
hardware problems such as bad devices (including firmware) or cables.
************************************************************************** **************************************************************************
* Error codes returned by usbcore-functions * * Error codes returned by usbcore-functions *
...@@ -100,4 +125,6 @@ usb_register(): ...@@ -100,4 +125,6 @@ usb_register():
-EINVAL error during registering new driver -EINVAL error during registering new driver
usb_get_*/usb_set_*(): usb_get_*/usb_set_*():
usb_control_msg():
usb_bulk_msg():
All USB errors (submit/status) can occur All USB errors (submit/status) can occur
...@@ -505,6 +505,21 @@ CONFIG_USB_DABUSB ...@@ -505,6 +505,21 @@ CONFIG_USB_DABUSB
The module will be called dabusb.o. If you want to compile it as a The module will be called dabusb.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
CONFIG_USB_KONICAWC
Say Y here if you want support for webcams based on a Konica
chipset. This is known to work with the Intel YC76 webcam.
This driver uses the Video For Linux API. You must enable
(Y or M in config) Video For Linux (under Character Devices)
to use this driver. Information on this API and pointers to
"v4l" programs may be found on the WWW at
<http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called konicawc.o. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
CONFIG_USB_USBNET CONFIG_USB_USBNET
This driver supports network links over USB with USB "Network" This driver supports network links over USB with USB "Network"
or "data transfer" cables, often used to network laptops to PCs. or "data transfer" cables, often used to network laptops to PCs.
......
...@@ -80,6 +80,7 @@ else ...@@ -80,6 +80,7 @@ else
dep_tristate ' USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)' CONFIG_USB_VICAM $CONFIG_USB $CONFIG_VIDEO_DEV $CONFIG_EXPERIMENTAL dep_tristate ' USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)' CONFIG_USB_VICAM $CONFIG_USB $CONFIG_VIDEO_DEV $CONFIG_EXPERIMENTAL
dep_tristate ' D-Link USB FM radio support (EXPERIMENTAL)' CONFIG_USB_DSBR $CONFIG_USB $CONFIG_VIDEO_DEV $CONFIG_EXPERIMENTAL dep_tristate ' D-Link USB FM radio support (EXPERIMENTAL)' CONFIG_USB_DSBR $CONFIG_USB $CONFIG_VIDEO_DEV $CONFIG_EXPERIMENTAL
dep_tristate ' DABUSB driver' CONFIG_USB_DABUSB $CONFIG_USB dep_tristate ' DABUSB driver' CONFIG_USB_DABUSB $CONFIG_USB
dep_tristate ' USB Konica Webcam support' CONFIG_USB_KONICAWC $CONFIG_USB $CONFIG_VIDEO_DEV
fi fi
comment 'USB Network adaptors' comment 'USB Network adaptors'
......
...@@ -64,6 +64,7 @@ obj-$(CONFIG_USB_ACM) += acm.o ...@@ -64,6 +64,7 @@ obj-$(CONFIG_USB_ACM) += acm.o
obj-$(CONFIG_USB_PRINTER) += printer.o obj-$(CONFIG_USB_PRINTER) += printer.o
obj-$(CONFIG_USB_AUDIO) += audio.o obj-$(CONFIG_USB_AUDIO) += audio.o
obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o
obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o
obj-$(CONFIG_USB_PWC) += pwc.o obj-$(CONFIG_USB_PWC) += pwc.o
obj-$(CONFIG_USB_DC2XX) += dc2xx.o obj-$(CONFIG_USB_DC2XX) += dc2xx.o
obj-$(CONFIG_USB_MDC800) += mdc800.o obj-$(CONFIG_USB_MDC800) += mdc800.o
......
/*
* $Id: konicawc.c,v 1.12 2002/02/07 23:18:53 spse Exp $
*
* konicawc.c - konica webcam driver
*
* Author: Simon Evans <spse@secret.org.uk>
*
* Copyright (C) 2002 Simon Evans
*
* Licence: GPL
*
* Driver for USB webcams based on Konica chipset. This
* chipset is used in Intel YC76 camera.
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#define DEBUG
#include "usbvideo.h"
#define MAX_BRIGHTNESS 108
#define MAX_CONTRAST 108
#define MAX_SATURATION 108
#define MAX_SHARPNESS 108
#define MAX_WHITEBAL 363
#define MAX_CAMERAS 1
enum ctrl_req {
SetWhitebal = 0x01,
SetBrightness = 0x02,
SetSharpness = 0x03,
SetContrast = 0x04,
SetSaturation = 0x05,
};
enum frame_sizes {
SIZE_160X130 = 0,
SIZE_176X144 = 1,
SIZE_320X240 = 2,
};
static usbvideo_t *cams;
/* Some default values for inital camera settings,
can be set by modprobe */
static int debug;
static enum frame_sizes size;
static int brightness = MAX_BRIGHTNESS/2;
static int contrast = MAX_CONTRAST/2;
static int saturation = MAX_SATURATION/2;
static int sharpness = MAX_SHARPNESS/2;
static int whitebal = 3*(MAX_WHITEBAL/4);
struct konicawc {
u8 brightness; /* camera uses 0 - 9, x11 for real value */
u8 contrast; /* as above */
u8 saturation; /* as above */
u8 sharpness; /* as above */
u8 white_bal; /* 0 - 33, x11 for real value */
u8 fps; /* Stored as fps * 3 */
u8 size; /* Frame Size */
int height;
int width;
struct urb *sts_urb[USBVIDEO_NUMFRAMES];
u8 sts_buf[USBVIDEO_NUMFRAMES][FRAMES_PER_DESC];
struct urb *last_data_urb;
int lastframe;
};
#define konicawc_set_misc(uvd, req, value, index) konicawc_ctrl_msg(uvd, USB_DIR_OUT, req, value, index, NULL, 0)
#define konicawc_get_misc(uvd, req, value, index, buf, sz) konicawc_ctrl_msg(uvd, USB_DIR_IN, req, value, index, buf, sz)
#define konicawc_set_value(uvd, value, index) konicawc_ctrl_msg(uvd, USB_DIR_OUT, 2, value, index, NULL, 0)
static int konicawc_ctrl_msg(uvd_t *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len)
{
int retval = usb_control_msg(uvd->dev,
dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0),
request, 0x40 | dir, value, index, buf, len, HZ);
return retval < 0 ? retval : 0;
}
static int konicawc_setup_on_open(uvd_t *uvd)
{
struct konicawc *cam = (struct konicawc *)uvd->user_data;
konicawc_set_misc(uvd, 0x2, 0, 0x0b);
dbg("setting brightness to %d (%d)", cam->brightness,
cam->brightness*11);
konicawc_set_value(uvd, cam->brightness, SetBrightness);
dbg("setting white balance to %d (%d)", cam->white_bal,
cam->white_bal*11);
konicawc_set_value(uvd, cam->white_bal, SetWhitebal);
dbg("setting contrast to %d (%d)", cam->contrast,
cam->contrast*11);
konicawc_set_value(uvd, cam->brightness, SetBrightness);
dbg("setting saturation to %d (%d)", cam->saturation,
cam->saturation*11);
konicawc_set_value(uvd, cam->saturation, SetSaturation);
dbg("setting sharpness to %d (%d)", cam->sharpness,
cam->sharpness*11);
konicawc_set_value(uvd, cam->sharpness, SetSharpness);
dbg("setting size %d", cam->size);
switch(cam->size) {
case 0:
konicawc_set_misc(uvd, 0x2, 0xa, 0x08);
break;
case 1:
konicawc_set_misc(uvd, 0x2, 4, 0x08);
break;
case 2:
konicawc_set_misc(uvd, 0x2, 5, 0x08);
break;
}
konicawc_set_misc(uvd, 0x2, 1, 0x0b);
cam->lastframe = -1;
return 0;
}
static int konicawc_compress_iso(uvd_t *uvd, struct urb *dataurb, struct urb *stsurb)
{
char *cdata;
int i, totlen = 0;
unsigned char *status = stsurb->transfer_buffer;
int keep = 0, discard = 0, bad = 0;
static int buttonsts = 0;
for (i = 0; i < dataurb->number_of_packets; i++) {
int button = buttonsts;
unsigned char sts;
int n = dataurb->iso_frame_desc[i].actual_length;
int st = dataurb->iso_frame_desc[i].status;
cdata = dataurb->transfer_buffer +
dataurb->iso_frame_desc[i].offset;
/* Detect and ignore errored packets */
if (st < 0) {
if (debug >= 1)
err("Data error: packet=%d. len=%d. status=%d.",
i, n, st);
uvd->stats.iso_err_count++;
continue;
}
/* Detect and ignore empty packets */
if (n <= 0) {
uvd->stats.iso_skip_count++;
continue;
}
/* See what the status data said about the packet */
sts = *(status+stsurb->iso_frame_desc[i].offset);
/* sts: 0x80-0xff: frame start with frame number (ie 0-7f)
* otherwise:
* bit 0 0:drop packet (padding data)
* 1 keep packet
*
* bit 4 0 button not clicked
* 1 button clicked
* button is used to `take a picture' (in software)
*/
if(sts < 0x80) {
button = sts & 0x40;
sts &= ~0x40;
}
/* work out the button status, but dont do
anything with it for now */
if(button != buttonsts) {
dbg("button: %sclicked", button ? "" : "un");
buttonsts = button;
}
if(sts == 0x01) { /* drop frame */
discard++;
continue;
}
if((sts > 0x01) && (sts < 0x80)) {
info("unknown status %2.2x", sts);
bad++;
continue;
}
keep++;
if(*(status+i) & 0x80) { /* frame start */
unsigned char marker[] = { 0, 0xff, 0, 0x00 };
if(debug > 1)
dbg("Adding Marker packet = %d, frame = %2.2x",
i, *(status+i));
marker[3] = *(status+i) - 0x80;
RingQueue_Enqueue(&uvd->dp, marker, 4);
totlen += 4;
}
totlen += n; /* Little local accounting */
if(debug > 5)
dbg("Adding packet %d, bytes = %d", i, n);
RingQueue_Enqueue(&uvd->dp, cdata, n);
}
if(debug > 8) {
dbg("finished: keep = %d discard = %d bad = %d added %d bytes",
keep, discard, bad, totlen);
}
return totlen;
}
static void konicawc_isoc_irq(struct urb *urb)
{
int i, len = 0;
uvd_t *uvd = urb->context;
struct konicawc *cam = (struct konicawc *)uvd->user_data;
/* We don't want to do anything if we are about to be removed! */
if (!CAMERA_IS_OPERATIONAL(uvd))
return;
if (urb->actual_length > 32) {
cam->last_data_urb = urb;
return;
}
if (!uvd->streaming) {
if (debug >= 1)
info("Not streaming, but interrupt!");
return;
}
uvd->stats.urb_count++;
if (urb->actual_length <= 0)
goto urb_done_with;
/* Copy the data received into ring queue */
if(cam->last_data_urb) {
len = konicawc_compress_iso(uvd, cam->last_data_urb, urb);
for (i = 0; i < FRAMES_PER_DESC; i++) {
cam->last_data_urb->iso_frame_desc[i].status = 0;
cam->last_data_urb->iso_frame_desc[i].actual_length = 0;
}
cam->last_data_urb = NULL;
}
uvd->stats.urb_length = len;
if (len <= 0) {
goto urb_done_with;
}
/* Here we got some data */
uvd->stats.data_count += len;
RingQueue_WakeUpInterruptible(&uvd->dp);
urb_done_with:
for (i = 0; i < FRAMES_PER_DESC; i++) {
urb->iso_frame_desc[i].status = 0;
urb->iso_frame_desc[i].actual_length = 0;
}
return;
}
static int konicawc_start_data(uvd_t *uvd)
{
struct usb_device *dev = uvd->dev;
int i, errFlag;
struct konicawc *cam = (struct konicawc *)uvd->user_data;
if (!CAMERA_IS_OPERATIONAL(uvd)) {
err("Camera is not operational");
return -EFAULT;
}
uvd->curframe = -1;
/* Alternate interface 1 is is the biggest frame size */
i = usb_set_interface(dev, uvd->iface, uvd->ifaceAltActive);
if (i < 0) {
err("usb_set_interface error");
uvd->last_error = i;
return -EBUSY;
}
/* We double buffer the Iso lists */
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
int j, k;
struct urb *urb = uvd->sbuf[i].urb;
urb->dev = dev;
urb->context = uvd;
urb->pipe = usb_rcvisocpipe(dev, uvd->video_endp);
urb->transfer_flags = USB_ISO_ASAP;
urb->transfer_buffer = uvd->sbuf[i].data;
urb->complete = konicawc_isoc_irq;
urb->number_of_packets = FRAMES_PER_DESC;
urb->transfer_buffer_length = uvd->iso_packet_len * FRAMES_PER_DESC;
for (j=k=0; j < FRAMES_PER_DESC; j++, k += uvd->iso_packet_len) {
urb->iso_frame_desc[j].offset = k;
urb->iso_frame_desc[j].length = uvd->iso_packet_len;
}
urb = cam->sts_urb[i];
urb->dev = dev;
urb->context = uvd;
urb->pipe = usb_rcvisocpipe(dev, uvd->video_endp-1);
urb->transfer_flags = USB_ISO_ASAP;
urb->transfer_buffer = cam->sts_buf[i];
urb->complete = konicawc_isoc_irq;
urb->number_of_packets = FRAMES_PER_DESC;
urb->transfer_buffer_length = FRAMES_PER_DESC;
for (j=0; j < FRAMES_PER_DESC; j++) {
urb->iso_frame_desc[j].offset = j;
urb->iso_frame_desc[j].length = 1;
}
}
/* Link URBs into a ring so that they invoke each other infinitely */
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
if ((i+1) < USBVIDEO_NUMSBUF) {
cam->sts_urb[i]->next = uvd->sbuf[i].urb;
uvd->sbuf[i].urb->next = cam->sts_urb[i+1];
} else {
cam->sts_urb[i]->next = uvd->sbuf[i].urb;
uvd->sbuf[i].urb->next = cam->sts_urb[0];
}
}
/* Submit all URBs */
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
errFlag = usb_submit_urb(uvd->sbuf[i].urb, GFP_KERNEL);
if (errFlag)
err ("usb_submit_isoc(%d) ret %d", i, errFlag);
errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL);
if (errFlag)
err("usb_submit_isoc(%d) ret %d", i, errFlag);
}
uvd->streaming = 1;
if (debug > 1)
dbg("streaming=1 video_endp=$%02x", uvd->video_endp);
return 0;
}
static void konicawc_stop_data(uvd_t *uvd)
{
int i, j;
struct konicawc *cam = (struct konicawc *)uvd->user_data;
if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL))
return;
/* Unschedule all of the iso td's */
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
j = usb_unlink_urb(uvd->sbuf[i].urb);
if (j < 0)
err("usb_unlink_urb() error %d.", j);
j = usb_unlink_urb(cam->sts_urb[i]);
if (j < 0)
err("usb_unlink_urb() error %d.", j);
}
uvd->streaming = 0;
if (!uvd->remove_pending) {
/* Set packet size to 0 */
j = usb_set_interface(uvd->dev, uvd->iface, uvd->ifaceAltInactive);
if (j < 0) {
err("usb_set_interface() error %d.", j);
uvd->last_error = j;
}
}
}
static void konicawc_process_isoc(uvd_t *uvd, usbvideo_frame_t *frame)
{
int n;
int maxline, yplanesz;
struct konicawc *cam = (struct konicawc *)uvd->user_data;
assert(uvd != NULL);
assert(frame != NULL);
maxline = (cam->height * cam->width * 3) / (2 * 384);
yplanesz = cam->height * cam->width;
if(debug > 5)
dbg("maxline = %d yplanesz = %d", maxline, yplanesz);
if(debug > 3)
dbg("Frame state = %d", frame->scanstate);
if(frame->scanstate == ScanState_Scanning) {
int drop = 0;
int curframe;
int fdrops = 0;
if(debug > 3)
dbg("Searching for marker, queue len = %d", RingQueue_GetLength(&uvd->dp));
while(RingQueue_GetLength(&uvd->dp) >= 4) {
if ((RING_QUEUE_PEEK(&uvd->dp, 0) == 0x00) &&
(RING_QUEUE_PEEK(&uvd->dp, 1) == 0xff) &&
(RING_QUEUE_PEEK(&uvd->dp, 2) == 0x00) &&
(RING_QUEUE_PEEK(&uvd->dp, 3) < 0x80)) {
curframe = RING_QUEUE_PEEK(&uvd->dp, 3);
if(cam->lastframe != -1) {
if(curframe < cam->lastframe) {
fdrops = (curframe + 0x80) - cam->lastframe;
} else {
fdrops = curframe - cam->lastframe;
}
fdrops--;
if(fdrops)
info("Dropped %d frames (%d -> %d)", fdrops,
cam->lastframe, curframe);
}
cam->lastframe = curframe;
frame->curline = 0;
frame->scanstate = ScanState_Lines;
RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, 4);
break;
}
RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, 1);
drop++;
}
}
if(frame->scanstate == ScanState_Scanning)
return;
/* Try to move data from queue into frame buffer
* We get data in blocks of 384 bytes made up of:
* 256 Y, 64 U, 64 V.
* This needs to be written out as a Y plane, a U plane and a V plane.
*/
while ( frame->curline < maxline && (n = RingQueue_GetLength(&uvd->dp)) >= 384) {
/* Y */
RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256);
/* U */
RingQueue_Dequeue(&uvd->dp, frame->data + yplanesz + (frame->curline * 64), 64);
/* V */
RingQueue_Dequeue(&uvd->dp, frame->data + (5 * yplanesz)/4 + (frame->curline * 64), 64);
frame->seqRead_Length += 384;
frame->curline++;
}
/* See if we filled the frame */
if (frame->curline == maxline) {
if(debug > 5)
dbg("got whole frame");
frame->frameState = FrameState_Done_Hold;
frame->curline = 0;
uvd->curframe = -1;
uvd->stats.frame_num++;
}
}
static int konicawc_calculate_fps(uvd_t *uvd)
{
struct konicawc *t = uvd->user_data;
dbg("");
return (t->fps)/3;
}
static void konicawc_configure_video(uvd_t *uvd)
{
struct konicawc *cam = (struct konicawc *)uvd->user_data;
u8 buf[2];
memset(&uvd->vpic, 0, sizeof(uvd->vpic));
memset(&uvd->vpic_old, 0x55, sizeof(uvd->vpic_old));
RESTRICT_TO_RANGE(brightness, 0, MAX_BRIGHTNESS);
RESTRICT_TO_RANGE(contrast, 0, MAX_CONTRAST);
RESTRICT_TO_RANGE(saturation, 0, MAX_SATURATION);
RESTRICT_TO_RANGE(sharpness, 0, MAX_SHARPNESS);
RESTRICT_TO_RANGE(whitebal, 0, MAX_WHITEBAL);
cam->brightness = brightness / 11;
cam->contrast = contrast / 11;
cam->saturation = saturation / 11;
cam->sharpness = sharpness / 11;
cam->white_bal = whitebal / 11;
uvd->vpic.colour = 108;
uvd->vpic.hue = 108;
uvd->vpic.brightness = brightness;
uvd->vpic.contrast = contrast;
uvd->vpic.whiteness = whitebal;
uvd->vpic.depth = 6;
uvd->vpic.palette = VIDEO_PALETTE_YUV420P;
memset(&uvd->vcap, 0, sizeof(uvd->vcap));
strcpy(uvd->vcap.name, "Konica Webcam");
uvd->vcap.type = VID_TYPE_CAPTURE;
uvd->vcap.channels = 1;
uvd->vcap.audios = 0;
uvd->vcap.maxwidth = cam->width;
uvd->vcap.maxheight = cam->height;
uvd->vcap.minwidth = cam->width;
uvd->vcap.minheight = cam->height;
memset(&uvd->vchan, 0, sizeof(uvd->vchan));
uvd->vchan.flags = 0 ;
uvd->vchan.tuners = 0;
uvd->vchan.channel = 0;
uvd->vchan.type = VIDEO_TYPE_CAMERA;
strcpy(uvd->vchan.name, "Camera");
/* Talk to device */
dbg("device init");
if(!konicawc_get_misc(uvd, 0x3, 0, 0x10, buf, 2))
dbg("3,10 -> %2.2x %2.2x", buf[0], buf[1]);
if(!konicawc_get_misc(uvd, 0x3, 0, 0x10, buf, 2))
dbg("3,10 -> %2.2x %2.2x", buf[0], buf[1]);
if(konicawc_set_misc(uvd, 0x2, 0, 0xd))
dbg("2,0,d failed");
dbg("setting initial values");
}
static void *konicawc_probe(struct usb_device *dev, unsigned int ifnum ,const struct usb_device_id *devid)
{
uvd_t *uvd = NULL;
int i, nas;
int actInterface=-1, inactInterface=-1, maxPS=0;
unsigned char video_ep = 0;
if (debug >= 1)
dbg("konicawc_probe(%p,%u.)", dev, ifnum);
/* We don't handle multi-config cameras */
if (dev->descriptor.bNumConfigurations != 1)
return NULL;
info("Konica Webcam (rev. 0x%04x)", dev->descriptor.bcdDevice);
/* Validate found interface: must have one ISO endpoint */
nas = dev->actconfig->interface[ifnum].num_altsetting;
if (debug > 0)
info("Number of alternate settings=%d.", nas);
if (nas < 8) {
err("Too few alternate settings for this camera!");
return NULL;
}
/* Validate all alternate settings */
for (i=0; i < nas; i++) {
const struct usb_interface_descriptor *interface;
const struct usb_endpoint_descriptor *endpoint;
interface = &dev->actconfig->interface[ifnum].altsetting[i];
if (interface->bNumEndpoints != 2) {
err("Interface %d. has %u. endpoints!",
ifnum, (unsigned)(interface->bNumEndpoints));
return NULL;
}
endpoint = &interface->endpoint[1];
dbg("found endpoint: addr: 0x%2.2x maxps = 0x%4.4x",
endpoint->bEndpointAddress, endpoint->wMaxPacketSize);
if (video_ep == 0)
video_ep = endpoint->bEndpointAddress;
else if (video_ep != endpoint->bEndpointAddress) {
err("Alternate settings have different endpoint addresses!");
return NULL;
}
if ((endpoint->bmAttributes & 0x03) != 0x01) {
err("Interface %d. has non-ISO endpoint!", ifnum);
return NULL;
}
if ((endpoint->bEndpointAddress & 0x80) == 0) {
err("Interface %d. has ISO OUT endpoint!", ifnum);
return NULL;
}
if (endpoint->wMaxPacketSize == 0) {
if (inactInterface < 0)
inactInterface = i;
else {
err("More than one inactive alt. setting!");
return NULL;
}
} else {
if (actInterface < 0) {
actInterface = i;
maxPS = endpoint->wMaxPacketSize;
if (debug > 0)
info("Active setting=%d. maxPS=%d.",
i, maxPS);
} else {
/* Got another active alt. setting */
if (maxPS < endpoint->wMaxPacketSize) {
/* This one is better! */
actInterface = i;
maxPS = endpoint->wMaxPacketSize;
if (debug > 0) {
info("Even better active setting=%d. maxPS=%d.",
i, maxPS);
}
}
}
}
}
/* Code below may sleep, need to lock module while we are here */
MOD_INC_USE_COUNT;
uvd = usbvideo_AllocateDevice(cams);
if (uvd != NULL) {
struct konicawc *konicawc_data = (struct konicawc *)(uvd->user_data);
/* Here uvd is a fully allocated uvd_t object */
for(i = 0; i < USBVIDEO_NUMSBUF; i++) {
konicawc_data->sts_urb[i] = usb_alloc_urb(FRAMES_PER_DESC);
}
switch(size) {
case SIZE_160X130:
default:
konicawc_data->height = 136;
konicawc_data->width = 160;
konicawc_data->size = SIZE_160X130;
break;
case SIZE_176X144:
konicawc_data->height = 144;
konicawc_data->width = 176;
konicawc_data->size = SIZE_176X144;
break;
case SIZE_320X240:
konicawc_data->height = 240;
konicawc_data->width = 320;
konicawc_data->size = SIZE_320X240;
break;
}
uvd->flags = 0;
uvd->debug = debug;
uvd->dev = dev;
uvd->iface = ifnum;
uvd->ifaceAltInactive = inactInterface;
uvd->ifaceAltActive = actInterface;
uvd->video_endp = video_ep;
uvd->iso_packet_len = maxPS;
uvd->paletteBits = 1L << VIDEO_PALETTE_YUV420P;
uvd->defaultPalette = VIDEO_PALETTE_YUV420P;
uvd->canvas = VIDEOSIZE(konicawc_data->width, konicawc_data->height);
uvd->videosize = uvd->canvas;
/* Initialize konicawc specific data */
konicawc_configure_video(uvd);
i = usbvideo_RegisterVideoDevice(uvd);
uvd->max_frame_size = (konicawc_data->width * konicawc_data->height * 3)/2;
if (i != 0) {
err("usbvideo_RegisterVideoDevice() failed.");
uvd = NULL;
}
}
MOD_DEC_USE_COUNT;
return uvd;
}
static int __init konicawc_init(void)
{
usbvideo_cb_t cbTbl;
memset(&cbTbl, 0, sizeof(cbTbl));
cbTbl.probe = konicawc_probe;
cbTbl.setupOnOpen = konicawc_setup_on_open;
cbTbl.processData = konicawc_process_isoc;
cbTbl.getFPS = konicawc_calculate_fps;
cbTbl.startDataPump = konicawc_start_data;
cbTbl.stopDataPump = konicawc_stop_data;
return usbvideo_register(
&cams,
MAX_CAMERAS,
sizeof(struct konicawc),
"konicawc",
&cbTbl,
THIS_MODULE);
}
static void __exit konicawc_cleanup(void)
{
usbvideo_Deregister(&cams);
}
#if defined(usb_device_id_ver)
static __devinitdata struct usb_device_id id_table[] = {
{ USB_DEVICE(0x04c8, 0x0720) }, /* Intel YC 76 */
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, id_table);
#endif /* defined(usb_device_id_ver) */
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>");
MODULE_DESCRIPTION("Konica Webcam driver");
MODULE_PARM(size, "i");
MODULE_PARM_DESC(size, "Frame Size 0: 160x136 1: 176x144 2: 320x240");
MODULE_PARM(brightness, "i");
MODULE_PARM_DESC(brightness, "Initial brightness 0 - 108");
MODULE_PARM(contrast, "i");
MODULE_PARM_DESC(contrast, "Initial contrast 0 - 108");
MODULE_PARM(saturation, "i");
MODULE_PARM_DESC(saturation, "Initial saturation 0 - 108");
MODULE_PARM(sharpness, "i");
MODULE_PARM_DESC(sharpness, "Initial brightness 0 - 108");
MODULE_PARM(whitebal, "i");
MODULE_PARM_DESC(whitebal, "Initial white balance 0 - 363");
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug level: 0-9 (default=0)");
module_init(konicawc_init);
module_exit(konicawc_cleanup);
...@@ -415,14 +415,14 @@ ...@@ -415,14 +415,14 @@
/* Structures */ /* Structures */
typedef struct digi_serial { struct digi_serial {
spinlock_t ds_serial_lock; spinlock_t ds_serial_lock;
struct usb_serial_port *ds_oob_port; /* out-of-band port */ struct usb_serial_port *ds_oob_port; /* out-of-band port */
int ds_oob_port_num; /* index of out-of-band port */ int ds_oob_port_num; /* index of out-of-band port */
int ds_device_started; int ds_device_started;
} digi_serial_t; };
typedef struct digi_port { struct digi_port {
spinlock_t dp_port_lock; spinlock_t dp_port_lock;
int dp_port_num; int dp_port_num;
int dp_out_buf_len; int dp_out_buf_len;
...@@ -441,7 +441,7 @@ typedef struct digi_port { ...@@ -441,7 +441,7 @@ typedef struct digi_port {
int dp_in_close; /* close in progress */ int dp_in_close; /* close in progress */
wait_queue_head_t dp_close_wait; /* wait queue for close */ wait_queue_head_t dp_close_wait; /* wait queue for close */
struct tq_struct dp_wakeup_task; struct tq_struct dp_wakeup_task;
} digi_port_t; };
/* Local Function Declarations */ /* Local Function Declarations */
...@@ -599,7 +599,7 @@ static void digi_wakeup_write_lock( struct usb_serial_port *port ) ...@@ -599,7 +599,7 @@ static void digi_wakeup_write_lock( struct usb_serial_port *port )
{ {
unsigned long flags; unsigned long flags;
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
spin_lock_irqsave( &priv->dp_port_lock, flags ); spin_lock_irqsave( &priv->dp_port_lock, flags );
...@@ -645,8 +645,8 @@ static int digi_write_oob_command( struct usb_serial_port *port, ...@@ -645,8 +645,8 @@ static int digi_write_oob_command( struct usb_serial_port *port,
int ret = 0; int ret = 0;
int len; int len;
struct usb_serial_port *oob_port = (struct usb_serial_port *)((digi_serial_t *)port->serial->private)->ds_oob_port; struct usb_serial_port *oob_port = (struct usb_serial_port *)((struct digi_serial *)port->serial->private)->ds_oob_port;
digi_port_t *oob_priv = (digi_port_t *)oob_port->private; struct digi_port *oob_priv = (struct digi_port *)oob_port->private;
unsigned long flags = 0; unsigned long flags = 0;
...@@ -714,7 +714,7 @@ static int digi_write_inb_command( struct usb_serial_port *port, ...@@ -714,7 +714,7 @@ static int digi_write_inb_command( struct usb_serial_port *port,
int ret = 0; int ret = 0;
int len; int len;
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
unsigned char *data = port->write_urb->transfer_buffer; unsigned char *data = port->write_urb->transfer_buffer;
unsigned long flags = 0; unsigned long flags = 0;
...@@ -800,9 +800,9 @@ static int digi_set_modem_signals( struct usb_serial_port *port, ...@@ -800,9 +800,9 @@ static int digi_set_modem_signals( struct usb_serial_port *port,
{ {
int ret; int ret;
digi_port_t *port_priv = (digi_port_t *)port->private; struct digi_port *port_priv = (struct digi_port *)port->private;
struct usb_serial_port *oob_port = (struct usb_serial_port *)((digi_serial_t *)port->serial->private)->ds_oob_port; struct usb_serial_port *oob_port = (struct usb_serial_port *)((struct digi_serial *)port->serial->private)->ds_oob_port;
digi_port_t *oob_priv = (digi_port_t *)oob_port->private; struct digi_port *oob_priv = (struct digi_port *)oob_port->private;
unsigned char *data = oob_port->write_urb->transfer_buffer; unsigned char *data = oob_port->write_urb->transfer_buffer;
unsigned long flags = 0; unsigned long flags = 0;
...@@ -879,7 +879,7 @@ static int digi_transmit_idle( struct usb_serial_port *port, ...@@ -879,7 +879,7 @@ static int digi_transmit_idle( struct usb_serial_port *port,
int ret; int ret;
unsigned char buf[2]; unsigned char buf[2];
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
unsigned long flags = 0; unsigned long flags = 0;
...@@ -919,7 +919,7 @@ static void digi_rx_throttle( struct usb_serial_port *port ) ...@@ -919,7 +919,7 @@ static void digi_rx_throttle( struct usb_serial_port *port )
{ {
unsigned long flags; unsigned long flags;
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
dbg( "digi_rx_throttle: TOP: port=%d", priv->dp_port_num ); dbg( "digi_rx_throttle: TOP: port=%d", priv->dp_port_num );
...@@ -940,7 +940,7 @@ static void digi_rx_unthrottle( struct usb_serial_port *port ) ...@@ -940,7 +940,7 @@ static void digi_rx_unthrottle( struct usb_serial_port *port )
int ret = 0; int ret = 0;
int len; int len;
unsigned long flags; unsigned long flags;
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
struct tty_struct *tty = port->tty; struct tty_struct *tty = port->tty;
...@@ -984,7 +984,7 @@ static void digi_set_termios( struct usb_serial_port *port, ...@@ -984,7 +984,7 @@ static void digi_set_termios( struct usb_serial_port *port,
struct termios *old_termios ) struct termios *old_termios )
{ {
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
unsigned int iflag = port->tty->termios->c_iflag; unsigned int iflag = port->tty->termios->c_iflag;
unsigned int cflag = port->tty->termios->c_cflag; unsigned int cflag = port->tty->termios->c_cflag;
unsigned int old_iflag = old_termios->c_iflag; unsigned int old_iflag = old_termios->c_iflag;
...@@ -1208,7 +1208,7 @@ static int digi_ioctl( struct usb_serial_port *port, struct file *file, ...@@ -1208,7 +1208,7 @@ static int digi_ioctl( struct usb_serial_port *port, struct file *file,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
unsigned int val; unsigned int val;
unsigned long flags = 0; unsigned long flags = 0;
...@@ -1260,7 +1260,7 @@ static int digi_write( struct usb_serial_port *port, int from_user, ...@@ -1260,7 +1260,7 @@ static int digi_write( struct usb_serial_port *port, int from_user,
{ {
int ret,data_len,new_len; int ret,data_len,new_len;
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
unsigned char *data = port->write_urb->transfer_buffer; unsigned char *data = port->write_urb->transfer_buffer;
unsigned char user_buf[64]; /* 64 bytes is max USB bulk packet */ unsigned char user_buf[64]; /* 64 bytes is max USB bulk packet */
unsigned long flags = 0; unsigned long flags = 0;
...@@ -1347,14 +1347,14 @@ static void digi_write_bulk_callback( struct urb *urb ) ...@@ -1347,14 +1347,14 @@ static void digi_write_bulk_callback( struct urb *urb )
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct usb_serial *serial; struct usb_serial *serial;
digi_port_t *priv; struct digi_port *priv;
int ret = 0; int ret = 0;
dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status ); dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status );
/* port and serial sanity check */ /* port and serial sanity check */
if( port == NULL || (priv=(digi_port_t *)(port->private)) == NULL ) { if( port == NULL || (priv=(struct digi_port *)(port->private)) == NULL ) {
err( __FUNCTION__ ": port or port->private is NULL, status=%d", err( __FUNCTION__ ": port or port->private is NULL, status=%d",
urb->status ); urb->status );
return; return;
...@@ -1367,7 +1367,7 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status ); ...@@ -1367,7 +1367,7 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status );
/* handle oob callback */ /* handle oob callback */
if( priv->dp_port_num if( priv->dp_port_num
== ((digi_serial_t *)(serial->private))->ds_oob_port_num ) { == ((struct digi_serial *)(serial->private))->ds_oob_port_num ) {
dbg( "digi_write_bulk_callback: oob callback" ); dbg( "digi_write_bulk_callback: oob callback" );
spin_lock( &priv->dp_port_lock ); spin_lock( &priv->dp_port_lock );
priv->dp_write_urb_in_use = 0; priv->dp_write_urb_in_use = 0;
...@@ -1427,7 +1427,7 @@ static int digi_write_room( struct usb_serial_port *port ) ...@@ -1427,7 +1427,7 @@ static int digi_write_room( struct usb_serial_port *port )
{ {
int room; int room;
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
unsigned long flags = 0; unsigned long flags = 0;
...@@ -1450,7 +1450,7 @@ dbg( "digi_write_room: port=%d, room=%d", priv->dp_port_num, room ); ...@@ -1450,7 +1450,7 @@ dbg( "digi_write_room: port=%d, room=%d", priv->dp_port_num, room );
static int digi_chars_in_buffer( struct usb_serial_port *port ) static int digi_chars_in_buffer( struct usb_serial_port *port )
{ {
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
if( port->write_urb->status == -EINPROGRESS if( port->write_urb->status == -EINPROGRESS
...@@ -1471,7 +1471,7 @@ static int digi_open( struct usb_serial_port *port, struct file *filp ) ...@@ -1471,7 +1471,7 @@ static int digi_open( struct usb_serial_port *port, struct file *filp )
int ret; int ret;
unsigned char buf[32]; unsigned char buf[32];
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
struct termios not_termios; struct termios not_termios;
unsigned long flags = 0; unsigned long flags = 0;
...@@ -1548,7 +1548,7 @@ static void digi_close( struct usb_serial_port *port, struct file *filp ) ...@@ -1548,7 +1548,7 @@ static void digi_close( struct usb_serial_port *port, struct file *filp )
int ret; int ret;
unsigned char buf[32]; unsigned char buf[32];
struct tty_struct *tty = port->tty; struct tty_struct *tty = port->tty;
digi_port_t *priv = (digi_port_t *)port->private; struct digi_port *priv = (struct digi_port *)port->private;
unsigned long flags = 0; unsigned long flags = 0;
...@@ -1656,7 +1656,7 @@ static int digi_startup_device( struct usb_serial *serial ) ...@@ -1656,7 +1656,7 @@ static int digi_startup_device( struct usb_serial *serial )
{ {
int i,ret = 0; int i,ret = 0;
digi_serial_t *serial_priv = (digi_serial_t *)serial->private; struct digi_serial *serial_priv = (struct digi_serial *)serial->private;
struct usb_serial_port *port; struct usb_serial_port *port;
...@@ -1695,8 +1695,8 @@ static int digi_startup( struct usb_serial *serial ) ...@@ -1695,8 +1695,8 @@ static int digi_startup( struct usb_serial *serial )
{ {
int i; int i;
digi_port_t *priv; struct digi_port *priv;
digi_serial_t *serial_priv; struct digi_serial *serial_priv;
dbg( "digi_startup: TOP" ); dbg( "digi_startup: TOP" );
...@@ -1707,9 +1707,9 @@ dbg( "digi_startup: TOP" ); ...@@ -1707,9 +1707,9 @@ dbg( "digi_startup: TOP" );
/* allocate port private structure */ /* allocate port private structure */
priv = serial->port[i].private = priv = serial->port[i].private =
(digi_port_t *)kmalloc( sizeof(digi_port_t), (struct digi_port *)kmalloc( sizeof(struct digi_port),
GFP_KERNEL ); GFP_KERNEL );
if( priv == (digi_port_t *)0 ) { if( priv == (struct digi_port *)0 ) {
while( --i >= 0 ) while( --i >= 0 )
kfree( serial->port[i].private ); kfree( serial->port[i].private );
return( 1 ); /* error */ return( 1 ); /* error */
...@@ -1742,9 +1742,9 @@ dbg( "digi_startup: TOP" ); ...@@ -1742,9 +1742,9 @@ dbg( "digi_startup: TOP" );
/* allocate serial private structure */ /* allocate serial private structure */
serial_priv = serial->private = serial_priv = serial->private =
(digi_serial_t *)kmalloc( sizeof(digi_serial_t), (struct digi_serial *)kmalloc( sizeof(struct digi_serial),
GFP_KERNEL ); GFP_KERNEL );
if( serial_priv == (digi_serial_t *)0 ) { if( serial_priv == (struct digi_serial *)0 ) {
for( i=0; i<serial->type->num_ports+1; i++ ) for( i=0; i<serial->type->num_ports+1; i++ )
kfree( serial->port[i].private ); kfree( serial->port[i].private );
return( 1 ); /* error */ return( 1 ); /* error */
...@@ -1765,7 +1765,7 @@ static void digi_shutdown( struct usb_serial *serial ) ...@@ -1765,7 +1765,7 @@ static void digi_shutdown( struct usb_serial *serial )
{ {
int i; int i;
digi_port_t *priv; struct digi_port *priv;
unsigned long flags; unsigned long flags;
...@@ -1800,14 +1800,14 @@ static void digi_read_bulk_callback( struct urb *urb ) ...@@ -1800,14 +1800,14 @@ static void digi_read_bulk_callback( struct urb *urb )
{ {
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
digi_port_t *priv; struct digi_port *priv;
int ret; int ret;
dbg( "digi_read_bulk_callback: TOP" ); dbg( "digi_read_bulk_callback: TOP" );
/* port sanity check, do not resubmit if port is not valid */ /* port sanity check, do not resubmit if port is not valid */
if( port == NULL || (priv=(digi_port_t *)(port->private)) == NULL ) { if( port == NULL || (priv=(struct digi_port *)(port->private)) == NULL ) {
err( __FUNCTION__ ": port or port->private is NULL, status=%d", err( __FUNCTION__ ": port or port->private is NULL, status=%d",
urb->status ); urb->status );
return; return;
...@@ -1827,7 +1827,7 @@ dbg( "digi_read_bulk_callback: TOP" ); ...@@ -1827,7 +1827,7 @@ dbg( "digi_read_bulk_callback: TOP" );
/* handle oob or inb callback, do not resubmit if error */ /* handle oob or inb callback, do not resubmit if error */
if( priv->dp_port_num if( priv->dp_port_num
== ((digi_serial_t *)(port->serial->private))->ds_oob_port_num ) { == ((struct digi_serial *)(port->serial->private))->ds_oob_port_num ) {
if( digi_read_oob_callback( urb ) != 0 ) if( digi_read_oob_callback( urb ) != 0 )
return; return;
} else { } else {
...@@ -1860,7 +1860,7 @@ static int digi_read_inb_callback( struct urb *urb ) ...@@ -1860,7 +1860,7 @@ static int digi_read_inb_callback( struct urb *urb )
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct tty_struct *tty = port->tty; struct tty_struct *tty = port->tty;
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
int opcode = ((unsigned char *)urb->transfer_buffer)[0]; int opcode = ((unsigned char *)urb->transfer_buffer)[0];
int len = ((unsigned char *)urb->transfer_buffer)[1]; int len = ((unsigned char *)urb->transfer_buffer)[1];
int status = ((unsigned char *)urb->transfer_buffer)[2]; int status = ((unsigned char *)urb->transfer_buffer)[2];
...@@ -1972,7 +1972,7 @@ static int digi_read_oob_callback( struct urb *urb ) ...@@ -1972,7 +1972,7 @@ static int digi_read_oob_callback( struct urb *urb )
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
digi_port_t *priv = (digi_port_t *)(port->private); struct digi_port *priv = (struct digi_port *)(port->private);
int opcode, line, status, val; int opcode, line, status, val;
int i; int i;
......
...@@ -154,7 +154,7 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); ...@@ -154,7 +154,7 @@ MODULE_DEVICE_TABLE (usb, id_table_combined);
struct ftdi_private { struct ftdi_private {
ftdi_type_t ftdi_type; enum ftdi_type ftdi_type;
__u16 last_set_data_urb_value ; /* the last data state set - needed for doing a break */ __u16 last_set_data_urb_value ; /* the last data state set - needed for doing a break */
int write_offset; int write_offset;
}; };
...@@ -652,7 +652,7 @@ static void ftdi_sio_read_bulk_callback (struct urb *urb) ...@@ -652,7 +652,7 @@ static void ftdi_sio_read_bulk_callback (struct urb *urb)
} /* ftdi_sio_serial_read_bulk_callback */ } /* ftdi_sio_serial_read_bulk_callback */
static __u16 translate_baudrate_to_ftdi(unsigned int cflag, ftdi_type_t ftdi_type) static __u16 translate_baudrate_to_ftdi(unsigned int cflag, enum ftdi_type ftdi_type)
{ /* translate_baudrate_to_ftdi */ { /* translate_baudrate_to_ftdi */
__u16 urb_value = ftdi_sio_b9600; __u16 urb_value = ftdi_sio_b9600;
......
...@@ -87,13 +87,13 @@ ...@@ -87,13 +87,13 @@
* Data: None * Data: None
*/ */
typedef enum { enum ftdi_type {
sio = 1, sio = 1,
F8U232AM = 2, F8U232AM = 2,
} ftdi_type_t; };
typedef enum { enum {
ftdi_sio_b300 = 0, ftdi_sio_b300 = 0,
ftdi_sio_b600 = 1, ftdi_sio_b600 = 1,
ftdi_sio_b1200 = 2, ftdi_sio_b1200 = 2,
...@@ -104,10 +104,10 @@ typedef enum { ...@@ -104,10 +104,10 @@ typedef enum {
ftdi_sio_b38400 = 7, ftdi_sio_b38400 = 7,
ftdi_sio_b57600 = 8, ftdi_sio_b57600 = 8,
ftdi_sio_b115200 = 9 ftdi_sio_b115200 = 9
} FTDI_SIO_baudrate_t ; };
typedef enum { enum {
ftdi_8U232AM_12MHz_b300 = 0x09c4, ftdi_8U232AM_12MHz_b300 = 0x09c4,
ftdi_8U232AM_12MHz_b600 = 0x04E2, ftdi_8U232AM_12MHz_b600 = 0x04E2,
ftdi_8U232AM_12MHz_b1200 = 0x0271, ftdi_8U232AM_12MHz_b1200 = 0x0271,
...@@ -119,9 +119,9 @@ typedef enum { ...@@ -119,9 +119,9 @@ typedef enum {
ftdi_8U232AM_12MHz_b57600 = 0x000d, ftdi_8U232AM_12MHz_b57600 = 0x000d,
ftdi_8U232AM_12MHz_b115200 = 0x4006, ftdi_8U232AM_12MHz_b115200 = 0x4006,
ftdi_8U232AM_12MHz_b230400 = 0x8003, ftdi_8U232AM_12MHz_b230400 = 0x8003,
} FTDI_8U232AM_12MHz_baudrate_t; };
/* Apparently all devices are 48MHz */ /* Apparently all devices are 48MHz */
typedef enum { enum {
ftdi_8U232AM_48MHz_b300 = 0x2710, ftdi_8U232AM_48MHz_b300 = 0x2710,
ftdi_8U232AM_48MHz_b600 = 0x1388, ftdi_8U232AM_48MHz_b600 = 0x1388,
ftdi_8U232AM_48MHz_b1200 = 0x09c4, ftdi_8U232AM_48MHz_b1200 = 0x09c4,
...@@ -136,7 +136,7 @@ typedef enum { ...@@ -136,7 +136,7 @@ typedef enum {
ftdi_8U232AM_48MHz_b460800 = 0x4006, ftdi_8U232AM_48MHz_b460800 = 0x4006,
ftdi_8U232AM_48MHz_b921600 = 0x8003, ftdi_8U232AM_48MHz_b921600 = 0x8003,
} FTDI_8U232AM_48MHz_baudrate_t; };
#define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA #define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA
#define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40 #define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40
......
...@@ -369,8 +369,8 @@ struct edgeport_port { ...@@ -369,8 +369,8 @@ struct edgeport_port {
struct edgeport_serial { struct edgeport_serial {
char name[MAX_NAME_LEN+1]; /* string name of this device */ char name[MAX_NAME_LEN+1]; /* string name of this device */
EDGE_MANUF_DESCRIPTOR manuf_descriptor; /* the manufacturer descriptor */ struct edge_manuf_descriptor manuf_descriptor; /* the manufacturer descriptor */
EDGE_BOOT_DESCRIPTOR boot_descriptor; /* the boot firmware descriptor */ struct edge_boot_descriptor boot_descriptor; /* the boot firmware descriptor */
struct edgeport_product_info product_info; /* Product Info */ struct edgeport_product_info product_info; /* Product Info */
__u8 interrupt_in_endpoint; /* the interrupt endpoint handle */ __u8 interrupt_in_endpoint; /* the interrupt endpoint handle */
...@@ -397,17 +397,17 @@ struct edgeport_serial { ...@@ -397,17 +397,17 @@ struct edgeport_serial {
}; };
/* baud rate information */ /* baud rate information */
typedef struct _DIVISOR_TABLE_ENTRY { struct divisor_table_entry {
__u32 BaudRate; __u32 BaudRate;
__u16 Divisor; __u16 Divisor;
} DIVISOR_TABLE_ENTRY, *PDIVISOR_TABLE_ENTRY; };
// //
// Define table of divisors for Rev A EdgePort/4 hardware // Define table of divisors for Rev A EdgePort/4 hardware
// These assume a 3.6864MHz crystal, the standard /16, and // These assume a 3.6864MHz crystal, the standard /16, and
// MCR.7 = 0. // MCR.7 = 0.
// //
static DIVISOR_TABLE_ENTRY DivisorTable[] = { static struct divisor_table_entry divisor_table[] = {
{ 75, 3072}, { 75, 3072},
{ 110, 2095}, /* 2094.545455 => 230450 => .0217 % over */ { 110, 2095}, /* 2094.545455 => 230450 => .0217 % over */
{ 134, 1713}, /* 1713.011152 => 230398.5 => .00065% under */ { 134, 1713}, /* 1713.011152 => 230398.5 => .00065% under */
...@@ -507,7 +507,7 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial) ...@@ -507,7 +507,7 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial)
__u16 BootBuildNumber; __u16 BootBuildNumber;
__u8 *BootImage; __u8 *BootImage;
__u32 BootSize; __u32 BootSize;
PEDGE_FIRMWARE_IMAGE_RECORD record; struct edge_firmware_image_record *record;
unsigned char *firmware; unsigned char *firmware;
int response; int response;
...@@ -563,13 +563,13 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial) ...@@ -563,13 +563,13 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial)
firmware = BootImage; firmware = BootImage;
for (;;) { for (;;) {
record = (PEDGE_FIRMWARE_IMAGE_RECORD)firmware; record = (struct edge_firmware_image_record *)firmware;
response = rom_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]); response = rom_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]);
if (response < 0) { if (response < 0) {
err("sram_write failed (%x, %x, %d)", record->ExtAddr, record->Addr, record->Len); err("sram_write failed (%x, %x, %d)", record->ExtAddr, record->Addr, record->Len);
break; break;
} }
firmware += sizeof (EDGE_FIRMWARE_IMAGE_RECORD) + record->Len; firmware += sizeof (struct edge_firmware_image_record) + record->Len;
if (firmware >= &BootImage[BootSize]) { if (firmware >= &BootImage[BootSize]) {
break; break;
} }
...@@ -2569,9 +2569,9 @@ static int calc_baud_rate_divisor (int baudrate, int *divisor) ...@@ -2569,9 +2569,9 @@ static int calc_baud_rate_divisor (int baudrate, int *divisor)
dbg(__FUNCTION__" - %d", baudrate); dbg(__FUNCTION__" - %d", baudrate);
for (i = 0; i < NUM_ENTRIES(DivisorTable); i++) { for (i = 0; i < NUM_ENTRIES(divisor_table); i++) {
if ( DivisorTable[i].BaudRate == baudrate ) { if ( divisor_table[i].BaudRate == baudrate ) {
*divisor = DivisorTable[i].Divisor; *divisor = divisor_table[i].Divisor;
return 0; return 0;
} }
} }
...@@ -2863,7 +2863,7 @@ static void get_boot_desc (struct edgeport_serial *edge_serial) ...@@ -2863,7 +2863,7 @@ static void get_boot_desc (struct edgeport_serial *edge_serial)
****************************************************************************/ ****************************************************************************/
static void load_application_firmware (struct edgeport_serial *edge_serial) static void load_application_firmware (struct edgeport_serial *edge_serial)
{ {
PEDGE_FIRMWARE_IMAGE_RECORD record; struct edge_firmware_image_record *record;
unsigned char *firmware; unsigned char *firmware;
unsigned char *FirmwareImage; unsigned char *FirmwareImage;
int ImageSize; int ImageSize;
...@@ -2901,13 +2901,13 @@ static void load_application_firmware (struct edgeport_serial *edge_serial) ...@@ -2901,13 +2901,13 @@ static void load_application_firmware (struct edgeport_serial *edge_serial)
for (;;) { for (;;) {
record = (PEDGE_FIRMWARE_IMAGE_RECORD)firmware; record = (struct edge_firmware_image_record *)firmware;
response = sram_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]); response = sram_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]);
if (response < 0) { if (response < 0) {
err("sram_write failed (%x, %x, %d)", record->ExtAddr, record->Addr, record->Len); err("sram_write failed (%x, %x, %d)", record->ExtAddr, record->Addr, record->Len);
break; break;
} }
firmware += sizeof (EDGE_FIRMWARE_IMAGE_RECORD) + record->Len; firmware += sizeof (struct edge_firmware_image_record) + record->Len;
if (firmware >= &FirmwareImage[ImageSize]) { if (firmware >= &FirmwareImage[ImageSize]) {
break; break;
} }
......
...@@ -136,7 +136,6 @@ struct string_block { ...@@ -136,7 +136,6 @@ struct string_block {
__u16 Strings[1]; /* Start of string block */ __u16 Strings[1]; /* Start of string block */
}; };
typedef struct string_block STRING_BLOCK, *PSTRING_BLOCK;
#endif #endif
...@@ -12,20 +12,18 @@ ...@@ -12,20 +12,18 @@
//Image structure definition //Image structure definition
#if !defined(DEFINED_EDGE_FIRMWARE_IMAGE_RECORD) #if !defined(DEFINED_EDGE_FIRMWARE_IMAGE_RECORD)
#define DEFINED_EDGE_FIRMWARE_IMAGE_RECORD #define DEFINED_EDGE_FIRMWARE_IMAGE_RECORD
typedef struct _EDGE_FIRMWARE_IMAGE_RECORD struct edge_firmware_image_record {
{
unsigned short ExtAddr; unsigned short ExtAddr;
unsigned short Addr; unsigned short Addr;
unsigned short Len; unsigned short Len;
unsigned char Data[0]; unsigned char Data[0];
} EDGE_FIRMWARE_IMAGE_RECORD, *PEDGE_FIRMWARE_IMAGE_RECORD; };
typedef struct _EDGE_FIRMWARE_VERSION_INFO struct edge_firmware_version_info {
{
unsigned char MajorVersion; unsigned char MajorVersion;
unsigned char MinorVersion; unsigned char MinorVersion;
unsigned short BuildNumber; unsigned short BuildNumber;
} EDGE_FIRMWARE_VERSION_INFO, *PEDGE_FIRMWARE_VERSION_INFO; };
#endif #endif
...@@ -549,7 +547,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = { ...@@ -549,7 +547,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = {
0x7e, 0x74, 0x00, 0x01, 0x02, 0x08, 0xd6, 0x7e, 0x74, 0x00, 0x01, 0x02, 0x08, 0xd6,
}; };
static EDGE_FIRMWARE_VERSION_INFO IMAGE_VERSION_NAME = { static struct edge_firmware_version_info IMAGE_VERSION_NAME = {
1, 12, 2 }; // Major, Minor, Build 1, 12, 2 }; // Major, Minor, Build
#undef IMAGE_VERSION_NAME #undef IMAGE_VERSION_NAME
......
...@@ -12,20 +12,18 @@ ...@@ -12,20 +12,18 @@
//Image structure definition //Image structure definition
#if !defined(DEFINED_EDGE_FIRMWARE_IMAGE_RECORD) #if !defined(DEFINED_EDGE_FIRMWARE_IMAGE_RECORD)
#define DEFINED_EDGE_FIRMWARE_IMAGE_RECORD #define DEFINED_EDGE_FIRMWARE_IMAGE_RECORD
typedef struct _EDGE_FIRMWARE_IMAGE_RECORD struct edge_firmware_image_record {
{
unsigned short ExtAddr; unsigned short ExtAddr;
unsigned short Addr; unsigned short Addr;
unsigned short Len; unsigned short Len;
unsigned char Data[0]; unsigned char Data[0];
} EDGE_FIRMWARE_IMAGE_RECORD, *PEDGE_FIRMWARE_IMAGE_RECORD; };
typedef struct _EDGE_FIRMWARE_VERSION_INFO struct edge_firmware_version_info {
{
unsigned char MajorVersion; unsigned char MajorVersion;
unsigned char MinorVersion; unsigned char MinorVersion;
unsigned short BuildNumber; unsigned short BuildNumber;
} EDGE_FIRMWARE_VERSION_INFO, *PEDGE_FIRMWARE_VERSION_INFO; };
#endif #endif
...@@ -539,7 +537,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = { ...@@ -539,7 +537,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = {
}; };
static EDGE_FIRMWARE_VERSION_INFO IMAGE_VERSION_NAME = { static struct edge_firmware_version_info IMAGE_VERSION_NAME = {
2, 0, 3 }; // Major, Minor, Build 2, 0, 3 }; // Major, Minor, Build
#undef IMAGE_VERSION_NAME #undef IMAGE_VERSION_NAME
......
...@@ -12,20 +12,18 @@ ...@@ -12,20 +12,18 @@
//Image structure definition //Image structure definition
#if !defined(DEFINED_EDGE_FIRMWARE_IMAGE_RECORD) #if !defined(DEFINED_EDGE_FIRMWARE_IMAGE_RECORD)
#define DEFINED_EDGE_FIRMWARE_IMAGE_RECORD #define DEFINED_EDGE_FIRMWARE_IMAGE_RECORD
typedef struct _EDGE_FIRMWARE_IMAGE_RECORD struct edge_firmware_image_record {
{
unsigned short ExtAddr; unsigned short ExtAddr;
unsigned short Addr; unsigned short Addr;
unsigned short Len; unsigned short Len;
unsigned char Data[0]; unsigned char Data[0];
} EDGE_FIRMWARE_IMAGE_RECORD, *PEDGE_FIRMWARE_IMAGE_RECORD; };
typedef struct _EDGE_FIRMWARE_VERSION_INFO struct edge_firmware_version_info {
{
unsigned char MajorVersion; unsigned char MajorVersion;
unsigned char MinorVersion; unsigned char MinorVersion;
unsigned short BuildNumber; unsigned short BuildNumber;
} EDGE_FIRMWARE_VERSION_INFO, *PEDGE_FIRMWARE_VERSION_INFO; };
#endif #endif
...@@ -1114,7 +1112,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = { ...@@ -1114,7 +1112,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = {
0x08, 0xa5, 0xb8, 0x02, 0x03, 0x4e, 0xa0, 0x08, 0x22, 0x80, 0xfe, 0x08, 0xa5, 0xb8, 0x02, 0x03, 0x4e, 0xa0, 0x08, 0x22, 0x80, 0xfe,
}; };
static EDGE_FIRMWARE_VERSION_INFO IMAGE_VERSION_NAME = { static struct edge_firmware_version_info IMAGE_VERSION_NAME = {
1, 12, 3 }; // Major, Minor, Build 1, 12, 3 }; // Major, Minor, Build
#undef IMAGE_VERSION_NAME #undef IMAGE_VERSION_NAME
......
...@@ -12,20 +12,18 @@ ...@@ -12,20 +12,18 @@
//Image structure definition //Image structure definition
#if !defined(DEFINED_EDGE_FIRMWARE_IMAGE_RECORD) #if !defined(DEFINED_EDGE_FIRMWARE_IMAGE_RECORD)
#define DEFINED_EDGE_FIRMWARE_IMAGE_RECORD #define DEFINED_EDGE_FIRMWARE_IMAGE_RECORD
typedef struct _EDGE_FIRMWARE_IMAGE_RECORD struct edge_firmware_image_record {
{
unsigned short ExtAddr; unsigned short ExtAddr;
unsigned short Addr; unsigned short Addr;
unsigned short Len; unsigned short Len;
unsigned char Data[0]; unsigned char Data[0];
} EDGE_FIRMWARE_IMAGE_RECORD, *PEDGE_FIRMWARE_IMAGE_RECORD; };
typedef struct _EDGE_FIRMWARE_VERSION_INFO struct edge_firmware_version_info {
{ unsigned char MajorVersion;
unsigned char MajorVersion;
unsigned char MinorVersion; unsigned char MinorVersion;
unsigned short BuildNumber; unsigned short BuildNumber;
} EDGE_FIRMWARE_VERSION_INFO, *PEDGE_FIRMWARE_VERSION_INFO; };
#endif #endif
...@@ -1126,7 +1124,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = { ...@@ -1126,7 +1124,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = {
0x02, 0x03, 0x4e, 0xa0, 0x08, 0x22, 0x80, 0xfe, 0x02, 0x03, 0x4e, 0xa0, 0x08, 0x22, 0x80, 0xfe,
}; };
static EDGE_FIRMWARE_VERSION_INFO IMAGE_VERSION_NAME = { static struct edge_firmware_version_info IMAGE_VERSION_NAME = {
2, 0, 3 }; // Major, Minor, Build 2, 0, 3 }; // Major, Minor, Build
#undef IMAGE_VERSION_NAME #undef IMAGE_VERSION_NAME
......
...@@ -88,12 +88,12 @@ All 16-bit fields are sent in little-endian (Intel) format. ...@@ -88,12 +88,12 @@ All 16-bit fields are sent in little-endian (Intel) format.
// Interrupt pipe // Interrupt pipe
// //
typedef struct _INT_STATUS_PKT { struct int_status_pkt {
__u16 RxBytesAvail; // Additional bytes available to __u16 RxBytesAvail; // Additional bytes available to
// be read from Bulk IN pipe // be read from Bulk IN pipe
__u16 TxCredits[ MAX_RS232_PORTS ]; // Additional space available in __u16 TxCredits[ MAX_RS232_PORTS ]; // Additional space available in
// given port's TxBuffer // given port's TxBuffer
} INT_STATUS_PKT, *PINT_STATUS_PKT; };
#define GET_INT_STATUS_SIZE(NumPorts) (sizeof(__u16) + (sizeof(__u16) * (NumPorts))) #define GET_INT_STATUS_SIZE(NumPorts) (sizeof(__u16) + (sizeof(__u16) * (NumPorts)))
......
...@@ -182,11 +182,11 @@ ...@@ -182,11 +182,11 @@
// Version 2 format of DeviceParams. This format is longer (3C0h) // Version 2 format of DeviceParams. This format is longer (3C0h)
// and starts lower in memory, at the uppermost 1K in ROM. // and starts lower in memory, at the uppermost 1K in ROM.
#define EDGE_MANUF_DESC_ADDR 0x00FF7C00 #define EDGE_MANUF_DESC_ADDR 0x00FF7C00
#define EDGE_MANUF_DESC_LEN sizeof(EDGE_MANUF_DESCRIPTOR) #define EDGE_MANUF_DESC_LEN sizeof(struct edge_manuf_descriptor)
// Boot params descriptor // Boot params descriptor
#define EDGE_BOOT_DESC_ADDR 0x00FF7FC0 #define EDGE_BOOT_DESC_ADDR 0x00FF7FC0
#define EDGE_BOOT_DESC_LEN sizeof(EDGE_BOOT_DESCRIPTOR) #define EDGE_BOOT_DESC_LEN sizeof(struct edge_boot_descriptor)
// Define the max block size that may be read or written // Define the max block size that may be read or written
// in a read/write RAM/ROM command. // in a read/write RAM/ROM command.
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
#define MAX_SERIALNUMBER_LEN 12 #define MAX_SERIALNUMBER_LEN 12
#define MAX_ASSEMBLYNUMBER_LEN 14 #define MAX_ASSEMBLYNUMBER_LEN 14
typedef struct _EDGE_MANUF_DESCRIPTOR { struct edge_manuf_descriptor {
__u16 RootDescTable[0x10]; // C00 Root of descriptor tables (just a placeholder) __u16 RootDescTable[0x10]; // C00 Root of descriptor tables (just a placeholder)
__u8 DescriptorArea[0x2E0]; // C20 Descriptors go here, up to 2E0h (just a placeholder) __u8 DescriptorArea[0x2E0]; // C20 Descriptors go here, up to 2E0h (just a placeholder)
...@@ -272,7 +272,7 @@ typedef struct _EDGE_MANUF_DESCRIPTOR { ...@@ -272,7 +272,7 @@ typedef struct _EDGE_MANUF_DESCRIPTOR {
__u8 IonConfig; // FBF Config byte for ION manufacturing use __u8 IonConfig; // FBF Config byte for ION manufacturing use
// FBF end of structure, total len = 3C0h // FBF end of structure, total len = 3C0h
} EDGE_MANUF_DESCRIPTOR, *PEDGE_MANUF_DESCRIPTOR; };
#define MANUF_DESC_VER_1 1 // Original definition of MANUF_DESC #define MANUF_DESC_VER_1 1 // Original definition of MANUF_DESC
...@@ -317,10 +317,10 @@ typedef struct _EDGE_MANUF_DESCRIPTOR { ...@@ -317,10 +317,10 @@ typedef struct _EDGE_MANUF_DESCRIPTOR {
#define MANUF_SERNUM_LENGTH sizeof(((PEDGE_MANUF_DESCRIPTOR)0)->SerialNumber) #define MANUF_SERNUM_LENGTH sizeof(((struct edge_manuf_descriptor *)0)->SerialNumber)
#define MANUF_ASSYNUM_LENGTH sizeof(((PEDGE_MANUF_DESCRIPTOR)0)->AssemblyNumber) #define MANUF_ASSYNUM_LENGTH sizeof(((struct edge_manuf_descriptor *)0)->AssemblyNumber)
#define MANUF_OEMASSYNUM_LENGTH sizeof(((PEDGE_MANUF_DESCRIPTOR)0)->OemAssyNumber) #define MANUF_OEMASSYNUM_LENGTH sizeof(((struct edge_manuf_descriptor *)0)->OemAssyNumber)
#define MANUF_MANUFDATE_LENGTH sizeof(((PEDGE_MANUF_DESCRIPTOR)0)->ManufDate) #define MANUF_MANUFDATE_LENGTH sizeof(((struct edge_manuf_descriptor *)0)->ManufDate)
#define MANUF_ION_CONFIG_MASTER 0x80 // 1=Master mode, 0=Normal #define MANUF_ION_CONFIG_MASTER 0x80 // 1=Master mode, 0=Normal
#define MANUF_ION_CONFIG_DIAG 0x40 // 1=Run h/w diags, 0=norm #define MANUF_ION_CONFIG_DIAG 0x40 // 1=Run h/w diags, 0=norm
...@@ -335,7 +335,7 @@ typedef struct _EDGE_MANUF_DESCRIPTOR { ...@@ -335,7 +335,7 @@ typedef struct _EDGE_MANUF_DESCRIPTOR {
// - FF:xFFF. Note that the 930-mandated UCONFIG bytes are // - FF:xFFF. Note that the 930-mandated UCONFIG bytes are
// included in this structure. // included in this structure.
// //
typedef struct _EDGE_BOOT_DESCRIPTOR { struct edge_boot_descriptor {
__u8 Length; // C0 Desc length, per USB (= 40h) __u8 Length; // C0 Desc length, per USB (= 40h)
__u8 DescType; // C1 Desc type, per USB (= DEVICE type) __u8 DescType; // C1 Desc type, per USB (= DEVICE type)
__u8 DescVer; // C2 Desc version/format __u8 DescVer; // C2 Desc version/format
...@@ -359,8 +359,7 @@ typedef struct _EDGE_BOOT_DESCRIPTOR { ...@@ -359,8 +359,7 @@ typedef struct _EDGE_BOOT_DESCRIPTOR {
__u8 UConfig1; // F9 930-defined CPU configuration byte 1 __u8 UConfig1; // F9 930-defined CPU configuration byte 1
__u8 Reserved3[6]; // FA -- unused, set to 0 -- __u8 Reserved3[6]; // FA -- unused, set to 0 --
// FF end of structure, total len = 80 // FF end of structure, total len = 80
};
} EDGE_BOOT_DESCRIPTOR, *PEDGE_BOOT_DESCRIPTOR;
#define BOOT_DESC_VER_1 1 // Original definition of BOOT_PARAMS #define BOOT_DESC_VER_1 1 // Original definition of BOOT_PARAMS
......
...@@ -107,7 +107,7 @@ struct keyspan_serial_private { ...@@ -107,7 +107,7 @@ struct keyspan_serial_private {
/* number of active ports */ /* number of active ports */
atomic_t active_count; atomic_t active_count;
const keyspan_device_details *device_details; const struct keyspan_device_details *device_details;
struct urb *instat_urb; struct urb *instat_urb;
char instat_buf[INSTAT_BUFLEN]; char instat_buf[INSTAT_BUFLEN];
...@@ -125,7 +125,7 @@ struct keyspan_port_private { ...@@ -125,7 +125,7 @@ struct keyspan_port_private {
/* Keep duplicate of device details in each port /* Keep duplicate of device details in each port
structure as well - simplifies some of the structure as well - simplifies some of the
callback functions etc. */ callback functions etc. */
const keyspan_device_details *device_details; const struct keyspan_device_details *device_details;
/* Input endpoints and buffer for this port */ /* Input endpoints and buffer for this port */
struct urb *in_urbs[2]; struct urb *in_urbs[2];
...@@ -243,7 +243,7 @@ static void keyspan_set_termios (struct usb_serial_port *port, ...@@ -243,7 +243,7 @@ static void keyspan_set_termios (struct usb_serial_port *port,
{ {
int baud_rate; int baud_rate;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
unsigned int cflag; unsigned int cflag;
dbg(__FUNCTION__ ".\n"); dbg(__FUNCTION__ ".\n");
...@@ -321,7 +321,7 @@ static int keyspan_write(struct usb_serial_port *port, int from_user, ...@@ -321,7 +321,7 @@ static int keyspan_write(struct usb_serial_port *port, int from_user,
const unsigned char *buf, int count) const unsigned char *buf, int count)
{ {
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
int flip; int flip;
int left, todo; int left, todo;
struct urb *this_urb; struct urb *this_urb;
...@@ -481,7 +481,7 @@ static void usa26_outcont_callback(struct urb *urb) ...@@ -481,7 +481,7 @@ static void usa26_outcont_callback(struct urb *urb)
static void usa26_instat_callback(struct urb *urb) static void usa26_instat_callback(struct urb *urb)
{ {
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
keyspan_usa26_portStatusMessage *msg; struct keyspan_usa26_portStatusMessage *msg;
struct usb_serial *serial; struct usb_serial *serial;
struct usb_serial_port *port; struct usb_serial_port *port;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
...@@ -498,7 +498,7 @@ static void usa26_instat_callback(struct urb *urb) ...@@ -498,7 +498,7 @@ static void usa26_instat_callback(struct urb *urb)
goto exit; goto exit;
} }
msg = (keyspan_usa26_portStatusMessage *)data; msg = (struct keyspan_usa26_portStatusMessage *)data;
#if 0 #if 0
dbg(__FUNCTION__ " port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d\n", dbg(__FUNCTION__ " port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d\n",
...@@ -619,7 +619,7 @@ static void usa28_instat_callback(struct urb *urb) ...@@ -619,7 +619,7 @@ static void usa28_instat_callback(struct urb *urb)
{ {
int err; int err;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
keyspan_usa28_portStatusMessage *msg; struct keyspan_usa28_portStatusMessage *msg;
struct usb_serial *serial; struct usb_serial *serial;
struct usb_serial_port *port; struct usb_serial_port *port;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
...@@ -642,7 +642,7 @@ static void usa28_instat_callback(struct urb *urb) ...@@ -642,7 +642,7 @@ static void usa28_instat_callback(struct urb *urb)
data[6], data[7], data[8], data[9], data[10], data[11]);*/ data[6], data[7], data[8], data[9], data[10], data[11]);*/
/* Now do something useful with the data */ /* Now do something useful with the data */
msg = (keyspan_usa28_portStatusMessage *)data; msg = (struct keyspan_usa28_portStatusMessage *)data;
/* Check port number from message and retrieve private data */ /* Check port number from message and retrieve private data */
...@@ -710,7 +710,7 @@ static void usa49_instat_callback(struct urb *urb) ...@@ -710,7 +710,7 @@ static void usa49_instat_callback(struct urb *urb)
{ {
int err; int err;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
keyspan_usa49_portStatusMessage *msg; struct keyspan_usa49_portStatusMessage *msg;
struct usb_serial *serial; struct usb_serial *serial;
struct usb_serial_port *port; struct usb_serial_port *port;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
...@@ -735,7 +735,7 @@ static void usa49_instat_callback(struct urb *urb) ...@@ -735,7 +735,7 @@ static void usa49_instat_callback(struct urb *urb)
data[6], data[7], data[8], data[9], data[10]);*/ data[6], data[7], data[8], data[9], data[10]);*/
/* Now do something useful with the data */ /* Now do something useful with the data */
msg = (keyspan_usa49_portStatusMessage *)data; msg = (struct keyspan_usa49_portStatusMessage *)data;
/* Check port number from message and retrieve private data */ /* Check port number from message and retrieve private data */
if (msg->portNumber >= serial->num_ports) { if (msg->portNumber >= serial->num_ports) {
...@@ -851,7 +851,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) ...@@ -851,7 +851,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
struct keyspan_serial_private *s_priv; struct keyspan_serial_private *s_priv;
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
int i, already_active, err; int i, already_active, err;
struct urb *urb; struct urb *urb;
...@@ -1106,7 +1106,7 @@ static void keyspan_setup_urbs(struct usb_serial *serial) ...@@ -1106,7 +1106,7 @@ static void keyspan_setup_urbs(struct usb_serial *serial)
{ {
int i, j; int i, j;
struct keyspan_serial_private *s_priv; struct keyspan_serial_private *s_priv;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
struct usb_serial_port *port; struct usb_serial_port *port;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
struct callbacks *cback; struct callbacks *cback;
...@@ -1293,7 +1293,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, ...@@ -1293,7 +1293,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
struct keyspan_usa26_portControlMessage msg; struct keyspan_usa26_portControlMessage msg;
struct keyspan_serial_private *s_priv; struct keyspan_serial_private *s_priv;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
int outcont_urb; int outcont_urb;
struct urb *this_urb; struct urb *this_urb;
int err; int err;
...@@ -1429,7 +1429,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, ...@@ -1429,7 +1429,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
struct keyspan_usa28_portControlMessage msg; struct keyspan_usa28_portControlMessage msg;
struct keyspan_serial_private *s_priv; struct keyspan_serial_private *s_priv;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
struct urb *this_urb; struct urb *this_urb;
int err; int err;
...@@ -1514,7 +1514,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, ...@@ -1514,7 +1514,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
struct keyspan_usa49_portControlMessage msg; struct keyspan_usa49_portControlMessage msg;
struct keyspan_serial_private *s_priv; struct keyspan_serial_private *s_priv;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
int glocont_urb; int glocont_urb;
struct urb *this_urb; struct urb *this_urb;
int err; int err;
...@@ -1640,7 +1640,7 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) ...@@ -1640,7 +1640,7 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port)
{ {
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
struct keyspan_serial_private *s_priv; struct keyspan_serial_private *s_priv;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
s_priv = (struct keyspan_serial_private *)(serial->private); s_priv = (struct keyspan_serial_private *)(serial->private);
d_details = s_priv->device_details; d_details = s_priv->device_details;
...@@ -1666,7 +1666,7 @@ static int keyspan_startup (struct usb_serial *serial) ...@@ -1666,7 +1666,7 @@ static int keyspan_startup (struct usb_serial *serial)
struct usb_serial_port *port; struct usb_serial_port *port;
struct keyspan_serial_private *s_priv; struct keyspan_serial_private *s_priv;
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
const keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
dbg("keyspan_startup called.\n"); dbg("keyspan_startup called.\n");
......
...@@ -194,7 +194,7 @@ struct ezusb_hex_record { ...@@ -194,7 +194,7 @@ struct ezusb_hex_record {
#define keyspan_usa49w_product_id 0x010a #define keyspan_usa49w_product_id 0x010a
typedef struct { struct keyspan_device_details {
/* product ID value */ /* product ID value */
int product_id; int product_id;
...@@ -232,13 +232,13 @@ typedef struct { ...@@ -232,13 +232,13 @@ typedef struct {
u8 *rate_hi, u8 *rate_low, u8 *prescaler); u8 *rate_hi, u8 *rate_low, u8 *prescaler);
u32 baudclk; u32 baudclk;
} keyspan_device_details; };
/* Now for each device type we setup the device detail /* Now for each device type we setup the device detail
structure with the appropriate information (provided structure with the appropriate information (provided
in Keyspan's documentation) */ in Keyspan's documentation) */
static const keyspan_device_details usa18x_device_details = { static const struct keyspan_device_details usa18x_device_details = {
keyspan_usa18x_product_id, /* product ID */ keyspan_usa18x_product_id, /* product ID */
msg_usa26, /* msg type*/ msg_usa26, /* msg type*/
1, /* num ports */ 1, /* num ports */
...@@ -254,7 +254,7 @@ static const keyspan_device_details usa18x_device_details = { ...@@ -254,7 +254,7 @@ static const keyspan_device_details usa18x_device_details = {
KEYSPAN_USA18X_BAUDCLK /* base baud clock */ KEYSPAN_USA18X_BAUDCLK /* base baud clock */
}; };
static const keyspan_device_details usa19_device_details = { static const struct keyspan_device_details usa19_device_details = {
keyspan_usa19_product_id, /* product ID */ keyspan_usa19_product_id, /* product ID */
msg_usa28, /* msg type*/ msg_usa28, /* msg type*/
1, /* num ports */ 1, /* num ports */
...@@ -270,7 +270,7 @@ static const keyspan_device_details usa19_device_details = { ...@@ -270,7 +270,7 @@ static const keyspan_device_details usa19_device_details = {
KEYSPAN_USA19_BAUDCLK /* base baud clock */ KEYSPAN_USA19_BAUDCLK /* base baud clock */
}; };
static const keyspan_device_details usa19w_device_details = { static const struct keyspan_device_details usa19w_device_details = {
keyspan_usa19w_product_id, /* product ID */ keyspan_usa19w_product_id, /* product ID */
msg_usa26, /* msg type*/ msg_usa26, /* msg type*/
1, /* num ports */ 1, /* num ports */
...@@ -286,7 +286,7 @@ static const keyspan_device_details usa19w_device_details = { ...@@ -286,7 +286,7 @@ static const keyspan_device_details usa19w_device_details = {
KEYSPAN_USA19W_BAUDCLK /* base baud clock */ KEYSPAN_USA19W_BAUDCLK /* base baud clock */
}; };
static const keyspan_device_details usa28x_device_details = { static const struct keyspan_device_details usa28x_device_details = {
keyspan_usa28x_product_id, /* product ID */ keyspan_usa28x_product_id, /* product ID */
msg_usa26, /* msg type*/ msg_usa26, /* msg type*/
2, /* num ports */ 2, /* num ports */
...@@ -302,7 +302,7 @@ static const keyspan_device_details usa28x_device_details = { ...@@ -302,7 +302,7 @@ static const keyspan_device_details usa28x_device_details = {
KEYSPAN_USA28X_BAUDCLK KEYSPAN_USA28X_BAUDCLK
}; };
static const keyspan_device_details usa28xa_device_details = { static const struct keyspan_device_details usa28xa_device_details = {
keyspan_usa28xa_product_id, /* product ID */ keyspan_usa28xa_product_id, /* product ID */
msg_usa26, /* msg type*/ msg_usa26, /* msg type*/
2, /* num ports */ 2, /* num ports */
...@@ -320,7 +320,7 @@ static const keyspan_device_details usa28xa_device_details = { ...@@ -320,7 +320,7 @@ static const keyspan_device_details usa28xa_device_details = {
/* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */ /* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
static const keyspan_device_details usa49w_device_details = { static const struct keyspan_device_details usa49w_device_details = {
keyspan_usa49w_product_id, /* product ID */ keyspan_usa49w_product_id, /* product ID */
msg_usa49, /* msg type*/ msg_usa49, /* msg type*/
4, /* num ports */ 4, /* num ports */
...@@ -336,7 +336,7 @@ static const keyspan_device_details usa49w_device_details = { ...@@ -336,7 +336,7 @@ static const keyspan_device_details usa49w_device_details = {
KEYSPAN_USA49W_BAUDCLK KEYSPAN_USA49W_BAUDCLK
}; };
static const keyspan_device_details *keyspan_devices[] = { static const struct keyspan_device_details *keyspan_devices[] = {
&usa18x_device_details, &usa18x_device_details,
&usa19_device_details, &usa19_device_details,
&usa19w_device_details, &usa19w_device_details,
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
#define __USA26MSG__ #define __USA26MSG__
typedef struct keyspan_usa26_portControlMessage struct keyspan_usa26_portControlMessage
{ {
/* /*
there are three types of "commands" sent in the control message: there are three types of "commands" sent in the control message:
...@@ -164,7 +164,7 @@ typedef struct keyspan_usa26_portControlMessage ...@@ -164,7 +164,7 @@ typedef struct keyspan_usa26_portControlMessage
returnStatus, // BOTH: return current status (even if it hasn't changed) returnStatus, // BOTH: return current status (even if it hasn't changed)
resetDataToggle;// BOTH: reset data toggle state to DATA0 resetDataToggle;// BOTH: reset data toggle state to DATA0
} keyspan_usa26_portControlMessage; };
// defines for bits in lcr // defines for bits in lcr
#define USA_DATABITS_5 0x00 #define USA_DATABITS_5 0x00
...@@ -182,7 +182,7 @@ typedef struct keyspan_usa26_portControlMessage ...@@ -182,7 +182,7 @@ typedef struct keyspan_usa26_portControlMessage
// all things called "StatusMessage" are sent on the status endpoint // all things called "StatusMessage" are sent on the status endpoint
typedef struct keyspan_usa26_portStatusMessage // one for each port struct keyspan_usa26_portStatusMessage // one for each port
{ {
u8 port, // BOTH: 0=first, 1=second, other=see below u8 port, // BOTH: 0=first, 1=second, other=see below
hskia_cts, // USA26: reports HSKIA pin hskia_cts, // USA26: reports HSKIA pin
...@@ -195,7 +195,7 @@ typedef struct keyspan_usa26_portStatusMessage // one for each port ...@@ -195,7 +195,7 @@ typedef struct keyspan_usa26_portStatusMessage // one for each port
_txXoff, // port is in XOFF state (either host or RX XOFF) _txXoff, // port is in XOFF state (either host or RX XOFF)
rxEnabled, // as configured by rxOn/rxOff 1=on, 0=off rxEnabled, // as configured by rxOn/rxOff 1=on, 0=off
controlResponse;// 1=a control message has been processed controlResponse;// 1=a control message has been processed
} keyspan_usa26_portStatusMessage; };
// bits in RX data message when STAT byte is included // bits in RX data message when STAT byte is included
#define RXERROR_OVERRUN 0x02 #define RXERROR_OVERRUN 0x02
...@@ -203,28 +203,28 @@ typedef struct keyspan_usa26_portStatusMessage // one for each port ...@@ -203,28 +203,28 @@ typedef struct keyspan_usa26_portStatusMessage // one for each port
#define RXERROR_FRAMING 0x08 #define RXERROR_FRAMING 0x08
#define RXERROR_BREAK 0x10 #define RXERROR_BREAK 0x10
typedef struct keyspan_usa26_globalControlMessage struct keyspan_usa26_globalControlMessage
{ {
u8 sendGlobalStatus, // 2=request for two status responses u8 sendGlobalStatus, // 2=request for two status responses
resetStatusToggle, // 1=reset global status toggle resetStatusToggle, // 1=reset global status toggle
resetStatusCount; // a cycling value resetStatusCount; // a cycling value
} keyspan_usa26_globalControlMessage; };
typedef struct keyspan_usa26_globalStatusMessage struct keyspan_usa26_globalStatusMessage
{ {
u8 port, // 3 u8 port, // 3
sendGlobalStatus, // from request, decremented sendGlobalStatus, // from request, decremented
resetStatusCount; // as in request resetStatusCount; // as in request
} keyspan_usa26_globalStatusMessage; };
typedef struct keyspan_usa26_globalDebugMessage struct keyspan_usa26_globalDebugMessage
{ {
u8 port, // 2 u8 port, // 2
a, a,
b, b,
c, c,
d; d;
} keyspan_usa26_globalDebugMessage; };
// ie: the maximum length of an EZUSB endpoint buffer // ie: the maximum length of an EZUSB endpoint buffer
#define MAX_DATA_LEN 64 #define MAX_DATA_LEN 64
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
#define __USA28MSG__ #define __USA28MSG__
typedef struct keyspan_usa28_portControlMessage struct keyspan_usa28_portControlMessage
{ {
/* /*
there are four types of "commands" sent in the control message: there are four types of "commands" sent in the control message:
...@@ -146,9 +146,9 @@ typedef struct keyspan_usa28_portControlMessage ...@@ -146,9 +146,9 @@ typedef struct keyspan_usa28_portControlMessage
returnStatus, // return current status n times (1 or 2) returnStatus, // return current status n times (1 or 2)
resetDataToggle;// reset data toggle state to DATA0 resetDataToggle;// reset data toggle state to DATA0
} keyspan_usa28_portControlMessage; };
typedef struct keyspan_usa28_portStatusMessage struct keyspan_usa28_portStatusMessage
{ {
u8 port, // 0=first, 1=second, 2=global (see below) u8 port, // 0=first, 1=second, 2=global (see below)
cts, cts,
...@@ -164,32 +164,32 @@ typedef struct keyspan_usa28_portStatusMessage ...@@ -164,32 +164,32 @@ typedef struct keyspan_usa28_portStatusMessage
rxBreak, // 1=we're in break state rxBreak, // 1=we're in break state
rs232invalid, // 1=no valid signals on rs-232 inputs rs232invalid, // 1=no valid signals on rs-232 inputs
controlResponse;// 1=a control messages has been processed controlResponse;// 1=a control messages has been processed
} keyspan_usa28_portStatusMessage; };
// bit defines in txState // bit defines in txState
#define TX_OFF 0x01 // requested by host txOff command #define TX_OFF 0x01 // requested by host txOff command
#define TX_XOFF 0x02 // either real, or simulated by host #define TX_XOFF 0x02 // either real, or simulated by host
typedef struct keyspan_usa28_globalControlMessage struct keyspan_usa28_globalControlMessage
{ {
u8 sendGlobalStatus, // 2=request for two status responses u8 sendGlobalStatus, // 2=request for two status responses
resetStatusToggle, // 1=reset global status toggle resetStatusToggle, // 1=reset global status toggle
resetStatusCount; // a cycling value resetStatusCount; // a cycling value
} keyspan_usa28_globalControlMessage; };
typedef struct keyspan_usa28_globalStatusMessage struct keyspan_usa28_globalStatusMessage
{ {
u8 port, // 3 u8 port, // 3
sendGlobalStatus, // from request, decremented sendGlobalStatus, // from request, decremented
resetStatusCount; // as in request resetStatusCount; // as in request
} keyspan_usa28_globalStatusMessage; };
typedef struct keyspan_usa28_globalDebugMessage struct keyspan_usa28_globalDebugMessage
{ {
u8 port, // 2 u8 port, // 2
n, // typically a count/status byte n, // typically a count/status byte
b; // typically a data byte b; // typically a data byte
} keyspan_usa28_globalDebugMessage; };
// ie: the maximum length of an EZUSB endpoint buffer // ie: the maximum length of an EZUSB endpoint buffer
#define MAX_DATA_LEN 64 #define MAX_DATA_LEN 64
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
0x80 globalControlMessage 0x80 globalControlMessage
*/ */
typedef struct keyspan_usa49_portControlMessage struct keyspan_usa49_portControlMessage
{ {
/* /*
0. 0/1/2/3 port control message follows 0. 0/1/2/3 port control message follows
...@@ -173,7 +173,7 @@ typedef struct keyspan_usa49_portControlMessage ...@@ -173,7 +173,7 @@ typedef struct keyspan_usa49_portControlMessage
enablePort, // start servicing port (move data, check status) enablePort, // start servicing port (move data, check status)
disablePort; // stop servicing port (does implicit tx/rx flush/off) disablePort; // stop servicing port (does implicit tx/rx flush/off)
} keyspan_usa49_portControlMessage; };
// defines for bits in lcr // defines for bits in lcr
#define USA_DATABITS_5 0x00 #define USA_DATABITS_5 0x00
...@@ -201,7 +201,7 @@ typedef struct keyspan_usa49_portControlMessage ...@@ -201,7 +201,7 @@ typedef struct keyspan_usa49_portControlMessage
sends any control message (either global or port-specific). sends any control message (either global or port-specific).
*/ */
typedef struct keyspan_usa49_globalControlMessage struct keyspan_usa49_globalControlMessage
{ {
u8 portNumber, // 0x80 u8 portNumber, // 0x80
sendGlobalStatus, // 1/2=number of status responses requested sendGlobalStatus, // 1/2=number of status responses requested
...@@ -209,7 +209,7 @@ typedef struct keyspan_usa49_globalControlMessage ...@@ -209,7 +209,7 @@ typedef struct keyspan_usa49_globalControlMessage
resetStatusCount, // a cycling value resetStatusCount, // a cycling value
remoteWakeupEnable, // 0x10=P1, 0x20=P2, 0x40=P3, 0x80=P4 remoteWakeupEnable, // 0x10=P1, 0x20=P2, 0x40=P3, 0x80=P4
disableStatusMessages; // 1=send no status until host talks disableStatusMessages; // 1=send no status until host talks
} keyspan_usa49_globalControlMessage; };
/* /*
Device->host messages send on the global status endpoint Device->host messages send on the global status endpoint
...@@ -221,7 +221,7 @@ typedef struct keyspan_usa49_globalControlMessage ...@@ -221,7 +221,7 @@ typedef struct keyspan_usa49_globalControlMessage
0x81 globalDebugMessage 0x81 globalDebugMessage
*/ */
typedef struct keyspan_usa49_portStatusMessage // one for each port struct keyspan_usa49_portStatusMessage // one for each port
{ {
u8 portNumber, // 0,1,2,3 u8 portNumber, // 0,1,2,3
cts, // reports CTS pin cts, // reports CTS pin
...@@ -234,7 +234,7 @@ typedef struct keyspan_usa49_portStatusMessage // one for each port ...@@ -234,7 +234,7 @@ typedef struct keyspan_usa49_portStatusMessage // one for each port
controlResponse,// 1=a control message has been processed controlResponse,// 1=a control message has been processed
txAck, // ACK (data TX complete) txAck, // ACK (data TX complete)
rs232valid; // RS-232 signal valid rs232valid; // RS-232 signal valid
} keyspan_usa49_portStatusMessage; };
// bits in RX data message when STAT byte is included // bits in RX data message when STAT byte is included
#define RXERROR_OVERRUN 0x02 #define RXERROR_OVERRUN 0x02
...@@ -242,19 +242,19 @@ typedef struct keyspan_usa49_portStatusMessage // one for each port ...@@ -242,19 +242,19 @@ typedef struct keyspan_usa49_portStatusMessage // one for each port
#define RXERROR_FRAMING 0x08 #define RXERROR_FRAMING 0x08
#define RXERROR_BREAK 0x10 #define RXERROR_BREAK 0x10
typedef struct keyspan_usa49_globalStatusMessage struct keyspan_usa49_globalStatusMessage
{ {
u8 portNumber, // 0x80=globalStatusMessage u8 portNumber, // 0x80=globalStatusMessage
sendGlobalStatus, // from request, decremented sendGlobalStatus, // from request, decremented
resetStatusCount; // as in request resetStatusCount; // as in request
} keyspan_usa49_globalStatusMessage; };
typedef struct keyspan_usa49_globalDebugMessage struct keyspan_usa49_globalDebugMessage
{ {
u8 portNumber, // 0x81=globalDebugMessage u8 portNumber, // 0x81=globalDebugMessage
n, // typically a count/status byte n, // typically a count/status byte
b; // typically a data byte b; // typically a data byte
} keyspan_usa49_globalDebugMessage; };
// ie: the maximum length of an EZUSB endpoint buffer // ie: the maximum length of an EZUSB endpoint buffer
#define MAX_DATA_LEN 64 #define MAX_DATA_LEN 64
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* baud rates */ /* baud rates */
typedef enum { enum {
kl5kusb105a_sio_b115200 = 0, kl5kusb105a_sio_b115200 = 0,
kl5kusb105a_sio_b57600 = 1, kl5kusb105a_sio_b57600 = 1,
kl5kusb105a_sio_b38400 = 2, kl5kusb105a_sio_b38400 = 2,
...@@ -27,7 +27,7 @@ typedef enum { ...@@ -27,7 +27,7 @@ typedef enum {
kl5kusb105a_sio_b2400 = 9, /* unchecked */ kl5kusb105a_sio_b2400 = 9, /* unchecked */
kl5kusb105a_sio_b1200 = 0xa, /* unchecked */ kl5kusb105a_sio_b1200 = 0xa, /* unchecked */
kl5kusb105a_sio_b600 = 0xb /* unchecked */ kl5kusb105a_sio_b600 = 0xb /* unchecked */
} KL5KUSB105A_SIO_baudrate_t; };
/* data bits */ /* data bits */
#define kl5kusb105a_dtb_7 7 #define kl5kusb105a_dtb_7 7
......
...@@ -186,25 +186,27 @@ void usb_stor_print_Scsi_Cmnd( Scsi_Cmnd* cmd ) ...@@ -186,25 +186,27 @@ void usb_stor_print_Scsi_Cmnd( Scsi_Cmnd* cmd )
US_DEBUGP("Buffer has %d scatterlists.\n", cmd->use_sg ); US_DEBUGP("Buffer has %d scatterlists.\n", cmd->use_sg );
for ( i=0; i<cmd->use_sg; i++ ) for ( i=0; i<cmd->use_sg; i++ )
{ {
char *adr = page_address(sg[i].page) + sg[i].offset;
US_DEBUGP("Length of scatterlist %d is %d.\n",i,sg[i].length); US_DEBUGP("Length of scatterlist %d is %d.\n",i,sg[i].length);
US_DEBUGP("%02x %02x %02x %02x %02x %02x %02x %02x\n" US_DEBUGP("%02x %02x %02x %02x %02x %02x %02x %02x\n"
"%02x %02x %02x %02x %02x %02x %02x %02x\n", "%02x %02x %02x %02x %02x %02x %02x %02x\n",
sg[i].address[0], adr[0],
sg[i].address[1], adr[1],
sg[i].address[2], adr[2],
sg[i].address[3], adr[3],
sg[i].address[4], adr[4],
sg[i].address[5], adr[5],
sg[i].address[6], adr[6],
sg[i].address[7], adr[7],
sg[i].address[8], adr[8],
sg[i].address[9], adr[9],
sg[i].address[10], adr[10],
sg[i].address[11], adr[11],
sg[i].address[12], adr[12],
sg[i].address[13], adr[13],
sg[i].address[14], adr[14],
sg[i].address[15]); adr[15]);
} }
} }
......
...@@ -791,6 +791,10 @@ int usbvideo_register( ...@@ -791,6 +791,10 @@ int usbvideo_register(
cams->cb.getFrame = usbvideo_GetFrame; cams->cb.getFrame = usbvideo_GetFrame;
if (cams->cb.disconnect == NULL) if (cams->cb.disconnect == NULL)
cams->cb.disconnect = usbvideo_Disconnect; cams->cb.disconnect = usbvideo_Disconnect;
if (cams->cb.startDataPump == NULL)
cams->cb.startDataPump = usbvideo_StartDataPump;
if (cams->cb.stopDataPump == NULL)
cams->cb.stopDataPump = usbvideo_StopDataPump;
#if USES_PROC_FS #if USES_PROC_FS
/* /*
* If both /proc fs callbacks are NULL then we assume that the driver * If both /proc fs callbacks are NULL then we assume that the driver
...@@ -963,7 +967,7 @@ void usbvideo_Disconnect(struct usb_device *dev, void *ptr) ...@@ -963,7 +967,7 @@ void usbvideo_Disconnect(struct usb_device *dev, void *ptr)
uvd->remove_pending = 1; /* Now all ISO data will be ignored */ uvd->remove_pending = 1; /* Now all ISO data will be ignored */
/* At this time we ask to cancel outstanding URBs */ /* At this time we ask to cancel outstanding URBs */
usbvideo_StopDataPump(uvd); GET_CALLBACK(uvd, stopDataPump)(uvd);
for (i=0; i < USBVIDEO_NUMSBUF; i++) for (i=0; i < USBVIDEO_NUMSBUF; i++)
usb_free_urb(uvd->sbuf[i].urb); usb_free_urb(uvd->sbuf[i].urb);
...@@ -1299,7 +1303,7 @@ int usbvideo_v4l_open(struct video_device *dev, int flags) ...@@ -1299,7 +1303,7 @@ int usbvideo_v4l_open(struct video_device *dev, int flags)
if (errCode == 0) { if (errCode == 0) {
/* Start data pump if we have valid endpoint */ /* Start data pump if we have valid endpoint */
if (uvd->video_endp != 0) if (uvd->video_endp != 0)
errCode = usbvideo_StartDataPump(uvd); errCode = GET_CALLBACK(uvd, startDataPump)(uvd);
if (errCode == 0) { if (errCode == 0) {
if (VALID_CALLBACK(uvd, setupOnOpen)) { if (VALID_CALLBACK(uvd, setupOnOpen)) {
if (uvd->debug > 1) if (uvd->debug > 1)
...@@ -1349,8 +1353,8 @@ void usbvideo_v4l_close(struct video_device *dev) ...@@ -1349,8 +1353,8 @@ void usbvideo_v4l_close(struct video_device *dev)
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s($%p)", proc, dev); info("%s($%p)", proc, dev);
down(&uvd->lock); down(&uvd->lock);
usbvideo_StopDataPump(uvd); GET_CALLBACK(uvd, stopDataPump)(uvd);
usbvideo_rvfree(uvd->fbuf, uvd->fbuf_size); usbvideo_rvfree(uvd->fbuf, uvd->fbuf_size);
uvd->fbuf = NULL; uvd->fbuf = NULL;
RingQueue_Free(&uvd->dp); RingQueue_Free(&uvd->dp);
......
...@@ -269,6 +269,8 @@ typedef struct { ...@@ -269,6 +269,8 @@ typedef struct {
int (*getFrame)(uvd_t *, int); int (*getFrame)(uvd_t *, 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)(uvd_t *uvd);
void (*stopDataPump)(uvd_t *uvd);
} usbvideo_cb_t; } usbvideo_cb_t;
struct s_usbvideo_t { struct s_usbvideo_t {
......
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