Rev 2 | Rev 80 | Go to most recent revision | 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 | /* |
||
42 | * CVS : $Id: bdevinit.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $ |
||
43 | * |
||
44 | * File: $File$ |
||
45 | * Revision: $Revision: 1.1.1.1 $ |
||
46 | * Last update: $Date: 2002-03-29 14:12:51 $ |
||
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> |
||
57 | |||
58 | /* prolog */ |
||
59 | #define BASE_BDEV_START 0 |
||
60 | |||
61 | /* |
||
62 | * IDE |
||
63 | */ |
||
64 | |||
65 | #ifdef IDE_BLOCK_DEVICE |
||
66 | |||
67 | typedef struct ide_parms { |
||
68 | void *parm_initserver; |
||
69 | } IDE_PARMS; |
||
70 | |||
71 | #define IDEPARMS(ptr) ((ptr)->ideparms) |
||
72 | |||
73 | #define BASE_BDEV_IDE BASE_BDEV_START,{NULL} |
||
74 | |||
75 | /* |
||
76 | typedef struct ide_parms { |
||
77 | __uint8_t pclass; |
||
78 | __uint32_t dline; |
||
79 | __uint32_t wcet; |
||
80 | } IDE_PARMS; |
||
81 | |||
82 | #define BASE_IDE {DEFAULT,DEFAULT,DEFAULT} |
||
83 | |||
84 | #define ide_def_task(s,p,d,w) {(s).pclass=(p); (s).dline=(d); (s).wcet=(w);} |
||
85 | */ |
||
86 | |||
87 | #else |
||
88 | |||
89 | #define BASE_BDEV_IDE BASE_BDEV_START |
||
90 | |||
91 | #endif |
||
92 | |||
93 | /* |
||
94 | * LOOP |
||
95 | */ |
||
96 | |||
97 | #ifdef LOOP_BLOCK_DEVICE |
||
98 | |||
99 | typedef struct loop_parms { |
||
100 | int dummy; |
||
101 | } LOOP_PARMS; |
||
102 | |||
103 | #define BASE_BDEV_LOOP BASE_BDEV_IDE,{0} |
||
104 | |||
105 | #else |
||
106 | |||
107 | #define BASE_BDEV_LOOP BASE_BDEV_IDE |
||
108 | |||
109 | #endif |
||
110 | |||
111 | /* epilog */ |
||
112 | #define BASE_BDEV_OPTIONAL BASE_BDEV_LOOP |
||
113 | |||
114 | /* |
||
115 | * block device params structure |
||
116 | */ |
||
117 | |||
118 | extern NPP_mutexattr_t bdevdef_mutexattr; |
||
119 | |||
120 | typedef struct bdev_parms { |
||
121 | __uint32_t showinfo:1; |
||
122 | char *config; |
||
123 | void *bmutexattr; |
||
124 | |||
125 | __uint16_t dummy; |
||
126 | |||
127 | #ifdef IDE_BLOCK_DEVICE |
||
128 | IDE_PARMS ideparms; |
||
129 | #endif |
||
130 | |||
131 | #ifdef LOOP_BLOCK_DEVICE |
||
132 | LOOP_PARMS loopparms; |
||
133 | #endif |
||
134 | |||
135 | } BDEV_PARMS; |
||
136 | |||
137 | #define bdev_def_showinfo(s,v) ((s).showinfo=(v)&1) |
||
138 | #define bdev_def_configstring(s,v) ((s).config=(v)) |
||
139 | #define bdev_def_mutexattrptr(s,v) ((s).bmutexattr=(v)) |
||
140 | |||
141 | #define BASE_BDEV {0,NULL,(void*)&bdevdef_mutexattr,BASE_BDEV_OPTIONAL} |
||
142 | |||
143 | /**/ |
||
144 | |||
145 | int bdev_init(BDEV_PARMS *); |
||
146 | |||
147 | #ifdef IDE_BLOCK_DEVICE |
||
148 | int ide_init(BDEV_PARMS *); |
||
149 | #ifndef NDEBUG |
||
150 | void ide_dump_status(void); |
||
151 | #endif |
||
152 | #endif |
||
153 | |||
154 | #ifdef LOOP_BLOCK_DEVICE |
||
155 | int loop_init(BDEV_PARMS *); |
||
156 | #ifndef NDEBUG |
||
157 | void loop_dump_status(void); |
||
158 | #endif |
||
159 | #endif |
||
160 | |||
161 | /*+ find a device using its name +*/ |
||
162 | __dev_t bdev_find_byname(char *name); |
||
163 | |||
164 | /*+ find a device using its filesystem indicator +*/ |
||
165 | __dev_t bdev_find_byfs(__uint8_t fsind); |
||
166 | |||
167 | /*+ scan all devices present +*/ |
||
168 | int bdev_scan_devices(int(*callback)(__dev_t,__uint8_t)); |
||
169 | |||
170 | #endif |