OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [include/] [flash.h] - Blame information for rev 467

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marcus.erl
#ifndef _FLASH_H
2
#define _FLASH_H
3
 
4 467 julius
#ifdef FLASH_BASE_ADDR
5
 
6 2 marcus.erl
#ifdef FLASH_ORG_16_2
7
/* INC_ADDR = for how many bytes address should be incremented */
8
#define INC_ADDR             4
9
#define reg_write(a,b)       (REG32(a) = b)
10
#define reg_read(a)          (REG32(a))
11
#define check_error_bit(a,b) ((a & (b << 16)) || (a & b))
12
#define fl_wait_busy(a)      (!(a & (FL_SR_WSM_READY << 16)) || !(a & FL_SR_WSM_READY))
13
 
14
#elif FLASH_ORG_16_1
15
#define INC_ADDR             2
16
#define reg_write(a,b)       (REG16(a) = (unsigned short)b)
17
#define reg_read(a)          (REG16(a))
18
#define check_error_bit(a,b) (a & b)
19
#define fl_wait_busy(a)      (!(a & FL_SR_WSM_READY))
20
#else
21
#error Flash organization is not set! Check board.h.
22
#endif
23
 
24
#define FL_SR_WSM_READY   0x80
25
#define FL_SR_ERASE_ERR   0x20
26
#define FL_SR_PROG_ERR    0x40
27
#define FL_SR_PROG_LV     0x08
28
#define FL_SR_LOCK        0x02
29
 
30
int fl_init (void);
31
int fl_unlock_one_block (unsigned long addr);
32
int fl_unlock_blocks (void);
33
int fl_word_program (unsigned long addr, unsigned long val);
34
int fl_block_erase (unsigned long addr);
35
 
36
/* erase = 1 (whole chip), erase = 2 (required only) */
37
int fl_program (unsigned long src_addr, unsigned long dst_addr, unsigned long len, int erase, int verify);
38
 
39
/*
40
 * Next definitions and functions are here, because we need there flash
41
 * functions in RAM (when we are running orpmon from Flash). They are
42
 * copied to RAM and fl_ext_program, fl_ext_erase and fl_ext_unlock are
43
 * pointing to them.
44
 */
45
typedef int(*t_fl_ext_program)(unsigned long, unsigned long);
46
typedef int(*t_fl_erase)(unsigned long);
47
 
48
typedef void(*t_uart_putc)(unsigned char);
49
 
50
t_fl_ext_program fl_ext_program;
51
t_fl_erase fl_ext_erase, fl_ext_unlock;
52
 
53 467 julius
#endif
54
 
55 2 marcus.erl
#endif /* _FLASH_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.