Changeset 5c89efa in rtems


Ignore:
Timestamp:
May 31, 2006, 1:46:23 PM (14 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
491d882
Parents:
2ba4b72
Message:

2006-05-31 Joel Sherrill <joel@…>

  • at91rm9200/clock/clock.c: Convert to using shared clock driver shell.
Location:
c/src/lib/libcpu/arm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/arm/ChangeLog

    r2ba4b72 r5c89efa  
     12006-05-31      Joel Sherrill <joel@OARcorp.com>
     2
     3        * at91rm9200/clock/clock.c: Convert to using shared clock driver shell.
     4
    152006-05-16      Ralf Corsépius <ralf.corsepius@rtems.org>
    26
  • c/src/lib/libcpu/arm/at91rm9200/clock/clock.c

    r2ba4b72 r5c89efa  
    2525
    2626
    27 rtems_device_major_number rtems_clock_major = ~0;
    28 rtems_device_minor_number rtems_clock_minor;
    29 volatile uint32_t Clock_driver_ticks;
    3027static unsigned long st_pimr_reload;
    31 
    32 rtems_isr clock_isr(rtems_vector_number vector);
    33 void Clock_exit(void);
    34 static void clock_isr_on(const rtems_irq_connect_data *unused);
    35 static void clock_isr_off(const rtems_irq_connect_data *unused);
    36 static int clock_isr_is_on(const rtems_irq_connect_data *irq);
    37 
    38 /* Replace the first value with the clock's interrupt name. */
    39 rtems_irq_connect_data clock_isr_data = {AT91RM9200_INT_SYSIRQ,   
    40                                          (rtems_irq_hdl)clock_isr,
    41                                          clock_isr_on,
    42                                          clock_isr_off,
    43                                          clock_isr_is_on,
    44                                          3,     /* unused for ARM cpus */
    45                                          0 };   /* unused for ARM cpus */
    46 
    47 
    48 rtems_isr clock_isr(rtems_vector_number vector)
    49 {
    50     uint32_t st_str;
    51 
    52     Clock_driver_ticks++;
    53 
    54     /* read the status to clear the int */
    55     st_str = ST_REG(ST_SR);
    56 
    57     rtems_clock_tick();
    58 }
    59 
    60 void Install_clock(rtems_isr_entry clock_isr)
    61 {
    62     uint32_t st_str;
    63     int slck;
    64 
    65     Clock_driver_ticks = 0;
    66 
    67     BSP_install_rtems_irq_handler(&clock_isr_data);
    68 
    69     /* the system timer is driven from SLCK */
    70     slck = at91rm9200_get_slck();
    71     st_pimr_reload = (((BSP_Configuration.microseconds_per_tick * slck) + (1000000/2))/
    72                       1000000);
    73 
    74     /* read the status to clear the int */
    75     st_str = ST_REG(ST_SR);
    76    
    77     /* set priority */
    78     AIC_SMR_REG(AIC_SMR_SYSIRQ) = AIC_SMR_PRIOR(0x7);
    79 
    80     /* set the timer value */
    81     ST_REG(ST_PIMR) = st_pimr_reload;
    82 
    83     atexit( Clock_exit );
    84 }
    85 
    86 void Clock_exit( void )
    87 {
    88     BSP_remove_rtems_irq_handler(&clock_isr_data);
    89 }
    90 
    91 rtems_device_driver Clock_initialize(
    92     rtems_device_major_number major,
    93     rtems_device_minor_number minor,
    94     void *pargp
    95     )
    96 {
    97     Install_clock( clock_isr );
    98  
    99     rtems_clock_major = major;
    100     rtems_clock_minor = minor;
    101 
    102     return RTEMS_SUCCESSFUL;
    103 }
    104 
    105 rtems_device_driver Clock_control(
    106     rtems_device_major_number major,
    107     rtems_device_minor_number minor,
    108     void *pargp
    109 )
    110 {
    111     uint32_t  isrlevel;
    112     rtems_libio_ioctl_args_t *args = pargp;
    113    
    114     if (args == 0) {
    115         return RTEMS_SUCCESSFUL;
    116     }
    117  
    118     if (args->command == rtems_build_name('I', 'S', 'R', ' ')) {
    119         clock_isr(0);
    120     } else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) {
    121         rtems_interrupt_disable(isrlevel);
    122 
    123         BSP_install_rtems_irq_handler(args->buffer);
    124 
    125         rtems_interrupt_enable(isrlevel);
    126     }
    127  
    128     return RTEMS_SUCCESSFUL;
    129 }
    13028
    13129/**
     
    16361    return ST_REG(ST_IMR) & ST_SR_PITS;
    16462}
     63
     64rtems_isr Clock_isr(rtems_vector_number vector);
     65
     66/* Replace the first value with the clock's interrupt name. */
     67rtems_irq_connect_data clock_isr_data = {AT91RM9200_INT_SYSIRQ,   
     68                                         (rtems_irq_hdl)Clock_isr,
     69                                         clock_isr_on,
     70                                         clock_isr_off,
     71                                         clock_isr_is_on,
     72                                         3,     /* unused for ARM cpus */
     73                                         0 };   /* unused for ARM cpus */
     74
     75
     76#define Clock_driver_support_install_isr( _new, _old ) \
     77  BSP_install_rtems_irq_handler(&clock_isr_data)
     78
     79void Clock_driver_support_initialize_hardware(void)
     80{
     81  uint32_t st_str;
     82  int slck;
     83
     84  /* the system timer is driven from SLCK */
     85  slck = at91rm9200_get_slck();
     86  st_pimr_reload =
     87    (((BSP_Configuration.microseconds_per_tick * slck) + (1000000/2))/ 1000000);
     88
     89  /* read the status to clear the int */
     90  st_str = ST_REG(ST_SR);
     91   
     92  /* set priority */
     93  AIC_SMR_REG(AIC_SMR_SYSIRQ) = AIC_SMR_PRIOR(0x7);
     94
     95  /* set the timer value */
     96  ST_REG(ST_PIMR) = st_pimr_reload;
     97}
     98
     99
     100#define CLOCK_VECTOR 0
     101
     102#define Clock_driver_support_at_tick() \
     103  do { \
     104    uint32_t st_str; \
     105    \
     106    /* read the status to clear the int */ \
     107    st_str = ST_REG(ST_SR); \
     108  } while (0)
     109
     110void Clock_driver_support_shutdown_hardware( void )
     111{
     112    BSP_remove_rtems_irq_handler(&clock_isr_data);
     113}
     114
     115#include "../../../../libbsp/shared/clockdrv_shell.c"
Note: See TracChangeset for help on using the changeset viewer.