2 * Definitions for bulk memory services
4 * bulkmem.h 1.12 2000/06/12 21:55:41
6 * The contents of this file are subject to the Mozilla Public License
7 * Version 1.1 (the "License"); you may not use this file except in
8 * compliance with the License. You may obtain a copy of the License
9 * at http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS"
12 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
13 * the License for the specific language governing rights and
14 * limitations under the License.
16 * The initial developer of the original code is David A. Hinds
17 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
18 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
20 * Alternatively, the contents of this file may be used under the
21 * terms of the GNU General Public License version 2 (the "GPL"), in which
22 * case the provisions of the GPL are applicable instead of the
23 * above. If you wish to allow the use of your version of this file
24 * only under the terms of the GPL and not to allow others to use
25 * your version of this file under the MPL, indicate your decision by
26 * deleting the provisions above and replace them with the notice and
27 * other provisions required by the GPL. If you do not delete the
28 * provisions above, a recipient may use your version of this file
29 * under either the MPL or the GPL.
30 * bulkmem.h 1.3 1995/05/27 04:49:49
33 #ifndef _LINUX_BULKMEM_H
34 #define _LINUX_BULKMEM_H
36 /* For GetFirstRegion and GetNextRegion */
37 typedef struct region_info_t {
44 u_char JedecMfr, JedecInfo;
48 #define REGION_TYPE 0x0001
49 #define REGION_TYPE_CM 0x0000
50 #define REGION_TYPE_AM 0x0001
51 #define REGION_PREFETCH 0x0008
52 #define REGION_CACHEABLE 0x0010
53 #define REGION_BAR_MASK 0xe000
54 #define REGION_BAR_SHIFT 13
57 typedef struct open_mem_t {
62 /* Attributes for OpenMemory */
63 #define MEMORY_TYPE 0x0001
64 #define MEMORY_TYPE_CM 0x0000
65 #define MEMORY_TYPE_AM 0x0001
66 #define MEMORY_EXCLUSIVE 0x0002
67 #define MEMORY_PREFETCH 0x0008
68 #define MEMORY_CACHEABLE 0x0010
69 #define MEMORY_BAR_MASK 0xe000
70 #define MEMORY_BAR_SHIFT 13
72 typedef struct eraseq_entry_t {
73 memory_handle_t Handle;
80 typedef struct eraseq_hdr_t {
82 eraseq_entry_t *QueueEntryArray;
85 #define ERASE_QUEUED 0x00
86 #define ERASE_IN_PROGRESS(n) (((n) > 0) && ((n) < 0x80))
87 #define ERASE_IDLE 0xff
88 #define ERASE_PASSED 0xe0
89 #define ERASE_FAILED 0xe1
91 #define ERASE_MISSING 0x80
92 #define ERASE_MEDIA_WRPROT 0x84
93 #define ERASE_NOT_ERASABLE 0x85
94 #define ERASE_BAD_OFFSET 0xc1
95 #define ERASE_BAD_TECH 0xc2
96 #define ERASE_BAD_SOCKET 0xc3
97 #define ERASE_BAD_VCC 0xc4
98 #define ERASE_BAD_VPP 0xc5
99 #define ERASE_BAD_SIZE 0xc6
102 typedef struct copy_op_t {
109 /* For ReadMemory and WriteMemory */
110 typedef struct mem_op_t {
116 #define MEM_OP_BUFFER 0x01
117 #define MEM_OP_BUFFER_USER 0x00
118 #define MEM_OP_BUFFER_KERNEL 0x01
119 #define MEM_OP_DISABLE_ERASE 0x02
120 #define MEM_OP_VERIFY 0x04
122 /* For RegisterMTD */
123 typedef struct mtd_reg_t {
130 * Definitions for MTD requests
133 typedef struct mtd_request_t {
135 u_int DestCardOffset;
136 u_int TransferLength;
143 /* Fields in MTD Function */
144 #define MTD_REQ_ACTION 0x003
145 #define MTD_REQ_ERASE 0x000
146 #define MTD_REQ_READ 0x001
147 #define MTD_REQ_WRITE 0x002
148 #define MTD_REQ_COPY 0x003
149 #define MTD_REQ_NOERASE 0x004
150 #define MTD_REQ_VERIFY 0x008
151 #define MTD_REQ_READY 0x010
152 #define MTD_REQ_TIMEOUT 0x020
153 #define MTD_REQ_LAST 0x040
154 #define MTD_REQ_FIRST 0x080
155 #define MTD_REQ_KERNEL 0x100
158 #define MTD_WAITREQ 0x00
159 #define MTD_WAITTIMER 0x01
160 #define MTD_WAITRDY 0x02
161 #define MTD_WAITPOWER 0x03
164 * Definitions for MTD helper functions
167 /* For MTDModifyWindow */
168 typedef struct mtd_mod_win_t {
175 typedef struct mtd_vpp_req_t {
180 typedef struct mtd_rdy_req_t {
185 MTDRequestWindow, MTDModifyWindow, MTDReleaseWindow,
186 MTDSetVpp, MTDRDYMask
189 #ifdef IN_CARD_SERVICES
190 extern int MTDHelperEntry(int func, void *a1, void *a2);
192 extern int MTDHelperEntry(int func, ...);
195 int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn);
196 int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn);
197 int pcmcia_register_mtd(client_handle_t handle, mtd_reg_t *reg);
198 int pcmcia_register_erase_queue(client_handle_t *handle, eraseq_hdr_t *header, eraseq_handle_t *e);
199 int pcmcia_deregister_erase_queue(eraseq_handle_t eraseq);
200 int pcmcia_check_erase_queue(eraseq_handle_t eraseq);
201 int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_t *m);
202 int pcmcia_close_memory(memory_handle_t handle);
203 int pcmcia_read_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
204 int pcmcia_write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
205 int pcmcia_copy_memory(memory_handle_t handle, copy_op_t *req);
207 #endif /* _LINUX_BULKMEM_H */