FreeNOS
DeviceServer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIB_LIBFS_DEVICESERVER_H
19#define __LIB_LIBFS_DEVICESERVER_H
20
21#include <Index.h>
22#include <List.h>
23#include "FileSystemServer.h"
24
44{
45 private:
46
48 static const Size MaximumDevices = 32;
49
51 static const Size MaximumInterrupts = 256;
52
53 public:
54
58 DeviceServer(const char *path);
59
63 virtual ~DeviceServer();
64
71
81 void registerDevice(Device *dev, const char *path);
82
95 void registerInterrupt(Device *dev, Size vector);
96
107 virtual void interruptHandler(Size vector);
108
109 private:
110
113
125};
126
132#endif /* __LIB_LIBFS_DEVICESERVER_H */
Device driver server.
static const Size MaximumInterrupts
Maximum number of interrupts that can be registered.
virtual FileSystem::Result initialize()
Initialize DeviceServer.
static const Size MaximumDevices
Maximum number of Devices that can be registered.
void registerDevice(Device *dev, const char *path)
Add a Device.
void registerInterrupt(Device *dev, Size vector)
Register an interrupt vector for the given device.
Index< List< Device * >, MaximumInterrupts > m_interrupts
Registers Devices using interrupts.
virtual ~DeviceServer()
Destructor.
Index< Device, MaximumDevices > m_devices
Contains all Devices served by this DeviceServer.
Abstract device class interface.
Definition Device.h:36
Abstract filesystem class.
Index is a N-sized array of pointers to items of type T.
Definition Index.h:37
C void interruptHandler()
Interrupt Service Router (ISR) handler.
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
Result
Result code for filesystem Actions.
Definition FileSystem.h:53