Mercurial > flash_v2
comparison packages/io/flash/current/include/flash.h @ 115:6ed91473a1cd ecos-sw-2000-08-21
Merge from eCos master repository on 2000-08-21-22:40:54-BST
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2000 17:32:38 +0000 |
| parents | |
| children | 77cec8369160 |
comparison
equal
deleted
inserted
replaced
| 114:5ad2b71d525e | 115:6ed91473a1cd |
|---|---|
| 1 //========================================================================== | |
| 2 // | |
| 3 // flash.h | |
| 4 // | |
| 5 // Flash programming - external interfaces | |
| 6 // | |
| 7 //========================================================================== | |
| 8 //####COPYRIGHTBEGIN#### | |
| 9 // | |
| 10 // ------------------------------------------- | |
| 11 // The contents of this file are subject to the Red Hat eCos Public License | |
| 12 // Version 1.1 (the "License"); you may not use this file except in | |
| 13 // compliance with the License. You may obtain a copy of the License at | |
| 14 // http://www.redhat.com/ | |
| 15 // | |
| 16 // Software distributed under the License is distributed on an "AS IS" | |
| 17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 18 // License for the specific language governing rights and limitations under | |
| 19 // the License. | |
| 20 // | |
| 21 // The Original Code is eCos - Embedded Configurable Operating System, | |
| 22 // released September 30, 1998. | |
| 23 // | |
| 24 // The Initial Developer of the Original Code is Red Hat. | |
| 25 // Portions created by Red Hat are | |
| 26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. | |
| 27 // All Rights Reserved. | |
| 28 // ------------------------------------------- | |
| 29 // | |
| 30 //####COPYRIGHTEND#### | |
| 31 //========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): gthomas | |
| 35 // Contributors: gthomas | |
| 36 // Date: 2000-07-14 | |
| 37 // Purpose: | |
| 38 // Description: | |
| 39 // | |
| 40 //####DESCRIPTIONEND#### | |
| 41 // | |
| 42 //========================================================================== | |
| 43 | |
| 44 #ifndef _IO_FLASH_H_ | |
| 45 #define _IO_FLASH_H_ | |
| 46 | |
| 47 #define FLASH_MIN_WORKSPACE 0x10000 // Space used by FLASH code | |
| 48 | |
| 49 extern int flash_init(void *work_space, int work_space_length); | |
| 50 extern int flash_erase(void *base, int len, void **err_address); | |
| 51 extern int flash_program(void *flash_base, void *ram_base, int len, void **err_address); | |
| 52 extern int flash_verify_addr(void *base); | |
| 53 extern int flash_get_limits(void *base, void **start, void **end); | |
| 54 extern int flash_get_block_info(int *block_size, int *blocks); | |
| 55 extern bool flash_code_overlaps(void *start, void *end); | |
| 56 extern char *flash_errmsg(int err); | |
| 57 | |
| 58 #define FLASH_ERR_OK 0x00 // No error - operation complete | |
| 59 #define FLASH_ERR_INVALID 0x01 // Invalid FLASH address | |
| 60 #define FLASH_ERR_ERASE 0x02 // Error trying to erase | |
| 61 #define FLASH_ERR_LOCK 0x03 // Error trying to lock/unlock | |
| 62 #define FLASH_ERR_PROGRAM 0x04 // Error trying to program | |
| 63 #define FLASH_ERR_PROTOCOL 0x05 // Generic error | |
| 64 #define FLASH_ERR_PROTECT 0x06 // Device/region is write-protected | |
| 65 #define FLASH_ERR_NOT_INIT 0x07 // FLASH info not yet initialized | |
| 66 #define FLASH_ERR_HWR 0x08 // Hardware (configuration?) problem | |
| 67 | |
| 68 #ifdef _FLASH_PRIVATE_ | |
| 69 | |
| 70 struct flash_info { | |
| 71 void *work_space; | |
| 72 int work_space_size; | |
| 73 int block_size; // Assuming fixed size "blocks" | |
| 74 int blocks; // Number of blocks | |
| 75 unsigned long block_mask; | |
| 76 void *start, *end; // Address range | |
| 77 int init; | |
| 78 }; | |
| 79 | |
| 80 extern struct flash_info flash_info; | |
| 81 extern int flash_hwr_init(void); | |
| 82 extern int flash_hwr_map_error(int err); | |
| 83 | |
| 84 #endif | |
| 85 | |
| 86 #endif // _IO_FLASH_H_ |
