]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/sja1000.c
To prevent future name collisions "chip_t" changed to "canchip_t"
[lincan.git] / lincan / src / sja1000.c
index dfc47a290f3df84a0e239ffe4d7c1c61debe6f4b..27eebcabfd9a9c9bd67498f78140f4df84f060fc 100644 (file)
 #include "../include/main.h"
 #include "../include/sja1000.h"
 
-void sja1000_irq_read_handler(struct chip_t *chip, struct msgobj_t *obj);
-void sja1000_irq_write_handler(struct chip_t *chip, struct msgobj_t *obj);
+void sja1000_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj);
+void sja1000_irq_write_handler(struct canchip_t *chip, struct msgobj_t *obj);
 
-int sja1000_enable_configuration(struct chip_t *chip)
+int sja1000_enable_configuration(struct canchip_t *chip)
 {
        int i=0;
        unsigned flags;
@@ -39,7 +39,7 @@ int sja1000_enable_configuration(struct chip_t *chip)
        return 0;
 }
 
-int sja1000_disable_configuration(struct chip_t *chip)
+int sja1000_disable_configuration(struct canchip_t *chip)
 {
        int i=0;
        unsigned flags;
@@ -62,7 +62,7 @@ int sja1000_disable_configuration(struct chip_t *chip)
        return 0;
 }
 
-int sja1000_chip_config(struct chip_t *chip)
+int sja1000_chip_config(struct canchip_t *chip)
 {
        if (sja1000_enable_configuration(chip))
                return -ENODEV;
@@ -88,7 +88,7 @@ int sja1000_chip_config(struct chip_t *chip)
        return 0;
 }
 
