Blame view

include/nios2-epcs.h 1.81 KB
0c1c117cf   wdenk   * Patch by Scott ...
1
2
3
4
  /*
   * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
   * Scott McNutt <smcnutt@psyent.com>
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
5
   * SPDX-License-Identifier:	GPL-2.0+
0c1c117cf   wdenk   * Patch by Scott ...
6
7
8
9
10
11
12
13
14
15
   */
  
  /*************************************************************************
   * Altera Nios-II EPCS Controller Core interfaces
   ************************************************************************/
  
  #ifndef __NIOS2_EPCS_H__
  #define __NIOS2_EPCS_H__
  
  typedef struct epcs_devinfo_t {
53677ef18   Wolfgang Denk   Big white-space c...
16
  	const char	*name;		/* Device name */
0c1c117cf   wdenk   * Patch by Scott ...
17
18
19
20
21
22
23
  	unsigned char	id;		/* Device silicon id */
  	unsigned char	size;		/* Total size log2(bytes)*/
  	unsigned char	num_sects;	/* Number of sectors */
  	unsigned char	sz_sect;	/* Sector size log2(bytes) */
  	unsigned char	sz_page;	/* Page size log2(bytes) */
  	unsigned char   prot_mask;	/* Protection mask */
  }epcs_devinfo_t;
1f6ce8f5b   Scott McNutt   Nios II - Add EPC...
24
25
26
27
  /* Resets the epcs controller -- to prevent (potential) soft-reset
   * problems when booting from the epcs controller
   */
  extern int epcs_reset (void);
0c1c117cf   wdenk   * Patch by Scott ...
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
58
  /* Returns the devinfo struct if EPCS device is found;
   * NULL otherwise.
   */
  extern epcs_devinfo_t *epcs_dev_find (void);
  
  /* Returns the number of bytes used by config data.
   * Negative on error.
   */
  extern int epcs_cfgsz (void);
  
  /* Erase sectors 'start' to 'end' - return zero on success
   */
  extern int epcs_erase (unsigned start, unsigned end);
  
  /* Read 'cnt' bytes from device offset 'off' into buf at 'addr'
   * Zero return on success
   */
  extern int epcs_read (ulong addr, ulong off, ulong cnt);
  
  /* Write 'cnt' bytes to device offset 'off' from buf at 'addr'.
   * Zero return on success
   */
  extern int epcs_write (ulong addr, ulong off, ulong cnt);
  
  /* Verify 'cnt' bytes at device offset 'off' comparing with buf
   * at 'addr'. On failure, write first invalid offset to *err.
   * Zero return on success
   */
  extern int epcs_verify (ulong addr, ulong off, ulong cnt, ulong *err);
  
  #endif /* __NIOS2_EPCS_H__ */