RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Functions | Variables
can.c File Reference

CAN controller for the mbed lpc1768 board. More...

#include <rtems/status-checks.h>
#include <bsp/irq.h>
#include <bsp/can.h>
#include <bsp/can-defs.h>
#include <bsp/mbed-pinmap.h>
#include <string.h>

Functions

rtems_status_code can_close (const lpc176x_can_number minor)
 Closes the passed CAN device and shut it down.
 
rtems_status_code can_open (const lpc176x_can_number minor, can_freq freq)
 Opens CAN device.
 
rtems_status_code can_read (const lpc176x_can_number minor, can_message *message)
 Reads the CAN device.
 
rtems_status_code can_write (const lpc176x_can_number minor, const can_message *const message)
 Writes the passed CAN message into the selected CAN device.
 
rtems_status_code can_register_isr (const lpc176x_can_number number, const can_irq_type type, const lpc176x_can_isr isr)
 Registers an isr in the driver vector, and enables the interrupt in the device.
 
rtems_status_code create_can_message (can_message *const msg, const int _id, const char *const _data, const char _len)
 Creates a CAN message.
 

Variables

lpc176x_can_isr_vector isr_vector
 Vector of isr for the can_driver .
 
can_acceptance_filter *const acceptance_filter_device
 The CAN acceptance filter.
 

Detailed Description

CAN controller for the mbed lpc1768 board.

Function Documentation

◆ can_close()

rtems_status_code can_close ( lpc176x_can_number  minor)

Closes the passed CAN device and shut it down.

Parameters
minorThe device to close.
Returns
RTEMS_SUCCESSFUL if ok, RTEMS_INVALID_NUMBER for a bad parameter.

◆ can_open()

rtems_status_code can_open ( lpc176x_can_number  minor,
can_freq  freq 
)

Opens CAN device.

It enables the module and gives it a clock, sets the pins, disables the interrupts, sets the frequency and bypasses the acceptance filter.

Parameters
minorThe device to open.
freqThe desired frequency.
Returns
RTEMS_SUCCESFUL on success.

◆ can_read()

rtems_status_code can_read ( const lpc176x_can_number  minor,
can_message message 
)

Reads the CAN device.

Parameters
minorThe CAN device to read.
messageThe read message.
Returns
RTEMS_SUCCESSFUL if read ok, RTEMS_IO_ERROR otherwise.

◆ can_register_isr()

rtems_status_code can_register_isr ( const lpc176x_can_number  number,
const can_irq_type  type,
const lpc176x_can_isr  isr 
)

Registers an isr in the driver vector, and enables the interrupt in the device.

Parameters
numberThe CAN device to set
typeThe interrupt type.
isrThe isr to register.
Returns
RTEMS_SUCCESSFUL if ok RTEMS_INVALID_NUMBER otherwise.

◆ can_write()

rtems_status_code can_write ( const lpc176x_can_number  minor,
const can_message *const  message 
)

Writes the passed CAN message into the selected CAN device.

Parameters
minorThe device to write.
messageThe message to write.
Returns
RTEMS_SUCCESFUL if write ok. RTEMS_IO_ERROR otherwise.

◆ create_can_message()

rtems_status_code create_can_message ( can_message *const  msg,
const int  _id,
const char *const  _data,
const char  _len 
)

Creates a CAN message.

[long description]

Parameters
msgThe created message.
_idThe can id for the message.
_dataThe data of the message.
_lenThe length of the message.
Returns
RTEMS_SUCCESFUL if created, RTEMS_INVALID_NUMBER otherwise.

Variable Documentation

◆ acceptance_filter_device

can_acceptance_filter* const acceptance_filter_device
Initial value:
=
(can_acceptance_filter *) CAN_ACCEPT_BASE_ADDR
Represents the acceptance filter registers.
Definition: can-defs.h:127

The CAN acceptance filter.