X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/3d6c5be34ccd4bf1633c6b7f98e9beedfebc262f..95c031e101c74ae6472a7e538f3128f67a490082:/lincan/src/i82527.c diff --git a/lincan/src/i82527.c b/lincan/src/i82527.c index 3aed30b..d11a79b 100644 --- a/lincan/src/i82527.c +++ b/lincan/src/i82527.c @@ -12,7 +12,7 @@ #include "../include/main.h" #include "../include/i82527.h" -void i82527_irq_rtr_handler(struct chip_t *chip, struct msgobj_t *obj, +void i82527_irq_rtr_handler(struct canchip_t *chip, struct msgobj_t *obj, struct rtr_id *rtr_search, unsigned long message_id); @@ -23,7 +23,7 @@ extern int mo15mask; /* helper functions for segmented cards read and write configuration and status registers above 0xf offset */ -void i82527_seg_write_reg(const struct chip_t *chip, unsigned char data, unsigned address) +void i82527_seg_write_reg(const struct canchip_t *chip, unsigned char data, unsigned address) { if((address > 0xf) && (chip->flags & CHIP_SEGMENTED)) canobj_write_reg(chip, chip->msgobj[(address>>4)-1],data, address & 0xf); @@ -31,7 +31,7 @@ void i82527_seg_write_reg(const struct chip_t *chip, unsigned char data, unsigne can_write_reg(chip, data, address); } -unsigned i82527_seg_read_reg(const struct chip_t *chip, unsigned address) +unsigned i82527_seg_read_reg(const struct canchip_t *chip, unsigned address) { if((address > 0xf) && (chip->flags & CHIP_SEGMENTED)) return canobj_read_reg(chip, chip->msgobj[(address>>4)-1], address & 0xf); @@ -39,7 +39,7 @@ unsigned i82527_seg_read_reg(const struct chip_t *chip, unsigned address) return can_read_reg(chip, address); } -int i82527_enable_configuration(struct chip_t *chip) +int i82527_enable_configuration(struct canchip_t *chip) { unsigned short flags=0; @@ -49,7 +49,7 @@ int i82527_enable_configuration(struct chip_t *chip) return 0; } -int i82527_disable_configuration(struct chip_t *chip) +int i82527_disable_configuration(struct canchip_t *chip) { unsigned short flags=0; @@ -59,7 +59,7 @@ int i82527_disable_configuration(struct chip_t *chip) return 0; } -int i82527_chip_config(struct chip_t *chip) +int i82527_chip_config(struct canchip_t *chip) { can_write_reg(chip,chip->int_cpu_reg,iCPU); // Configure cpu interface can_write_reg(chip,(iCTL_CCE|iCTL_INI),iCTL); // Enable configuration @@ -121,7 +121,7 @@ int i82527_chip_config(struct chip_t *chip) * 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 i82527_baud_rate(struct chip_t *chip, int rate, int clock, int sjw, +int i82527_baud_rate(struct canchip_t *chip, int rate, int clock, int sjw, int sampl_pt, int flags) { int best_error = 1000000000, error; @@ -185,7 +185,7 @@ int i82527_baud_rate(struct chip_t *chip, int rate, int clock, int sjw, return 0; } -int i82527_standard_mask(struct chip_t *chip, unsigned short code, unsigned short mask) +int i82527_standard_mask(struct canchip_t *chip, unsigned short code, unsigned short mask) { unsigned char mask0, mask1; @@ -200,7 +200,7 @@ int i82527_standard_mask(struct chip_t *chip, unsigned short code, unsigned shor return 0; } -int i82527_extended_mask(struct chip_t *chip, unsigned long code, unsigned long mask) +int i82527_extended_mask(struct canchip_t *chip, unsigned long code, unsigned long mask) { unsigned char mask0, mask1, mask2, mask3; @@ -219,7 +219,7 @@ int i82527_extended_mask(struct chip_t *chip, unsigned long code, unsigned long return 0; } -int i82527_message15_mask(struct chip_t *chip, unsigned long code, unsigned long mask) +int i82527_message15_mask(struct canchip_t *chip, unsigned long code, unsigned long mask) { unsigned char mask0, mask1, mask2, mask3; @@ -240,7 +240,7 @@ int i82527_message15_mask(struct chip_t *chip, unsigned long code, unsigned long } -int i82527_clear_objects(struct chip_t *chip) +int i82527_clear_objects(struct canchip_t *chip) { int i=0,id=0,data=0; struct msgobj_t *obj; @@ -271,14 +271,14 @@ int i82527_clear_objects(struct chip_t *chip) return 0; } -int i82527_config_irqs(struct chip_t *chip, short irqs) +int i82527_config_irqs(struct canchip_t *chip, short irqs) { can_write_reg(chip,irqs,iCTL); DEBUGMSG("Configured hardware interrupt delivery\n"); return 0; } -int i82527_pre_read_config(struct chip_t *chip, struct msgobj_t *obj) +int i82527_pre_read_config(struct canchip_t *chip, struct msgobj_t *obj) { unsigned long id=obj->rx_preconfig_id; @@ -306,7 +306,7 @@ int i82527_pre_read_config(struct chip_t *chip, struct msgobj_t *obj) return 0; } -int i82527_pre_write_config(struct chip_t *chip, struct msgobj_t *obj, +int i82527_pre_write_config(struct canchip_t *chip, struct msgobj_t *obj, struct canmsg_t *msg) { int i=0,id0=0,id1=0,id2=0,id3=0; @@ -346,7 +346,7 @@ int i82527_pre_write_config(struct chip_t *chip, struct msgobj_t *obj, return 0; } -int i82527_send_msg(struct chip_t *chip, struct msgobj_t *obj, +int i82527_send_msg(struct canchip_t *chip, struct msgobj_t *obj, struct canmsg_t *msg) { canobj_write_reg(chip,obj,(MVAL_SET|TXIE_SET|RXIE_RES|INTPD_RES),iMSGCTL0); @@ -361,7 +361,7 @@ int i82527_send_msg(struct chip_t *chip, struct msgobj_t *obj, return 0; } -int i82527_check_tx_stat(struct chip_t *chip) +int i82527_check_tx_stat(struct canchip_t *chip) { if (can_read_reg(chip,iSTAT) & iSTAT_TXOK) { can_write_reg(chip,0x0,iSTAT); @@ -373,7 +373,7 @@ int i82527_check_tx_stat(struct chip_t *chip) } } -int i82527_remote_request(struct chip_t *chip, struct msgobj_t *obj) +int i82527_remote_request(struct canchip_t *chip, struct msgobj_t *obj) { canobj_write_reg(chip,obj,(MVAL_SET|TXIE_RES|RXIE_SET|INTPD_RES),iMSGCTL0); canobj_write_reg(chip,obj,(RMPD_RES|TXRQ_SET|MLST_RES|NEWD_RES),iMSGCTL1); @@ -381,7 +381,7 @@ int i82527_remote_request(struct chip_t *chip, struct msgobj_t *obj) return 0; } -int i82527_set_btregs(struct chip_t *chip, unsigned short btr0, +int i82527_set_btregs(struct canchip_t *chip, unsigned short btr0, unsigned short btr1) { if (i82527_enable_configuration(chip)) @@ -395,7 +395,7 @@ int i82527_set_btregs(struct chip_t *chip, unsigned short btr0, return 0; } -int i82527_start_chip(struct chip_t *chip) +int i82527_start_chip(struct canchip_t *chip) { unsigned short flags = 0; @@ -405,7 +405,7 @@ int i82527_start_chip(struct chip_t *chip) return 0; } -int i82527_stop_chip(struct chip_t *chip) +int i82527_stop_chip(struct canchip_t *chip) { unsigned short flags = 0; @@ -416,7 +416,7 @@ int i82527_stop_chip(struct chip_t *chip) } static inline -void i82527_irq_write_handler(struct chip_t *chip, struct msgobj_t *obj) +void i82527_irq_write_handler(struct canchip_t *chip, struct msgobj_t *obj) { int cmd; @@ -458,7 +458,7 @@ void i82527_irq_write_handler(struct chip_t *chip, struct msgobj_t *obj) } static inline -void i82527_irq_read_handler(struct chip_t *chip, struct msgobj_t *obj, int objnum) +void i82527_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj, int objnum) { int i; unsigned long message_id; @@ -565,7 +565,7 @@ void i82527_irq_read_handler(struct chip_t *chip, struct msgobj_t *obj, int objn static inline -void i82527_irq_update_filter(struct chip_t *chip, struct msgobj_t *obj) +void i82527_irq_update_filter(struct canchip_t *chip, struct msgobj_t *obj) { struct canfilt_t filt; @@ -587,7 +587,7 @@ void i82527_irq_update_filter(struct chip_t *chip, struct msgobj_t *obj) } -void i82527_irq_sync_activities(struct chip_t *chip, struct msgobj_t *obj) +void i82527_irq_sync_activities(struct canchip_t *chip, struct msgobj_t *obj) { while(!can_msgobj_test_and_set_fl(obj,TX_LOCK)) { @@ -611,7 +611,7 @@ void i82527_irq_sync_activities(struct chip_t *chip, struct msgobj_t *obj) } } -int i82527_irq_handler(int irq, struct chip_t *chip) +int i82527_irq_handler(int irq, struct canchip_t *chip) { unsigned char msgcfg; @@ -666,7 +666,7 @@ int i82527_irq_handler(int irq, struct chip_t *chip) return CANCHIP_IRQ_HANDLED; } -void i82527_irq_rtr_handler(struct chip_t *chip, struct msgobj_t *obj, +void i82527_irq_rtr_handler(struct canchip_t *chip, struct msgobj_t *obj, struct rtr_id *rtr_search, unsigned long message_id) { short int i=0; @@ -698,7 +698,7 @@ void i82527_irq_rtr_handler(struct chip_t *chip, struct msgobj_t *obj, * Return Value: negative value reports error. * File: src/i82527.c */ -int i82527_wakeup_tx(struct chip_t *chip, struct msgobj_t *obj) +int i82527_wakeup_tx(struct canchip_t *chip, struct msgobj_t *obj) { can_preempt_disable(); @@ -712,7 +712,7 @@ int i82527_wakeup_tx(struct chip_t *chip, struct msgobj_t *obj) return 0; } -int i82527_filtch_rq(struct chip_t *chip, struct msgobj_t *obj) +int i82527_filtch_rq(struct canchip_t *chip, struct msgobj_t *obj) { can_preempt_disable(); @@ -750,7 +750,7 @@ int i82527_register(struct chipspecops_t *chipspecops) return 0; } -int i82527_fill_chipspecops(struct chip_t *chip) +int i82527_fill_chipspecops(struct canchip_t *chip) { chip->chip_type="i82527"; chip->max_objects=15;