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

📄 flash_api.h

📁 MIPS下的boottloader yamon 的源代码
💻 H
字号:
#ifndef FLASH_API_H
#define FLASH_API_H

/************************************************************************
 *
 *      FLASH_api.h
 *
 *      The 'FLASH_api' module defines the FLASH device driver
 *      interface to be used via 'FLASH' device driver services:
 *
 *        1) init  device:  configure and initialize FLASH driver
 *        2) open  device:  not used
 *        3) close device:  not used
 *        4) read  device:  not used
 *        5) write device:  write FLASH device
 *        6) ctrl  device:  a) ERASE_SYSTEMFLASH
 *                          b) ERASE_FILEFLASH
 *
 *
 *
 * ######################################################################
 *
 * Copyright (c) 1999-2000 MIPS Technologies, Inc. All rights reserved. 
 * 
 * Unpublished rights reserved under the Copyright Laws of the United States of 
 * America. 
 * 
 * This document contains information that is proprietary to MIPS Technologies, 
 * Inc. ("MIPS Technologies"). Any copying, modifying or use of this information 
 * (in whole or in part) which is not expressly permitted in writing by MIPS 
 * Technologies or a contractually-authorized third party is strictly 
 * prohibited. At a minimum, this information is protected under unfair 
 * competition laws and the expression of the information contained herein is 
 * protected under federal copyright laws. Violations thereof may result in 
 * criminal penalties and fines. 
 * MIPS Technologies or any contractually-authorized third party reserves the 
 * right to change the information contained in this document to improve 
 * function, design or otherwise. MIPS Technologies does not assume any 
 * liability arising out of the application or use of this information. Any 
 * license under patent rights or any other intellectual property rights owned 
 * by MIPS Technologies or third parties shall be conveyed by MIPS Technologies 
 * or any contractually-authorized third party in a separate license agreement 
 * between the parties. 
 * The information contained in this document constitutes one or more of the 
 * following: commercial computer software, commercial computer software 
 * documentation or other commercial items. If the user of this information, or 
 * any related documentation of any kind, including related technical data or 
 * manuals, is an agency, department, or other entity of the United States 
 * government ("Government"), the use, duplication, reproduction, release, 
 * modification, disclosure, or transfer of this information, or any related 
 * documentation of any kind, is restricted in accordance with Federal 
 * Acquisition Regulation 12.212 for civilian agencies and Defense Federal 
 * Acquisition Regulation Supplement 227.7202 for military agencies. The use of 
 * this information by the Government is further restricted in accordance with 
 * the terms of the license agreement(s) and/or applicable contract terms and 
 * conditions covering this information from MIPS Technologies or any 
 * contractually-authorized third party. 
 *
 ************************************************************************/




/************************************************************************
 *    Include files
 ************************************************************************/

#include "sysdefs.h"
#include "syserror.h"

/************************************************************************
 *   FLASH device driver, ERROR completion codes
*************************************************************************/


typedef enum FLASH_error_ids
{
	                              
    ERROR_FLASH_PROGRAM_ERROR        /* Flash device failure         */
          = ERROR_FLASH,  
    ERROR_FLASH_INVALID_ADDRESS,     /* Physical address not impl.   */
    ERROR_FLASH_INVALID_COMMAND,     /* Ctrl. Command not supported  */
    ERROR_FLASH_TIME_OUT,            /* FLASH operation timed out    */
    ERROR_FLASH_VERIFY_ERROR,        /* Program error detected during verify */
    ERROR_FLASH_LOCKED,              /* Some sector(s) locked        */
    ERROR_FLASH_ERASE_ERROR,         /* Some sector(s) have erase error */
    ERROR_FLASH_LOW_VOLTAGE,         /* Low programming voltage detected */
    ERROR_FLASH_WRITE_PROTECTED,     /* Flash is write protected     */
    ERROR_FLASH_FILE_FLASH_PROT,     /* Environment FLASH is write protected */
    ERROR_FLASH_FILE_FLASH_LOCK,     /* Environment FLASH is lock-bit protected */
    ERROR_FLASH_MONITOR_FLASH_LOCK,  /* MONITOR FLASH sector(s) locked */
    ERROR_FLASH_QRY_NOT_FOUND,       /* CFI Query-id string not found  */
    ERROR_FLASH_BOOT_WRITE_PROTECTED  /* Boot is write protected       */


/******* ADD NEW FLASH ERROR TAGS JUST BEFORE THIS LINE ONLY *******/

} t_FLASH_error_ids;


/************************************************************************
 *   FLASH 'ctrl' service, command codes
*************************************************************************/


