⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plat_api.c

📁 BY USING THIS SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE TERMS OF * THIS AGREEMENT. DO NOT USE
💻 C
字号:
/****************************************************************************
***  Intel Confidential
***  Copyright (C) Intel Corporation 1994-2002
***  All Rights Reserved.
***  ------------------------------------------------------------------------
***
***
***  Project Name:   Persistent Storage Manager (PSM)
***
***  Module Name:    Platform Specific Library/Services (PLAT) for Cotulla
***
***  File:           PLAT_API.C - External API functions for this module
***
***  File Revision:  $Revision:: 10                                         $
***                      $Date:: 2/13/03 6:39p                              $
***                    $Author:: Fqli                                       $
***
***  Purpose:        Defines all external (API) functions that are
***                  used to interface with the Platform Services module.
***
***  $NoKeywords: $
*****************************************************************************/

/*
*****************************************************************
* NOTICE OF LICENSE AGREEMENT
*
* This code is provided by Intel Corp., and the use is governed   
* under the terms of a license agreement. See license agreement   
* for complete terms of license. 
*
* YOU MAY ONLY USE THE SOFTWARE WITH INTEL FLASH PRODUCTS.  YOUR 
* USE OF THE SOFTWARE WITH ANY OTHER FLASH PRODUCTS IS EXPRESSLY  
* PROHIBITED UNLESS AND UNTIL YOU APPLY FOR, AND ARE GRANTED IN 
* INTEL'S SOLE DISCRETION, A SEPARATE WRITTEN SOFTWARE LICENSE  
* FROM INTEL LICENSING ANY SUCH USE.  
***************************************************************** 
*/

/*-------------------------- Start of PLAT_API.C --------------------------*/


/****************************************************************************
*
* Include Files:
*
* PLAT_API.H - All required definitions, prototypes, and external header files
*
****************************************************************************/
#include "PLAT_API.H"

//#define LANGUAGE_ENG
BOOL RAMCACHE_DEBUGGING = FALSE; 
BOOL RAMCACHE_DETAILED_DEBUGGING =FALSE;
BOOL REG_TIMING = FALSE; 
#define LANGUAGE_ENG

/*
 * This global is used to control whether any "extra" debug statements
 * will come from the idle reclaim task.
 * 
 * True - Enables extra debug statements will be exposed
 *
 * FALSE - Disables these extra checks.
 */
 
BOOL Idle_Reclaim_Debug_Msg = FALSE;

/*------------------------------- Constants -------------------------------*/


/*--------------------- External Function Source Code ---------------------*/


/****************************************************************************
*
* "PLAT_DefineArrayParameters"
*
* DESCRIPTION:
*    This function supplies platform-specific information to the PSM software
*    stack.  It is called by the PSM stack during initialization, to retrieve
*    information about the location of the flash array, as well as information
*    about the size and start offset of the data partition.
*
*    Normally, this function just copies the contents of the local OEMInfo
*    structure out to the caller's memory space.  This procedure is defined
*    as a function, to give OEMs the opportunity to analyze the current state
*    of their system, and adjust these values accordingly (if desired).
*
****************************************************************************/
UINT8 PLAT_DefineArrayParameters(PSM_OEMInfoPtr oem_info_ptr)
{
   static const PSM_OEMInfo oem_info = {


   /* PhysicalReadStartAddress      */   (VOID_PTR)0x00000000,
   /* PhysicalWriteStartAddress     */   (VOID_PTR)0x00000000,
   /* PhysicalBurstReadStartAddress */   (VOID_PTR)0x00000000,
   /* VirtualReadStartAddress       */   (VOID_PTR)0xB8300000,
   /* VirtualWriteStartAddress      */   (VOID_PTR)0xB8300000,
   /* VirtualBurstReadStartAddress  */   (VOID_PTR)0xB8300000,
   /* MaximumArrayLength            */   0x02000000,
   /* MaximumRegistrySize           */   0x00080000,
   #ifndef LANGUAGE_ENG
   /* ManagedAreaStart              */   0x01C00000,
   /* ManagedAreaLength             */   0x00400000,
   #else
   /* ManagedAreaStart              */   0x01e00000,
   /* ManagedAreaLength             */   0x00200000,
   #endif
   /* ReadBusWidth                  */   32,
   /* WriteBusWidth                 */   32,
   /* BurstReadBusWidth             */   0

   };

   /* Copy the local OEMInfo structure out to the caller's structure */
   *oem_info_ptr = oem_info;
    RETAILMSG (1, (TEXT("++++++PLAT_DefineArrayParameters() ManagedAreaStart = 0x%X\r\n"),oem_info.ManagedAreaStart));
    RETAILMSG (1, (TEXT("++++++PLAT_DefineArrayParameters() ManagedAreaLength = 0x%X\r\n"),oem_info.ManagedAreaLength));

   /* All done; return with no errors */
   return(FALSE);
}


/****************************************************************************
*
* "PLAT_FormatRecovery"
*
* DESCRIPTION:
*    This function is called by the PSM software stack if its initialization
*    fails due to (what appears to be) a corrupted data partition.  The
*    purpose of this function is to allow the OEM to decide whether to
*    reformat the data partition, as a "last resort" form of recovery.  Note
*    that this may not be the best course of action, if the OEM suspects that
*    the initialization is failing due to a low-battery condition, rather than
*    because of a data corruption issue in flash.
*
**************************************************0+9574**************************/

