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

| RTEMS 5.4-rc2

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

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

`#include <stdio.h>`
`#include <rtems/status-checks.h>`
`#include <bsp.h>`
`#include <bsp/irq.h>`
`#include <bsp/io.h>`
`#include <bsp/timer.h>`

## Functions
rtems_status_code | lpc176x_timer_reset (const lpc176x_timer_number tnumber)
| resets timer counter and stops it.
rtems_status_code | lpc176x_timer_set_mode (const lpc176x_timer_number tnumber, const lpc176x_timer_mode mode)
| Sets mode of the timer (timer, counter rising, counter falling or counter both edges)
rtems_status_code | lpc176x_timer_start (const lpc176x_timer_number tnumber)
| Starts the timer counter.
rtems_status_code | lpc176x_timer_is_started (const lpc176x_timer_number tnumber, bool *is_started)
| true if timer is started.
rtems_status_code | lpc176x_timer_set_resolution (const lpc176x_timer_number tnumber, const lpc176x_microseconds resolution)
| sets the resolution in microseconds of the timer
rtems_status_code | lpc176x_timer_match_config (const lpc176x_timer_number tnumber, const lpc176x_match_port match_port, const lpc176x_match_function function, const uint32_t match_value)
| Configures the timer match.
rtems_status_code | lpc176x_timer_capture_config (const lpc176x_timer_number tnumber, const lpc176x_capture_port capture_port, const lpc176x_capture_function function)
| Configures the capture ports.
rtems_status_code | lpc176x_timer_external_match_config (const lpc176x_timer_number number, const lpc176x_match_port match_port, const lpc176x_ext_match_function function)
| Configures the external match ports.
uint32_t | lpc176x_timer_get_capvalue (const lpc176x_timer_number number, const lpc176x_capture_port capture_port)
| Gets the captured value.
uint32_t | lpc176x_timer_get_timer_value (const lpc176x_timer_number tnumber)
| Gets the timer value.
rtems_status_code | lpc176x_timer_set_timer_value (const lpc176x_timer_number tnumber, const uint32_t timer_value)
| Sets the timer value.
void | lpc176x_timer_isr (void *arg)
| Timer generic isroutine.
rtems_status_code | lpc176x_timer_init (const lpc176x_timer_number tnumber)
| Initializes timer in timer mode and resets counter but without starting it, and without any capture or match function.
rtems_status_code | lpc176x_timer_init_with_interrupt (const lpc176x_timer_number tnumber, const lpc176x_isr_funct_vector *const vector)
| Initializes timer in timer mode and resets counter but without starting it, and without any capture or match function.

## Variables
const lpc176x_timer | timers [LPC176X_TIMER_COUNT]
| Represents all the timers.
lpc176x_timer_functions | functions_vector [LPC176X_TIMER_COUNT]
| Represents all the functions according to the timers.

## Detailed Description

Timer controller for the mbed lpc1768 board.

## Function Documentation

## ◆ lpc176x_timer_capture_config()

rtems_status_code lpc176x_timer_capture_config | ( | lpc176x_timer_number | tnumber,
|  | lpc176x_capture_port | capture_port,
|  | lpc176x_capture_function | function
| ) |  |
| inline

Configures the capture ports.

Parameters

  tnumber | the device to be modified
  capture_port | which port of this timer will be setted
  function | At which edge/s will the capture work, and if it will interrupt

## ◆ lpc176x_timer_external_match_config()

rtems_status_code lpc176x_timer_external_match_config | ( | lpc176x_timer_number | tnumber,
|  | lpc176x_match_port | match_port,
|  | lpc176x_ext_match_function | function
| ) |  |
| inline

Configures the external match ports.

Parameters

  tnumber | the device to be modified
  match_port | which match for this timer
  function | what should do when match: set, clear toggle or nothing

## ◆ lpc176x_timer_get_capvalue()

uint32_t lpc176x_timer_get_capvalue | ( | lpc176x_timer_number | tnumber,
|  | lpc176x_capture_port | capnumber
| ) |  |
| inline

Gets the captured value.

Parameters

  tnumber | the device to be modified
  capnumber | which capture port for this timer

Returns
  the captured value

## ◆ lpc176x_timer_get_timer_value()

uint32_t lpc176x_timer_get_timer_value | ( | lpc176x_timer_number | tnumber | ) |
| inline

Gets the timer value.

Parameters

  tnumber | the device

Returns
  the timer value

## ◆ lpc176x_timer_init()

rtems_status_code lpc176x_timer_init | ( | lpc176x_timer_number | tnumber | ) |

Initializes timer in timer mode and resets counter but without starting it, and without any capture or match function.

Parameters

  tnumber | which timer

Returns
  RTEMS_SUCCESSFUL when everything ok.

## ◆ lpc176x_timer_init_with_interrupt()

rtems_status_code lpc176x_timer_init_with_interrupt | ( | lpc176x_timer_number | tnumber,
|  | const lpc176x_isr_funct_vector * | vector
| ) |  |

Initializes timer in timer mode and resets counter but without starting it, and without any capture or match function.

