X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/6234a9dc385e5a9258a84227b2eab09bbb099c27..831ccb1f14f7472962fc2d185f32e18105209bd7:/lincan/include/main.h diff --git a/lincan/include/main.h b/lincan/include/main.h index 5e7ed39..f360dcf 100644 --- a/lincan/include/main.h +++ b/lincan/include/main.h @@ -48,7 +48,7 @@ struct canhardware_t { * @flags: board flags: %PROGRAMMABLE_IRQ .. interrupt number * can be programmed into board * @nr_all_chips: number of chips present on the board - * @nr_82527_chips: number of Intel 8257 chips + * @nr_82527_chips: number of Intel 8257 chips * @nr_sja1000_chips: number of Philips SJA100 chips * @chip: array of pointers to the chip structures * @hwspecops: pointer to board specific operations @@ -87,7 +87,7 @@ struct candevice_t { struct hwspecops_t *hwspecops; struct canhardware_t *hosthardware_p; - + union { void *anydev; #ifdef CAN_ENABLE_PCI_SUPPORT @@ -140,14 +140,14 @@ struct candevice_t { * @worker_thread: chip worker thread ID (RT-Linux specific field) * @pend_flags: holds information about pending interrupt and tx_wake() operations * (RT-Linux specific field). Masks values: - * %MSGOBJ_TX_REQUEST .. some of the message objects requires tx_wake() call, + * %MSGOBJ_TX_REQUEST .. some of the message objects requires tx_wake() call, * %MSGOBJ_IRQ_REQUEST .. chip interrupt processing required * %MSGOBJ_WORKER_WAKE .. marks, that worker thread should be waked * for some of above reasons * * The fields @write_register and @read_register are copied from * corresponding fields from @hwspecops structure - * (chip->hostdevice->hwspecops->write_register and + * (chip->hostdevice->hwspecops->write_register and * chip->hostdevice->hwspecops->read_register) * to speedup can_write_reg() and can_read_reg() functions. */ @@ -162,9 +162,9 @@ struct canchip_t { void (*write_register)(unsigned data, can_ioptr_t address); unsigned (*read_register)(can_ioptr_t address); - + void *chip_data; - + unsigned short sja_cdr_reg; /* sja1000 only! */ unsigned short sja_ocr_reg; /* sja1000 only! */ unsigned short int_cpu_reg; /* intel 82527 only! */ @@ -176,7 +176,7 @@ struct canchip_t { struct chipspecops_t *chipspecops; struct candevice_t *hostdevice; - + int max_objects; /* 1 for sja1000, 15 for i82527 */ can_spinlock_t chip_lock; @@ -189,7 +189,7 @@ struct canchip_t { /** * struct msgobj_t - structure holding communication object state - * @obj_base_addr: + * @obj_base_addr: * @minor: associated device minor number * @object: object number in canchip_t structure +1 * @flags: message object flags @@ -209,7 +209,7 @@ struct canchip_t { * @obj_users: list of user structures of type &canuser_t. * @obj_flags: message object specific flags. Masks values: * %MSGOBJ_TX_REQUEST .. the message object requests TX activation - * %MSGOBJ_TX_LOCK .. some IRQ routine or callback on some CPU + * %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 @@ -218,7 +218,7 @@ struct msgobj_t { can_ioptr_t obj_base_addr; unsigned int minor; /* associated device minor number */ unsigned int object; /* object number in canchip_t +1 for debug printk */ - unsigned long obj_flags; + unsigned long obj_flags; int ret; struct canque_ends_t *qends; @@ -227,11 +227,11 @@ struct msgobj_t { struct canque_slot_t *tx_slot; int tx_retry_cnt; struct timer_list tx_timeout; - + struct canmsg_t rx_msg; struct canchip_t *hostchip; - + unsigned long rx_preconfig_id; atomic_t obj_used; @@ -277,7 +277,7 @@ struct canuser_t { * @request_io: reserve io or memory range for can board * @release_io: free reserved io memory range * @reset: hardware reset routine - * @init_hw_data: called to initialize &candevice_t structure, mainly + * @init_hw_data: called to initialize &candevice_t structure, mainly * @res_add, @nr_all_chips, @nr_82527_chips, @nr_sja1000_chips * and @flags fields * @init_chip_data: called initialize each &canchip_t structure, mainly @@ -287,7 +287,7 @@ struct canuser_t { * @init_obj_data: called initialize each &msgobj_t structure, * mainly @obj_base_addr field. * @program_irq: program interrupt generation hardware of the board - * if flag %PROGRAMMABLE_IRQ is present for specified device/board + * if flag %PROGRAMMABLE_IRQ is present for specified device/board * @write_register: low level write register routine * @read_register: low level read register routine */ @@ -333,11 +333,11 @@ struct chipspecops_t { int (*chip_config)(struct canchip_t *chip); int (*baud_rate)(struct canchip_t *chip, int rate, int clock, int sjw, int sampl_pt, int flags); - int (*standard_mask)(struct canchip_t *chip, unsigned short code, + int (*standard_mask)(struct canchip_t *chip, unsigned short code, unsigned short mask); - int (*extended_mask)(struct canchip_t *chip, unsigned long code, + int (*extended_mask)(struct canchip_t *chip, unsigned long code, unsigned long mask); - int (*message15_mask)(struct canchip_t *chip, unsigned long code, + int (*message15_mask)(struct canchip_t *chip, unsigned long code, unsigned long mask); int (*clear_objects)(struct canchip_t *chip); int (*config_irqs)(struct canchip_t *chip, short irqs); @@ -352,7 +352,7 @@ struct chipspecops_t { int (*filtch_rq)(struct canchip_t *chip, struct msgobj_t *obj); int (*enable_configuration)(struct canchip_t *chip); int (*disable_configuration)(struct canchip_t *chip); - int (*set_btregs)(struct canchip_t *chip, unsigned short btr0, + int (*set_btregs)(struct canchip_t *chip, unsigned short btr0, unsigned short btr1); int (*attach_to_chip)(struct canchip_t *chip); int (*release_chip)(struct canchip_t *chip); @@ -438,7 +438,7 @@ extern inline unsigned canobj_read_reg(const struct canchip_t *chip, const struc #define CONFIG_OC_LINCAN_DYNAMICIO #endif -/* Inline function to write to the hardware registers. The argument reg_offs is +/* Inline function to write to the hardware registers. The argument reg_offs is * relative to the memory map of the chip and not the absolute memory reg_offs. */ extern inline void can_write_reg(const struct canchip_t *chip, unsigned char data, unsigned reg_offs) @@ -512,3 +512,6 @@ void can_filltimestamp(canmsg_tstamp_t *ptimestamp) #ifdef CAN_WITH_RTL extern int can_rtl_priority; #endif /*CAN_WITH_RTL*/ + +extern struct candevice_t* register_usbdev(const char *hwname,void *devdata,void (*chipdataregfnc)(struct canchip_t *chip,void *data)); +extern void cleanup_usbdev(struct candevice_t *dev);