CAN Device Driver Internals
Pavel Pisa
pisa@cmp.felk.cvut.cz
Copyright
© 2002 by Pavel Pisa
Table of Contents
Introduction
LinCAN Driver API
Driver API Overview
CAN Driver File Operations
open
— message communication object open system call
close
— message communication object close system call
read
— reads received CAN messages from message object
write
— writes CAN messages to message object for transmission
Driver Internal Documentation
Basic Driver Data Structures
struct canhardware_t
— structure representing pointers to all CAN boards
struct candevice_t
— CAN device/board structure
struct chip_t
— CAN chip state and type information
struct msgobj_t
— structure holding communication object state
struct canuser_t
— structure holding CAN user/client state
struct hwspecops_t
— hardware/board specific operations
struct chipspecops_t
— can controller chip specific operations
Board Support Functions
template_request_io
— reserve io or memory range for can board
template_release_io
— free reserved io memory range
template_reset
— hardware reset routine
template_init_hw_data
— Initialize hardware cards
template_init_chip_data
— Initialize chips
template_init_obj_data
— Initialize message buffers
template_program_irq
— program interrupts
template_write_register
— Low level write register routine
template_read_register
— Low level read register routine
Chip Support Functions
sja1000p_enable_configuration
— enable chip configuration mode
sja1000p_disable_configuration
— disable chip configuration mode
sja1000p_chip_config
— can chip configuration
sja1000p_extended_mask
— setup of extended mask for message filtering
sja1000p_baud_rate
— set communication parameters.
sja1000p_read
— reads and distributes one or more received messages
sja1000p_pre_read_config
— prepares message object for message reception
sja1000p_pre_write_config
— prepares message object for message transmission
sja1000p_send_msg
— initiate message transmission
sja1000p_check_tx_stat
— checks state of transmission engine
sja1000p_set_btregs
— configures bitrate registers
sja1000p_start_chip
— starts chip message processing
sja1000p_stop_chip
— stops chip message processing
sja1000p_remote_request
— configures message object and asks for RTR message
sja1000p_standard_mask
— setup of mask for message filtering
sja1000p_clear_objects
— clears state of all message object residing in chip
sja1000p_config_irqs
— tunes chip hardware interrupt delivery
sja1000p_irq_write_handler
— part of ISR code responsible for transmit events
sja1000p_irq_handler
— interrupt service routine
sja1000p_wakeup_tx
— wakeups TX processing
CAN Queues Structures and Functions
struct canque_slot_t
— one CAN message slot in the CAN FIFO queue
struct canque_fifo_t
— CAN FIFO queue representation
canque_fifo_get_inslot
— allocate slot for the input of one CAN message
canque_fifo_put_inslot
— releases slot to further processing
canque_fifo_abort_inslot
— release and abort slot
canque_fifo_test_outslot
— test and get ready slot from the FIFO
canque_fifo_free_outslot
— free processed FIFO slot
canque_fifo_again_outslot
— interrupt and postpone processing of the slot
struct canque_edge_t
— CAN message delivery subsystem graph edge
struct canque_ends_t
— CAN message delivery subsystem graph vertex (FIFO ends)
canque_notify_inends
— request to send notification to the input ends
canque_notify_outends
— request to send notification to the output ends
canque_notify_bothends
— request to send notification to the both ends
canque_activate_edge
— mark output end of the edge as active
canque_filtid2internal
— converts message ID and filter flags into internal format
canque_fifo_flush_slots
— free all ready slots from the FIFO
canque_fifo_init_slots
— initialize one CAN FIFO
canque_fifo_done
— frees slots allocated for CAN FIFO
canque_get_inslot
— finds one outgoing edge and allocates slot from it
canque_get_inslot4id
— finds best outgoing edge and slot for given ID
canque_put_inslot
— schedules filled slot for processing
canque_abort_inslot
— aborts preparation of the message in the slot
canque_filter_msg2edges
— sends message into all edges which accept its ID
canque_test_outslot
— test and retrieve ready slot for given ends
canque_free_outslot
— frees processed output slot
canque_again_outslot
— reschedule output slot to process it again later
canque_set_filt
— sets filter for specified edge
canque_flush
— fluesh all ready slots in the edge
canqueue_ends_init_gen
— subsystem independent routine to initialize ends state
canqueue_notify_kern
— notification callback handler for Linux userspace clients
canqueue_ends_init_kern
— Linux userspace clients specific ends initialization
canque_get_inslot4id_wait_kern
— find or wait for best outgoing edge and slot for given ID
canque_get_outslot_wait_kern
— receive or wait for ready slot for given ends
canque_sync_wait_kern
— wait for all slots processing
canque_new_edge_kern
— allocate new edge structure in the Linux kernel context
canqueue_connect_edge
— connect edge between two communication entities
canqueue_disconnect_edge
— disconnect edge from communicating entities
canqueue_disconnect_edge_kern
— disconnect edge from communicating entities with wait
canqueue_ends_done_kern
— finalizing of the ends structure for Linux kernel clients
Next >>>
Introduction