diff options
Diffstat (limited to 'nor_flash.h')
-rw-r--r-- | nor_flash.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/nor_flash.h b/nor_flash.h new file mode 100644 index 0000000..a5e5e9e --- /dev/null +++ b/nor_flash.h @@ -0,0 +1,57 @@ +/* + Nios-sim - one simple NIOSII simulator only for personal interest and fun. + Copyright (C) 2010 chysun2000@gmail.com + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef __NOR_FLASH_H__ +#define __NOR_FLASH_H__ + +#include <stdio.h> +#include <stdlib.h> + +#include "io_device.h" + +#define NOR_FLASH_OPS_CNT (10) +struct nor_flash_operations{ + uint32_t addr; + uint32_t value; +}; + +#define STATUS_READ (0) +#define STATUS_WRITE (1) +#define STATUS_CHIP_ERASE (2) +#define STATUS_SECTION_ERASE (3) + +#define NOR_FLASH_BASE_ADDR (0x0000) +#define NOR_FLASH_SIZE (0x400000) +#define NOR_FLASH_BUS_WIDTH (8) + +struct nor_flash_core_hw { + struct nor_flash_operations ops[10]; + uint32_t phys_base_addr; + uint32_t size; + uint32_t status; + uint8_t * mem_base_addr; + uint32_t bus_width; +}; + +extern struct io_device nor_flash_core; +extern uint8_t * nor_flash_mem_addr(void); +#endif /* end of nor_flash.h */ + + + |