Parameters

  tnumber | which timer to init
  vector | the functions to be used by the isr.

Returns
  RTEMS_SUCCESSFUL when everything ok.

## ◆ lpc176x_timer_is_started()

rtems_status_code lpc176x_timer_is_started | ( | lpc176x_timer_number | tnumber,
|  | bool * | is_started
| ) |  |
| inline

true if timer is started.

Parameters

  tnumber | the timer number to check.
  is_started | TRUE if the timer is running.

Returns
  RTEMS_SUCCESSFUL if the started timer check was successfuly.

## ◆ lpc176x_timer_isr()

void lpc176x_timer_isr | ( | void * | lpc176x_timer_number | ) |

Timer generic isroutine.

Parameters

  timernumber | the number of timer.

## ◆ lpc176x_timer_match_config()

rtems_status_code lpc176x_timer_match_config | ( | lpc176x_timer_number | tnumber,
|  | lpc176x_match_port | match_port,
|  | lpc176x_match_function | function,
|  | uint32_t | match_value
| ) |  |

Configures the timer match.

Parameters

  tnumber | the device to be modified
  match_port | which port of this timer will be setted
  function | what the timer should do when match: stop timer, clear, and/or interrupt
  match_value | the value that the timer should match.

Returns
  RTEMS_SUCCESSFUL if the timer was configured successfuly.

## ◆ lpc176x_timer_reset()

rtems_status_code lpc176x_timer_reset | ( | lpc176x_timer_number | tnumber | ) |
| inline

resets timer counter and stops it.

Parameters

  tnumber | the device to be reseted

Returns
  RTEMS_SUCCESSFUL if the timer was reseted successfuly.

## ◆ lpc176x_timer_set_mode()

rtems_status_code lpc176x_timer_set_mode | ( | lpc176x_timer_number | tnumber,
|  | lpc176x_timer_mode | mode
| ) |  |
| inline

Sets mode of the timer (timer, counter rising, counter falling or counter both edges)

Parameters

  tnumber | the device to be setted
  mode | the desired mode

Returns
  RTEMS_SUCCESSFUL if the timer's mode was setted successfuly.

## ◆ lpc176x_timer_set_resolution()

rtems_status_code lpc176x_timer_set_resolution | ( | lpc176x_timer_number | tnumber,
|  | lpc176x_microseconds | resolution
| ) |  |
| inline

sets the resolution in microseconds of the timer

Parameters

  tnumber | the device to be modified.
  resolution | how many microseconds will mean each timer counter unit.

Returns
  RTEMS_SUCCESSFUL if the timer resolution was setted successfuly.

## ◆ lpc176x_timer_set_timer_value()

rtems_status_code lpc176x_timer_set_timer_value | ( | lpc176x_timer_number | tnumber,
|  | uint32_t | lpc176x_timer_value
| ) |  |
| inline

Sets the timer value.

Parameters

  tnumber | the timer to modify.
  timer_value | the value to set.

## ◆ lpc176x_timer_start()

rtems_status_code lpc176x_timer_start | ( | lpc176x_timer_number | tnumber | ) |
| inline

Starts the timer counter.

Parameters

  tnumber | the device to be started

Returns
  RTEMS_SUCCESSFUL if the timer's was started successfuly.

## Variable Documentation

## ◆ functions_vector

lpc176x_timer_functions functions_vector[LPC176X_TIMER_COUNT]

Initial value:
=
{
{
.funct_vector = NULL
},
{
.funct_vector = NULL
},
{
.funct_vector = NULL
},
{
.funct_vector = NULL
}
}
NULL
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77

Represents all the functions according to the timers.

## ◆ timers

const lpc176x_timer timers[LPC176X_TIMER_COUNT]

Initial value:
=
{
{
.device = (lpc176x_timer_device *) LPC176X_TMR0_BASE_ADDR,
.module = LPC176X_MODULE_TIMER_0,
.pinselcap = LPC176X_TIMER0_CAPTURE_PORTS,
.pinselemat = LPC176X_TIMER0_EMATCH_PORTS,
},
{
.device = (lpc176x_timer_device *) LPC176X_TMR1_BASE_ADDR,
.module = LPC176X_MODULE_TIMER_1,
.pinselcap = LPC176X_TIMER1_CAPTURE_PORTS,
.pinselemat = LPC176X_TIMER1_EMATCH_PORTS,
},
{
.device = (lpc176x_timer_device *) LPC176X_TMR2_BASE_ADDR,
.module = LPC176X_MODULE_TIMER_2,
.pinselcap = LPC176X_TIMER2_CAPTURE_PORTS,
.pinselemat = LPC176X_TIMER2_EMATCH_PORTS,
},
{
.device = (lpc176x_timer_device *) LPC176X_TMR3_BASE_ADDR,
.module = LPC176X_MODULE_TIMER_3,
.pinselcap = LPC176X_TIMER3_CAPTURE_PORTS,
.pinselemat = LPC176X_TIMER3_EMATCH_PORTS,
}
}
lpc176x_timer_device
Represents the timer device registers.
Definition: timer-defs.h:186

Represents all the timers.