Changeset b335c503 in rtems


Ignore:
Timestamp:
04/20/01 13:14:55 (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
b85df34
Parents:
831aba1
Message:

2001-04-20 Joel Sherrill <joel@…>

  • include/bsp.h (Clear_tm27_intr): Stop the timer and disable the interrupt. This was not quite right before and we were getting uncontrolled interrupt nesting in tm27.
  • timer/timer.c (Timer_Initialize): Added an extra reset and changed the ITMR register so we will never get an interrupt. (Read_timer): Fixed so the timer actually stops before it is read. Before some times reported were outraguously high.
  • start/start.S: Major clean including using stack in linkcmds, deleting unused code, and zeroing the BSS using the linkcmds information.
  • startup/linkcmds: Put heap in lower memory than workspace and move _clear_end so both are zeroed.
Location:
c/src/lib/libbsp/mips/jmr3904
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/mips/jmr3904/ChangeLog

    r831aba1 rb335c503  
     12001-04-20      Joel Sherrill <joel@OARcorp.com>
     2
     3        * include/bsp.h (Clear_tm27_intr): Stop the timer and disable
     4        the interrupt.  This was not quite right before and we were
     5        getting uncontrolled interrupt nesting in tm27.
     6        * timer/timer.c (Timer_Initialize): Added an extra reset and
     7        changed the ITMR register so we will never get an interrupt.
     8        (Read_timer): Fixed so the timer actually stops before it
     9        is read.  Before some times reported were outraguously high.
     10        * start/start.S: Major clean including using stack in linkcmds,
     11        deleting unused code, and zeroing the BSS using the linkcmds
     12        information.
     13        * startup/linkcmds: Put heap in lower memory than workspace
     14        and move _clear_end so both are zeroed.
     15
    1162001-01-12      Joel Sherrill <joel@OARcorp.com>
    217
  • c/src/lib/libbsp/mips/jmr3904/include/bsp.h

    r831aba1 rb335c503  
    7575
    7676#define Clear_tm27_intr() \
    77   TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_TCR,   0x03 );
     77  do { \
     78    TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_ITMR, 0x0001 ); \
     79    TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_CCDR, 0x3 ); \
     80    TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_TISR,   0x00 ); \
     81  } while(0)
    7882
    7983#define Lower_tm27_intr() \
  • c/src/lib/libbsp/mips/jmr3904/start/start.S

    r831aba1 rb335c503  
    1818 */
    1919
     20#include <asm.h>
     21#include "regs.S"
     22
    2023#ifdef __mips16
    2124/* This file contains 32 bit assembly code.  */
    2225        .set nomips16
    2326#endif
    24 
    25 #include <asm.h>
    26 #include "regs.S"
    27 
    28 /*
    29  * Set up some room for a stack. We just grab a chunk of memory.
    30  */
    31 #define STACK_SIZE  0x4000
    32 #define GLOBAL_SIZE 0x2000
    33 
    34 #define STARTUP_STACK_SIZE      0x0100
    3527
    3628/* This is for referencing addresses that are not in the .sdata or
     
    4537# define LA(t,x) la t,x
    4638#endif /* __mips_embedded_pic */
    47 
    48         .comm   __memsize, 12
    49         .comm   __lstack, STARTUP_STACK_SIZE
    50         .comm   __stackbase,4
    5139
    5240        .text
     
    6351_start:
    6452        .set    noreorder
     53        # Get the address of start into $5 in a position independent fashion.
     54        # This lets us know whether we have been relocated or not.
     55       
     56        $LF1 = . + 8
     57        bal     $LF1
     58        nop
     59_branch:
     60        move    $5, $31                         # $5 == where are we
     61        li      $6, 0x8800000c                  # $6 == where we want to be
     62        #la      $6,_branch
     63        beq     $5, $6, _start_in_ram
     64        nop
     65        # relocate the code from EEPROM to RAM
     66        la      $7, _edata
     67relocate:
     68        lw      $8, ($5)                        # $8 = *EEPROM
     69        addu    $5, $5, 4                       # EEPROM++
     70        sw      $8, ($6)                        # *RAM = $8
     71        addu    $6, $6, 4                       # RAM++
     72        bne     $6, $7, relocate                # copied all the way to edata?
     73        nop
     74        la      $6, _start_in_ram
     75        jr      $6
     76        nop
     77        .end _start
     78
     79       
     80        .globl  _start_in_ram
     81        .ent _start_in_ram
     82_start_in_ram:
     83        nop
     84
    6585#ifdef __mips_embedded_pic
    6686        PICBASE = .+8
     
    112132 */
    113133        .globl  __memsize
    114         .globl  get_mem_info .text
    115         .globl  __stack
    116         .globl  __global
    117134        .globl  zerobss
    118135        .ent    zerobss
     
    125142        addiu   v0,v0,4                         # executed in delay slot
    126143
    127         la      t0, __lstack                    # make a small stack so we
    128         addiu   sp, t0, STARTUP_STACK_SIZE      # can run some C code
    129         la      a0, __memsize                   # get the usable memory size
    130         jal     get_mem_info
    131         nop
    132 
    133         /* setup the stack pointer */
    134         LA (t0, __stack)                        # is __stack set ?
    135         bne     t0,zero,4f
    136         nop
    137 
    138         /* NOTE: a0[0] contains the amount of memory available, and
    139                  not the last memory address. */
    140         lw      t0,0(a0)                        # last address of memory available
    141         la      t1,K0BASE                       # cached kernel memory
    142         addu    t0,t0,t1                        # get the end of memory address
     144        la      t0, _stack_init                 # initialize stack so we
    143145        /* We must subtract 24 bytes for the 3 8 byte arguments to main, in
    144146           case main wants to write them back to the stack.  The caller is
     
    150152           32, which satisifes the stack for the arguments and keeps the
    151153           stack pointer better aligned.  */
    152         subu    t0,t0,32                        # and generate a starting stack-pointer
    153 4:
     154        subu    t0,t0,32
    154155        move    sp,t0                           # set stack pointer
    155         sw      sp,__stackbase                  # keep this for future ref
    156156        .end    zerobss
    157157
    158 /*
    159  * initialize target specific stuff. Only execute these
    160  * functions it they exist.
    161  */
    162 #if 0
    163         .globl  hardware_init_hook .text
    164         .globl  software_init_hook .text
    165         .globl  __do_global_dtors .text
    166         .globl  atexit .text
    167 #endif
    168158        .globl  exit .text
    169159        .globl  init
    170160        .ent    init
    171161init:
    172 #if 0
    173         LA (t9, hardware_init_hook)             # init the hardware if needed
    174         beq     t9,zero,6f
    175         nop
    176         jal     t9
    177         nop
    178 6:
    179         LA (t9, software_init_hook)             # init the hardware if needed
    180         beq     t9,zero,7f
    181         nop
    182         jal     t9
    183         nop
    184 7:
    185         LA (a0, __do_global_dtors)
    186         jal     atexit
    187         nop
    188 #endif
    189 
    190 #ifdef GCRT0
    191         .globl  _ftext
    192         .globl  _extext
    193         LA (a0, _ftext)
    194         LA (a1, _etext)
    195         jal     monstartup
    196         nop
    197 #endif
    198162
    199163        move    a0,zero                         # set argc to 0
     
    202166
    203167        # fall through to the "exit" routine
    204         jal     exit                            # call libc exit to run the G++
     168        jal     _sys_exit                       # call libc exit to run the G++
    205169                                                # destructors
    206170        move    a0,v0                           # pass through the exit code
     
    208172       
    209173/*
    210  * Exit from the application. Normally we cause a user trap
    211  *  to return to the ROM monitor for another run. NOTE: This is
    212  *  the only other routine we provide in the crt0.o object, since
    213  *  it may be tied to the "_start" routine. It also allows
    214  *  executables that contain a complete world to be linked with
    215  *  just the crt0.o object.
     174 * _sys_exit -- Exit from the application. Normally we cause a user trap
     175 *          to return to the ROM monitor for another run. NOTE: This is
     176 *          the only other routine we provide in the crt0.o object, since
     177 *          it may be tied to the "_start" routine. It also allows
     178 *          executables that contain a complete world to be linked with
     179 *          just the crt0.o object.
    216180 */
    217 
    218 FRAME(_sys_exit,sp,0,ra)
     181        .globl  _sys_exit
     182        .ent _sys_exit
     183_sys_exit:
    2191847:
    220185#ifdef GCRT0
     
    227192        b       7b                              # but loop back just in-case
    228193        nop
    229 ENDFRAME(_sys_exit)
     194        .end _sys_exit
    230195
    231196/* EOF crt0.S */
  • c/src/lib/libbsp/mips/jmr3904/startup/linkcmds

    r831aba1 rb335c503  
    109109    __stack = .;
    110110    _stack_init = .;
    111     _clear_end = .;
     111    HeapBase = .;
     112    . += HeapSize;    /* reserve some memory for heap */
    112113    WorkspaceBase = .;
    113114     /* HACK -- tied to value bspstart */
    114115    . += 4096K;    /* reserve some memory for workspace */
    115     HeapBase = .;
    116     . += HeapSize;    /* reserve some memory for heap */
     116    _clear_end = .;
    117117  }
    118118 end = .;
  • c/src/lib/libbsp/mips/jmr3904/timer/timer.c

    r831aba1 rb335c503  
    3232   */
    3333
     34  TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_TCR,   0x20 );
    3435  TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_CCDR, 0x3 );
    3536  TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_TRR, 0x0 );
    3637  TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_CPRA, 0xFFFFFFFF );
    3738  TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_TISR, 0x00 );
    38   TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_ITMR, 0x8001 );
    39   TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_TCR,   0x20 );
     39  TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_ITMR, 0x0001 );
    4040  TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_TCR,   0xe0 );
    4141}
     
    5050  rtems_unsigned32  total;
    5151
    52   TX3904_TIMER_WRITE( TX3904_TIMER1_BASE, TX3904_TIMER_TCR,   0x03 );
    5352  total = TX3904_TIMER_READ( TX3904_TIMER1_BASE, TX3904_TIMER_TRR );
    5453
Note: See TracChangeset for help on using the changeset viewer.