Changeset 8430205 in rtems for c/src/lib/libcpu/powerpc


Ignore:
Timestamp:
Apr 12, 2004, 10:04:28 PM (16 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
e69307b7
Parents:
db87589
Message:

2004-04-12 David Querbach <querbach@…>

  • README, configure.ac, mpc5xx/Makefile.am, mpc5xx/exceptions/raw_exception.c, mpc5xx/exceptions/raw_exception.h, mpc5xx/timer/timer.c, shared/include/cpuIdent.h: addition of a significant amount of MPC5xx support as part of the addition of the SS555 BSP.
  • mpc5xx/README, mpc5xx/clock/clock.c, mpc5xx/console-generic/console-generic.c, mpc5xx/include/console.h, mpc5xx/include/mpc5xx.h, mpc5xx/irq/irq.c, mpc5xx/irq/irq.h, mpc5xx/irq/irq_asm.S, mpc5xx/irq/irq_init.c, mpc5xx/vectors/vectors.S, mpc5xx/vectors/vectors.h, mpc5xx/vectors/vectors_init.c: New files.
  • mpc5xx/exceptions/asm_utils.S: Removed.
Location:
c/src/lib/libcpu/powerpc
Files:
12 added
1 deleted
8 edited

Legend:

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

    rdb87589 r8430205  
     12004-04-12      David Querbach <querbach@realtime.bc.ca>
     2
     3        * README, configure.ac, mpc5xx/Makefile.am,
     4        mpc5xx/exceptions/raw_exception.c, mpc5xx/exceptions/raw_exception.h,
     5        mpc5xx/timer/timer.c, shared/include/cpuIdent.h: addition of a
     6        significant amount of MPC5xx support as part of the addition of the
     7        SS555 BSP.
     8        * mpc5xx/README, mpc5xx/clock/clock.c,
     9        mpc5xx/console-generic/console-generic.c, mpc5xx/include/console.h,
     10        mpc5xx/include/mpc5xx.h, mpc5xx/irq/irq.c, mpc5xx/irq/irq.h,
     11        mpc5xx/irq/irq_asm.S, mpc5xx/irq/irq_init.c,
     12        mpc5xx/vectors/vectors.S, mpc5xx/vectors/vectors.h,
     13        mpc5xx/vectors/vectors_init.c: New files.
     14        * mpc5xx/exceptions/asm_utils.S: Removed.
     15
    1162004-04-02      Ralf Corsepius <ralf_corsepius@rtems.org>
    217
  • c/src/lib/libcpu/powerpc/README

    rdb87589 r8430205  
    1414
    1515  + mpc505
    16   + mpc5xx (mpc565)
     16  + mpc5xx (5xx devices other than 505/509)
    1717  + mpc6xx
    1818  + mpc750
  • c/src/lib/libcpu/powerpc/configure.ac

    rdb87589 r8430205  
    2323
    2424AM_CONDITIONAL(shared, \
    25 test "$RTEMS_CPU_MODEL" = "mpc5xx" \
    26 || test "$RTEMS_CPU_MODEL" = "mpc750" \
     25   test "$RTEMS_CPU_MODEL" = "mpc750" \
    2726|| test "$RTEMS_CPU_MODEL" = "mpc7400" \
     27|| test "$RTEMS_CPU_MODEL" = "mpc555" \
     28|| test "$RTEMS_CPU_MODEL" = "mpc5xx" \
    2829|| test "$RTEMS_CPU_MODEL" = "ppc603e" \
    2930|| test "$RTEMS_CPU_MODEL" = "mpc604" \
     
    3637## test on CPU type
    3738AM_CONDITIONAL(mpc505, test "$RTEMS_CPU_MODEL" = "mpc505")
    38 AM_CONDITIONAL(mpc5xx, test "$RTEMS_CPU_MODEL" = "mpc5xx")
     39AM_CONDITIONAL(mpc5xx, test "$RTEMS_CPU_MODEL" = "mpc5xx" \
     40|| test "$RTEMS_CPU_MODEL" = "mpc555" )
    3941AM_CONDITIONAL(mpc6xx, test "$RTEMS_CPU_MODEL" = "mpc6xx" \
    4042|| test "$RTEMS_CPU_MODEL" = "mpc604" \
  • c/src/lib/libcpu/powerpc/mpc5xx/Makefile.am

    rdb87589 r8430205  
    1111
    1212if mpc5xx
     13include_mpc5xxdir = $(includedir)/mpc5xx
    1314include_libcpudir = $(includedir)/libcpu
    1415
    15 # exceptions
     16include_HEADERS = include/mpc5xx.h
     17
     18## clock
     19EXTRA_PROGRAMS += clock.rel
     20CLEANFILES += clock.rel
     21clock_rel_SOURCES = clock/clock.c
     22clock_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
     23clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     24
     25EXTRA_PROGRAMS += clock_g.rel
     26CLEANFILES += clock_g.rel
     27clock_g_rel_SOURCES = $(clock_rel_SOURCES)
     28clock_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
     29clock_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     30
     31noinst_DATA += clock$(LIB_VARIANT).rel
     32
     33## console-generic
     34include_mpc5xx_HEADERS = include/console.h
     35
     36EXTRA_PROGRAMS += console-generic.rel
     37CLEANFILES += console-generic.rel
     38console_generic_rel_SOURCES = console-generic/console-generic.c
     39console_generic_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
     40console_generic_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     41
     42EXTRA_PROGRAMS += console-generic_g.rel
     43CLEANFILES += console-generic_g.rel
     44console_generic_g_rel_SOURCES = $(console_generic_rel_SOURCES)
     45console_generic_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
     46console_generic_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     47
     48noinst_DATA += console-generic$(LIB_VARIANT).rel
     49
     50## exceptions
    1651include_libcpu_HEADERS = exceptions/raw_exception.h
    1752
    1853EXTRA_PROGRAMS += exceptions.rel
    1954CLEANFILES += exceptions.rel
    20 exceptions_rel_SOURCES = exceptions/raw_exception.c exceptions/asm_utils.S
     55exceptions_rel_SOURCES = exceptions/raw_exception.c
    2156exceptions_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
    2257exceptions_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     
    3065noinst_DATA += exceptions$(LIB_VARIANT).rel
    3166
    32 # ictrl
    33 include_HEADERS = ictrl/ictrl.h
     67## irq
     68include_libcpu_HEADERS += irq/irq.h
    3469
    35 EXTRA_PROGRAMS += ictrl.rel
    36 CLEANFILES += ictrl.rel
    37 ictrl_rel_SOURCES = ictrl/ictrl.c ictrl/ictrl.h
    38 ictrl_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
    39 ictrl_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     70EXTRA_PROGRAMS += irq.rel
     71CLEANFILES += irq.rel
     72irq_rel_SOURCES = irq/irq.c irq/irq_init.c irq/irq_asm.S
     73irq_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
     74irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
    4075
    41 EXTRA_PROGRAMS += ictrl_g.rel
    42 CLEANFILES += ictrl_g.rel
    43 ictrl_g_rel_SOURCES = $(ictrl_rel_SOURCES)
    44 ictrl_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
    45 ictrl_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     76EXTRA_PROGRAMS += irq_g.rel
     77CLEANFILES += irq_g.rel
     78irq_g_rel_SOURCES = $(irq_rel_SOURCES)
     79irq_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
     80irq_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
    4681
    47 noinst_DATA += ictrl$(LIB_VARIANT).rel
     82noinst_DATA += irq$(LIB_VARIANT).rel
    4883
    49 # timer
     84## timer
    5085EXTRA_PROGRAMS += timer.rel
    5186CLEANFILES += timer.rel
     
    6196
    6297noinst_DATA += timer$(LIB_VARIANT).rel
     98
     99## vectors
     100include_libcpu_HEADERS += vectors/vectors.h
     101
     102EXTRA_PROGRAMS += vectors.rel
     103CLEANFILES += vectors.rel
     104vectors_rel_SOURCES = vectors/vectors_init.c vectors/vectors.S
     105vectors_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
     106vectors_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     107
     108EXTRA_PROGRAMS += vectors_g.rel
     109CLEANFILES += vectors_g.rel
     110vectors_g_rel_SOURCES = $(vectors_rel_SOURCES)
     111vectors_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
     112vectors_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
     113
     114noinst_DATA += vectors$(LIB_VARIANT).rel
    63115endif
     116
     117## --
     118all-local: $(PREINSTALL_FILES)
    64119
    65120PREINSTALL_DIRS =
     
    72127
    73128if mpc5xx
     129$(PROJECT_INCLUDE)/mpc5xx/$(dirstamp):
     130        @$(mkdir_p) $(PROJECT_INCLUDE)/mpc5xx
     131        @: > $(PROJECT_INCLUDE)/mpc5xx/$(dirstamp)
     132PREINSTALL_DIRS += $(PROJECT_INCLUDE)/mpc5xx/$(dirstamp)
     133
    74134$(PROJECT_INCLUDE)/libcpu/$(dirstamp):
    75135        @$(mkdir_p) $(PROJECT_INCLUDE)/libcpu
     
    77137PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
    78138
     139$(PROJECT_INCLUDE)/mpc5xx.h: include/mpc5xx.h $(PROJECT_INCLUDE)/$(dirstamp)
     140        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc5xx.h
     141PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc5xx.h
     142
     143$(PROJECT_INCLUDE)/mpc5xx/console.h: include/console.h $(PROJECT_INCLUDE)/mpc5xx/$(dirstamp)
     144        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc5xx/console.h
     145PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc5xx/console.h
     146
    79147$(PROJECT_INCLUDE)/libcpu/raw_exception.h: exceptions/raw_exception.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
    80148        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/raw_exception.h
    81149PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/raw_exception.h
    82150
    83 $(PROJECT_INCLUDE)/ictrl.h: ictrl/ictrl.h $(PROJECT_INCLUDE)/$(dirstamp)
    84         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/ictrl.h
    85 PREINSTALL_FILES += $(PROJECT_INCLUDE)/ictrl.h
     151$(PROJECT_INCLUDE)/libcpu/irq.h: irq/irq.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
     152        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/irq.h
     153PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/irq.h
     154
     155$(PROJECT_INCLUDE)/libcpu/vectors.h: vectors/vectors.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
     156        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/vectors.h
     157PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/vectors.h
    86158endif
    87159
     
    89161DISTCLEANFILES = $(PREINSTALL_DIRS)
    90162
    91 include $(top_srcdir)/../../../../../automake/local.am
     163include $(top_srcdir)/../../../automake/local.am
  • c/src/lib/libcpu/powerpc/mpc5xx/exceptions/raw_exception.c

    rdb87589 r8430205  
    11/*
    2  * raw_exception.c  - This file contains implementation of C function to
    3  *                    Instanciate 8xx ppc primary exception entries.
    4  *                    More detailled information can be found on motorola
    5  *                    site and more precisely in the following book :
     2 * raw_exception.c  - This file contains implementation of C functions to
     3 *                    Instantiate mpc5xx primary exception entries.
     4 *                    More detailled information can be found on the Motorola
     5 *                    site and more precisely in the following book:
    66 *
    7  *                    MPC860
    8  *                    Risc Microporcessor User's Manual
    9  *                    Motorola REF : MPC860UM/AD
     7 *                   MPC555/MPC556 User's Manual
     8 *                   Motorola REF : MPC555UM/D Rev. 3, 2000 October 15
     9 *
     10 *
     11 * MPC5xx port sponsored by Defence Research and Development Canada - Suffield
     12 * Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
     13 *
     14 * Derived from libcpu/powerpc/mpc8xx/exceptions/raw_exception.c:
    1015 *
    1116 * Copyright (C) 1999  Eric Valette (valette@crf.canon.fr)
    1217 *                     Canon Centre Recherche France.
    1318 *
    14  * Changes for MPC5XX Wilfried Busalski (w.busalski@lancier-monitoring.de)
    15  * Copyright (C) 2003 Lancier Monitoring GmbH
    16  *
    1719 *  The license and distribution terms for this file may be
    1820 *  found in found in the file LICENSE in this distribution or at
    19  *  http://www.OARcorp.com/rtems/license.html.
     21 *  http://www.rtems.com/license/LICENSE.
    2022 *
    21  * raw_exception.c,v 1.5 2002/11/04 14:29:02 joel Exp
     23 * $Id$
    2224 */
    2325
     
    3032#include <string.h>
    3133
    32 void * codemove(void *, const void *, unsigned int, unsigned long);
    33 
    3434static rtems_raw_except_connect_data*           raw_except_table;
    3535static rtems_raw_except_connect_data            default_raw_except_entry;
    3636static rtems_raw_except_global_settings*        local_settings;
    3737
    38 int mpc565_vector_is_valid(rtems_vector vector)
    39 {
    40   switch(vector) {
    41   case ASM_RESET_VECTOR: /* fall through */
    42   case ASM_MACH_VECTOR:
    43   case ASM_PROT_VECTOR:
    44   case ASM_ISI_VECTOR:
    45   case ASM_EXT_VECTOR:                     
    46   case ASM_ALIGN_VECTOR:
    47   case ASM_PROG_VECTOR:
    48   case ASM_FLOAT_VECTOR:
    49   case ASM_DEC_VECTOR:
    50    
    51   case ASM_SYS_VECTOR:
    52   case ASM_TRACE_VECTOR:
    53   case ASM_FLOATASSIST_VECTOR:
    54 
    55   case ASM_SOFTEMUL_VECTOR:
    56 
    57   case ASM_ITLBERROR_VECTOR:
    58   case ASM_DTLBERROR_VECTOR:
    59 
    60   case ASM_DBREAK_VECTOR:
    61   case ASM_IBREAK_VECTOR:
    62   case ASM_PERIFBREAK_VECTOR:
    63   case ASM_DEVPORT_VECTOR:
    64     return 1;
    65   default: return 0;
    66   }
    67 }
    68 
    6938int mpc5xx_vector_is_valid(rtems_vector vector)
    7039{
    71      switch (current_ppc_cpu) {
    72         case MPC_5XX:
    73             if (!mpc565_vector_is_valid(vector)) {
    74                 return 0;
    75             }
    76             break;
    77         default:
    78             printk("Please complete libcpu/powerpc/mpc5xx/exceptions/raw_exception.c\n");
    79             printk("current_ppc_cpu = %x\n", current_ppc_cpu);
    80             return 0;
    81      }
    82      return 1;
     40  switch (current_ppc_cpu) {
     41    case PPC_5XX:
     42      switch(vector) {
     43        case ASM_RESET_VECTOR:
     44        case ASM_MACH_VECTOR:
     45
     46        case ASM_EXT_VECTOR:
     47        case ASM_ALIGN_VECTOR:
     48        case ASM_PROG_VECTOR:
     49        case ASM_FLOAT_VECTOR:
     50        case ASM_DEC_VECTOR:
     51
     52        case ASM_SYS_VECTOR:
     53        case ASM_TRACE_VECTOR:
     54        case ASM_FLOATASSIST_VECTOR:
     55
     56        case ASM_SOFTEMUL_VECTOR:
     57
     58        case ASM_IPROT_VECTOR:
     59        case ASM_DPROT_VECTOR:
     60
     61        case ASM_DBREAK_VECTOR:
     62        case ASM_IBREAK_VECTOR:
     63        case ASM_MEBREAK_VECTOR:
     64        case ASM_NMEBREAK_VECTOR:
     65          return 1;
     66        default:
     67          return 0;
     68      }
     69    default:
     70      printk("Please complete libcpu/powerpc/mpc5xx/exceptions/raw_exception.c\n");
     71      printk("current_ppc_cpu = %x\n", current_ppc_cpu);
     72      return 0;
     73  }
    8374}
    8475
    8576int mpc5xx_set_exception  (const rtems_raw_except_connect_data* except)
    8677{
    87     unsigned int level;
     78  unsigned int level;
    8879
    89     if (!mpc5xx_vector_is_valid(except->exceptIndex)) {
    90       return 0;
    91     }
    92     /*
    93      * Check if default handler is actually connected. If not issue an error.
    94      * You must first get the current handler via mpc5xx_get_current_exception
    95      * and then disconnect it using mpc5xx_delete_exception.
    96      * RATIONALE : to always have the same transition by forcing the user
    97      * to get the previous handler before accepting to disconnect.
    98      */
    99     if (memcmp(mpc5xx_get_vector_addr(except->exceptIndex), (void*)default_raw_except_entry.hdl.raw_hdl,default_raw_except_entry.hdl.raw_hdl_size)) {
    100       return 0;
    101     }
     80  if (!mpc5xx_vector_is_valid(except->exceptIndex)) {
     81    return 0;
     82  }
     83  /*
     84   * Check if default handler is actually connected. If not issue an error.
     85   * You must first get the current handler via mpc5xx_get_current_exception
     86   * and then disconnect it using mpc5xx_delete_exception.
     87   * RATIONALE : to always have the same transition by forcing the user
     88   * to get the previous handler before accepting to disconnect.
     89   */
     90  if (exception_handler_table[except->exceptIndex] !=
     91      default_raw_except_entry.hdl.raw_hdl) {
     92    return 0;
     93  }
    10294
    103     _CPU_ISR_Disable(level);
    104    
    105     raw_except_table [except->exceptIndex] = *except;
    106     codemove((void*)mpc5xx_get_vector_addr(except->exceptIndex),
    107              except->hdl.raw_hdl,
    108              except->hdl.raw_hdl_size,
    109              PPC_CACHE_ALIGNMENT);
    110     except->on(except);
    111    
    112     _CPU_ISR_Enable(level);
    113     return 1;
     95  _CPU_ISR_Disable(level);
     96 
     97  raw_except_table[except->exceptIndex] = *except;
     98
     99  exception_handler_table[except->exceptIndex] = except->hdl.raw_hdl;
     100  except->on(except);
     101 
     102  _CPU_ISR_Enable(level);
     103  return 1;
    114104}
    115105
     
    120110  }
    121111   
    122   *except = raw_except_table [except->exceptIndex];
     112  *except = raw_except_table[except->exceptIndex];
    123113   
    124114  return 1;
     
    139129   * to get the previous handler before accepting to disconnect.
    140130   */
    141   if (memcmp(mpc5xx_get_vector_addr(except->exceptIndex),
    142              (void*)except->hdl.raw_hdl,
    143              except->hdl.raw_hdl_size)) {
    144       return 0;
     131  if (exception_handler_table[except->exceptIndex] != except->hdl.raw_hdl) {
     132    return 0;
    145133  }
     134
    146135  _CPU_ISR_Disable(level);
    147136
    148137  except->off(except);
    149   codemove((void*)mpc5xx_get_vector_addr(except->exceptIndex),
    150            default_raw_except_entry.hdl.raw_hdl,
    151            default_raw_except_entry.hdl.raw_hdl_size,
    152            PPC_CACHE_ALIGNMENT);
    153 
    154    
     138  exception_handler_table[except->exceptIndex] =
     139    default_raw_except_entry.hdl.raw_hdl;
     140 
    155141  raw_except_table[except->exceptIndex] = default_raw_except_entry;
    156142  raw_except_table[except->exceptIndex].exceptIndex = except->exceptIndex;
     
    163149/*
    164150 * Exception global init.
     151 *
     152 * Install exception handler pointers from the raw exception table into the
     153 * exception handler table.
    165154 */
    166155int mpc5xx_init_exceptions (rtems_raw_except_global_settings* config)
    167156{
    168     unsigned                    i;
    169     unsigned int level;
    170    
    171     /*
    172      * store various accelerators
    173      */
    174     raw_except_table            = config->rawExceptHdlTbl;
    175     local_settings              = config;
    176     default_raw_except_entry    = config->defaultRawEntry;
     157  unsigned                      i;
     158  unsigned int level;
     159 
     160  /*
     161   * store various accelerators
     162   */
     163  raw_except_table              = config->rawExceptHdlTbl;
     164  local_settings                = config;
     165  default_raw_except_entry      = config->defaultRawEntry;
    177166
    178     _CPU_ISR_Disable(level);
     167  _CPU_ISR_Disable(level);
    179168
    180     for (i=0; i <= LAST_VALID_EXC; i++) {
    181       if (!mpc5xx_vector_is_valid(i)){
    182         continue;
    183       }
    184       codemove((void*)mpc5xx_get_vector_addr(i),
    185              raw_except_table[i].hdl.raw_hdl,
    186              raw_except_table[i].hdl.raw_hdl_size,
    187              PPC_CACHE_ALIGNMENT);
    188       if (raw_except_table[i].hdl.raw_hdl != default_raw_except_entry.hdl.raw_hdl) {
    189         raw_except_table[i].on(&raw_except_table[i]);
    190       }
    191       else {
    192         raw_except_table[i].off(&raw_except_table[i]);
    193       }
     169  for (i = 0; i < NUM_EXCEPTIONS; i++) {
     170    exception_handler_table[i] = raw_except_table[i].hdl.raw_hdl;
     171
     172    if (raw_except_table[i].hdl.raw_hdl != default_raw_except_entry.hdl.raw_hdl) {
     173      raw_except_table[i].on(&raw_except_table[i]);
    194174    }
    195     _CPU_ISR_Enable(level);
     175    else {
     176      raw_except_table[i].off(&raw_except_table[i]);
     177    }
     178  }
     179  _CPU_ISR_Enable(level);
    196180
    197     return 1;
     181  return 1;
    198182}
    199183
  • c/src/lib/libcpu/powerpc/mpc5xx/exceptions/raw_exception.h

    rdb87589 r8430205  
    33 *
    44 *          This file contains implementation of C function to
    5  *          Instanciate 8xx ppc primary exception entries.
    6  *          More detailled information can be found on motorola
    7  *          site and more precisely in the following book :
     5 *          Instantiate mpc5xx primary exception entries.
     6 *          More detailled information can be found on the Motorola
     7 *          site and more precisely in the following book:
    88 *
    9  *              MPC860
    10  *              Risc Microporcessor User's Manual
    11  *              Motorola REF : MPC860UM/AD 07/98 Rev .1
     9 *              MPC555/MPC556 User's Manual
     10 *              Motorola REF : MPC555UM/D Rev. 3, 2000 October 15
    1211 *
    13  * Copyright (C) 1999  Eric Valette (valette@crf.canon.fr)
     12 *
     13 *  MPC5xx port sponsored by Defence Research and Development Canada - Suffield
     14 *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
     15 *
     16 *  Derived from libcpu/powerpc/mpc8xx/exceptions/raw_exception.h:
     17 *
     18 *  Copyright (C) 1999  Eric Valette (valette@crf.canon.fr)
    1419 *                     Canon Centre Recherche France.
    15  *
    16  * Changes for MPC5XX Wilfried Busalski (w.busalski@lancier-monitoring.de)
    17  * Copyright (C) 2003 Lancier Monitoring GmbH
    18  
    1920 *
    2021 *  The license and distribution terms for this file may be
    2122 *  found in found in the file LICENSE in this distribution or at
    22  *  http://www.OARcorp.com/rtems/license.html.
     23 *  http://www.rtems.com/license/LICENSE.
    2324 *
    24  * raw_exception.h,v 1.1 2001/04/06 15:54:18 joel Exp
     25 *  $Id$
    2526 */
    2627
     
    2829#define _LIBCPU_MPC5XX_EXCEPTION_RAW_EXCEPTION_H
    2930
     31#include <libcpu/vectors.h>
     32
    3033/*
    31  * Exception Vectors as defined in the MCP750 manual
     34 * Exception Vectors as defined in the MPC555 User's Manual
    3235 */
    3336
    34 #define ASM_RESET_VECTOR                0x01
    35 #define ASM_MACH_VECTOR                 0x02
    36 #define ASM_PROT_VECTOR                 0x03
    37 #define ASM_ISI_VECTOR                  0x04
    38 #define ASM_EXT_VECTOR                  0x05
    39 #define ASM_ALIGN_VECTOR                0x06
    40 #define ASM_PROG_VECTOR                 0x07
    41 #define ASM_FLOAT_VECTOR                0x08
    42 #define ASM_DEC_VECTOR                  0x09
     37#define ASM_RESET_VECTOR        0x01
     38#define ASM_MACH_VECTOR         0x02
    4339
    44 #define ASM_SYS_VECTOR                  0x0C
    45 #define ASM_TRACE_VECTOR                0x0D
     40#define ASM_EXT_VECTOR          0x05
     41#define ASM_ALIGN_VECTOR        0x06
     42#define ASM_PROG_VECTOR         0x07
     43#define ASM_FLOAT_VECTOR        0x08
     44#define ASM_DEC_VECTOR          0x09
     45
     46#define ASM_SYS_VECTOR          0x0C
     47#define ASM_TRACE_VECTOR        0x0D
    4648#define ASM_FLOATASSIST_VECTOR  0x0E
    4749
    48 #define ASM_SOFTEMUL_VECTOR             0x10
     50#define ASM_SOFTEMUL_VECTOR     0x10
    4951
    50 #define ASM_ITLBERROR_VECTOR    0x13
    51 #define ASM_DTLBERROR_VECTOR    0x14
     52#define ASM_IPROT_VECTOR        0x13
     53#define ASM_DPROT_VECTOR        0x14
    5254
    53 #define ASM_DBREAK_VECTOR               0x1C
    54 #define ASM_IBREAK_VECTOR               0x1D
    55 #define ASM_PERIFBREAK_VECTOR   0x1E
    56 #define ASM_DEVPORT_VECTOR              0x1F
     55#define ASM_DBREAK_VECTOR       0x1C
     56#define ASM_IBREAK_VECTOR       0x1D
     57#define ASM_MEBREAK_VECTOR      0x1E
     58#define ASM_NMEBREAK_VECTOR     0x1F
    5759
    58 #define LAST_VALID_EXC          ASM_DEVPORT_VECTOR
    59 
    60 /*
    61  * Vector offsets as defined in the MPC860 manual
    62  */
    63 
    64 #define ASM_RESET_VECTOR_OFFSET                 (ASM_RESET_VECTOR << 8)
    65 #define ASM_MACH_VECTOR_OFFSET                  (ASM_MACH_VECTOR  << 8)
    66 #define ASM_PROT_VECTOR_OFFSET                  (ASM_PROT_VECTOR  << 8)
    67 #define ASM_ISI_VECTOR_OFFSET                   (ASM_ISI_VECTOR   << 8)
    68 #define ASM_EXT_VECTOR_OFFSET                   (ASM_EXT_VECTOR   << 8)
    69 #define ASM_ALIGN_VECTOR_OFFSET                 (ASM_ALIGN_VECTOR << 8)
    70 #define ASM_PROG_VECTOR_OFFSET                  (ASM_PROG_VECTOR  << 8)
    71 #define ASM_FLOAT_VECTOR_OFFSET                 (ASM_FLOAT_VECTOR << 8)
    72 #define ASM_DEC_VECTOR_OFFSET                   (ASM_DEC_VECTOR   << 8)
    73 
    74 #define ASM_SYS_VECTOR_OFFSET                   (ASM_SYS_VECTOR   << 8)
    75 #define ASM_TRACE_VECTOR_OFFSET                 (ASM_TRACE_VECTOR << 8)
    76 #define ASM_FLOATASSIST_VECTOR_OFFSET   (ASM_FLOATASSIST_VECTOR << 8)
    77 
    78 #define ASM_SOFTEMUL_VECTOR_OFFSET              (ASM_SOFTEMUL_VECTOR << 8)
    79 
    80 #define ASM_ITLBERROR_VECTOR_OFFSET             (ASM_ITLBERROR_VECTOR << 8)
    81 #define ASM_DTLBERROR_VECTOR_OFFSET             (ASM_DTLBERROR_VECTOR << 8)
    82 
    83 #define ASM_DBREAK_VECTOR_OFFSET                (ASM_DBREAK_VECTOR << 8)
    84 #define ASM_IBREAK_VECTOR_OFFSET                (ASM_IBREAK_VECTOR << 8)
    85 #define ASM_PERIFBREAK_VECTOR_OFFSET    (ASM_PERIFBREAK_VECTOR << 8)
    86 #define ASM_DEVPORT_VECTOR_OFFSET               (ASM_DEVPORT_VECTOR_OFFSET << 8)
     60#define LAST_VALID_EXC          ASM_NMEBREAK_VECTOR
    8761
    8862#ifndef ASM
     
    9468typedef unsigned char  rtems_vector;
    9569struct  __rtems_raw_except_connect_data__;
    96 typedef void            (*rtems_raw_except_func)                (void);
    9770typedef unsigned char   rtems_raw_except_hdl_size;
    9871
    9972typedef struct {
    10073  rtems_vector                  vector;
    101   rtems_raw_except_func         raw_hdl;
    102   rtems_raw_except_hdl_size     raw_hdl_size;
     74  rtems_exception_handler_t*    raw_hdl;
    10375}rtems_raw_except_hdl;
    10476 
     
    187159# endif /* ASM */
    188160
     161#define SIZEOF_
     162
    189163#endif
    190164
  • c/src/lib/libcpu/powerpc/mpc5xx/timer/timer.c

    rdb87589 r8430205  
    11/*  timer.c
    22 *
    3  *  This file manages the benchmark timer used by the RTEMS Timing Test
    4  *  Suite.  Each measured time period is demarcated by calls to
    5  *  Timer_initialize() and Read_timer().  Read_timer() usually returns
    6  *  the number of microseconds since Timer_initialize() exitted.
     3 *  This file manages the interval timer on the PowerPC MPC5xx.
     4 *  NOTE: This is not the PIT, but rather the RTEMS interval
     5 *        timer
     6 *  We shall use the bottom 32 bits of the timebase register,
    77 *
     8 *  The following was in the 403 version of this file. I don't
     9 *  know what it means. JTM 5/19/98
    810 *  NOTE: It is important that the timer start/stop overhead be
    911 *        determined when porting or modifying this code.
    1012 *
    11  *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
     13 *
     14 *  MPC5xx port sponsored by Defence Research and Development Canada - Suffield
     15 *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
     16 *
     17 *  Derived from c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c:
     18 *
     19 *  Author: Jay Monkman (jmonkman@frasca.com)
     20 *  Copywright (C) 1998 by Frasca International, Inc.
     21 *
     22 *  Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
     23 *
     24 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
     25 *
     26 *  COPYRIGHT (c) 1995 by i-cubed ltd.
     27 *
     28 *  To anyone who acknowledges that this file is provided "AS IS"
     29 *  without any express or implied warranty:
     30 *      permission to use, copy, modify, and distribute this file
     31 *      for any purpose is hereby granted without fee, provided that
     32 *      the above copyright notice and this notice appears in all
     33 *      copies, and that the name of i-cubed limited not be used in
     34 *      advertising or publicity pertaining to distribution of the
     35 *      software without specific, written prior permission.
     36 *      i-cubed limited makes no representations about the suitability
     37 *      of this software for any purpose.
     38 *
     39 *  Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
     40 *
     41 *  COPYRIGHT (c) 1989-1998.
    1242 *  On-Line Applications Research Corporation (OAR).
    13  *  All rights assigned to U.S. Government, 1994.
    1443 *
    15  *  This material may be reproduced by or for the U.S. Government pursuant
    16  *  to the copyright license under the clause at DFARS 252.227-7013.  This
    17  *  notice must appear in all copies of this file and its derivatives.
     44 *  The license and distribution terms for this file may be
     45 *  found in the file LICENSE in this distribution or at
     46 *  http://www.rtems.com/license/LICENSE.
    1847 *
    19  *  timer.c,v 1.2 1995/05/31 16:56:39 joel Exp
     48 *  $Id$
    2049 */
    2150
    2251#include <rtems.h>
     52#include <mpc5xx.h>
    2353
    24 rtems_boolean Timer_driver_Find_average_overhead;
     54static volatile rtems_unsigned32 Timer_starting;
     55static rtems_boolean Timer_driver_Find_average_overhead;
    2556
    26 static unsigned int volatile lastInitValue;
     57/*
     58 *  This is so small that this code will be reproduced where needed.
     59 */
     60static inline rtems_unsigned32 get_itimer(void)
     61{
     62   rtems_unsigned32 ret;
    2763
    28 void Timer_initialize( void )
    29 {
    30   asm volatile( " mftb %0": "=r" (lastInitValue) );
     64   asm volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
     65
     66   return ret;
    3167}
    3268
    33 /*
    34  *  The following controls the behavior of Read_timer().
    35  *
    36  *  AVG_OVEREHAD is the overhead for starting and stopping the timer.  It
    37  *  is usually deducted from the number returned.
    38  *
    39  *  LEAST_VALID is the lowest number this routine should trust.  Numbers
    40  *  below this are "noise" and zero is returned.
    41  */
    42 
    43 #define AVG_OVERHEAD      0  /* It typically takes X.X microseconds */
    44                              /* (Y countdowns) to start/stop the timer. */
    45                              /* This value is in microseconds. */
    46 #define LEAST_VALID       1  /* Don't trust a clicks value lower than this */
    47 
    48 int Read_timer( void )
     69void Timer_initialize(void)
    4970{
    50   uint32_t   value;
    51   asm volatile ( " mftb %0": "=r" (value) );
    52   return value - lastInitValue;
     71  /* set interrupt level and enable timebase. This should never */
     72  /*  generate an interrupt however. */
     73  usiu.tbscrk = USIU_UNLOCK_KEY;
     74  usiu.tbscr |= USIU_TBSCR_TBIRQ(4)     /* interrupt priority level */
     75              | USIU_TBSCR_TBF          /* freeze timebase during debug */
     76              | USIU_TBSCR_TBE;         /* enable timebase */
     77  usiu.tbscrk = 0;
     78 
     79  Timer_starting = get_itimer();
    5380}
    5481
    55 /*
    56  *  Empty function call used in loops to measure basic cost of looping
    57  *  in Timing Test Suite.
    58  */
     82#ifndef  rtems_cpu_configuration_get_timer_least_valid
     83#define  rtems_cpu_configuration_get_timer_least_valid() 0
     84#endif
    5985
    60 rtems_status_code Empty_function( void )
     86#ifndef  rtems_cpu_configuration_get_timer_average_overhead
     87#define  rtems_cpu_configuration_get_timer_average_overhead() 0
     88#endif
     89
     90int Read_timer(void)
     91{
     92  rtems_unsigned32 clicks;
     93  rtems_unsigned32 total;
     94
     95  clicks = get_itimer();
     96
     97  total = clicks - Timer_starting;
     98
     99  if ( Timer_driver_Find_average_overhead == 1 )
     100    return total;          /* in XXX microsecond units */
     101
     102  else {
     103    if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
     104      return 0;            /* below timer resolution */
     105    }
     106    return (total - rtems_cpu_configuration_get_timer_average_overhead());
     107  }
     108}
     109
     110rtems_status_code Empty_function(void)
    61111{
    62112  return RTEMS_SUCCESSFUL;
    63113}
    64114
    65 void Set_find_average_overhead(
    66   rtems_boolean find_flag
    67 )
     115void Set_find_average_overhead(rtems_boolean find_flag)
    68116{
    69117  Timer_driver_Find_average_overhead = find_flag;
  • c/src/lib/libcpu/powerpc/shared/include/cpuIdent.h

    rdb87589 r8430205  
    2222  PPC_601 = 0x1,
    2323  PPC_5XX = 0x2,
    24   PPC_509 = PPC_5XX,
    25   PPC_533 = PPC_5XX,
    26   PPC_534 = PPC_5XX,
    27   PPC_535 = PPC_5XX,
    28   PPC_536 = PPC_5XX,
    29   PPC_555 = PPC_5XX,
    30   PPC_556 = PPC_5XX,
    31   PPC_561 = PPC_5XX,
    32   PPC_562 = PPC_5XX,
    33   PPC_563 = PPC_5XX,
    34   PPC_564 = PPC_5XX,
    35   PPC_565 = PPC_5XX,
    36   PPC_566 = PPC_5XX,
    37   MPC_5XX = PPC_5XX,
    3824  PPC_603 = 0x3,
    3925  PPC_604 = 0x4,
Note: See TracChangeset for help on using the changeset viewer.