RTEMS: bsps/arm/lpc176x/can/can.c File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Functions | Variables
can.c File Reference
Board Support Packages » ARM » NXP LPC176X

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

  minor | The 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

  minor | The device to open.
  freq | The 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

  minor | The CAN device to read.
  message | The 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

  number | The CAN device to set
  type | The interrupt type.
  isr | The 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

  minor | The device to write.
  message | The 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

  msg | The created message.
  _id | The can id for the message.
  _data | The data of the message.
  _len | The 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
can_acceptance_filter
Represents the acceptance filter registers.
Definition: can-defs.h:127

The CAN acceptance filter.