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 */
Index.h
FileSystemServer.h
DeviceServer::registerInterrupt
void registerInterrupt(Device *dev, Size vector)
Register an interrupt vector for the given device.
Definition: DeviceServer.cpp:79
Index< Device, MaximumDevices >
Device
Abstract device class interface.
Definition: Device.h:35
FileSystemServer
Abstract filesystem class.
Definition: FileSystemServer.h:44
DeviceServer
Device driver server.
Definition: DeviceServer.h:43
DeviceServer::registerDevice
void registerDevice(Device *dev, const char *path)
Add a Device.
Definition: DeviceServer.cpp:67
DeviceServer::interruptHandler
virtual void interruptHandler(Size vector)
Interrupt request handler.
Definition: DeviceServer.cpp:106
DeviceServer::DeviceServer
DeviceServer(const char *path)
Constructor.
Definition: DeviceServer.cpp:21
DeviceServer::m_devices
Index< Device, MaximumDevices > m_devices
Contains all Devices served by this DeviceServer.
Definition: DeviceServer.h:112
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
DeviceServer::MaximumDevices
static const Size MaximumDevices
Maximum number of Devices that can be registered.
Definition: DeviceServer.h:48
DeviceServer::initialize
virtual FileSystem::Result initialize()
Initialize DeviceServer.
Definition: DeviceServer.cpp:30
FileSystem::Result
Result
Result code for filesystem Actions.
Definition: FileSystem.h:52
DeviceServer::~DeviceServer
virtual ~DeviceServer()
Destructor.
Definition: DeviceServer.cpp:26
DeviceServer::m_interrupts
Index< List< Device * >, MaximumInterrupts > m_interrupts
Registers Devices using interrupts.
Definition: DeviceServer.h:124
DeviceServer::MaximumInterrupts
static const Size MaximumInterrupts
Maximum number of interrupts that can be registered.
Definition: DeviceServer.h:51
List.h