X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/a6d355f1cf48f39eecb2f1bdead51817d1fd5989..b29ebe97fb5acced24e8ce9bb30e5d4dcad58815:/lincan/include/usbcan.h diff --git a/lincan/include/usbcan.h b/lincan/include/usbcan.h index 36c3753..5370cea 100644 --- a/lincan/include/usbcan.h +++ b/lincan/include/usbcan.h @@ -127,19 +127,15 @@ 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_TERMINATE (3) -#define USBCAN_MESSAGE_ERROR (4) -#define USBCAN_MESSAGE_DATA_OK (5) -#define USBCAN_MESSAGE_TYPE_RX (6) -#define USBCAN_MESSAGE_TYPE_TX (7) +#define USBCAN_MESSAGE_TERMINATE (1) +#define USBCAN_MESSAGE_ERROR (2) +#define USBCAN_MESSAGE_DATA_OK (3) /* Structure to hold all of our device specific stuff */ struct usbcan_usb { @@ -150,10 +146,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; @@ -182,6 +184,7 @@ struct usbcan_devs { struct usbcan_usb **devs; int count; struct candevice_t *candev; + struct usb_device *udev; };