OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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