Staging ced1401: cleanup coding style issues.

A basic Lindent run on the .c files, clean up the .h file by hand.

Cc: Alois Schlögl <alois.schloegl@ist.ac.at>
Cc: Greg P. Smith <greg@ced.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2012-09-17 21:12:59 -07:00
parent 2d96650139
commit cd915200af
3 changed files with 2325 additions and 2117 deletions

View File

@ -39,7 +39,8 @@
****************************************************************************/
void FlushOutBuff(DEVICE_EXTENSION * pdx)
{
dev_dbg(&pdx->interface->dev, "%s currentState=%d", __func__, pdx->sCurrentState);
dev_dbg(&pdx->interface->dev, "%s currentState=%d", __func__,
pdx->sCurrentState);
if (pdx->sCurrentState == U14ERR_TIME) /* Do nothing if hardware in trouble */
return;
// CharSend_Cancel(pdx); /* Kill off any pending I/O */
@ -58,7 +59,8 @@ void FlushOutBuff(DEVICE_EXTENSION *pdx)
****************************************************************************/
void FlushInBuff(DEVICE_EXTENSION * pdx)
{
dev_dbg(&pdx->interface->dev, "%s currentState=%d", __func__, pdx->sCurrentState);
dev_dbg(&pdx->interface->dev, "%s currentState=%d", __func__,
pdx->sCurrentState);
if (pdx->sCurrentState == U14ERR_TIME) /* Do nothing if hardware in trouble */
return;
// CharRead_Cancel(pDevObject); /* Kill off any pending I/O */
@ -75,15 +77,14 @@ void FlushInBuff(DEVICE_EXTENSION *pdx)
** Utility routine to copy chars into the output buffer and fire them off.
** called from user mode, holds charOutLock.
****************************************************************************/
static int PutChars(DEVICE_EXTENSION* pdx, const char* pCh, unsigned int uCount)
static int PutChars(DEVICE_EXTENSION * pdx, const char *pCh,
unsigned int uCount)
{
int iReturn;
spin_lock_irq(&pdx->charOutLock); // get the output spin lock
if ((OUTBUF_SZ - pdx->dwNumOutput) >= uCount)
{
if ((OUTBUF_SZ - pdx->dwNumOutput) >= uCount) {
unsigned int u;
for (u=0; u<uCount; u++)
{
for (u = 0; u < uCount; u++) {
pdx->outputBuffer[pdx->dwOutBuffPut++] = pCh[u];
if (pdx->dwOutBuffPut >= OUTBUF_SZ)
pdx->dwOutBuffPut = 0;
@ -91,9 +92,7 @@ static int PutChars(DEVICE_EXTENSION* pdx, const char* pCh, unsigned int uCount)
pdx->dwNumOutput += uCount;
spin_unlock_irq(&pdx->charOutLock);
iReturn = SendChars(pdx); // ...give a chance to transmit data
}
else
{
} else {
iReturn = U14ERR_NOOUT; // no room at the out (ha-ha)
spin_unlock_irq(&pdx->charOutLock);
}
@ -105,7 +104,8 @@ static int PutChars(DEVICE_EXTENSION* pdx, const char* pCh, unsigned int uCount)
** trigger an output transfer if this is appropriate. User mode.
** Holds the io_mutex
*****************************************************************************/
int SendString(DEVICE_EXTENSION* pdx, const char __user* pData, unsigned int n)
int SendString(DEVICE_EXTENSION * pdx, const char __user * pData,
unsigned int n)
{
int iReturn = U14ERR_NOERROR; // assume all will be well
char buffer[OUTBUF_SZ + 1]; // space in our address space for characters
@ -118,7 +118,8 @@ int SendString(DEVICE_EXTENSION* pdx, const char __user* pData, unsigned int n)
mutex_lock(&pdx->io_mutex); // Protect disconnect from new i/o
if (n > 0) // do nothing if nowt to do!
{
dev_dbg(&pdx->interface->dev, "%s n=%d>%s<", __func__, n, buffer);
dev_dbg(&pdx->interface->dev, "%s n=%d>%s<", __func__, n,
buffer);
iReturn = PutChars(pdx, buffer, n);
}
@ -179,17 +180,16 @@ int Get1401State(DEVICE_EXTENSION* pdx, __u32* state, __u32* error)
nGot = usb_control_msg(pdx->udev, usb_rcvctrlpipe(pdx->udev, 0),
GET_STATUS, (D_TO_H | VENDOR | DEVREQ), 0, 0,
pdx->statBuf, sizeof(pdx->statBuf), HZ);
if (nGot != sizeof(pdx->statBuf))
{
dev_err(&pdx->interface->dev, "Get1401State() FAILED, return code %d", nGot);
if (nGot != sizeof(pdx->statBuf)) {
dev_err(&pdx->interface->dev,
"Get1401State() FAILED, return code %d", nGot);
pdx->sCurrentState = U14ERR_TIME; // Indicate that things are very wrong indeed
*state = 0; // Force status values to a known state
*error = 0;
}
else
{
} else {
int nDevice;
dev_dbg(&pdx->interface->dev, "Get1401State() Success, state: 0x%x, 0x%x",
dev_dbg(&pdx->interface->dev,
"Get1401State() Success, state: 0x%x, 0x%x",
pdx->statBuf[0], pdx->statBuf[1]);
*state = pdx->statBuf[0]; // Return the state values to the calling code
@ -221,7 +221,8 @@ int Get1401State(DEVICE_EXTENSION* pdx, __u32* state, __u32* error)
****************************************************************************/
int ReadWrite_Cancel(DEVICE_EXTENSION * pdx)
{
dev_dbg(&pdx->interface->dev, "ReadWrite_Cancel entry %d", pdx->bStagedUrbPending);
dev_dbg(&pdx->interface->dev, "ReadWrite_Cancel entry %d",
pdx->bStagedUrbPending);
#ifdef NOT_WRITTEN_YET
int ntStatus = STATUS_SUCCESS;
bool bResult = false;
@ -231,7 +232,8 @@ int ReadWrite_Cancel(DEVICE_EXTENSION *pdx)
if (pdx->bStagedUrbPending) // anything to be cancelled? May need more...
{
dev_info(&pdx->interface-dev, "ReadWrite_Cancel about to cancel Urb");
dev_info(&pdx->interface - dev,
"ReadWrite_Cancel about to cancel Urb");
// KeClearEvent(&pdx->StagingDoneEvent); // Clear the staging done flag
USB_ASSERT(pdx->pStagedIrp != NULL);
@ -240,22 +242,24 @@ int ReadWrite_Cancel(DEVICE_EXTENSION *pdx)
// on the spinlock while this function hands waiting for the event.
spin_unlock_irq(&pdx->stagedLock);
bResult = IoCancelIrp(pdx->pStagedIrp); // Actually do the cancel
if (bResult)
{
if (bResult) {
LARGE_INTEGER timeout;
timeout.QuadPart = -10000000; // Use a timeout of 1 second
dev_info(&pdx->interface-dev, "ReadWrite_Cancel about to wait till done");
ntStatus = KeWaitForSingleObject(&pdx->StagingDoneEvent, Executive,
KernelMode, FALSE, &timeout);
}
else
{
dev_info(&pdx->interface-dev, "ReadWrite_Cancel, cancellation failed");
dev_info(&pdx->interface - dev,
"ReadWrite_Cancel about to wait till done");
ntStatus =
KeWaitForSingleObject(&pdx->StagingDoneEvent,
Executive, KernelMode, FALSE,
&timeout);
} else {
dev_info(&pdx->interface - dev,
"ReadWrite_Cancel, cancellation failed");
ntStatus = U14ERR_FAIL;
}
USB_KdPrint(DBGLVL_DEFAULT, ("ReadWrite_Cancel ntStatus = 0x%x decimal %d\n", ntStatus, ntStatus));
}
else
USB_KdPrint(DBGLVL_DEFAULT,
("ReadWrite_Cancel ntStatus = 0x%x decimal %d\n",
ntStatus, ntStatus));
} else
spin_unlock_irq(&pdx->stagedLock);
dev_info(&pdx->interface - dev, "ReadWrite_Cancel done");
@ -330,8 +334,7 @@ bool Is1401(DEVICE_EXTENSION* pdx)
if (iReturn > 0) // do we need to wait for self-test?
{
unsigned long ulTimeOut = jiffies + 30 * HZ; // when to give up
while((iReturn > 0) && time_before(jiffies, ulTimeOut))
{
while ((iReturn > 0) && time_before(jiffies, ulTimeOut)) {
schedule(); // let other stuff run
iReturn = InSelfTest(pdx, &state); // see if done yet
}
@ -339,8 +342,7 @@ bool Is1401(DEVICE_EXTENSION* pdx)
if (iReturn == 0) // if all is OK...
iReturn = state == 0; // then sucess is that the state is 0
}
else
} else
iReturn = 0; // we failed
pdx->bForceReset = false; // Clear forced reset flag now
@ -370,14 +372,17 @@ bool QuickCheck(DEVICE_EXTENSION* pdx, bool bTestBuff, bool bCanReset)
(!pdx->bForceReset) && // Not had a real reset forced
(pdx->sCurrentState >= U14ERR_STD)); // No 1401 errors stored
dev_dbg(&pdx->interface->dev, "%s DMAFlag:%d, state:%d, force:%d, testBuff:%d, short:%d",
__func__, pdx->dwDMAFlag, pdx->sCurrentState, pdx->bForceReset, bTestBuff, bShortTest);
dev_dbg(&pdx->interface->dev,
"%s DMAFlag:%d, state:%d, force:%d, testBuff:%d, short:%d",
__func__, pdx->dwDMAFlag, pdx->sCurrentState, pdx->bForceReset,
bTestBuff, bShortTest);
if ((bTestBuff) && // Buffer check requested, and...
(pdx->dwNumInput || pdx->dwNumOutput)) // ...characters were in the buffer?
{
bShortTest = false; // Then do the full test
dev_dbg(&pdx->interface->dev, "%s will reset as buffers not empty", __func__);
dev_dbg(&pdx->interface->dev,
"%s will reset as buffers not empty", __func__);
}
if (bShortTest || !bCanReset) // Still OK to try the short test?
@ -394,7 +399,8 @@ bool QuickCheck(DEVICE_EXTENSION* pdx, bool bTestBuff, bool bCanReset)
if (!bRet && bCanReset) // If all not OK, then
{
dev_info(&pdx->interface->dev, "%s->Is1401 %d %d %d %d",
__func__, bShortTest, pdx->sCurrentState, bTestBuff, pdx->bForceReset);
__func__, bShortTest, pdx->sCurrentState, bTestBuff,
pdx->bForceReset);
bRet = Is1401(pdx); // do full test
}
@ -437,8 +443,7 @@ int GetChar(DEVICE_EXTENSION *pdx)
if (pdx->dwInBuffGet >= INBUF_SZ)
pdx->dwInBuffGet = 0;
pdx->dwNumInput--;
}
else
} else
iReturn = U14ERR_NOIN; // no input data to read
spin_unlock_irq(&pdx->charInLock);
@ -481,8 +486,7 @@ int GetString(DEVICE_EXTENSION *pdx, char __user* pUser, int n)
int nGot = 0;
int nCopyToUser; // number to copy to user
char cData;
do
{
do {
cData = pdx->inputBuffer[pdx->dwInBuffGet++];
if (cData == CR_CHAR) // replace CR with zero
cData = (char)0;
@ -505,12 +509,12 @@ int GetString(DEVICE_EXTENSION *pdx, char __user* pUser, int n)
pdx->dwNumInput -= nGot;
spin_unlock_irq(&pdx->charInLock);
dev_dbg(&pdx->interface->dev,"GetString read %d characters >%s<", nGot, buffer);
dev_dbg(&pdx->interface->dev,
"GetString read %d characters >%s<", nGot, buffer);
copy_to_user(pUser, buffer, nCopyToUser);
iReturn = nGot; // report characters read
}
else
} else
spin_unlock_irq(&pdx->charInLock);
Allowi(pdx, false); // Make sure char reads are running
@ -553,8 +557,7 @@ int LineCount(DEVICE_EXTENSION *pdx)
{
unsigned int dwIndex = pdx->dwInBuffGet; // start at first available
unsigned int dwEnd = pdx->dwInBuffPut; // Position for search end
do
{
do {
if (pdx->inputBuffer[dwIndex++] == CR_CHAR)
++iReturn; // inc count if CR
@ -597,44 +600,45 @@ int ClearArea(DEVICE_EXTENSION *pdx, int nArea)
{
int iReturn = U14ERR_NOERROR;
if ((nArea < 0) || (nArea >= MAX_TRANSAREAS))
{
if ((nArea < 0) || (nArea >= MAX_TRANSAREAS)) {
iReturn = U14ERR_BADAREA;
dev_err(&pdx->interface->dev, "%s Attempt to clear area %d", __func__, nArea);
}
else
{
dev_err(&pdx->interface->dev, "%s Attempt to clear area %d",
__func__, nArea);
} else {
TRANSAREA *pTA = &pdx->rTransDef[nArea]; // to save typing
if (!pTA->bUsed) // if not used...
iReturn = U14ERR_NOTSET; // ...nothing to be done
else
{
else {
// We must save the memory we return as we shouldn't mess with memory while
// holding a spin lock.
struct page **pPages = 0; // save page address list
int nPages = 0; // and number of pages
int np;
dev_dbg(&pdx->interface->dev, "%s area %d", __func__, nArea);
dev_dbg(&pdx->interface->dev, "%s area %d", __func__,
nArea);
spin_lock_irq(&pdx->stagedLock);
if ((pdx->StagedId == nArea) && (pdx->dwDMAFlag > MODE_CHAR))
{
if ((pdx->StagedId == nArea)
&& (pdx->dwDMAFlag > MODE_CHAR)) {
iReturn = U14ERR_UNLOCKFAIL; // cannot delete as in use
dev_err(&pdx->interface->dev, "%s call on area %d while active", __func__, nArea);
}
else
{
dev_err(&pdx->interface->dev,
"%s call on area %d while active",
__func__, nArea);
} else {
pPages = pTA->pPages; // save page address list
nPages = pTA->nPages; // and page count
if (pTA->dwEventSz) // if events flagging in use
wake_up_interruptible(&pTA->wqEvent); // release anything that was waiting
if (pdx->bXFerWaiting && (pdx->rDMAInfo.wIdent == nArea))
if (pdx->bXFerWaiting
&& (pdx->rDMAInfo.wIdent == nArea))
pdx->bXFerWaiting = false; // Cannot have pending xfer if area cleared
// Clean out the TRANSAREA except for the wait queue, which is at the end
// This sets bUsed to false and dwEventSz to 0 to say area not used and no events.
memset(pTA, 0, sizeof(TRANSAREA)-sizeof(wait_queue_head_t));
memset(pTA, 0,
sizeof(TRANSAREA) -
sizeof(wait_queue_head_t));
}
spin_unlock_irq(&pdx->stagedLock);
@ -643,19 +647,19 @@ int ClearArea(DEVICE_EXTENSION *pdx, int nArea)
// Now we must undo the pinning down of the pages. We will assume the worst and mark
// all the pages as dirty. Don't be tempted to move this up above as you must not be
// holding a spin lock to do this stuff as it is not atomic.
dev_dbg(&pdx->interface->dev, "%s nPages=%d", __func__, nPages);
dev_dbg(&pdx->interface->dev, "%s nPages=%d",
__func__, nPages);
for (np = 0; np < nPages; ++np)
{
if (pPages[np])
{
for (np = 0; np < nPages; ++np) {
if (pPages[np]) {
SetPageDirty(pPages[np]);
page_cache_release(pPages[np]);
}
}
kfree(pPages);
dev_dbg(&pdx->interface->dev, "%s kfree(pPages) done", __func__);
dev_dbg(&pdx->interface->dev,
"%s kfree(pPages) done", __func__);
}
}
}
@ -692,17 +696,19 @@ static int SetArea(DEVICE_EXTENSION *pdx, int nArea, char __user* puBuf,
return -EFAULT; // ...then we are done
// Now allocate space to hold the page pointer and virtual address pointer tables
pPages = (struct page **)kmalloc(len*sizeof(struct page *), GFP_KERNEL);
if (!pPages)
{
pPages =
(struct page **)kmalloc(len * sizeof(struct page *), GFP_KERNEL);
if (!pPages) {
iReturn = U14ERR_NOMEMORY;
goto error;
}
dev_dbg(&pdx->interface->dev, "%s %p, length=%06x, circular %d", __func__, puBuf, dwLength, bCircular);
dev_dbg(&pdx->interface->dev, "%s %p, length=%06x, circular %d",
__func__, puBuf, dwLength, bCircular);
// To pin down user pages we must first acquire the mapping semaphore.
down_read(&current->mm->mmap_sem); // get memory map semaphore
nPages = get_user_pages(current, current->mm, ulStart, len, 1, 0, pPages, 0);
nPages =
get_user_pages(current, current->mm, ulStart, len, 1, 0, pPages, 0);
up_read(&current->mm->mmap_sem); // release the semaphore
dev_dbg(&pdx->interface->dev, "%s nPages = %d", __func__, nPages);
@ -729,9 +735,7 @@ static int SetArea(DEVICE_EXTENSION *pdx, int nArea, char __user* puBuf,
spin_unlock_irq(&pdx->stagedLock);
iReturn = U14ERR_NOERROR; // say all was well
}
else
{
} else {
iReturn = U14ERR_LOCKFAIL;
goto error;
}
@ -756,11 +760,15 @@ int SetTransfer(DEVICE_EXTENSION *pdx, TRANSFERDESC __user *pTD)
TRANSFERDESC td;
copy_from_user(&td, pTD, sizeof(td));
mutex_lock(&pdx->io_mutex);
dev_dbg(&pdx->interface->dev,"%s area:%d, size:%08x", __func__, td.wAreaNum, td.dwLength);
dev_dbg(&pdx->interface->dev, "%s area:%d, size:%08x", __func__,
td.wAreaNum, td.dwLength);
// The strange cast is done so that we don't get warnings in 32-bit linux about the size of the
// pointer. The pointer is always passed as a 64-bit object so that we don't have problems using
// a 32-bit program on a 64-bit system. unsigned long is 64-bits on a 64-bit system.
iReturn = SetArea(pdx, td.wAreaNum, (char __user *)((unsigned long)td.lpvBuff), td.dwLength, false, false);
iReturn =
SetArea(pdx, td.wAreaNum,
(char __user *)((unsigned long)td.lpvBuff), td.dwLength,
false, false);
mutex_unlock(&pdx->io_mutex);
return iReturn;
}
@ -793,8 +801,7 @@ int SetEvent(DEVICE_EXTENSION *pdx, TRANSFEREVENT __user*pTE)
copy_from_user(&te, pTE, sizeof(te)); // get a local copy of the data
if (te.wAreaNum >= MAX_TRANSAREAS) // the area must exist
return U14ERR_BADAREA;
else
{
else {
TRANSAREA *pTA = &pdx->rTransDef[te.wAreaNum];
mutex_lock(&pdx->io_mutex); // make sure we have no competitor
spin_lock_irq(&pdx->stagedLock);
@ -804,13 +811,13 @@ int SetEvent(DEVICE_EXTENSION *pdx, TRANSFEREVENT __user*pTE)
pTA->dwEventSz = te.dwLength; // set size (0 cancels it)
pTA->bEventToHost = te.wFlags & 1; // set the direction
pTA->iWakeUp = 0; // zero the wake up count
}
else
} else
iReturn = U14ERR_NOTSET;
spin_unlock_irq(&pdx->stagedLock);
mutex_unlock(&pdx->io_mutex);
}
return iReturn == U14ERR_NOERROR ? (te.iSetEvent ? 1 : U14ERR_NOERROR) : iReturn;
return iReturn ==
U14ERR_NOERROR ? (te.iSetEvent ? 1 : U14ERR_NOERROR) : iReturn;
}
/****************************************************************************
@ -824,8 +831,7 @@ int WaitEvent(DEVICE_EXTENSION *pdx, int nArea, int msTimeOut)
int iReturn;
if ((unsigned)nArea > MAX_TRANSAREAS)
return U14ERR_BADAREA;
else
{
else {
int iWait;
TRANSAREA *pTA = &pdx->rTransDef[nArea];
msTimeOut = (msTimeOut * HZ + 999) / 1000; // convert timeout to jiffies
@ -840,9 +846,15 @@ int WaitEvent(DEVICE_EXTENSION *pdx, int nArea, int msTimeOut)
mutex_unlock(&pdx->io_mutex);
if (msTimeOut)
iWait = wait_event_interruptible_timeout(pTA->wqEvent, pTA->iWakeUp || !pTA->bUsed, msTimeOut);
iWait =
wait_event_interruptible_timeout(pTA->wqEvent,
pTA->iWakeUp
|| !pTA->bUsed,
msTimeOut);
else
iWait = wait_event_interruptible(pTA->wqEvent, pTA->iWakeUp || !pTA->bUsed);
iWait =
wait_event_interruptible(pTA->wqEvent, pTA->iWakeUp
|| !pTA->bUsed);
if (iWait)
iReturn = -ERESTARTSYS; // oops - we have had a SIGNAL
else
@ -866,8 +878,7 @@ int TestEvent(DEVICE_EXTENSION *pdx, int nArea)
int iReturn;
if ((unsigned)nArea > MAX_TRANSAREAS)
iReturn = U14ERR_BADAREA;
else
{
else {
TRANSAREA *pTA = &pdx->rTransDef[nArea];
mutex_lock(&pdx->io_mutex); // make sure we have no competitor
spin_lock_irq(&pdx->stagedLock);
@ -892,8 +903,7 @@ int GetTransfer(DEVICE_EXTENSION *pdx, TGET_TX_BLOCK __user *pTX)
dwIdent = pdx->StagedId; // area ident for last xfer
if (dwIdent >= MAX_TRANSAREAS)
iReturn = U14ERR_BADAREA;
else
{
else {
// Return the best information we have - we don't have physical addresses
TGET_TX_BLOCK tx;
memset(&tx, 0, sizeof(tx)); // clean out local work structure
@ -901,7 +911,8 @@ int GetTransfer(DEVICE_EXTENSION *pdx, TGET_TX_BLOCK __user *pTX)
tx.linear = (long long)((long)pdx->rTransDef[dwIdent].lpvBuff);
tx.avail = GET_TX_MAXENTRIES; // how many blocks we could return
tx.used = 1; // number we actually return
tx.entries[0].physical = (long long)(tx.linear+pdx->StagedOffset);
tx.entries[0].physical =
(long long)(tx.linear + pdx->StagedOffset);
tx.entries[0].size = tx.size;
copy_to_user(pTX, &tx, sizeof(tx));
}
@ -954,6 +965,7 @@ int StateOf1401(DEVICE_EXTENSION *pdx)
return iReturn;
}
/****************************************************************************
** StartSelfTest
**
@ -972,9 +984,7 @@ int StartSelfTest(DEVICE_EXTENSION *pdx)
// ReadWrite_Cancel(pDeviceObject); /* so things stay tidy */
pdx->dwDMAFlag = MODE_CHAR; /* Clear DMA mode flags here */
nGot = usb_control_msg(pdx->udev, usb_rcvctrlpipe(pdx->udev, 0),
DB_SELFTEST, (H_TO_D|VENDOR|DEVREQ), 0, 0,
0, 0, HZ); // allow 1 second timeout
nGot = usb_control_msg(pdx->udev, usb_rcvctrlpipe(pdx->udev, 0), DB_SELFTEST, (H_TO_D | VENDOR | DEVREQ), 0, 0, 0, 0, HZ); // allow 1 second timeout
pdx->ulSelfTestTime = jiffies + HZ * 30; // 30 seconds into the future
mutex_unlock(&pdx->io_mutex);
@ -983,7 +993,6 @@ int StartSelfTest(DEVICE_EXTENSION *pdx)
return nGot < 0 ? U14ERR_FAIL : U14ERR_NOERROR;
}
/****************************************************************************
** CheckSelfTest
**
@ -1005,7 +1014,9 @@ int CheckSelfTest(DEVICE_EXTENSION *pdx, TGET_SELFTEST __user *pGST)
if (iReturn != U14ERR_NOERROR) // Self-test can cause comms errors
{ // so we assume still testing
dev_err(&pdx->interface->dev, "%s Get1401State=%d, assuming still testing", __func__, iReturn);
dev_err(&pdx->interface->dev,
"%s Get1401State=%d, assuming still testing", __func__,
iReturn);
state = 0x80; // Force still-testing, no error
error = 0;
iReturn = U14ERR_NOERROR;
@ -1013,7 +1024,9 @@ int CheckSelfTest(DEVICE_EXTENSION *pdx, TGET_SELFTEST __user *pGST)
if ((state == -1) && (error == -1)) // If Get1401State had problems
{
dev_err(&pdx->interface->dev, "%s Get1401State failed, assuming still testing", __func__);
dev_err(&pdx->interface->dev,
"%s Get1401State failed, assuming still testing",
__func__);
state = 0x80; // Force still-testing, no error
error = 0;
}
@ -1025,22 +1038,20 @@ int CheckSelfTest(DEVICE_EXTENSION *pdx, TGET_SELFTEST __user *pGST)
gst.code = (state & 0x00FF0000) >> 16; // read the error code
gst.x = error & 0x0000FFFF; // Error data X
gst.y = (error & 0xFFFF0000) >> 16; // and data Y
dev_dbg(&pdx->interface->dev,"Self-test error code %d", gst.code);
}
else // No error, check for timeout
dev_dbg(&pdx->interface->dev, "Self-test error code %d",
gst.code);
} else // No error, check for timeout
{
unsigned long ulNow = jiffies; // get current time
if (time_after(ulNow, pdx->ulSelfTestTime))
{
if (time_after(ulNow, pdx->ulSelfTestTime)) {
gst.code = -2; // Flag the timeout
dev_dbg(&pdx->interface->dev, "Self-test timed-out");
dev_dbg(&pdx->interface->dev,
"Self-test timed-out");
} else
dev_dbg(&pdx->interface->dev,
"Self-test on-going");
}
else
dev_dbg(&pdx->interface->dev, "Self-test on-going");
}
}
else
{
} else {
gst.code = -1; // Flag the test is done
dev_dbg(&pdx->interface->dev, "Self-test done");
}
@ -1069,14 +1080,18 @@ int TypeOf1401(DEVICE_EXTENSION *pdx)
mutex_lock(&pdx->io_mutex);
dev_dbg(&pdx->interface->dev, "%s", __func__);
switch (pdx->s1401Type)
{
case TYPE1401: iReturn = U14ERR_STD; break; // Handle these types directly
case TYPEPLUS: iReturn = U14ERR_PLUS; break;
case TYPEU1401:iReturn = U14ERR_U1401;break;
switch (pdx->s1401Type) {
case TYPE1401:
iReturn = U14ERR_STD;
break; // Handle these types directly
case TYPEPLUS:
iReturn = U14ERR_PLUS;
break;
case TYPEU1401:
iReturn = U14ERR_U1401;
break;
default:
if ((pdx->s1401Type >= TYPEPOWER) &&
(pdx->s1401Type <= 25))
if ((pdx->s1401Type >= TYPEPOWER) && (pdx->s1401Type <= 25))
iReturn = pdx->s1401Type + 4; // We can calculate types
else // for up-coming 1401 designs
iReturn = TYPEUNKNOWN; // Don't know or not there
@ -1110,16 +1125,15 @@ int TransferFlags(DEVICE_EXTENSION *pdx)
** Issues a debug\diagnostic command to the 1401 along with a 32-bit datum
** This is a utility command used for dbg operations.
*/
static int DbgCmd1401(DEVICE_EXTENSION *pdx, unsigned char cmd, unsigned int data)
static int DbgCmd1401(DEVICE_EXTENSION * pdx, unsigned char cmd,
unsigned int data)
{
int iReturn;
dev_dbg(&pdx->interface->dev, "%s entry", __func__);
iReturn = usb_control_msg(pdx->udev, usb_sndctrlpipe(pdx->udev, 0),
cmd, (H_TO_D|VENDOR|DEVREQ),
(unsigned short)data, (unsigned short)(data >> 16),
0, 0, HZ); // allow 1 second timeout
iReturn = usb_control_msg(pdx->udev, usb_sndctrlpipe(pdx->udev, 0), cmd, (H_TO_D | VENDOR | DEVREQ), (unsigned short)data, (unsigned short)(data >> 16), 0, 0, HZ); // allow 1 second timeout
if (iReturn < 0)
dev_err(&pdx->interface->dev, "%s fail code=%d", __func__, iReturn);
dev_err(&pdx->interface->dev, "%s fail code=%d", __func__,
iReturn);
return iReturn;
}
@ -1150,7 +1164,6 @@ int DbgPeek(DEVICE_EXTENSION *pdx, TDBGBLOCK __user* pDB)
return iReturn;
}
/****************************************************************************
** DbgPoke
**
@ -1178,7 +1191,6 @@ int DbgPoke(DEVICE_EXTENSION *pdx, TDBGBLOCK __user *pDB)
return iReturn;
}
/****************************************************************************
** DbgRampData
**
@ -1210,7 +1222,6 @@ int DbgRampData(DEVICE_EXTENSION *pdx, TDBGBLOCK __user *pDB)
return iReturn;
}
/****************************************************************************
** DbgRampAddr
**
@ -1239,7 +1250,6 @@ int DbgRampAddr(DEVICE_EXTENSION *pdx, TDBGBLOCK __user *pDB)
return iReturn;
}
/****************************************************************************
** DbgGetData
**
@ -1258,13 +1268,12 @@ int DbgGetData(DEVICE_EXTENSION *pdx, TDBGBLOCK __user *pDB)
iReturn = usb_control_msg(pdx->udev, usb_rcvctrlpipe(pdx->udev, 0),
DB_DATA, (D_TO_H | VENDOR | DEVREQ), 0, 0,
&db.iData, sizeof(db.iData), HZ);
if (iReturn == sizeof(db.iData))
{
if (iReturn == sizeof(db.iData)) {
copy_to_user(pDB, &db, sizeof(db));
iReturn = U14ERR_NOERROR;
}
else
dev_err(&pdx->interface->dev, "%s failed, code %d", __func__, iReturn);
} else
dev_err(&pdx->interface->dev, "%s failed, code %d", __func__,
iReturn);
mutex_unlock(&pdx->io_mutex);
@ -1290,7 +1299,6 @@ int DbgStopLoop(DEVICE_EXTENSION *pdx)
return iReturn;
}
/****************************************************************************
** SetCircular
**
@ -1306,13 +1314,17 @@ int SetCircular(DEVICE_EXTENSION *pdx, TRANSFERDESC __user *pTD)
TRANSFERDESC td;
copy_from_user(&td, pTD, sizeof(td));
mutex_lock(&pdx->io_mutex);
dev_dbg(&pdx->interface->dev,"%s area:%d, size:%08x", __func__, td.wAreaNum, td.dwLength);
dev_dbg(&pdx->interface->dev, "%s area:%d, size:%08x", __func__,
td.wAreaNum, td.dwLength);
bToHost = td.eSize != 0; // this is used as the tohost flag
// The strange cast is done so that we don't get warnings in 32-bit linux about the size of the
// pointer. The pointer is always passed as a 64-bit object so that we don't have problems using
// a 32-bit program on a 64-bit system. unsigned long is 64-bits on a 64-bit system.
iReturn = SetArea(pdx, td.wAreaNum, (char __user *)((unsigned long)td.lpvBuff), td.dwLength, true, bToHost);
iReturn =
SetArea(pdx, td.wAreaNum,
(char __user *)((unsigned long)td.lpvBuff), td.dwLength,
true, bToHost);
mutex_unlock(&pdx->io_mutex);
return iReturn;
}
@ -1347,15 +1359,15 @@ int GetCircBlock(DEVICE_EXTENSION *pdx, TCIRCBLOCK __user* pCB)
{
cb.dwOffset = pArea->aBlocks[0].dwOffset;
cb.dwSize = pArea->aBlocks[0].dwSize;
dev_dbg(&pdx->interface->dev, "%s return block 0: %d bytes at %d", __func__, cb.dwSize, cb.dwOffset);
dev_dbg(&pdx->interface->dev,
"%s return block 0: %d bytes at %d",
__func__, cb.dwSize, cb.dwOffset);
}
}
else
} else
iReturn = U14ERR_NOTSET;
spin_unlock_irq(&pdx->stagedLock);
}
else
} else
iReturn = U14ERR_BADAREA;
copy_to_user(pCB, &cb, sizeof(cb));
@ -1363,7 +1375,6 @@ int GetCircBlock(DEVICE_EXTENSION *pdx, TCIRCBLOCK __user* pCB)
return iReturn;
}
/****************************************************************************
** FreeCircBlock
**
@ -1406,56 +1417,62 @@ int FreeCircBlock(DEVICE_EXTENSION *pdx, TCIRCBLOCK __user* pCB)
pArea->aBlocks[0] = pArea->aBlocks[1]; // Copy down block 2 data
pArea->aBlocks[1].dwSize = 0; // and mark the second block as unused
pArea->aBlocks[1].dwOffset = 0;
}
else
} else
pArea->aBlocks[0].dwOffset = 0;
}
dev_dbg(&pdx->interface->dev, "%s free %d bytes at %d, return %d bytes at %d, wait=%d",
__func__, uSize, uStart, pArea->aBlocks[0].dwSize, pArea->aBlocks[0].dwOffset, pdx->bXFerWaiting);
dev_dbg(&pdx->interface->dev,
"%s free %d bytes at %d, return %d bytes at %d, wait=%d",
__func__, uSize, uStart,
pArea->aBlocks[0].dwSize,
pArea->aBlocks[0].dwOffset,
pdx->bXFerWaiting);
// Return the next available block of memory as well
if (pArea->aBlocks[0].dwSize > 0) // Got anything?
{
cb.dwOffset = pArea->aBlocks[0].dwOffset;
cb.dwOffset =
pArea->aBlocks[0].dwOffset;
cb.dwSize = pArea->aBlocks[0].dwSize;
}
bWaiting = pdx->bXFerWaiting;
if (bWaiting && pdx->bStagedUrbPending)
{
dev_err(&pdx->interface->dev, "%s ERROR: waiting xfer and staged Urb pending!", __func__);
if (bWaiting && pdx->bStagedUrbPending) {
dev_err(&pdx->interface->dev,
"%s ERROR: waiting xfer and staged Urb pending!",
__func__);
bWaiting = false;
}
}
else
{
dev_err(&pdx->interface->dev, "%s ERROR: freeing %d bytes at %d, block 0 is %d bytes at %d",
__func__, uSize, uStart, pArea->aBlocks[0].dwSize, pArea->aBlocks[0].dwOffset);
} else {
dev_err(&pdx->interface->dev,
"%s ERROR: freeing %d bytes at %d, block 0 is %d bytes at %d",
__func__, uSize, uStart,
pArea->aBlocks[0].dwSize,
pArea->aBlocks[0].dwOffset);
iReturn = U14ERR_NOMEMORY;
}
// If we have one, kick off pending transfer
if (bWaiting) // Got a block xfer waiting?
{
int RWMStat = ReadWriteMem(pdx, !pdx->rDMAInfo.bOutWard,
pdx->rDMAInfo.wIdent, pdx->rDMAInfo.dwOffset, pdx->rDMAInfo.dwSize);
int RWMStat =
ReadWriteMem(pdx, !pdx->rDMAInfo.bOutWard,
pdx->rDMAInfo.wIdent,
pdx->rDMAInfo.dwOffset,
pdx->rDMAInfo.dwSize);
if (RWMStat != U14ERR_NOERROR)
dev_err(&pdx->interface->dev, "%s rw setup failed %d", __func__, RWMStat);
dev_err(&pdx->interface->dev,
"%s rw setup failed %d",
__func__, RWMStat);
}
}
else
} else
iReturn = U14ERR_NOTSET;
spin_unlock_irq(&pdx->stagedLock);
}
else
} else
iReturn = U14ERR_BADAREA;
copy_to_user(pCB, &cb, sizeof(cb));
mutex_unlock(&pdx->io_mutex);
return iReturn;
}

View File

@ -1,27 +1,24 @@
/* ced_ioctl.h
IOCTL calls for the CED1401 driver
Copyright (C) 2010 Cambridge Electronic Design Ltd
Author Greg P Smith (greg@ced.co.uk)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/*
* IOCTL calls for the CED1401 driver
* Copyright (C) 2010 Cambridge Electronic Design Ltd
* Author Greg P Smith (greg@ced.co.uk)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __CED_IOCTL_H__
#define __CED_IOCTL_H__
#include <asm/ioctl.h>
/// dma modes, only MODE_CHAR and MODE_LINEAR are used in this driver
#include <linux/ioctl.h>
/* dma modes, only MODE_CHAR and MODE_LINEAR are used in this driver */
#define MODE_CHAR 0
#define MODE_LINEAR 1
@ -29,73 +26,67 @@
** TypeDefs
*****************************************************************************/
typedef unsigned short TBLOCKENTRY; // index the blk transfer table 0-7
typedef unsigned short TBLOCKENTRY; /* index the blk transfer table 0-7 */
typedef struct TransferDesc
{
long long lpvBuff; // address of transfer area (for 64 or 32 bit)
unsigned int dwLength; // length of the area
TBLOCKENTRY wAreaNum; // number of transfer area to set up
short eSize; // element size - is tohost flag for circular
typedef struct TransferDesc {
long long lpvBuff; /* address of transfer area (for 64 or 32 bit) */
unsigned int dwLength; /* length of the area */
TBLOCKENTRY wAreaNum; /* number of transfer area to set up */
short eSize; /* element size - is tohost flag for circular */
} TRANSFERDESC;
typedef TRANSFERDESC * LPTRANSFERDESC;
typedef struct TransferEvent
{
unsigned int dwStart; // offset into the area
unsigned int dwLength; // length of the region
unsigned short wAreaNum; // the area number
unsigned short wFlags; // bit 0 set for toHost
int iSetEvent; // could be dummy in LINUX
typedef struct TransferEvent {
unsigned int dwStart; /* offset into the area */
unsigned int dwLength; /* length of the region */
unsigned short wAreaNum; /* the area number */
unsigned short wFlags; /* bit 0 set for toHost */
int iSetEvent; /* could be dummy in LINUX */
} TRANSFEREVENT;
#define MAX_TRANSFER_SIZE 0x4000 /* Maximum data bytes per IRP */
#define MAX_AREA_LENGTH 0x100000 /* Maximum size of transfer area */
#define MAX_TRANSAREAS 8 /* definitions for dma set up */
typedef struct TGetSelfTest
{
int code; // self-test error code
int x,y; // additional information
typedef struct TGetSelfTest {
int code; /* self-test error code */
int x, y; /* additional information */
} TGET_SELFTEST;
/// Debug block used for several commands. Not all fields are used for all commands.
typedef struct TDbgBlock
{
int iAddr; // the address in the 1401
int iRepeats; // number of repeats
int iWidth; // width in bytes 1, 2, 4
int iDefault; // default value
int iMask; // mask to apply
int iData; // data for poke, result for peek
/* Debug block used for several commands. Not all fields are used for all commands. */
typedef struct TDbgBlock {
int iAddr; /* the address in the 1401 */
int iRepeats; /* number of repeats */
int iWidth; /* width in bytes 1, 2, 4 */
int iDefault; /* default value */
int iMask; /* mask to apply */
int iData; /* data for poke, result for peek */
} TDBGBLOCK;
/// Used to collect information about a circular block from the device driver
typedef struct TCircBlock
{
unsigned int nArea; // the area to collect information from
unsigned int dwOffset; // offset into the area to the available block
unsigned int dwSize; // size of the area
/* Used to collect information about a circular block from the device driver */
typedef struct TCircBlock {
unsigned int nArea; /* the area to collect information from */
unsigned int dwOffset; /* offset into the area to the available block */
unsigned int dwSize; /* size of the area */
} TCIRCBLOCK;
/// Used to clollect the 1401 status
typedef struct TCSBlock
{
/* Used to clollect the 1401 status */
typedef struct TCSBlock {
unsigned int uiState;
unsigned int uiError;
} TCSBLOCK;
// As seen by the user, an ioctl call looks like:
// int ioctl(int fd, unsigned long cmd, char* argp);
// We will then have all sorts of variants on this that can be used
// to pass stuff to our driver. We will generate macros for each type
// of call so as to provide some sort of type safety in the calling:
/*
* As seen by the user, an ioctl call looks like: int ioctl(int fd, unsigned
* long cmd, char* argp); We will then have all sorts of variants on this that
* can be used to pass stuff to our driver. We will generate macros for each
* type of call so as to provide some sort of type safety in the calling:
*/
#define CED_MAGIC_IOC 0xce
// NBNB: READ and WRITE are from the point of view of the device, not user.
typedef struct ced_ioc_string
{
/* NBNB: READ and WRITE are from the point of view of the device, not user. */
typedef struct ced_ioc_string {
int nChars;
char buffer[256];
} CED_IOC_STRING;
@ -142,91 +133,213 @@ typedef struct ced_ioc_string
#define IOCTL_CED_TESTEVENT _IO(CED_MAGIC_IOC, 46)
#ifndef __KERNEL__
// If nothing said about return value, it is a U14ERR_... error code (U14ERR_NOERROR for none)
inline int CED_SendString(int fh, const char* szText, int n){return ioctl(fh, IOCTL_CED_SENDSTRING(n), szText);}
/*
* If nothing said about return value, it is a U14ERR_... error code
* (U14ERR_NOERROR for none)
*/
inline int CED_SendString(int fh, const char *szText, int n)
{
return ioctl(fh, IOCTL_CED_SENDSTRING(n), szText);
}
inline int CED_Reset1401(int fh){return ioctl(fh, IOCTL_CED_RESET1401);}
inline int CED_Reset1401(int fh)
{
return ioctl(fh, IOCTL_CED_RESET1401);
}
inline int CED_GetChar(int fh){return ioctl(fh, IOCTL_CED_GETCHAR);}
// Return the singe character or a -ve error code.
/* Return the singe character or a -ve error code. */
inline int CED_GetChar(int fh)
{
return ioctl(fh, IOCTL_CED_GETCHAR);
}
inline int CED_Stat1401(int fh){return ioctl(fh, IOCTL_CED_STAT1401);}
// Return character count in input buffer
/* Return character count in input buffer */
inline int CED_Stat1401(int fh)
{
return ioctl(fh, IOCTL_CED_STAT1401);
}
inline int CED_SendChar(int fh, char c){return ioctl(fh, IOCTL_CED_SENDCHAR, c);}
inline int CED_SendChar(int fh, char c)
{
return ioctl(fh, IOCTL_CED_SENDCHAR, c);
}
inline int CED_LineCount(int fh){return ioctl(fh, IOCTL_CED_LINECOUNT);}
inline int CED_LineCount(int fh)
{
return ioctl(fh, IOCTL_CED_LINECOUNT);
}
inline int CED_GetString(int fh, char* szText, int nMax){return ioctl(fh, IOCTL_CED_GETSTRING(nMax), szText);}
// return the count of characters returned. If the string was terminated by CR or 0, then the 0 is part
// of the count. Otherwise, we will add a zero if there is room, but it is not included in the count.
// The return value is 0 if there was nothing to read.
/*
* return the count of characters returned. If the string was terminated by CR
* or 0, then the 0 is part of the count. Otherwise, we will add a zero if
* there is room, but it is not included in the count. The return value is 0
* if there was nothing to read.
*/
inline int CED_GetString(int fh, char *szText, int nMax)
{
return ioctl(fh, IOCTL_CED_GETSTRING(nMax), szText);
}
inline int CED_GetOutBufSpace(int fh){return ioctl(fh, IOCTL_CED_GETOUTBUFSPACE);}
// returns space in the output buffer.
/* returns space in the output buffer. */
inline int CED_GetOutBufSpace(int fh)
{
return ioctl(fh, IOCTL_CED_GETOUTBUFSPACE);
}
inline int CED_GetBaseAddress(int fh){return ioctl(fh, IOCTL_CED_GETBASEADDRESS);}
// This always returns -1 as not implemented.
/* This always returns -1 as not implemented. */
inline int CED_GetBaseAddress(int fh)
{
return ioctl(fh, IOCTL_CED_GETBASEADDRESS);
}
inline int CED_GetDriverRevision(int fh){return ioctl(fh, IOCTL_CED_GETDRIVERREVISION);}
// returns the major revision <<16 | minor revision.
/* returns the major revision <<16 | minor revision. */
inline int CED_GetDriverRevision(int fh)
{
return ioctl(fh, IOCTL_CED_GETDRIVERREVISION);
}
inline int CED_SetTransfer(int fh, TRANSFERDESC* pTD){return ioctl(fh, IOCTL_CED_SETTRANSFER, pTD);}
inline int CED_SetTransfer(int fh, TRANSFERDESC *pTD)
{
return ioctl(fh, IOCTL_CED_SETTRANSFER, pTD);
}
inline int CED_UnsetTransfer(int fh, int nArea){return ioctl(fh, IOCTL_CED_UNSETTRANSFER, nArea);}
inline int CED_UnsetTransfer(int fh, int nArea)
{
return ioctl(fh, IOCTL_CED_UNSETTRANSFER, nArea);
}
inline int CED_SetEvent(int fh, TRANSFEREVENT* pTE){return ioctl(fh, IOCTL_CED_SETEVENT, pTE);}
inline int CED_SetEvent(int fh, TRANSFEREVENT *pTE)
{
return ioctl(fh, IOCTL_CED_SETEVENT, pTE);
}
inline int CED_GetTransfer(int fh, TGET_TX_BLOCK* pTX){return ioctl(fh, IOCTL_CED_GETTRANSFER, pTX);}
inline int CED_GetTransfer(int fh, TGET_TX_BLOCK *pTX)
{
return ioctl(fh, IOCTL_CED_GETTRANSFER, pTX);
}
inline int CED_KillIO1401(int fh){return ioctl(fh, IOCTL_CED_KILLIO1401);}
inline int CED_KillIO1401(int fh)
{
return ioctl(fh, IOCTL_CED_KILLIO1401);
}
inline int CED_BlkTransState(int fh){return ioctl(fh, IOCTL_CED_BLKTRANSSTATE);}
// returns 0 if no active DMA, 1 if active
/* returns 0 if no active DMA, 1 if active */
inline int CED_BlkTransState(int fh)
{
return ioctl(fh, IOCTL_CED_BLKTRANSSTATE);
}
inline int CED_StateOf1401(int fh){return ioctl(fh, IOCTL_CED_STATEOF1401);}
inline int CED_StateOf1401(int fh)
{
return ioctl(fh, IOCTL_CED_STATEOF1401);
}
inline int CED_Grab1401(int fh){return ioctl(fh, IOCTL_CED_GRAB1401);}
inline int CED_Free1401(int fh){return ioctl(fh, IOCTL_CED_FREE1401);}
inline int CED_Grab1401(int fh)
{
return ioctl(fh, IOCTL_CED_GRAB1401);
}
inline int CED_StartSelfTest(int fh){return ioctl(fh, IOCTL_CED_STARTSELFTEST);}
inline int CED_CheckSelfTest(int fh, TGET_SELFTEST* pGST){return ioctl(fh, IOCTL_CED_CHECKSELFTEST, pGST);}
inline int CED_Free1401(int fh)
{
return ioctl(fh, IOCTL_CED_FREE1401);
}
inline int CED_TypeOf1401(int fh){return ioctl(fh, IOCTL_CED_TYPEOF1401);}
inline int CED_TransferFlags(int fh){return ioctl(fh, IOCTL_CED_TRANSFERFLAGS);}
inline int CED_StartSelfTest(int fh)
{
return ioctl(fh, IOCTL_CED_STARTSELFTEST);
}
inline int CED_DbgPeek(int fh, TDBGBLOCK* pDB){return ioctl(fh, IOCTL_CED_DBGPEEK, pDB);}
inline int CED_DbgPoke(int fh, TDBGBLOCK* pDB){return ioctl(fh, IOCTL_CED_DBGPOKE, pDB);}
inline int CED_DbgRampData(int fh, TDBGBLOCK* pDB){return ioctl(fh, IOCTL_CED_DBGRAMPDATA, pDB);}
inline int CED_DbgRampAddr(int fh, TDBGBLOCK* pDB){return ioctl(fh, IOCTL_CED_DBGRAMPADDR, pDB);}
inline int CED_DbgGetData(int fh, TDBGBLOCK* pDB){return ioctl(fh, IOCTL_CED_DBGGETDATA, pDB);}
inline int CED_DbgStopLoop(int fh){return ioctl(fh, IOCTL_CED_DBGSTOPLOOP);}
inline int CED_CheckSelfTest(int fh, TGET_SELFTEST *pGST)
{
return ioctl(fh, IOCTL_CED_CHECKSELFTEST, pGST);
}
inline int CED_FullReset(int fh){return ioctl(fh, IOCTL_CED_FULLRESET);}
inline int CED_TypeOf1401(int fh)
{
return ioctl(fh, IOCTL_CED_TYPEOF1401);
}
inline int CED_SetCircular(int fh, TRANSFERDESC* pTD){return ioctl(fh, IOCTL_CED_SETCIRCULAR, pTD);}
inline int CED_GetCircBlock(int fh, TCIRCBLOCK* pCB){return ioctl(fh, IOCTL_CED_GETCIRCBLOCK, pCB);}
inline int CED_FreeCircBlock(int fh, TCIRCBLOCK* pCB){return ioctl(fh, IOCTL_CED_FREECIRCBLOCK, pCB);}
inline int CED_TransferFlags(int fh)
{
return ioctl(fh, IOCTL_CED_TRANSFERFLAGS);
}
inline int CED_WaitEvent(int fh, int nArea, int msTimeOut){return ioctl(fh, IOCTL_CED_WAITEVENT, (nArea & 0xff)|(msTimeOut << 8));}
inline int CED_TestEvent(int fh, int nArea){return ioctl(fh, IOCTL_CED_TESTEVENT, nArea);}
inline int CED_DbgPeek(int fh, TDBGBLOCK *pDB)
{
return ioctl(fh, IOCTL_CED_DBGPEEK, pDB);
}
inline int CED_DbgPoke(int fh, TDBGBLOCK *pDB)
{
return ioctl(fh, IOCTL_CED_DBGPOKE, pDB);
}
inline int CED_DbgRampData(int fh, TDBGBLOCK *pDB)
{
return ioctl(fh, IOCTL_CED_DBGRAMPDATA, pDB);
}
inline int CED_DbgRampAddr(int fh, TDBGBLOCK *pDB)
{
return ioctl(fh, IOCTL_CED_DBGRAMPADDR, pDB);
}
inline int CED_DbgGetData(int fh, TDBGBLOCK *pDB)
{
return ioctl(fh, IOCTL_CED_DBGGETDATA, pDB);
}
inline int CED_DbgStopLoop(int fh)
{
return ioctl(fh, IOCTL_CED_DBGSTOPLOOP);
}
inline int CED_FullReset(int fh)
{
return ioctl(fh, IOCTL_CED_FULLRESET);
}
inline int CED_SetCircular(int fh, TRANSFERDESC *pTD)
{
return ioctl(fh, IOCTL_CED_SETCIRCULAR, pTD);
}
inline int CED_GetCircBlock(int fh, TCIRCBLOCK *pCB)
{
return ioctl(fh, IOCTL_CED_GETCIRCBLOCK, pCB);
}
inline int CED_FreeCircBlock(int fh, TCIRCBLOCK *pCB)
{
return ioctl(fh, IOCTL_CED_FREECIRCBLOCK, pCB);
}
inline int CED_WaitEvent(int fh, int nArea, int msTimeOut)
{
return ioctl(fh, IOCTL_CED_WAITEVENT, (nArea & 0xff)|(msTimeOut << 8));
}
inline int CED_TestEvent(int fh, int nArea)
{
return ioctl(fh, IOCTL_CED_TESTEVENT, nArea);
}
#endif
#ifdef NOTWANTEDYET
#define IOCTL_CED_REGCALLBACK _IO(CED_MAGIC_IOC,9) // Not used
#define IOCTL_CED_GETMONITORBUF _IO(CED_MAGIC_IOC,10) // Not used
#define IOCTL_CED_REGCALLBACK _IO(CED_MAGIC_IOC, 9) /* Not used */
#define IOCTL_CED_GETMONITORBUF _IO(CED_MAGIC_IOC, 10) /* Not used */
#define IOCTL_CED_BYTECOUNT _IO(CED_MAGIC_IOC,20) // Not used
#define IOCTL_CED_ZEROBLOCKCOUNT _IO(CED_MAGIC_IOC,21) // Not used
#define IOCTL_CED_STOPCIRCULAR _IO(CED_MAGIC_IOC,22) // Not used
#define IOCTL_CED_BYTECOUNT _IO(CED_MAGIC_IOC, 20) /* Not used */
#define IOCTL_CED_ZEROBLOCKCOUNT _IO(CED_MAGIC_IOC, 21) /* Not used */
#define IOCTL_CED_STOPCIRCULAR _IO(CED_MAGIC_IOC, 22) /* Not used */
#define IOCTL_CED_REGISTERS1401 _IO(CED_MAGIC_IOC,24) // Not used
#define IOCTL_CED_STEP1401 _IO(CED_MAGIC_IOC,27) // Not used
#define IOCTL_CED_SET1401REGISTERS _IO(CED_MAGIC_IOC,28) // Not used
#define IOCTL_CED_STEPTILL1401 _IO(CED_MAGIC_IOC,29) // Not used
#define IOCTL_CED_SETORIN _IO(CED_MAGIC_IOC,30) // Not used
#define IOCTL_CED_REGISTERS1401 _IO(CED_MAGIC_IOC, 24) /* Not used */
#define IOCTL_CED_STEP1401 _IO(CED_MAGIC_IOC, 27) /* Not used */
#define IOCTL_CED_SET1401REGISTERS _IO(CED_MAGIC_IOC, 28) /* Not used */
#define IOCTL_CED_STEPTILL1401 _IO(CED_MAGIC_IOC, 29) /* Not used */
#define IOCTL_CED_SETORIN _IO(CED_MAGIC_IOC, 30) /* Not used */
#endif
// __CED_IOCTL_H__
/* __CED_IOCTL_H__ */
#endif

File diff suppressed because it is too large Load Diff