?? bootmem.c
字號:
/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*
B O O T M E M O R Y I N I T I A L I Z A T I O N
GENERAL DESCRIPTION
This module handles the DMSS Boot block memory initialization. It is
responsible for a hardware RAM test and a ROM verification test. The boot
memory read/write data segments are also initialized in this module.
EXTERNALIZED FUNCTIONS
boot_rom_test()
Performs simple ROM image verification.
boot_ram_init()
Zero-Out ZI RAM and copy initialized data (RW-DATA) into RAM
INITIALIZATION AND SEQUENCING REQUIREMENTS
All necessary initialization for normal CPU operation must have
been performed before entering this module.
Copyright (c) 1991-2002 by QUALCOMM Incorporated. All Rights Reserved.
*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/
/*===========================================================================
EDIT HISTORY FOR FILE
This section contains comments describing changes made to the module.
Notice that changes are listed in reverse chronological order.
$Header: L:/src/asw/MSM6000/vcs/bootmem.c_v 1.1 20 Mar 2002 19:35:36 hromero $
when who what, where, why
-------- --- ----------------------------------------------------------
04/02/01 nxb HW watchdog every 256KB during RAM init.
03/12/01 kk Added BOOTHW_KICK_WATCHDOG when zeroing out the zero-init
data segment of application RAM.
03/06/01 bkm Replaced KICK_WATCHDOG with BOOTHW_KICK_WATCHDOG in the
code featurized by FEATURE_IRAM.
09/08/00 jcw Merged in the following changes
jcw Added copy of code from ROM to IRAM
jct Added system mode stack declaration
08/27/00 rmd Replaced KICK_WATCHDOG with BOOTHW_KICK_WATCHDOG (in boothw.h).
Removed macro definition for KICK_WATCHDOG
08/20/99 mk ARM2.5 compiler update.
03/24/99 ms Added support for FEATURE_SI_STACK_WM
03/17/99 ms Changed ROM check to use VBB provided symbols, not pointers
02/19/99 ms Featurized the declaration of fiq_stack.
11/05/98 mdd Improved formatting and comments in boot_ram_init.
11/03/98 mdd Checked into SS archive -- no changes. Version numbers
restart, however.
10/21/98 hcg Initialize all RW RAM areas - Only zero-out ZI areas,
not all of RAM - Added IRQ and FIQ stack definitions
10/14/98 hcg Added h/w watchdog kicks to avoid h/w reset
09/13/98 hcg Updates to ROM/RAM test.
07/26/98 hcg Revised for coding standard, removed unused code
06/01/98 hcg Created
===========================================================================*/
/*===========================================================================
INCLUDE FILES FOR MODULE
===========================================================================*/
#include "bootmem_include.h"
//;#include "armasm.h"
//;#include "mem6000reg.h"
typedef unsigned char boolean; /* Boolean value type. */
typedef unsigned long int uint32; /* Unsigned 32 bit value */
typedef unsigned short uint16; /* Unsigned 16 bit value */
typedef unsigned char uint8; /* Unsigned 8 bit value */
typedef signed long int int32; /* Signed 32 bit value */
typedef signed short int16; /* Signed 16 bit value */
typedef signed char int8; /* Signed 8 bit value */
/* This group are the deprecated types. Their use should be
** discontinued and new code should use the types above
*/
typedef unsigned char byte; /* Unsigned 8 bit value type. */
typedef unsigned short word; /* Unsinged 16 bit value type. */
typedef unsigned long dword; /* Unsigned 32 bit value type. */
/*----------------------------------------------------------------------------
System stacks for each processor mode
----------------------------------------------------------------------------*/
byte svc_stack[SVC_Stack_Size];
/* supervisor mode stack */
byte abort_stack[Abort_Stack_Size];
/* abort mode stack */
byte undef_stack[Undef_Stack_Size];
/* undefined mode stack */
byte irq_stack[IRQ_Stack_Size];
/* IRQ mode stack */
byte sys_stack[Sys_Stack_Size];
/* IRQ mode stack */
#if defined FEATURE_INT_125_FIQ
byte fiq_stack[FIQ_Stack_Size];
/* FIQ mode stack */
#endif
/*----------------------------------------------------------------------------
Static LCD Error Messages
----------------------------------------------------------------------------*/
const char rom_error_msg[] = "ROM FAILED";
/*===========================================================================
FUNCTION boot_rom_test
DESCRIPTION
This function performs a simple ROM test to verify that the target ROM
contains a valid application image by reading the target model number
from the target model number location.
PARAMETERS
None.
DEPENDENCIES
None.
RETURN VALUE
Value of Zero if ROM test passed, otherwise a const char* to the ROM test
fail error message is returned.
SIDE EFFECTS
None.
===========================================================================*/
void*
boot_rom_test()
{
extern word stamp_mob_model;
extern word boot_mob_model;
if (boot_mob_model == stamp_mob_model)
return (void*)0; /* pass */
else
return ( (void *) rom_error_msg);
}
/*============================================================================
FUNCTION BOOT_RAM_INIT
DESCRIPTION
Zero-Out RAM and copy initialized data (RW-DATA) into RAM for both
the bootblock (BB_RAM) and for the application area (APP_RAM).
Note that this function cannot use any variables stored in RAM.
In theory we can use the stack for local variables, but we're not
going to do that just to be safe. Therefore, we bind our local
variables to registers 1-3.
See the scatter loading file (*.scl) for a description of the
structure of RAM.
FORMAL PARAMETERS
None.
DEPENDENCIES
None.
RETURN VALUE
None.
SIDE EFFECTS
Memory not in the initialized image or in the zero-init section is
not affected by this function -- those locations are left in an
unknown state. Also, the watchdog timer is kicked more often than
is strictly necessary, but that is a cheap (time-wise) operation
and will prevent future problems (in case we increase our memory usage).
============================================================================*/
__global_reg(1) dword *dst32;
__global_reg(2) dword *src32;
__global_reg(3) dword *stop_point;
/*
* Pointers to the base and length of BB_RAM segments
*
* These symbols are generated by the linker with $'s instead of _'s. We
* re-name the symbol to use _'s to make valid C identifiers. We embed
* those symbols in bootsys.s so that we have them in the flash.
*/
extern byte *Image__BB_RAM__Base;
extern byte *Image__BB_RAM__Length;
extern byte *Load__BB_RAM__Base;
extern byte *Image__BB_RAM__ZI__Base;
extern byte *Image__BB_RAM__ZI__Length;
/*
* Pointers to the base and length of APP_RAM segments
*
* These symbols are generated by the linker with $'s instead of _'s. We
* re-name the symbol to use _'s to make valid C identifiers. We embed
* those symbols in bootsys.s so that we have them in the flash.
*/
extern byte *Image__BB_RAM__Base;
extern byte *Image__BB_RAM__Length;
extern byte *Load__BB_RAM__Base;
extern byte *Image__BB_RAM__ZI__Base;
extern byte *Image__BB_RAM__ZI__Length;
#if defined(FEATURE_IRAM)
#error code not present
#endif /* FEATURE_IRAM */
void
boot_ram_init()
{
/* kick watchdog at least every 426 ms. */
BOOTHW_KICK_WATCHDOG();
/* Copy initialized data segment for the boot block
*
* This copies data from Load__BB_RAM__Base to Image__BB_RAM__Base
* for the length Image__BB_RAM__Length. This is accomplished by
* running two pointers in parallel -- one points to the flash area
* where the data is stored, and the other points to the RAM. We
* stop when the destination pointer reaches the end of the
* initialized segment (Base + Length). We pre-calculate this point
* and store it in a register for effeciency.
*/
stop_point = (dword *) ( (dword) Image__BB_RAM__Base +
(dword) Image__BB_RAM__Length);
for( src32 = (dword *) Load__BB_RAM__Base,
dst32 = (dword *) Image__BB_RAM__Base;
dst32 < stop_point;
src32++, dst32++ )
{
*dst32 = *src32;
}
/* kick watchdog at least every 426 ms. */
BOOTHW_KICK_WATCHDOG();
/* Zero out the zero-init data segment of the boot block
*
* This writes zeros into the RAM in the zero-init section of the
* boot block ram. This area starts at Image__BB_RAM__ZI_Base and
* continues for Image__BB_RAM__ZI_Length dwords.
*/
stop_point = (dword *) ( (dword) Image__BB_RAM__ZI__Base +
(dword) Image__BB_RAM__ZI__Length);
for( dst32=(dword *) Image__BB_RAM__ZI__Base;
dst32 < stop_point;
dst32++ )
{
*dst32 = 0;
}
/* kick watchdog at least every 426 ms. */
BOOTHW_KICK_WATCHDOG();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -