]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/include/main.h
First part of IRQ handling changes
[lincan.git] / lincan / include / main.h
index 78eace8ee71d4f02bfa2b22472025e72f5867d40..3af24c62bf32ba577ea53235e78d54ca07128779 100644 (file)
@@ -4,14 +4,13 @@
  * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
  * email:pisa@cmp.felk.cvut.cz
  * This software is released under the GPL-License.
- * Version lincan-0.2  9 Jul 2003
+ * Version lincan-0.3  17 Jun 2004
  */
 
 #include "./can.h"
 #include "./constants.h"
 #include "./can_sysdep.h"
 #include "./can_queue.h"
-#include "lincan_config.h"
 
 #ifdef CAN_DEBUG
        #define DEBUGMSG(fmt,args...) can_printk(KERN_ERR "can.o (debug): " fmt,\
@@ -88,6 +87,7 @@ struct candevice_t {
        struct canhardware_t *hosthardware_p;
        
        union {
+               void *anydev;
            #ifdef CAN_ENABLE_PCI_SUPPORT
                struct pci_dev *pcidev;
            #endif /*CAN_ENABLE_PCI_SUPPORT*/
@@ -158,7 +158,7 @@ struct chip_t {
        long clock; /* Chip clock in Hz */
        long baudrate;
 
-       void (*write_register)(unsigned char data,unsigned long address);
+       void (*write_register)(unsigned data,unsigned long address);
        unsigned (*read_register)(unsigned long address);
        
        void *chip_data;
@@ -209,6 +209,8 @@ struct chip_t {
  *     %MSGOBJ_TX_REQUEST .. the message object requests TX activation
  *     %MSGOBJ_TX_LOCK .. some IRQ routine or callback on some CPU 
  *             is running inside TX activation processing code
+ * @rx_preconfig_id: place to store RX message identifier for some chip types
+ *              that reuse same object for TX
  */
 struct msgobj_t {
        unsigned long obj_base_addr;
@@ -227,6 +229,8 @@ struct msgobj_t {
        struct canmsg_t rx_msg;
 
        struct chip_t *hostchip;
+       unsigned long rx_preconfig_id;
 
        atomic_t obj_used;
        struct list_head obj_users;
@@ -293,7 +297,7 @@ struct hwspecops_t {
        int (*init_chip_data)(struct candevice_t *candev, int chipnr);
        int (*init_obj_data)(struct chip_t *chip, int objnr);
        int (*program_irq)(struct candevice_t *candev);
-       void (*write_register)(unsigned char data,unsigned long address);
+       void (*write_register)(unsigned data,unsigned long address);
        unsigned (*read_register)(unsigned long address);
 };
 
@@ -347,7 +351,7 @@ struct chipspecops_t {
                                                        unsigned short btr1);
        int (*start_chip)(struct chip_t *chip);
        int (*stop_chip)(struct chip_t *chip);
-       can_irqreturn_t (*irq_handler)(int irq, void *dev_id, struct pt_regs *regs);
+       int (*irq_handler)(int irq, struct chip_t *chip);
 };
 
 struct mem_addr {
@@ -474,6 +478,28 @@ struct boardtype_t {
 
 const struct boardtype_t* boardtype_find(const char *str);
 
+int can_check_dev_taken(void *anydev);
+
+#if defined(can_gettimeofday) && defined(CAN_MSG_VERSION_2) && 1
+static inline
+void can_filltimestamp(canmsg_tstamp_t *ptimestamp)
+{
+       can_gettimeofday(ptimestamp);
+}
+#else /* No timestamp support, set field to zero */
+static inline
+void can_filltimestamp(canmsg_tstamp_t *ptimestamp)
+{
+    #ifdef CAN_MSG_VERSION_2
+       ptimestamp->tv_sec = 0;
+       ptimestamp->tv_usec = 0;
+    #else /* CAN_MSG_VERSION_2 */
+       *ptimestamp = 0;
+    #endif /* CAN_MSG_VERSION_2 */
+
+}
+#endif /* End of timestamp source selection */
+
 #ifdef CAN_WITH_RTL
 extern int can_rtl_priority;
 #endif /*CAN_WITH_RTL*/