RTEMS 7.0-rc1
Loading...
Searching...
No Matches
Macros | Functions | Variables
clockdrv.c File Reference

MC9328MXL clock specific using the System Timer. More...

#include <rtems.h>
#include <bsp.h>
#include <bsp/irq.h>
#include <mc9328mxl.h>
#include <rtems/bspIo.h>
#include "../../../shared/dev/clock/clockimpl.h"

Macros

#define Clock_driver_support_at_tick(arg)
 
#define Clock_driver_support_install_isr(_new)    BSP_install_rtems_irq_handler(&clock_isr_data)
 
#define Clock_driver_support_initialize_hardware()
 
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 

Functions

void Clock_isr (rtems_irq_hdl_param arg)
 

Variables

rtems_irq_connect_data clock_isr_data
 

Detailed Description

MC9328MXL clock specific using the System Timer.

Macro Definition Documentation

◆ Clock_driver_support_at_tick

#define Clock_driver_support_at_tick (   arg)
Value:
do { \
uint32_t reg; \
\
reg = MC9328MXL_TMR1_TSTAT; \
(void) reg; /* avoid set but not used warning */ \
MC9328MXL_TMR1_TSTAT = 0; \
} while(0)

When we get the clock interrupt

  • clear the interrupt bit?
  • restart the timer?

◆ Clock_driver_support_initialize_hardware

#define Clock_driver_support_initialize_hardware (   void)
Value:
do { \
int freq; \
int cnt; \
freq = get_perclk1_freq(); \
printk("perclk1 freq is %d\n", freq); \
cnt = ((long long)freq * rtems_configuration_get_microseconds_per_tick() + 500000) / 1000000;\
printk("cnt freq is %d\n", cnt); \
MC9328MXL_TMR1_TCMP = cnt; \
/* use PERCLK1 as input, enable timer */ \
MC9328MXL_TMR1_TCTL = (MC9328MXL_TMR_TCTL_CLKSRC_PCLK1 | \
MC9328MXL_TMR_TCTL_TEN | \
MC9328MXL_TMR_TCTL_IRQEN); \
/* set prescaler to 1 (register value + 1) */ \
MC9328MXL_TMR1_TPRER = 0; \
} while (0)
#define rtems_configuration_get_microseconds_per_tick()
Gets the number of microseconds per clock tick configured for this application.
Definition: config.h:527

Initialize the hardware for the clock

  • Set the frequency
  • enable it
  • clear any pending interrupts

Since you may want the clock always running, you can enable interrupts here. If you do so, the clock_isr_on(), clock_isr_off(), and clock_isr_is_on() functions can be NOPs.

◆ Clock_driver_support_install_isr

#define Clock_driver_support_install_isr (   _new)     BSP_install_rtems_irq_handler(&clock_isr_data)

Installs the clock ISR. You shouldn't need to change this.

Variable Documentation

◆ clock_isr_data

rtems_irq_connect_data clock_isr_data
Initial value:
= {
.name = BSP_INT_TIMER1,
.hdl = Clock_isr,
.handle = (void *)BSP_INT_TIMER1,
.on = clock_isr_on,
.off = clock_isr_off,
.isOn = clock_isr_is_on,
}