]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/include/usbcan.h
USB LinCAN support reworked to use lists instead of arrays.
[lincan.git] / lincan / include / usbcan.h
index 36c3753cbbe470e61713b84f9e931dc275161038..f29f9b8062bfcf14a47b15ca10e4134f98aff3c2 100644 (file)
@@ -127,16 +127,16 @@ struct usbcan_message {
        struct urb      *u;
        struct usbcan_usb *dev;
        u8      msg[USBCAN_TRANSFER_SIZE];
-       spinlock_t              acc;            /* access lock */
        struct canque_edge_t *qedge;
        struct canque_slot_t *slot;
+       struct list_head list_node;
        volatile long   flags;
 };
 
-#define USBCAN_MESSAGE_FREE                                    (1)
-#define USBCAN_MESSAGE_URB_PENDING             (2)
+#define USBCAN_MESSAGE_FREE                            (1)
+#define USBCAN_MESSAGE_URB_PENDING                     (2)
 #define USBCAN_MESSAGE_TERMINATE                       (3)
-#define USBCAN_MESSAGE_ERROR                                   (4)
+#define USBCAN_MESSAGE_ERROR                           (4)
 #define USBCAN_MESSAGE_DATA_OK                         (5)
 #define USBCAN_MESSAGE_TYPE_RX                         (6)
 #define USBCAN_MESSAGE_TYPE_TX                         (7)
@@ -150,10 +150,16 @@ struct usbcan_usb {
        u8                      bulk_in_endpointAddr;   /* the address of the bulk in endpoint */
        u8                      bulk_out_endpointAddr;  /* the address of the bulk out endpoint */
        struct mutex            io_mutex;               /* synchronize I/O with disconnect */
-       struct usbcan_message   rx[USBCAN_TOT_RX_URBS];
-       struct usbcan_message   tx[USBCAN_TOT_TX_URBS];
 
-       struct task_struct *comthread;                      /* usb communication kernel thread  */
+       struct list_head        rx_pend_list;           /* URBs waiting for data receive */
+       struct list_head        rx_ready_list;          /* URBs with valid received data */
+       struct list_head        tx_idle_list;           /* URBs prepared to hold Tx messages */
+       struct list_head        tx_pend_list;           /* URBs holding Tx messages in progress */
+       struct list_head        tx_ready_list;          /* URBs with yet confirmed Tx messages */
+
+       spinlock_t              list_lock;                      /* list lock */
+
+       struct task_struct *comthread;                  /* usb communication kernel thread  */
        wait_queue_head_t queue;
 
        struct canchip_t *chip;