X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/a35b5224bbdfbd7147e1cf715c2931a2d740f592..1a157d7de03aaf7887a59fae6fbd62eec854aede:/lincan/include/usbcan.h diff --git a/lincan/include/usbcan.h b/lincan/include/usbcan.h index 36c3753..f29f9b8 100644 --- a/lincan/include/usbcan.h +++ b/lincan/include/usbcan.h @@ -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;