UINT8 PLAT_FormatRecovery(PSM_FormatOptionsPtr format_options_ptr)
{                                               
   static const PSM_FormatOptions format_options = {
                    /* MinimumReclaimSize       */  0x4000,
                    /* StreamingGranularity     */  0x400,
                    /* MaxFilenameLength        */  0x100,
                    /* ReclaimThreshold         */  25,
                    /* StreamingOverhead        */  10,
                    /* UpdateAccessTimesEnabled */  FALSE,
                    /* Reserved                 */  FALSE
   };

   /* Copy the local FormatOptions structure out to the caller's structure */
   *format_options_ptr = format_options;

   /* Return TRUE to allow PSM to reformat the data partition */
   return (TRUE);
}

/****************************************************************************
*
* "PLAT_VPEN_ToggleInit"
*
* DESCRIPTION:
*    This function is called by the PSM software stack to to enable or disable
*    the toggling of the flash device Erase/Program/Block lock enable pin.  
*       
*
*    VPEN_VirtualReadRegAddress - A pointer containing an address which can be
*                                 used to read the current state I/O register
*                                 controlling the VPEN line of the flash 
*                                 device.  This information is required to 
*                                 properly change the VPEN I/O bit without 
*                                 changing the state of the other I/O bits that
*                                 may be controled by the register. This 
*                                 address MUST be a valid system address if 
*                                 VPEN_ReadModifyWrite is set to TRUE. 
*
*    VPEN_VirtualSetRegAddress - A pointer containing an address which can be
*                                  used to access the I/O register that controls 
*                                  setting (ouput set to TRUE) VPEN line of the 
*                                  flash device.  This information is required  
*                                  to properly change the VPEN I/O bit.  This 
*                                  address MUST be a valid system address.
*
*    VPEN_VirtualClearRegAddress - A pointer containing an address which can be
*                                  used to access the I/O register that controls 
*                                  clearing (ouput set to FALSE) VPEN line of the 
*                                  flash device.  This information is required  
*                                  to properly change the VPEN I/O bit.  This 
*                                  address MUST be a valid system address. 
*
*    VPEN_SetMask - Defines the bit mask needed to set the VPEN bit active.
*
*    VPEN_ClearMask - Defines the bit mask needed to set the VPEN bit inactive.
*
*    VPEN_ToggleEnabled - Set to TRUE if toggling of VPEN will be used.        
*
*    VPEN_ReadModifyWrite - This defines wether or not the register controlling
*                           the VPEN can be read from. 
*                           Set to FALSE if the register is a write only.  The 
*                           mask value will be store at the Virtual write 
*                           register address location.
*                           Set to TRUE - the current register value will be 
*                           read from the read register address.  Next the mask
*                           will be applied to this value.  (Note if negative 
*                           logic the mask value inverted first) The the value 
*                           is stored at the write register address.     
*
*
****************************************************************************/

BOOL PLAT_VPEN_ToggleInit(PLAT_OEM_VPENToggleInfoPtr vpen_info_ptr)
{
   static const PLAT_OEM_VPENToggleInfo vpen_info = {
         /* VPEN_VirtualReadRegAddress    */  (VOID_PTR)0xab800010,
         /* VPEN_VirtualSetRegAddress     */  (VOID_PTR)0xab800010,
         /* VPEN_VirtualClearRegAddress   */  (VOID_PTR)0xab800010,
         /* VPEN_SetMask                  */  0x0,
         /* VPEN_ClearMask                */  0x0,
         /* VPEN_ToggleEnabled            */  FALSE,
         /* VPEN_ReadModifyWrite          */  FALSE,
   };

   /* Copy the local FormatOptions structure out to the caller's structure */
   *vpen_info_ptr = vpen_info;

   /* All done; return with no errors */
   return (vpen_info.VPEN_ToggleEnabled);


}

/****************************************************************************
*
* "PLAT_DefineSystemIdleEventEnabled"
*
* DESCRIPTION:
*     This fuction is called by the PSM software stack to initialize its 
*     configuration for a system idle event.  The SystemIdleEventEnabled
*     should only be set to TRUE if a name event will be created with the exact 
*     name specified in the users guide and the signalling and unsignalling of
*     the event will be completely comtrolled by the OEM.  The OEM must determine  
*     when the  sytem is "idle" when signalling the event and unsignal the 
*     event when system is in use.      
*
****************************************************************************/

BOOL PLAT_DefineSystemIdleEventEnabled(void)
{
   BOOL SystemIdleEventEnabled = FALSE;

   return (SystemIdleEventEnabled);

}

/****************************************************************************
*
* "PLAT_INTC_AddrInit"
*
* DESCRIPTION:
*   This function is called by the PSM software stack to determine the OEM
*   IRQ Pending Register Address(icip) & FIQ interuppt Pending Register Address
*   location (icfp, if applicable).  These Registers will be polled by PSM to
*   check the pending interrupts to be serviced.  OEM must set appropriate polling
*   flag (say if only IRQ is enabled by OEM or both IRQ and FIQ are enabled)

*    INTC_icipVirtualReadAddress:   This is the absolute virtual address location 
                                    where the OEM implemented the IRQ Pending Register
*    INTC_icfpVirtualReadAdderss:   This is the absolute virtual address location 
                                    where the OEM implemented the  FIQ Pending Register
****************************************************************************/

BOOL  PLAT_INTC_AddrInit(PLAT_OEM_INTC_AddrInfoPtr intc_addr_info_ptr)
{
   static const PLAT_OEM_INTC_AddrInfo intc_addr_info= {
      /*INTC_icipVirtualReadAddress */       (VOID_PTR)0xA6F00000,
      /*INTC_icfpVirtualReadAdderss */       NULL
   };
   *intc_addr_info_ptr = intc_addr_info;
   return (TRUE);

}


/*---------------------------- End of PLAT_API.C --------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -