RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
can.h File Reference

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

#include <bsp.h>
#include <bsp/io.h>
#include <bsp/lpc176x.h>

Go to the source code of this file.

Data Structures

struct  registers_can_message
 A CAN message represented for the registers of the device. More...
 
struct  low_level_can_message
 A CAN message represented with each logical parts. More...
 
struct  can_message
 A CAN message represented of both forms. More...
 

Typedefs

typedef void(* lpc176x_can_isr) (lpc176x_can_number number)
 An isr for a CAN interrupt.
 
typedef unsigned int can_freq
 A CAN frequency value.
 

Enumerations

enum  lpc176x_can_number { CAN_0 , CAN_1 , CAN_DEVICES_NUMBER }
 The CAN devices of the board.
 
enum  can_irq_type {
  IRQ_RX = 0 , IRQ_TX , IRQ_ERROR , IRQ_OVERRUN ,
  IRQ_WAKEUP , IRQ_PASSIVE , IRQ_ARB , IRQ_BUS ,
  IRQ_READY , CAN_IRQ_NUMBER
}
 The possible interrupt sources for CAN.
 

Functions

rtems_status_code can_open (lpc176x_can_number minor, can_freq freq)
 Opens CAN device.
 
rtems_status_code can_close (lpc176x_can_number minor)
 Closes the passed CAN device and shut it down.
 
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.
 

Detailed Description

CAN controller for the mbed lpc1768 board.

Typedef Documentation

◆ lpc176x_can_isr

typedef void(* lpc176x_can_isr) (lpc176x_can_number number)

An isr for a CAN interrupt.

Parameters
numberThe CAN which rised the interrupt.

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.