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

📄 flash_strata.c

📁 MIPS YAMON, a famous monitor inc. source, make file and PDF manuals.
💻 C
📖 第 1 页 / 共 5 页
字号:
 *  Return values : *  --------------- * *  FALSE: not write protected *  TRUE:  write protected * * ************************************************************************/staticbool FLASH_STRATA_is_monitor_flash_write_protected( void ) ;/************************************************************************ * *                          FLASH_STRATA_devicetype *  Description : *  ------------- *  Derive the memory device type from 'physical address' *   * *  Parameters : *  ------------ * *  'physadr': physical address inside a 512 MByte space * * *  Return values : *  --------------- * *  t_flash_device_id:    memory device type detected. * * ************************************************************************/statict_flash_device_id FLASH_STRATA_devicetype( UINT32 physadr ) ;/************************************************************************ * *                          FLASH_STRATA_program_systemram *  Description : *  ------------- *  Programs (store data) in the system RAM device. *   * *  Parameters : *  ------------ * *  'p_param',   IN,    variable of type, t_FLASH_write_descriptor. * * *  Return values : *  --------------- * * 'OK' = 0x00:             Data stored in system RAM * * ************************************************************************/staticINT32 FLASH_STRATA_program_systemram( t_FLASH_write_descriptor *p_param ) ;/************************************************************************ * *                          FLASH_STRATA_program_flash *  Description : *  ------------- *  Programs a Intel 28Fxxx-compliant flash device. *   * *  Parameters : *  ------------ * *  'p_param',   IN,    variable of type, t_FLASH_write_descriptor. * * *  Return values : *  --------------- * * 'OK' = 0x00:                         FLASH programmed succesfully *  ERROR_FLASH_PROGRAM_ERROR           Flash device failure * * ************************************************************************/staticINT32 FLASH_STRATA_program_flash( t_FLASH_write_descriptor *p_param ) ;/************************************************************************ * *                          FLASH_STRATA_set_systemflash_read *  Description : *  ------------- *  Set system flash device in read mode. *   * *  Parameters : *  ------------ * *  - * * *  Return values : *  --------------- * * 'OK' = 0x00:                         System FLASH set to read mode *  ERROR_FLASH_PROGRAM_ERROR           Flash device failure * * ************************************************************************/staticINT32 FLASH_STRATA_set_systemflash_read( void ) ;/************************************************************************ * *                          FLASH_STRATA_set_fileflash_read *  Description : *  ------------- *  Set file flash device in read mode. *   * *  Parameters : *  ------------ * *  - * * *  Return values : *  --------------- * * 'OK' = 0x00:                         File FLASH set to read mode *  ERROR_FLASH_PROGRAM_ERROR           Flash device failure * * ************************************************************************/staticINT32 FLASH_STRATA_set_fileflash_read( void ) ;/************************************************************************ * *                          FLASH_STRATA_set_monitorflash_read *  Description : *  ------------- *  Set monitor flash device in read mode. *   * *  Parameters : *  ------------ * *  - * * *  Return values : *  --------------- * * 'OK' = 0x00:                         File FLASH set to read mode *  ERROR_FLASH_PROGRAM_ERROR           Flash device failure * * ************************************************************************/staticINT32 FLASH_STRATA_set_monitorflash_read( void ) ;/************************************************************************ * *                          FLASH_STRATA_erase_fileflash *  Description : *  ------------- *  Erase file flash, which is the last block (in each FLASH device) *  of the monitor flash. *   * *  Parameters : *  ------------ * *  - * *  Return values : *  --------------- * * 'OK' = 0x00:                         File FLASH erased succesfully *  ERROR_FLASH_PROGRAM_ERROR           Flash device failure * * ************************************************************************/staticINT32 FLASH_STRATA_erase_fileflash( void ) ;/************************************************************************ * *                          FLASH_STRATA_erase_flasharea *  Description : *  ------------- *  Erase flash area; i.e. the driver erases the flash blocks inside  *  the specified memory area. *   * *  Parameters : *  ------------ *  *  'p_param',   IN,    variable of type, t_FLASH_ctrl_descriptor. * * *  Return values : *  --------------- * * 'OK' = 0x00:                         FLASH erased succesfully *  ERROR_FLASH_PROGRAM_ERROR           Flash device failure *  ERROR_FLASH_INVALID_ADDRESS         Address area not inside FLASH *                                      devices * * ************************************************************************/staticINT32 FLASH_STRATA_erase_flasharea( t_FLASH_ctrl_descriptor *p_param ) ; /************************************************************************ * *                          FLASH_STRATA_inquire_flasharea *  Description : *  ------------- *  Inquire flash area; i.e. the driver calculates the effective flash *  block area covering the specified memory area. *   * *  Parameters : *  ------------ *  *  'p_param',   IN,    variable of type, t_FLASH_ctrl_descriptor. * * *  Return values : *  --------------- * * 'OK' = 0x00:                         Area specified inside valid *                                      FLASH device area *  ERROR_FLASH_INVALID_ADDRESS         Address area not inside FLASH *                                      devices * * ************************************************************************/staticINT32 FLASH_STRATA_inquire_flasharea( t_FLASH_ctrl_descriptor *p_param ) ; /************************************************************************ * *                          FLASH_STRATA_test_systemflash *  Description : *  ------------- *  Test complete system flash. *   * *  Parameters : *  ------------ * *  - * *  Return values : *  --------------- * * 'OK' = 0x00:                         System FLASH OK *  ERROR_FLASH_LOCKED                  Some sector(s) locked *  ERROR_FLASH_ERASE_ERROR             Some sector(s) have erase error * * ************************************************************************/staticINT32 FLASH_STRATA_test_systemflash( void ) ;/************************************************************************ * *                          FLASH_STRATA_test_fileflash *  Description : *  ------------- *  Test complete file flash (just one block) *   * *  Parameters : *  ------------ * *  - * *  Return values : *  --------------- * * 'OK' = 0x00:                         System FLASH OK *  ERROR_FLASH_LOCKED                  Some sector(s) locked *  ERROR_FLASH_ERASE_ERROR             Some sector(s) have erase error * * ************************************************************************/staticINT32 FLASH_STRATA_test_fileflash( void ) ;staticINT32 FLASH_STRATA_test_monitorflash( void ) ;/************************************************************************ * *                          FLASH_STRATA_wait_ready *  Description : *  ------------- *   *  Await FLASH operation completes. *   * *  Parameters : *  ------------ * *  - * *  Return values : *  --------------- * * 'OK' = 0x00:                         File FLASH erased succesfully *  ERROR_FLASH_PROGRAM_ERROR           Flash device failure * * ************************************************************************/staticINT32 FLASH_STRATA_wait_ready(UINT32 pw, UINT32 retry ) ;/************************************************************************ * *                          FLASH_STRATA_error_lookup *  Description : *  ------------- *  Lookup error code to error string(s) *   * *  Parameters : *  ------------ *  *  'p_param',   INOUT,    variable of type, t_sys_error_string. * * *  Return values : *  --------------- * * 'OK' = 0x00:   * * ************************************************************************/staticINT32 FLASH_STRATA_error_lookup( t_sys_error_string *p_param ) ;/************************************************************************ *      Implementation : Public functions ************************************************************************//************************************************************************ * *                          FLASH_STRATA_install *  Description : *  ------------- * *  Installs the STRATA FLASH device drivers services in  *  the IO system at the reserved device slot, found in the *  'sysdev.h' file, which defines all major device numbers. * *  Note: *  This service is the only public declared interface function; all *  provided device driver services are static declared, but this *  function installs the function pointers in the io-system to *  enable the provided public driver services. * *  Parameters : *  ------------ * *  - * * *  Return values : *  --------------- * *  'OK'(=0) *  'ERROR_IO_ILLEGAL_MAJOR':  Illegal major device number *  'ERROR_IO_NO_SPACE':       Device slot already allocated * ************************************************************************/INT32 FLASH_STRATA_install( void ){    t_sys_error_lookup_registration registration ;    /* register lookup syserror */    registration.prefix = SYSERROR_DOMAIN( ERROR_FLASH ) ;    registration.lookup = FLASH_STRATA_error_lookup ;    SYSCON_write( SYSCON_ERROR_REGISTER_LOOKUP_ID,                  &registration,                   sizeof( registration ) );    /* pre-initialize local variables and install device services */    IO_install( SYS_MAJOR_FLASH_STRATA,         /* major device number */           (t_io_service) FLASH_STRATA_init,    /* 'init'  service     */                          NULL,                 /* 'open'  service  na */                          NULL,                 /* 'close' service  na */                          NULL,                 /* 'read'  service     */           (t_io_service) FLASH_STRATA_write,   /* 'write' service     */           (t_io_service) FLASH_STRATA_ctrl ) ; /* 'ctrl'  service     */    /* call our own 'init' service */    return IO_init( SYS_MAJOR_FLASH_STRATA, 0, NULL);}/************************************************************************ *      Implementation : Static functions ************************************************************************//************************************************************************ * *                          FLASH_STRATA_init *  Description : *  ------------- *  This service initializes the FLASH_STRATA driver. *   * *  Parameters : *  ------------ * *  'major',     IN,    major device number *  'minor',     IN,    not used *  'p_param',   INOUT, not used

⌨️ 快捷键说明

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