typedef enum FLASH_ctrl_command_ids
{
    FLASH_CTRL_ERASE_SYSTEMFLASH = 0,      /* FLASH 'ERASE' SYSTEMFLASH */
    FLASH_CTRL_ERASE_FILEFLASH,            /* FLASH 'ERASE' FILEFLASH   */
    FLASH_CTRL_ERASE_FLASH_AREA,           /* FLASH 'ERASE' (partial) 
                                                     FLASH AREA         */
    FLASH_CTRL_INQUIRE_FLASH_AREA,         /* FLASH 'INQUIRE' committed
                                                     FLASH BLOCK AREA   */
    FLASH_CTRL_TEST_SYSTEMFLASH,           /* FLASH 'TEST' SYSTEMFLASH  */
    FLASH_CTRL_WRITE_FILEFLASH,            /* FLASH 'WRITE' FILEFLASH   */
    FLASH_CTRL_TEST_MONITORFLASH           /* FLASH 'TEST' MONITORFLASH */
} t_FLASH_ctrl_command_ids;


/************************************************************************
 *  Parameter definitions
*************************************************************************/


/* 
    FLASH write descriptor, to be used with FLASH-'write' service
                                                                        */
typedef struct FLASH_write_descriptor
{
    UINT32 adr ;           /* physical address to start programming;
                              this address can be in FLASH or RAM
                              space.                                   */ 
    UINT32 length ;        /* number of bytes to write                 */
    UINT8  *buffer ;       /* pointer for buffer of data to be written */
} t_FLASH_write_descriptor ;


/*
    FLASH ctrl descriptor, to be used with specific FLASH services
                                                                        */
typedef struct FLASH_ctrl_descriptor
{
    UINT32 command ;       /* IN: 'ctrl' command (ERASE_SYSTEMFLASH,..)     */
    UINT32 user_physadr ;  /* IN:  users request of physical address 
                                                    to start erase          */ 
    UINT32 user_length ;   /* IN:  users request of number of bytes 
                                                    to erase                */
    UINT32 driver_physadr ;/* OUT: drivers committed physical address 
                                                    to start erase          */ 
    UINT32 driver_length ; /* OUT: drivers committed number of bytes 
                                                    to erase                */
    t_FLASH_write_descriptor
           *wr_param ;     /* IN:  pointer for buffer of data to be written */
} t_FLASH_ctrl_descriptor ;


/************************************************************************
 *  FLASH device driver, minor device numbers
*************************************************************************/




/************************************************************************
 *  FLASH device driver services, called by IO subsystem
*************************************************************************/



/* 
   NAME:  'init'

   DESCRIPTION:
   This service initializes the FLASH driver to handle all 
   FLASH devices on this board environment (set of minor devices)

   RETURN VALUES:
   'OK' = 0x00

                                                                        */
typedef INT32 (*t_FLASH_init_service)( 
          UINT32 major,          /* IN: major device number             */
          UINT32 minor,          /* not used                            */
          void   *p_param ) ;    /* not used                            */



/* 
   NAME: 'open'    NOT USED

   DESCRIPTION:
     -

   RETURN VALUES:
     -
                                                                        */


/* 
   NAME: 'close'   NOT USED

   DESCRIPTION:
     -

   RETURN VALUES:
     -
                                                                        */


/* 
   NAME: 'write'

   DESCRIPTION:
   This service writes data into a specified physical location, which
   can be in either SYSTEM-RAM, SYSTEM-FLASH or FILE-FLASH space.

   RETURN VALUES:
   'OK' = 0x00:                         data has been stored           
    ERROR_FLASH_PROGRAM_ERROR           Flash device failure           
    ERROR_FLASH_INVALID_ADDRESS,        Physical address not impl.     

                                                                     */
typedef INT32 (*t_FLASH_write_service)( 
          UINT32 major,          /* IN: major device number          */
          UINT32 minor,          /* IN: minor device number          */
          t_FLASH_write_descriptor *p_param ) ; /* OUT: write data   */



/*
   NAME: 'ctrl'

   DESCRIPTION:
   This service comprise following specific FLASH services:
     1) 'ERASE_SYSTEMFLASH' device.
     2) 'ERASE_FILEFLASH'   device.

   RETURN VALUES:
   'OK' = 0x00:                 FLASH service completed successfully
   'ERROR_FLASH_PROGRAM_ERROR'  FLASH device failure

                                                                        */
typedef INT32 (*t_FLASH_ctrl_service)(
          UINT32 major,          /* IN: major device number             */
          UINT32 minor,          /* IN: minor device number             */
          t_FLASH_ctrl_descriptor *p_param ) ; /* INOUT: FLASH device   */

#endif /* #ifndef FLASH_API_H */

⌨️ 快捷键说明

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