-int sja1000_standard_mask(struct chip_t *chip, unsigned short code, unsigned short mask)
+int sja1000_standard_mask(struct canchip_t *chip, unsigned short code, unsigned short mask)
 {
        unsigned char write_code, write_mask;
 
@@ -123,7 +123,7 @@ int sja1000_standard_mask(struct chip_t *chip, unsigned short code, unsigned sho
  * param sampl_pt sample point in % (0-100) sets (TSEG1+2)/(TSEG1+TSEG2+3) ratio
  * param flags fields BTR1_SAM, OCMODE, OCPOL, OCTP, OCTN, CLK_OFF, CBP
  */
-int sja1000_baud_rate(struct chip_t *chip, int rate, int clock, int sjw,
+int sja1000_baud_rate(struct canchip_t *chip, int rate, int clock, int sjw,
                                                        int sampl_pt, int flags)
 {
        int best_error = 1000000000, error;
@@ -186,7 +186,7 @@ int sja1000_baud_rate(struct chip_t *chip, int rate, int clock, int sjw,
        return 0;
 }
 
-int sja1000_pre_read_config(struct chip_t *chip, struct msgobj_t *obj)
+int sja1000_pre_read_config(struct canchip_t *chip, struct msgobj_t *obj)
 {
        int i;
        
@@ -214,7 +214,7 @@ int sja1000_pre_read_config(struct chip_t *chip, struct msgobj_t *obj)
 
 #define MAX_TRANSMIT_WAIT_LOOPS 10
 
-int sja1000_pre_write_config(struct chip_t *chip, struct msgobj_t *obj, 
+int sja1000_pre_write_config(struct canchip_t *chip, struct msgobj_t *obj, 
                                                        struct canmsg_t *msg)
 {
        int i=0, id=0;
@@ -255,7 +255,7 @@ int sja1000_pre_write_config(struct chip_t *chip, struct msgobj_t *obj,
        return 0;
 }
 
-int sja1000_send_msg(struct chip_t *chip, struct msgobj_t *obj, 
+int sja1000_send_msg(struct canchip_t *chip, struct msgobj_t *obj, 
                                                        struct canmsg_t *msg)
 {
        can_write_reg(chip, sjaCMR_TR, SJACMR);
@@ -263,7 +263,7 @@ int sja1000_send_msg(struct chip_t *chip, struct msgobj_t *obj,
        return 0;
 }
 
-int sja1000_check_tx_stat(struct chip_t *chip)
+int sja1000_check_tx_stat(struct canchip_t *chip)
 {
        if (can_read_reg(chip,SJASR) & sjaSR_TCS)
                return 0;
@@ -271,7 +271,7 @@ int sja1000_check_tx_stat(struct chip_t *chip)
                return 1;
 }
 
-int sja1000_set_btregs(struct chip_t *chip, unsigned short btr0, 
+int sja1000_set_btregs(struct canchip_t *chip, unsigned short btr0, 
                                                        unsigned short btr1)
 {
        if (sja1000_enable_configuration(chip))
@@ -285,7 +285,7 @@ int sja1000_set_btregs(struct chip_t *chip, unsigned short btr0,
        return 0;
 }
 
-int sja1000_start_chip(struct chip_t *chip)
+int sja1000_start_chip(struct canchip_t *chip)
 {
        unsigned short flags = 0;
 
@@ -295,7 +295,7 @@ int sja1000_start_chip(struct chip_t *chip)
        return 0;
 }
 
-int sja1000_stop_chip(struct chip_t *chip)
+int sja1000_stop_chip(struct canchip_t *chip)
 {
        unsigned short flags = 0;
 
@@ -305,33 +305,33 @@ int sja1000_stop_chip(struct chip_t *chip)
        return 0;
 }
 
-int sja1000_remote_request(struct chip_t *chip, struct msgobj_t *obj)
+int sja1000_remote_request(struct canchip_t *chip, struct msgobj_t *obj)
 {
        CANMSG("sja1000_remote_request not implemented\n");
        return -ENOSYS;
 }
 
-int sja1000_extended_mask(struct chip_t *chip, unsigned long code,
+int sja1000_extended_mask(struct canchip_t *chip, unsigned long code,
                unsigned long mask)
 {
        CANMSG("sja1000_extended_mask not implemented\n");
        return -ENOSYS;
 }
 
-int sja1000_clear_objects(struct chip_t *chip)
+int sja1000_clear_objects(struct canchip_t *chip)
 {
        CANMSG("sja1000_clear_objects not implemented\n");
        return -ENOSYS;
 }
 
-int sja1000_config_irqs(struct chip_t *chip, short irqs)
+int sja1000_config_irqs(struct canchip_t *chip, short irqs)
 {
        CANMSG("sja1000_config_irqs not implemented\n");
        return -ENOSYS;
 }
 
 
-int sja1000_irq_handler(int irq, struct chip_t *chip)
+int sja1000_irq_handler(int irq, struct canchip_t *chip)
 {
        unsigned irq_register;
        struct msgobj_t *obj=chip->msgobj[0];
@@ -378,7 +378,7 @@ int sja1000_irq_handler(int irq, struct chip_t *chip)
        return CANCHIP_IRQ_HANDLED;
 }
 
-void sja1000_irq_read_handler(struct chip_t *chip, struct msgobj_t *obj)
+void sja1000_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj)
 {
        int i=0, id=0, len;
 
@@ -402,7 +402,7 @@ void sja1000_irq_read_handler(struct chip_t *chip, struct msgobj_t *obj)
        } while(can_read_reg(chip, SJASR) & sjaSR_RBS);
 }
 
-void sja1000_irq_write_handler(struct chip_t *chip, struct msgobj_t *obj)
+void sja1000_irq_write_handler(struct canchip_t *chip, struct msgobj_t *obj)
 {
        int cmd;
        
@@ -448,7 +448,7 @@ void sja1000_irq_write_handler(struct chip_t *chip, struct msgobj_t *obj)
  * Return Value: negative value reports error.
  * File: src/sja1000.c
  */
-int sja1000_wakeup_tx(struct chip_t *chip, struct msgobj_t *obj)
+int sja1000_wakeup_tx(struct canchip_t *chip, struct msgobj_t *obj)
 {
        can_preempt_disable();
        
@@ -491,7 +491,7 @@ int sja1000_register(struct chipspecops_t *chipspecops)
        return 0;
 }
 
-int sja1000_fill_chipspecops(struct chip_t *chip)
+int sja1000_fill_chipspecops(struct canchip_t *chip)
 {
        chip->chip_type="sja1000";
        chip->max_objects=1;