summaryrefslogtreecommitdiff
path: root/nor_flash.h
blob: a5e5e9e0b3b0428b2ee9ee051cd5197bd74e7a30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 */