Rev 80 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * (see the web pages for full authors list) |
||
13 | * |
||
14 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
15 | * |
||
16 | * http://www.sssup.it |
||
17 | * http://retis.sssup.it |
||
18 | * http://shark.sssup.it |
||
19 | */ |
||
20 | |||
21 | |||
22 | /* |
||
23 | * Copyright (C) 1999 Massimiliano Giorgi |
||
24 | * |
||
25 | * This program is free software; you can redistribute it and/or modify |
||
26 | * it under the terms of the GNU General Public License as published by |
||
27 | * the Free Software Foundation; either version 2 of the License, or |
||
28 | * (at your option) any later version. |
||
29 | * |
||
30 | * This program is distributed in the hope that it will be useful, |
||
31 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
32 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
33 | * GNU General Public License for more details. |
||
34 | * |
||
35 | * You should have received a copy of the GNU General Public License |
||
36 | * along with this program; if not, write to the Free Software |
||
37 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
38 | * |
||
39 | */ |
||
40 | |||
41 | /* |
||
80 | pj | 42 | * CVS : $Id: bdevinit.h,v 1.2 2003-03-13 13:37:58 pj Exp $ |
2 | pj | 43 | * |
44 | * File: $File$ |
||
80 | pj | 45 | * Revision: $Revision: 1.2 $ |
46 | * Last update: $Date: 2003-03-13 13:37:58 $ |
||
2 | pj | 47 | */ |
48 | |||
49 | #ifndef _HARTIK_BDEVINIT_H |
||
50 | #define _HARTIK_BDEVINIT_H |
||
51 | |||
52 | #include <kernel/model.h> |
||
53 | |||
54 | #include <fs/types.h> |
||
55 | #include <fs/const.h> |
||
56 | #include <fs/bdevconf.h> |
||
1689 | fabio | 57 | #include <arch/sys/cdefs.h> |
2 | pj | 58 | |
80 | pj | 59 | __BEGIN_DECLS |
60 | |||
2 | pj | 61 | /* prolog */ |
62 | #define BASE_BDEV_START 0 |
||
63 | |||
64 | /* |
||
65 | * IDE |
||
66 | */ |
||
67 | |||
68 | #ifdef IDE_BLOCK_DEVICE |
||
69 | |||
70 | typedef struct ide_parms { |
||
71 | void *parm_initserver; |
||
72 | } IDE_PARMS; |
||
73 | |||
74 | #define IDEPARMS(ptr) ((ptr)->ideparms) |
||
75 | |||
76 | #define BASE_BDEV_IDE BASE_BDEV_START,{NULL} |
||
77 | |||
78 | /* |
||
79 | typedef struct ide_parms { |
||
80 | __uint8_t pclass; |
||
81 | __uint32_t dline; |
||
82 | __uint32_t wcet; |
||
83 | } IDE_PARMS; |
||
84 | |||
85 | #define BASE_IDE {DEFAULT,DEFAULT,DEFAULT} |
||
86 | |||
87 | #define ide_def_task(s,p,d,w) {(s).pclass=(p); (s).dline=(d); (s).wcet=(w);} |
||
88 | */ |
||
89 | |||
90 | #else |
||
91 | |||
92 | #define BASE_BDEV_IDE BASE_BDEV_START |
||
93 | |||
94 | #endif |
||
95 | |||
96 | /* |
||
97 | * LOOP |
||
98 | */ |
||
99 | |||
100 | #ifdef LOOP_BLOCK_DEVICE |
||
101 | |||
102 | typedef struct loop_parms { |
||
103 | int dummy; |
||
104 | } LOOP_PARMS; |
||
105 | |||
106 | #define BASE_BDEV_LOOP BASE_BDEV_IDE,{0} |
||
107 | |||
108 | #else |
||
109 | |||
110 | #define BASE_BDEV_LOOP BASE_BDEV_IDE |
||
111 | |||
112 | #endif |
||
113 | |||
114 | /* epilog */ |
||
115 | #define BASE_BDEV_OPTIONAL BASE_BDEV_LOOP |
||
116 | |||
117 | /* |
||
118 | * block device params structure |
||
119 | */ |
||
120 | |||
121 | extern NPP_mutexattr_t bdevdef_mutexattr; |
||
122 | |||
123 | typedef struct bdev_parms { |
||
124 | __uint32_t showinfo:1; |
||
125 | char *config; |
||
126 | void *bmutexattr; |
||
127 | |||
128 | __uint16_t dummy; |
||
129 | |||
130 | #ifdef IDE_BLOCK_DEVICE |
||
131 | IDE_PARMS ideparms; |
||
132 | #endif |
||
133 | |||
134 | #ifdef LOOP_BLOCK_DEVICE |
||
135 | LOOP_PARMS loopparms; |
||
136 | #endif |
||
137 | |||
138 | } BDEV_PARMS; |
||
139 | |||
140 | #define bdev_def_showinfo(s,v) ((s).showinfo=(v)&1) |
||
141 | #define bdev_def_configstring(s,v) ((s).config=(v)) |
||
142 | #define bdev_def_mutexattrptr(s,v) ((s).bmutexattr=(v)) |
||
143 | |||
144 | #define BASE_BDEV {0,NULL,(void*)&bdevdef_mutexattr,BASE_BDEV_OPTIONAL} |
||
145 | |||
146 | /**/ |
||
147 | |||
148 | int bdev_init(BDEV_PARMS *); |
||
149 | |||
150 | #ifdef IDE_BLOCK_DEVICE |
||
151 | int ide_init(BDEV_PARMS *); |
||
152 | #ifndef NDEBUG |
||
153 | void ide_dump_status(void); |
||
154 | #endif |
||
155 | #endif |
||
156 | |||
157 | #ifdef LOOP_BLOCK_DEVICE |
||
158 | int loop_init(BDEV_PARMS *); |
||
159 | #ifndef NDEBUG |
||
160 | void loop_dump_status(void); |
||
161 | #endif |
||
162 | #endif |
||
163 | |||
164 | /*+ find a device using its name +*/ |
||
165 | __dev_t bdev_find_byname(char *name); |
||
166 | |||
167 | /*+ find a device using its filesystem indicator +*/ |
||
168 | __dev_t bdev_find_byfs(__uint8_t fsind); |
||
169 | |||
170 | /*+ scan all devices present +*/ |
||
171 | int bdev_scan_devices(int(*callback)(__dev_t,__uint8_t)); |
||
172 | |||
80 | pj | 173 | __END_DECLS |
2 | pj | 174 | #endif |