]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
update of error handling
authorhadaq <hadaq>
Wed, 23 Nov 2011 17:10:00 +0000 (17:10 +0000)
committerhadaq <hadaq>
Wed, 23 Nov 2011 17:10:00 +0000 (17:10 +0000)
pexor/kernel-module/pexor_trb.c

index 5115452f4c9ea3a779f84ab29eff898fa4534d94..a4f88884483664b763454897ddafa8fb55a49816 100644 (file)
@@ -1330,7 +1330,7 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg)
 
   default:
     pexor_msg(KERN_ERR "ERROR> invalid request %x\n", command);
-    status = -EFAULT;
+    status = -EINVAL;
     goto OUT_IOCTL;
   };
 
@@ -1386,8 +1386,9 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg)
                     (unsigned int)dmastat);
           /* reset DMA */
           iowrite32(PEXOR_TRB_DMA_RESET, priv->pexor.dma_control_stat);
+          ndelay(1000);
           /* do we need to flush the fifo-buffer, no libtrbnet takes care */
-          status = -130;
+          status = -201;
           goto OUT_IOCTL;
         }
       }
@@ -1408,8 +1409,9 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg)
                   (unsigned int)dmastat);
         /* reset DMA */
         iowrite32(PEXOR_TRB_DMA_RESET, priv->pexor.dma_control_stat);
+        ndelay(1000);
         /* do we need to flush the fifo-buffer, no libtrbnet takes care */
-        status = -131;
+        status = -202;
         goto OUT_IOCTL;
       }
 
@@ -1419,13 +1421,15 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg)
         /* No, end DMA */
         break;
       }
-      if ((sg_ctr + 1) >= priv->dma.nr_sglist) {
+      //      if ((sg_ctr + 1) >= priv->dma.nr_sglist) {
+      if ((sg_ctr + 1) >= 2) {
         pexor_msg(KERN_ERR
                   "ERROR> no more DMA buffers available, aborting DMA\n");
         /* reset DMA */
         iowrite32(PEXOR_TRB_DMA_RESET, priv->pexor.dma_control_stat);
+        ndelay(1000);
         /* do we need to flush the fifo-buffer, no libtrbnet takes care */
-        status = -132;
+        status = -203;
         goto OUT_IOCTL;
       }
     }
@@ -1434,7 +1438,7 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg)
     if ((dmaSize % 5) != 0) {
       pexor_msg(KERN_ERR
                 "ERROR> Invalid DMA Size %d\n", dmaSize);
-      status = -133;
+      status = -204;
       goto OUT_IOCTL;
     }
     
@@ -1447,7 +1451,7 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg)
       pexor_msg(KERN_ERR 
                 "ERROR> Lost DMA Credentials: 0x%08x != 0x%08x  Command: %d\n",
                 cred1, cred2, command); 
-      status = -EFAULT;
+      status = -205;
       goto OUT_IOCTL;
     }
 
@@ -1470,11 +1474,11 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg)
     status = pexor_copy_fifo_to_dma(priv, channel);
     pexor_dbg(KERN_ERR "FIFO copy to DMA buffer returned Size: %d\n", status);
     if (status == -1) {
-      status = -EFAULT;
+      status = -206;
       goto OUT_IOCTL;
     }
   }
-
+  
 OUT_IOCTL:
   spin_unlock((&(priv->dma_lock)));
   return status;