]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/include/main.h
Added full RT-Linux POSIX interface to LinCAN driver, needs preparation of RT tests.
[lincan.git] / lincan / include / main.h
index 4bb0e0e500b0ae9e3cb3abb06f55ced206239e3d..ba01dd23d89b54b767b2c5e257a24a9a4eaeed5e 100644 (file)
 #include "./can_queue.h"
 
 #ifdef CAN_DEBUG
-       #define DEBUGMSG(fmt,args...) printk(KERN_ERR "can.o (debug): " fmt,\
+       #define DEBUGMSG(fmt,args...) can_printk(KERN_ERR "can.o (debug): " fmt,\
        ##args)
 #else
        #define DEBUGMSG(fmt,args...)
 #endif
 
-#define CANMSG(fmt,args...) printk(KERN_ERR "can.o: " fmt,##args)
+#define CANMSG(fmt,args...) can_printk(KERN_ERR "can.o: " fmt,##args)
 
 
+extern can_spinlock_t canuser_manipulation_lock;
+
 /**
  * struct canhardware_t - structure representing pointers to all CAN boards
  * @nr_boards: number of present boards
@@ -152,6 +154,13 @@ struct chip_t {
        struct candevice_t *hostdevice;
        
        int max_objects;        /* 1 for sja1000, 15 for i82527 */
+
+       can_spinlock_t chip_lock;
+
+    #ifdef CAN_WITH_RTL
+       pthread_t worker_thread;
+       unsigned long pend_flags;
+    #endif /*CAN_WITH_RTL*/
 };
 
 /**
@@ -179,7 +188,7 @@ struct msgobj_t {
        unsigned long obj_base_addr;
        unsigned int minor;     /* associated device minor number  */
        unsigned int object;    /* object number in chip_t +1 for debug printk */
-       unsigned long flags; 
+       unsigned long obj_flags; 
        int ret;
 
        struct canque_ends_t *qends;
@@ -201,20 +210,33 @@ struct msgobj_t {
 
 /**
  * struct canuser_t - structure holding CAN user/client state
+ * @flags: used to distinguish Linux/RT-Linux type
  * @peers: for connection into list of object users
  * @qends: pointer to the ends structure corresponding for this user
- * @file: pointer to open device file state structure
  * @msgobj: communication object the user is connected to
  * @rx_edge0: default receive queue for filter IOCTL
+ * @userinfo: stores user context specific information.
+ *     The field @fileinfo.file holds pointer to open device file state structure
+ *     for the Linux user-space client applications
  * @magic: magic number to check consistency when pointer is retrieved
  *     from file private field
  */
 struct canuser_t {
+       unsigned long flags;
        struct list_head peers;
        struct canque_ends_t *qends;
-        struct file *file;      /* back ptr to file */
        struct msgobj_t *msgobj;
        struct canque_edge_t *rx_edge0; /* simplifies IOCTL */
+        union {
+               struct {
+                       struct file *file;  /* back ptr to file */
+               } fileinfo;
+           #ifdef CAN_WITH_RTL
+               struct {
+                       struct rtl_file *file;
+               } rtlinfo;
+           #endif /*CAN_WITH_RTL*/
+       } userinfo;
        int magic;
 };
 
@@ -297,7 +319,7 @@ struct chipspecops_t {
                                                        unsigned short btr1);
        int (*start_chip)(struct chip_t *chip);
        int (*stop_chip)(struct chip_t *chip);
-       irqreturn_t (*irq_handler)(int irq, void *dev_id, struct pt_regs *regs);
+       can_irqreturn_t (*irq_handler)(int irq, void *dev_id, struct pt_regs *regs);
 };
 
 struct mem_addr {