Changeset cdeed304 in rtems


Ignore:
Timestamp:
Sep 14, 2008, 7:54:15 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
12d853d
Parents:
b9cb6cdf
Message:

2008-09-14 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac, startup/bspstart.c: Split out bsp_get_work_area() into its own file and user BSP Framework to perform more initialization. Use same shared implementation as edb7312 and csb336.
Location:
c/src/lib/libbsp/arm/gp32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/gp32/ChangeLog

    rb9cb6cdf rcdeed304  
     12008-09-14      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * Makefile.am, configure.ac, startup/bspstart.c: Split out
     4        bsp_get_work_area() into its own file and user BSP Framework to
     5        perform more initialization. Use same shared implementation as
     6        edb7312 and csb336.
     7
    182008-08-21      Joel Sherrill <joel.sherrill@oarcorp.com>
    29
  • c/src/lib/libbsp/arm/gp32/Makefile.am

    rb9cb6cdf rcdeed304  
    2828
    2929startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
    30     ../../shared/bsppredriverhook.c \
    31     startup/bspstart.c startup/bspclean.c startup/memmap.c \
    32     ../../shared/bootcard.c ../../shared/sbrk.c \
     30    ../../shared/bsppredriverhook.c ../shared/bspgetworkarea.c \
     31    ../../shared/bsppretaskinghook.c startup/bspstart.c startup/bspclean.c \
     32    startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \
    3333    ../../shared/gnatinstallhandler.c
    3434console_SOURCES = console/uart.c ../../shared/console.c
  • c/src/lib/libbsp/arm/gp32/configure.ac

    rb9cb6cdf rcdeed304  
    1919AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
    2020
     21RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
     22
    2123# Explicitly list all Makefiles here
    2224AC_CONFIG_FILES([Makefile])
  • c/src/lib/libbsp/arm/gp32/startup/bspstart.c

    rb9cb6cdf rcdeed304  
    1 /*-------------------------------------------------------------------------+
    2 | This file contains the ARM BSP startup package. It includes application,
    3 | board, and monitor specific initialization and configuration. The generic CPU
    4 | dependent initialization has been performed before this routine is invoked.
    5 +--------------------------------------------------------------------------+
    6 |
    7 | Copyright (c) 2000 Canon Research Centre France SA.
    8 | Emmanuel Raguet, mailto:raguet@crf.canon.fr
    9 |
    10 |   The license and distribution terms for this file may be
    11 |   found in found in the file LICENSE in this distribution or at
    12 |   http://www.rtems.com/license/LICENSE.
    13 |
    14 +--------------------------------------------------------------------------*/
     1/*
     2 * This file contains the ARM BSP startup package. It includes application,
     3 * board, and monitor specific initialization and configuration. The generic CPU
     4 * dependent initialization has been performed before this routine is invoked.
     5 *
     6 *
     7 * Copyright (c) 2000 Canon Research Centre France SA.
     8 * Emmanuel Raguet, mailto:raguet@crf.canon.fr
     9 *
     10 *   The license and distribution terms for this file may be
     11 *   found in found in the file LICENSE in this distribution or at
     12 *   http://www.rtems.com/license/LICENSE.
     13 *
     14 */
    1515
    1616
     
    2121#include <s3c24xx.h>
    2222
    23 /*-------------------------------------------------------------------------+
    24 | Global Variables
    25 +--------------------------------------------------------------------------*/
     23/*
     24 * External Prototypes
     25 */
     26extern void rtems_irq_mngt_init(void);
    2627
    27 extern void            *_sdram_size;
    28 extern void            *_sdram_base;
    29 extern void            *_bss_free_start;
    30 
    31 unsigned long           free_mem_start;
    32 unsigned long           free_mem_end;
    33 
    34 /*-------------------------------------------------------------------------+
    35 | External Prototypes
    36 +--------------------------------------------------------------------------*/
    37 extern void rtems_irq_mngt_init(void);
    38 void bsp_libc_init( void *, uint32_t, int );
    39 
    40 /*-------------------------------------------------------------------------+
    41 |         Function: bsp_pretasking_hook
    42 |      Description: BSP pretasking hook.  Called just before drivers are
    43 |                   initialized. Used to setup libc and install any BSP
    44 |                   extensions. NOTE: Must not use libc (to do io) from here,
    45 |                   since drivers are not yet initialized.
    46 | Global Variables: None.
    47 |        Arguments: None.
    48 |          Returns: Nothing.
    49 +--------------------------------------------------------------------------*/
    50 void bsp_pretasking_hook(void)
    51 {
    52     uint32_t heap_start;
    53     uint32_t heap_size;
    54 
    55     /*
    56      * Set up the heap.
    57      */
    58     heap_start =  free_mem_start;
    59     heap_size = free_mem_end - free_mem_start;
    60 
    61     /* call rtems lib init - malloc stuff */
    62     bsp_libc_init((void *)heap_start, heap_size, 0);
    63 
    64 } /* bsp_pretasking_hook */
    65 
     28/*
     29 *  BSP specific Idle task
     30 */
    6631Thread bsp_idle_task(uint32_t ignored)
    6732{
     
    7136}
    7237 
    73 /*-------------------------------------------------------------------------+
    74 |         Function: bsp_start
    75 |      Description: Called before main is invoked.
    76 | Global Variables: None.
    77 |        Arguments: None.
    78 |          Returns: Nothing.
    79 +--------------------------------------------------------------------------*/
     38/*
     39 *  BSP Specific Initialization in C
     40 */
    8041void bsp_start_default( void )
    8142{
    82     uint32_t cr;
    83     uint32_t pend,last;
    84     uint32_t REFCNT;
    85     int i;
     43  uint32_t cr;
     44  uint32_t pend,last;
     45  uint32_t REFCNT;
     46  int i;
    8647
    87     /* stop RTC */
    88 #ifdef CPU_S3C2400
    89     rTICINT=0x0;
    90 #else
    91     rTICNT=0x0;
    92 #endif
    93     /* stop watchdog,ADC and timers */
    94     rWTCON=0x0;
    95     rTCON=0x0;
    96     rADCCON=0x0;
     48  /* stop RTC */
     49  #ifdef CPU_S3C2400
     50    rTICINT = 0x0;
     51  #else
     52    rTICNT = 0x0;
     53  #endif
     54  /* stop watchdog,ADC and timers */
     55  rWTCON = 0x0;
     56  rTCON = 0x0;
     57  rADCCON = 0x0;
    9758
    98     /* disable interrupts */
    99     rINTMOD=0x0;
    100     rINTMSK=BIT_ALLMSK; /* unmasked by drivers */
     59  /* disable interrupts */
     60  rINTMOD = 0x0;
     61  rINTMSK = BIT_ALLMSK; /* unmasked by drivers */
    10162
    102     last=0;
    103     for(i=0; i<4; i++) {
    104         pend=rSRCPND;
    105         if(pend == 0 || pend == last)
    106             break;
    107         rSRCPND=pend;
    108         rINTPND=pend;
    109         last=pend;
    110     }
     63  last = 0;
     64  for(i=0; i<4; i++) {
     65    pend = rSRCPND;
     66    if(pend == 0 || pend == last)
     67      break;
     68    rSRCPND = pend;
     69    rINTPND = pend;
     70    last    = pend;
     71  }
    11172
    112     /* setup clocks */
    113     rCLKDIVN=M_CLKDIVN;
    114     rMPLLCON=((M_MDIV<<12)+(M_PDIV<<4)+M_SDIV);
    115     /* setup rREFRESH */
    116     REFCNT=2048+1-(15.6*get_HCLK()/1000000); /* period=15.6 us, HCLK=66Mhz, (2048+1-15.6*66) */
    117     rREFRESH=((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT);
     73  /* setup clocks */
     74  rCLKDIVN = M_CLKDIVN;
     75  rMPLLCON = ((M_MDIV<<12)+(M_PDIV<<4)+M_SDIV);
     76  /* setup rREFRESH
     77   * period = 15.6 us, HCLK=66Mhz, (2048+1-15.6*66)
     78   */
     79  REFCNT   = 2048+1-(15.6*get_HCLK()/1000000);
     80  rREFRESH = ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT);
    11881
    119     /* set prescaler for timers 2,3,4 to 16(15+1) */
    120     cr=rTCFG0 & 0xFFFF00FF;
    121     rTCFG0=(cr | (15<<8));
     82  /* set prescaler for timers 2,3,4 to 16(15+1) */
     83  cr = rTCFG0 & 0xFFFF00FF;
     84  rTCFG0 = (cr | (15<<8));
    12285
    123     /* set prescaler for timers 0,1 to 1(0+1) */
    124     cr=rTCFG0 & 0xFFFFFF00;
    125     rTCFG0=(cr | (0<<0));
     86  /* set prescaler for timers 0,1 to 1(0+1) */
     87  cr = rTCFG0 & 0xFFFFFF00;
     88  rTCFG0 = (cr | (0<<0));
    12689
    127     /* Place RTEMS workspace at beginning of free memory. */
    128     Configuration.work_space_start = (void *)&_bss_free_start;
     90  /*
     91   * Init rtems exceptions management
     92   */
     93  rtems_exception_init_mngt();
    12994
    130     free_mem_start = ((uint32_t)&_bss_free_start + rtems_configuration_get_work_space_size());
    131    
    132     free_mem_end = ((uint32_t)&_sdram_base + (uint32_t)&_sdram_size);
    133 
    134     /*
    135      * Init rtems exceptions management
    136      */
    137     rtems_exception_init_mngt();
    138 
    139     /*
    140      * Init rtems interrupt management
    141      */
    142     rtems_irq_mngt_init();
    143     /*
    144      *  The following information is very useful when debugging.
    145      */
    146 
    147 #if 0
    148     printk( "work_space_size = 0x%x\n",
    149              rtems_configuration_get_work_space_size() );
    150     printk( "microseconds_per_tick = 0x%x\n",
    151             rtems_configuration_get_microseconds_per_tick() );
    152     printk( "ticks_per_timeslice = 0x%x\n",
    153             rtems_configuration_get_ticks_per_timeslice() );
    154    
    155     printk( "_heap_size = 0x%x\n", _heap_size );
    156     /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
    157     printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart );
    158     printk( "work_space_start = 0x%x\n", Configuration.work_space_start );
    159     printk( "work_space_size = 0x%x\n", rtems_configuration_get_work_space_size() );
    160 #endif
    161 
     95  /*
     96   * Init rtems interrupt management
     97   */
     98  rtems_irq_mngt_init();
    16299}
    163100
     
    171108void bsp_reset(void)
    172109{
    173     rtems_interrupt_level level;
    174     rtems_interrupt_disable(level);
    175     printk("bsp_reset.....\n");
    176         /* disable mmu, invalide i-cache and call swi #4 */
    177         asm volatile(""
    178                 "mrc    p15,0,r0,c1,c0,0        \n"
    179                 "bic    r0,r0,#1                        \n"
    180                 "mcr    p15,0,r0,c1,c0,0        \n"
    181                 "nop                                            \n"
    182                 "nop                                            \n"
    183                 "nop                                            \n"
    184                 "nop                                            \n"
    185                 "nop                                            \n"
    186                 "mov    r0,#0                                   \n"
    187                 "MCR    p15,0,r0,c7,c5,0                        \n"
    188                 "nop                                            \n"
    189                 "nop                                            \n"
    190                 "nop                                            \n"
    191                 "nop                                            \n"
    192                 "nop                                            \n"
    193                 "swi    #4                                      "
    194         :
    195         :
    196         : "r0"
    197         );
    198         /* we should be back in bios now */
     110  rtems_interrupt_level level;
     111  rtems_interrupt_disable(level);
     112  printk("bsp_reset.....\n");
     113  /* disable mmu, invalide i-cache and call swi #4 */
     114  asm volatile(""
     115    "mrc    p15,0,r0,c1,c0,0  \n"
     116    "bic    r0,r0,#1          \n"
     117    "mcr    p15,0,r0,c1,c0,0  \n"
     118    "nop                      \n"
     119    "nop                      \n"
     120    "nop                      \n"
     121    "nop                      \n"
     122    "nop                      \n"
     123    "mov    r0,#0             \n"
     124    "MCR    p15,0,r0,c7,c5,0  \n"
     125    "nop                      \n"
     126    "nop                      \n"
     127    "nop                      \n"
     128    "nop                      \n"
     129    "nop                      \n"
     130    "swi    #4                "
     131    :
     132    :
     133    : "r0"
     134  );
     135  /* we should be back in bios now */
    199136}
Note: See TracChangeset for help on using the changeset viewer.