Changeset bbbb8f0 in rtems


Ignore:
Timestamp:
Aug 20, 2008, 5:27:43 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.9, master
Children:
dab9e55c
Parents:
9a85541
Message:

2008-08-20 Sebastian Huber <sebastian.huber@…>

  • include/tm27.h: Uses now a decrementer exception handler. Replaces previous file.
  • startup/bspstart.c: Install a default decrementer exception handler.
Location:
c/src/lib/libbsp/powerpc/gen83xx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/gen83xx/ChangeLog

    r9a85541 rbbbb8f0  
     12008-08-20      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * include/tm27.h: Uses now a decrementer exception handler.  Replaces
     4        previous file.
     5        * startup/bspstart.c: Install a default decrementer exception handler.
     6
    172008-08-19      Sebastian Huber <sebastian.huber@embedded-brains.de>
    28
  • c/src/lib/libbsp/powerpc/gen83xx/include/tm27.h

    r9a85541 rbbbb8f0  
     1/**
     2 * @file
     3 *
     4 * @brief Support file for Timer Test 27.
     5 */
     6
    17/*
    2  *  tm27.h
     8 * Copyright (c) 2008
     9 * Embedded Brains GmbH
     10 * Obere Lagerstr. 30
     11 * D-82178 Puchheim
     12 * Germany
     13 * rtems@embedded-brains.de
    314 *
    4  *  The license and distribution terms for this file may be
    5  *  found in the file LICENSE in this distribution or at
    6  *  http://www.rtems.com/license/LICENSE.
    7  *
    8  *  tm27.h,v 1.2 2004/04/23 04:47:38 ralf Exp
     15 * The license and distribution terms for this file may be found in the file
     16 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
    917 */
    1018
    1119#ifndef _RTEMS_TMTEST27
    12 #error "This is an RTEMS internal file you must not include directly."
    13 #endif
     20  #error "This is an RTEMS internal file you must not include directly."
     21#endif /* _RTEMS_TMTEST27 */
    1422
    15 #ifndef __tm27_h
    16 #define __tm27_h
     23#ifndef TMTESTS_TM27_H
     24#define TMTESTS_TM27_H
    1725
    18 #include <bsp/irq.h>
     26#include <libcpu/powerpc-utility.h>
     27#include <libcpu/raw_exception.h>
    1928
    20 /*
    21  *  Stuff for Time Test 27
    22  */
     29#include <bsp/ppc_exc_bspsupp.h>
    2330
    2431#define MUST_WAIT_FOR_INTERRUPT 1
    2532
    26 void nullFunc() {}
     33static rtems_isr_entry tm27_interrupt_handler = NULL;
    2734
    28 static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
    29                                               0,
    30                                               (rtems_irq_enable)nullFunc,
    31                                               (rtems_irq_disable)nullFunc,
    32                                               (rtems_irq_is_enabled) nullFunc};
    33 void Install_tm27_vector(void (*_handler)())
     35static int tm27_exception_handler( BSP_Exception_frame *frame, unsigned number)
    3436{
    35   clockIrqData.hdl = _handler;
    36   if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
    37         printk("Error installing clock interrupt handler!\n");
    38         rtems_fatal_error_occurred(1);
     37        tm27_interrupt_handler( 0);
     38
     39        return 0;
     40}
     41
     42void Install_tm27_vector( rtems_isr_entry handler)
     43{
     44  int rv = 0;
     45
     46  tm27_interrupt_handler = handler;
     47
     48  rv = ppc_exc_set_handler( ASM_DEC_VECTOR, tm27_exception_handler);
     49  if (rv < 0) {
     50    printk( "Error installing clock interrupt handler!\n");
    3951  }
    4052}
    4153
    42 #define Cause_tm27_intr()  \
    43   do { \
    44     uint32_t   _clicks = 8; \
    45     asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
    46   } while (0)
     54#define Cause_tm27_intr() \
     55  ppc_set_decrementer_register( 8)
    4756
    4857#define Clear_tm27_intr() \
    49   do { \
    50     uint32_t   _clicks = 0xffffffff; \
    51     asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
    52   } while (0)
     58  ppc_set_decrementer_register( UINT32_MAX)
    5359
    5460#define Lower_tm27_intr() \
    55   do { \
    56     uint32_t   _msr = 0; \
    57     _ISR_Set_level( 0 ); \
    58     asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
    59     _msr |=  0x8002; \
    60     asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
    61   } while (0)
     61  (void) ppc_external_exceptions_enable()
    6262
    63 #endif
     63#endif /* TMTESTS_TM27_H */
  • c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c

    r9a85541 rbbbb8f0  
    2828
    2929#include <libcpu/powerpc-utility.h>
     30#include <libcpu/raw_exception.h>
    3031
    3132#include <bsp.h>
     
    5354uint32_t bsp_clicks_per_usec;
    5455
    55 /*
    56  *  Use the shared implementations of the following routines.
    57  *  Look in rtems/c/src/lib/libbsp/shared/bsplibc.c.
    58  */
    59 extern void cpu_init( void);
     56/* Default decrementer exception handler */
     57static int mpc83xx_decrementer_exception_handler( BSP_Exception_frame *frame, unsigned number)
     58{
     59        ppc_set_decrementer_register( UINT32_MAX);
     60
     61        return 0;
     62}
    6063
    6164void BSP_panic( char *s)
     
    106109void bsp_start( void)
    107110{
     111        rtems_status_code sc = RTEMS_SUCCESSFUL;
     112        int rv = 0;
     113
    108114        ppc_cpu_id_t myCpu;
    109115        ppc_cpu_revision_t myCpuRevision;
     
    156162        );
    157163
     164        /* Install default handler for the decrementer exception */
     165        rv = ppc_exc_set_handler( ASM_DEC_VECTOR, mpc83xx_decrementer_exception_handler);
     166        if (rv < 0) {
     167                BSP_panic( "Cannot install decrementer exception handler!\n");
     168        }
     169
    158170        /* Initalize interrupt support */
    159         if (bsp_interrupt_initialize() != RTEMS_SUCCESSFUL) {
    160                 BSP_panic("Cannot intitialize interrupt support\n");
     171        sc = bsp_interrupt_initialize();
     172        if (sc != RTEMS_SUCCESSFUL) {
     173                BSP_panic( "Cannot intitialize interrupt support\n");
    161174        }
    162175
Note: See TracChangeset for help on using the changeset viewer.