~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/u-boot/include/nios2-epcs.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
 
3
 * Scott McNutt <smcnutt@psyent.com>
 
4
 *
 
5
 * SPDX-License-Identifier:     GPL-2.0+
 
6
 */
 
7
 
 
8
/*************************************************************************
 
9
 * Altera Nios-II EPCS Controller Core interfaces
 
10
 ************************************************************************/
 
11
 
 
12
#ifndef __NIOS2_EPCS_H__
 
13
#define __NIOS2_EPCS_H__
 
14
 
 
15
typedef struct epcs_devinfo_t {
 
16
        const char      *name;          /* Device name */
 
17
        unsigned char   id;             /* Device silicon id */
 
18
        unsigned char   size;           /* Total size log2(bytes)*/
 
19
        unsigned char   num_sects;      /* Number of sectors */
 
20
        unsigned char   sz_sect;        /* Sector size log2(bytes) */
 
21
        unsigned char   sz_page;        /* Page size log2(bytes) */
 
22
        unsigned char   prot_mask;      /* Protection mask */
 
23
}epcs_devinfo_t;
 
24
 
 
25
/* Resets the epcs controller -- to prevent (potential) soft-reset
 
26
 * problems when booting from the epcs controller
 
27
 */
 
28
extern int epcs_reset (void);
 
29
 
 
30
/* Returns the devinfo struct if EPCS device is found;
 
31
 * NULL otherwise.
 
32
 */
 
33
extern epcs_devinfo_t *epcs_dev_find (void);
 
34
 
 
35
/* Returns the number of bytes used by config data.
 
36
 * Negative on error.
 
37
 */
 
38
extern int epcs_cfgsz (void);
 
39
 
 
40
/* Erase sectors 'start' to 'end' - return zero on success
 
41
 */
 
42
extern int epcs_erase (unsigned start, unsigned end);
 
43
 
 
44
/* Read 'cnt' bytes from device offset 'off' into buf at 'addr'
 
45
 * Zero return on success
 
46
 */
 
47
extern int epcs_read (ulong addr, ulong off, ulong cnt);
 
48
 
 
49
/* Write 'cnt' bytes to device offset 'off' from buf at 'addr'.
 
50
 * Zero return on success
 
51
 */
 
52
extern int epcs_write (ulong addr, ulong off, ulong cnt);
 
53
 
 
54
/* Verify 'cnt' bytes at device offset 'off' comparing with buf
 
55
 * at 'addr'. On failure, write first invalid offset to *err.
 
56
 * Zero return on success
 
57
 */
 
58
extern int epcs_verify (ulong addr, ulong off, ulong cnt, ulong *err);
 
59
 
 
60
#endif /* __NIOS2_EPCS_H__ */