]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/sja1000p.c
CPC-PCI second chip IRQ corrected. Message timestamp code added.
[lincan.git] / lincan / src / sja1000p.c
index 74dae55d245cef6cdff160f3119232abc2287a36..3087db5d23690bb1fdbd178a49bb9a9149f3eec3 100644 (file)
@@ -6,7 +6,7 @@
  * 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 "../include/can.h"
@@ -267,6 +267,9 @@ void sja1000p_read(struct chip_t *chip, struct msgobj_t *obj) {
                        obj->rx_msg.data[i]=can_read_reg(chip,datastart+i);
                }
 
+               /* fill CAN message timestamp */
+               can_filltimestamp(&obj->rx_msg.timestamp);
+
                canque_filter_msg2edges(obj->qends, &obj->rx_msg);
 
                can_write_reg(chip, sjaCMR_RRB, SJACMR);
@@ -559,6 +562,9 @@ void sja1000p_irq_write_handler(struct chip_t *chip, struct msgobj_t *obj)
        if(obj->tx_slot){
                /* Do local transmitted message distribution if enabled */
                if (processlocal){
+                       /* fill CAN message timestamp */
+                       can_filltimestamp(&obj->tx_slot->msg.timestamp);
+                       
                        obj->tx_slot->msg.flags |= MSG_LOCAL;
                        canque_filter_msg2edges(obj->qends, &obj->tx_slot->msg);
                }
@@ -738,3 +744,19 @@ int sja1000p_register(struct chipspecops_t *chipspecops)
        chipspecops->irq_handler=sja1000p_irq_handler;
        return 0;
 }
+
+/**
+ * sja1000p_fill_chipspecops - fills chip specific operations
+ * @chip: pointer to chip representation structure
+ *
+ * The function fills chip specific operations for sja1000 (PeliCAN) chip.
+ *
+ * Return Value: returns negative number in the case of fail
+ */
+int sja1000p_fill_chipspecops(struct chip_t *chip)
+{
+       chip->chip_type="sja1000p";
+       chip->max_objects=1;
+       sja1000p_register(chip->chipspecops);
+       return 0;
+}