Staging: ced1401: Fixes C99 // comments.
Patch fixes checkpatch warnings about C99 // comments. Signed-off-by: Elena Ufimtseva <ufimtseva@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d7e09d0397
commit
e4837704c5
File diff suppressed because it is too large
Load Diff
|
@ -79,7 +79,7 @@
|
|||
#if defined(LINUX) || defined(MAXOSX)
|
||||
#define FAR
|
||||
|
||||
typedef int BOOL; // To match Windows
|
||||
typedef int BOOL; /* To match Windows */
|
||||
typedef char * LPSTR;
|
||||
typedef const char * LPCSTR;
|
||||
typedef unsigned short WORD;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,31 +26,32 @@
|
|||
#define UINT unsigned int
|
||||
#endif
|
||||
|
||||
/// Device type codes, but these don't need to be extended - a succession is assumed
|
||||
/// These are set for usb from the bcdDevice field (suitably mangled). Future devices
|
||||
/// will be added in order of device creation to the list, so the names here are just
|
||||
/// to help use remember which device is which. The U14ERR_... values follow the same
|
||||
/// pattern for modern devices.
|
||||
#define TYPEUNKNOWN -1 // dont know
|
||||
#define TYPE1401 0 // standard 1401
|
||||
#define TYPEPLUS 1 // 1401 plus
|
||||
#define TYPEU1401 2 // u1401
|
||||
#define TYPEPOWER 3 // Power1401
|
||||
#define TYPEU14012 4 // u1401 mkII
|
||||
#define TYPEPOWER2 5 // Power1401 mk II
|
||||
#define TYPEMICRO3 6 // Micro1401-3
|
||||
#define TYPEPOWER3 7 // Power1401-3
|
||||
/** Device type codes, but these don't need to be extended - a succession is assumed
|
||||
** These are set for usb from the bcdDevice field (suitably mangled). Future devices
|
||||
** will be added in order of device creation to the list, so the names here are just
|
||||
** to help use remember which device is which. The U14ERR_... values follow the same
|
||||
** pattern for modern devices.a
|
||||
**/
|
||||
#define TYPEUNKNOWN -1 /* dont know */
|
||||
#define TYPE1401 0 /* standard 1401 */
|
||||
#define TYPEPLUS 1 /* 1401 plus */
|
||||
#define TYPEU1401 2 /* u1401 */
|
||||
#define TYPEPOWER 3 /* Power1401 */
|
||||
#define TYPEU14012 4 /* u1401 mkII */
|
||||
#define TYPEPOWER2 5 /* Power1401 mk II */
|
||||
#define TYPEMICRO3 6 /* Micro1401-3 */
|
||||
#define TYPEPOWER3 7 /* Power1401-3 */
|
||||
|
||||
/// Some useful defines of constants. DONT FORGET to change the version in the
|
||||
/// resources whenever you change it here!.
|
||||
#define DRIVERMAJREV 2 // driver revision level major (match windows)
|
||||
#define DRIVERMINREV 0 // driver revision level minor
|
||||
/* Some useful defines of constants. DONT FORGET to change the version in the */
|
||||
/* resources whenever you change it here!. */
|
||||
#define DRIVERMAJREV 2 /* driver revision level major (match windows) */
|
||||
#define DRIVERMINREV 0 /* driver revision level minor */
|
||||
|
||||
/// Definitions of the various block transfer command codes
|
||||
#define TM_EXTTOHOST 8 // extended tohost
|
||||
#define TM_EXTTO1401 9 // extended to1401
|
||||
/* Definitions of the various block transfer command codes */
|
||||
#define TM_EXTTOHOST 8 /* extended tohost */
|
||||
#define TM_EXTTO1401 9 /* extended to1401 */
|
||||
|
||||
/// Definitions of values in usbReqtype. Used in sorting out setup actions
|
||||
/* Definitions of values in usbReqtype. Used in sorting out setup actions */
|
||||
#define H_TO_D 0x00
|
||||
#define D_TO_H 0x80
|
||||
#define VENDOR 0x40
|
||||
|
@ -58,7 +59,7 @@
|
|||
#define INTREQ 0x01
|
||||
#define ENDREQ 0x02
|
||||
|
||||
/// Definition of values in usbRequest, again used to sort out setup
|
||||
/* Definition of values in usbRequest, again used to sort out setup */
|
||||
#define GET_STATUS 0x00
|
||||
#define CLEAR_FEATURE 0x01
|
||||
#define SET_FEATURE 0x03
|
||||
|
@ -71,8 +72,8 @@
|
|||
#define SET_INTERFACE 0x0b
|
||||
#define SYNCH_FRAME 0x0c
|
||||
|
||||
/// Definitions of the various debug command codes understood by the 1401. These
|
||||
/// are used in various vendor-specific commands to achieve the desired effect
|
||||
/* Definitions of the various debug command codes understood by the 1401. These */
|
||||
/* are used in various vendor-specific commands to achieve the desired effect */
|
||||
#define DB_GRAB 0x50 /* Grab is a NOP for USB */
|
||||
#define DB_FREE 0x51 /* Free is a NOP for the USB */
|
||||
#define DB_SETADD 0x52 /* Set debug address (double) */
|
||||
|
@ -91,35 +92,35 @@
|
|||
#define CR_CHAR 0x0D /* The carriage return character */
|
||||
#define CR_CHAR_80 0x8d /* and with bit 7 set */
|
||||
|
||||
/// A structure holding information about a block of memory for use in circular transfers
|
||||
/* A structure holding information about a block of memory for use in circular transfers */
|
||||
typedef struct circBlk
|
||||
{
|
||||
volatile UINT dwOffset; /* Offset within area of block start */
|
||||
volatile UINT dwSize; /* Size of the block, in bytes (0 = unused) */
|
||||
} CIRCBLK;
|
||||
|
||||
/// A structure holding all of the information about a transfer area - an area of
|
||||
/// memory set up for use either as a source or destination in DMA transfers.
|
||||
/* A structure holding all of the information about a transfer area - an area of */
|
||||
/* memory set up for use either as a source or destination in DMA transfers. */
|
||||
typedef struct transarea
|
||||
{
|
||||
void* lpvBuff; // User address of xfer area saved for completeness
|
||||
UINT dwBaseOffset; // offset to start of xfer area in first page
|
||||
UINT dwLength; // Length of xfer area, in bytes
|
||||
struct page **pPages; // Points at array of locked down pages
|
||||
int nPages; // number of pages that are locked down
|
||||
bool bUsed; // Is this structure in use?
|
||||
bool bCircular; // Is this area for circular transfers?
|
||||
bool bCircToHost; // Flag for direction of circular transfer
|
||||
bool bEventToHost; // Set event on transfer to host?
|
||||
int iWakeUp; // Set 1 on event, cleared by TestEvent()
|
||||
UINT dwEventSt; // Defines section within xfer area for...
|
||||
UINT dwEventSz; // ...notification by the event SZ is 0 if unset
|
||||
CIRCBLK aBlocks[2]; // Info on a pair of circular blocks
|
||||
wait_queue_head_t wqEvent; // The wait queue for events in this area MUST BE LAST
|
||||
void* lpvBuff; /* User address of xfer area saved for completeness */
|
||||
UINT dwBaseOffset; /* offset to start of xfer area in first page */
|
||||
UINT dwLength; /* Length of xfer area, in bytes */
|
||||
struct page **pPages; /* Points at array of locked down pages */
|
||||
int nPages; /* number of pages that are locked down */
|
||||
bool bUsed; /* Is this structure in use? */
|
||||
bool bCircular; /* Is this area for circular transfers? */
|
||||
bool bCircToHost; /* Flag for direction of circular transfer */
|
||||
bool bEventToHost; /* Set event on transfer to host? */
|
||||
int iWakeUp; /* Set 1 on event, cleared by TestEvent() */
|
||||
UINT dwEventSt; /* Defines section within xfer area for... */
|
||||
UINT dwEventSz; /* ...notification by the event SZ is 0 if unset */
|
||||
CIRCBLK aBlocks[2]; /* Info on a pair of circular blocks */
|
||||
wait_queue_head_t wqEvent; /* The wait queue for events in this area MUST BE LAST */
|
||||
} TRANSAREA;
|
||||
|
||||
/// The DMADESC structure is used to hold information on the transfer in progress. It
|
||||
/// is set up by ReadDMAInfo, using information sent by the 1401 in an escape sequence.
|
||||
/* The DMADESC structure is used to hold information on the transfer in progress. It */
|
||||
/* is set up by ReadDMAInfo, using information sent by the 1401 in an escape sequence. */
|
||||
typedef struct dmadesc
|
||||
{
|
||||
unsigned short wTransType; /* transfer type as TM_xxx above */
|
||||
|
@ -131,10 +132,10 @@ typedef struct dmadesc
|
|||
|
||||
#define INBUF_SZ 256 /* input buffer size */
|
||||
#define OUTBUF_SZ 256 /* output buffer size */
|
||||
#define STAGED_SZ 0x10000 // size of coherent buffer for staged transfers
|
||||
#define STAGED_SZ 0x10000 /* size of coherent buffer for staged transfers */
|
||||
|
||||
/// Structure to hold all of our device specific stuff. We are making this as similar as we
|
||||
/// can to the Windows driver to help in our understanding of what is going on.
|
||||
/* Structure to hold all of our device specific stuff. We are making this as similar as we */
|
||||
/* can to the Windows driver to help in our understanding of what is going on. */
|
||||
typedef struct _DEVICE_EXTENSION
|
||||
{
|
||||
char inputBuffer[INBUF_SZ]; /* The two buffers */
|
||||
|
@ -159,58 +160,58 @@ typedef struct _DEVICE_EXTENSION
|
|||
|
||||
volatile unsigned int dwDMAFlag; /* state of DMA */
|
||||
TRANSAREA rTransDef[MAX_TRANSAREAS];/* transfer area info */
|
||||
volatile DMADESC rDMAInfo; // info on current DMA transfer
|
||||
volatile bool bXFerWaiting; // Flag set if DMA transfer stalled
|
||||
volatile bool bInDrawDown; // Flag that we want to halt transfers
|
||||
volatile DMADESC rDMAInfo; /* info on current DMA transfer */
|
||||
volatile bool bXFerWaiting; /* Flag set if DMA transfer stalled */
|
||||
volatile bool bInDrawDown; /* Flag that we want to halt transfers */
|
||||
|
||||
// Parameters relating to a block read\write that is in progress. Some of these values
|
||||
// are equivalent to values in rDMAInfo. The values here are those in use, while those
|
||||
// in rDMAInfo are those received from the 1401 via an escape sequence. If another
|
||||
// escape sequence arrives before the previous xfer ends, rDMAInfo values are updated while these
|
||||
// are used to finish off the current transfer.
|
||||
volatile short StagedId; // The transfer area id for this transfer
|
||||
volatile bool StagedRead; // Flag TRUE for read from 1401, FALSE for write
|
||||
volatile unsigned int StagedLength; // Total length of this transfer
|
||||
volatile unsigned int StagedOffset; // Offset within memory area for transfer start
|
||||
volatile unsigned int StagedDone; // Bytes transferred so far
|
||||
volatile bool bStagedUrbPending; // Flag to indicate active
|
||||
char* pCoherStagedIO; // buffer used for block transfers
|
||||
struct urb* pStagedUrb; // The URB to use
|
||||
spinlock_t stagedLock; // protects ReadWriteMem() and circular buffer stuff
|
||||
/* Parameters relating to a block read\write that is in progress. Some of these values */
|
||||
/* are equivalent to values in rDMAInfo. The values here are those in use, while those */
|
||||
/* in rDMAInfo are those received from the 1401 via an escape sequence. If another */
|
||||
/* escape sequence arrives before the previous xfer ends, rDMAInfo values are updated while these */
|
||||
/* are used to finish off the current transfer. */
|
||||
volatile short StagedId; /* The transfer area id for this transfer */
|
||||
volatile bool StagedRead; /* Flag TRUE for read from 1401, FALSE for write */
|
||||
volatile unsigned int StagedLength; /* Total length of this transfer */
|
||||
volatile unsigned int StagedOffset; /* Offset within memory area for transfer start */
|
||||
volatile unsigned int StagedDone; /* Bytes transferred so far */
|
||||
volatile bool bStagedUrbPending; /* Flag to indicate active */
|
||||
char* pCoherStagedIO; /* buffer used for block transfers */
|
||||
struct urb* pStagedUrb; /* The URB to use */
|
||||
spinlock_t stagedLock; /* protects ReadWriteMem() and circular buffer stuff */
|
||||
|
||||
short s1401Type; // type of 1401 attached
|
||||
short sCurrentState; // current error state
|
||||
bool bIsUSB2; // type of the interface we connect to
|
||||
bool bForceReset; // Flag to make sure we get a real reset
|
||||
__u32 statBuf[2]; // buffer for 1401 state info
|
||||
short s1401Type; /* type of 1401 attached */
|
||||
short sCurrentState; /* current error state */
|
||||
bool bIsUSB2; /* type of the interface we connect to */
|
||||
bool bForceReset; /* Flag to make sure we get a real reset */
|
||||
__u32 statBuf[2]; /* buffer for 1401 state info */
|
||||
|
||||
unsigned long ulSelfTestTime; // used to timeout self test
|
||||
unsigned long ulSelfTestTime; /* used to timeout self test */
|
||||
|
||||
int nPipes; // Should be 3 or 4 depending on 1401 usb chip
|
||||
int bPipeError[4]; // set non-zero if an error on one of the pipe
|
||||
__u8 epAddr[4]; // addresses of the 3/4 end points
|
||||
int nPipes; /* Should be 3 or 4 depending on 1401 usb chip */
|
||||
int bPipeError[4]; /* set non-zero if an error on one of the pipe */
|
||||
__u8 epAddr[4]; /* addresses of the 3/4 end points */
|
||||
|
||||
struct usb_device *udev; // the usb device for this device
|
||||
struct usb_interface *interface; // the interface for this device, NULL if removed
|
||||
struct usb_anchor submitted; // in case we need to retract our submissions
|
||||
struct mutex io_mutex; // synchronize I/O with disconnect, one user-mode caller at a time
|
||||
struct usb_device *udev; /* the usb device for this device */
|
||||
struct usb_interface *interface; /* the interface for this device, NULL if removed */
|
||||
struct usb_anchor submitted; /* in case we need to retract our submissions */
|
||||
struct mutex io_mutex; /* synchronize I/O with disconnect, one user-mode caller at a time */
|
||||
|
||||
int errors; // the last request tanked
|
||||
int open_count; // count the number of openers
|
||||
spinlock_t err_lock; // lock for errors
|
||||
int errors; /* the last request tanked */
|
||||
int open_count; /* count the number of openers */
|
||||
spinlock_t err_lock; /* lock for errors */
|
||||
struct kref kref;
|
||||
}DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
||||
#define to_DEVICE_EXTENSION(d) container_of(d, DEVICE_EXTENSION, kref)
|
||||
|
||||
/// Definitions of routimes used between compilation object files
|
||||
// in usb1401.c
|
||||
/* Definitions of routimes used between compilation object files */
|
||||
/* in usb1401.c */
|
||||
extern int Allowi(DEVICE_EXTENSION* pdx);
|
||||
extern int SendChars(DEVICE_EXTENSION* pdx);
|
||||
extern void ced_draw_down(DEVICE_EXTENSION *pdx);
|
||||
extern int ReadWriteMem(DEVICE_EXTENSION *pdx, bool Read, unsigned short wIdent,
|
||||
unsigned int dwOffs, unsigned int dwLen);
|
||||
|
||||
// in ced_ioc.c
|
||||
/* in ced_ioc.c */
|
||||
extern int ClearArea(DEVICE_EXTENSION *pdx, int nArea);
|
||||
extern int SendString(DEVICE_EXTENSION* pdx, const char __user* pData, unsigned int n);
|
||||
extern int SendChar(DEVICE_EXTENSION *pdx, char c);
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
#define __USE1401_H__
|
||||
#include "machine.h"
|
||||
|
||||
// Some definitions to make things compatible. If you want to use Use1401 directly
|
||||
// from a Windows program you should define U14_NOT_DLL, in which case you also
|
||||
// MUST make sure that your application startup code calls U14InitLib().
|
||||
// DLL_USE1401 is defined when you are building the Use1401 dll, not otherwise.
|
||||
/* Some definitions to make things compatible. If you want to use Use1401 directly */
|
||||
/* from a Windows program you should define U14_NOT_DLL, in which case you also */
|
||||
/* MUST make sure that your application startup code calls U14InitLib(). */
|
||||
/* DLL_USE1401 is defined when you are building the Use1401 dll, not otherwise. */
|
||||
#ifdef _IS_WINDOWS_
|
||||
#ifndef U14_NOT_DLL
|
||||
#ifdef DLL_USE1401
|
||||
|
@ -50,20 +50,20 @@
|
|||
#define U14LONG long
|
||||
#endif
|
||||
|
||||
/// Error codes: We need them here as user space can see them.
|
||||
#define U14ERR_NOERROR 0 // no problems
|
||||
/* Error codes: We need them here as user space can see them. */
|
||||
#define U14ERR_NOERROR 0 /* no problems */
|
||||
|
||||
/// Device error codes, but these don't need to be extended - a succession is assumed
|
||||
#define U14ERR_STD 4 // standard 1401 connected
|
||||
#define U14ERR_U1401 5 // u1401 connected
|
||||
#define U14ERR_PLUS 6 // 1401 plus connected
|
||||
#define U14ERR_POWER 7 // Power1401 connected
|
||||
#define U14ERR_U14012 8 // u1401 mkII connected
|
||||
/* Device error codes, but these don't need to be extended - a succession is assumed */
|
||||
#define U14ERR_STD 4 /* standard 1401 connected */
|
||||
#define U14ERR_U1401 5 /* u1401 connected */
|
||||
#define U14ERR_PLUS 6 /* 1401 plus connected */
|
||||
#define U14ERR_POWER 7 /* Power1401 connected */
|
||||
#define U14ERR_U14012 8 /* u1401 mkII connected */
|
||||
#define U14ERR_POWER2 9
|
||||
#define U14ERR_U14013 10
|
||||
#define U14ERR_POWER3 11
|
||||
|
||||
/// NBNB Error numbers need shifting as some linux error codes start at 512
|
||||
/* NBNB Error numbers need shifting as some linux error codes start at 512 */
|
||||
#define U14ERR(n) (n+U14ERRBASE)
|
||||
#define U14ERR_OFF U14ERR(0) /* 1401 there but switched off */
|
||||
#define U14ERR_NC U14ERR(-1) /* 1401 not connected */
|
||||
|
@ -113,7 +113,7 @@
|
|||
#define U14ERR_DRIVCOMMS U14ERR(-110) /* failed talking to driver */
|
||||
#define U14ERR_OUTOFMEMORY U14ERR(-111) /* needed memory and couldnt get it*/
|
||||
|
||||
/// 1401 type codes.
|
||||
/* / 1401 type codes. */
|
||||
#define U14TYPE1401 0 /* standard 1401 */
|
||||
#define U14TYPEPLUS 1 /* 1401 plus */
|
||||
#define U14TYPEU1401 2 /* u1401 */
|
||||
|
@ -124,9 +124,9 @@
|
|||
#define U14TYPEPOWER3 7 /* power1401-3 */
|
||||
#define U14TYPEUNKNOWN -1 /* dont know */
|
||||
|
||||
/// Transfer flags to allow driver capabilities to be interrogated
|
||||
/* Transfer flags to allow driver capabilities to be interrogated */
|
||||
|
||||
/// Constants for transfer flags
|
||||
/* Constants for transfer flags */
|
||||
#define U14TF_USEDMA 1 /* Transfer flag for use DMA */
|
||||
#define U14TF_MULTIA 2 /* Transfer flag for multi areas */
|
||||
#define U14TF_FIFO 4 /* for FIFO interface card */
|
||||
|
@ -138,18 +138,18 @@
|
|||
#define U14TF_DIAG 256 /* Diagnostics/debug functions */
|
||||
#define U14TF_CIRC14 512 /* Circular-mode to 1401 */
|
||||
|
||||
/// Definitions of element sizes for DMA transfers - to allow byte-swapping
|
||||
/* Definitions of element sizes for DMA transfers - to allow byte-swapping */
|
||||
#define ESZBYTES 0 /* BYTE element size value */
|
||||
#define ESZWORDS 1 /* WORD element size value */
|
||||
#define ESZLONGS 2 /* long element size value */
|
||||
#define ESZUNKNOWN 0 /* unknown element size value */
|
||||
|
||||
/// These define required access types for the debug/diagnostics function
|
||||
/* These define required access types for the debug/diagnostics function */
|
||||
#define BYTE_SIZE 1 /* 8-bit access */
|
||||
#define WORD_SIZE 2 /* 16-bit access */
|
||||
#define LONG_SIZE 3 /* 32-bit access */
|
||||
|
||||
/// Stuff used by U14_GetTransfer
|
||||
/* Stuff used by U14_GetTransfer */
|
||||
#define GET_TX_MAXENTRIES 257 /* (max length / page size + 1) */
|
||||
|
||||
#ifdef _IS_WINDOWS_
|
||||
|
@ -200,8 +200,8 @@ typedef struct TGetTxBlock /* used for U14_GetTransfer results */
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
U14API(int) U14WhenToTimeOut(short hand); // when to timeout in ms
|
||||
U14API(short) U14PassedTime(int iTime); // non-zero if iTime passed
|
||||
U14API(int) U14WhenToTimeOut(short hand); /* when to timeout in ms */
|
||||
U14API(short) U14PassedTime(int iTime); /* non-zero if iTime passed */
|
||||
|
||||
U14API(short) U14LastErrCode(short hand);
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@
|
|||
METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
//--------------- Structures that are shared with the driver -------------
|
||||
/*--------------- Structures that are shared with the driver ------------- */
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct /* used for get/set standard 1401 registers */
|
||||
|
@ -298,4 +298,4 @@ typedef struct VXTransferDesc /* use1401.c and use1432x.x use only */
|
|||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue