mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-01-16 20:31:06 +02:00
add init.hhp
This commit is contained in:
parent
a2e13cbcda
commit
1e6f089025
60
boot-programs/init.hhp
Normal file
60
boot-programs/init.hhp
Normal file
@ -0,0 +1,60 @@
|
||||
#pypp 0
|
||||
// Iris: micro-kernel for a capability-based operating system.
|
||||
// boot-programs/init.hhp: interface for init task.
|
||||
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef __INIT_HH
|
||||
#define __INIT_HH
|
||||
|
||||
#include "iris.hh"
|
||||
|
||||
struct Init : public Kernel::Cap:
|
||||
Init (Kernel::Cap c = Kernel::Cap ()) : Kernel::Cap (c):
|
||||
enum request:
|
||||
REGISTER_GPIO = 0x1000
|
||||
REGISTER_LCD
|
||||
enum protected_codes:
|
||||
GPIO_KEYBOARD = 32
|
||||
GPIO_TOUCHPAD
|
||||
GPIO_LOCKLEDS
|
||||
GPIO_PWM
|
||||
LCD_SET_EOF_CB
|
||||
LCD_LOG
|
||||
void register_gpio ():
|
||||
Kernel::Caps c = Kernel::my_memory.create_caps (4)
|
||||
unsigned slot = c.use ()
|
||||
Kernel::set_recv_arg (Kernel::Cap (slot, 0))
|
||||
Kernel::my_receiver.create_capability (GPIO_KEYBOARD)
|
||||
Kernel::set_recv_arg (Kernel::Cap (slot, 1))
|
||||
Kernel::my_receiver.create_capability (GPIO_TOUCHPAD)
|
||||
Kernel::set_recv_arg (Kernel::Cap (slot, 2))
|
||||
Kernel::my_receiver.create_capability (GPIO_LOCKLEDS)
|
||||
Kernel::set_recv_arg (Kernel::Cap (slot, 3))
|
||||
Kernel::my_receiver.create_capability (GPIO_PWM)
|
||||
ocall (c, CAP_MASTER_DIRECT | REGISTER_GPIO)
|
||||
Kernel::my_memory.destroy (c)
|
||||
Kernel::free_cap (c)
|
||||
Kernel::free_slot (slot)
|
||||
void register_lcd ():
|
||||
Kernel::Caps c = Kernel::my_memory.create_caps (1)
|
||||
unsigned slot = c.use ()
|
||||
Kernel::set_recv_arg (Kernel::Cap (slot, 0))
|
||||
Kernel::my_receiver.create_capability (LCD_SET_EOF_CB)
|
||||
ocall (c, CAP_MASTER_DIRECT | REGISTER_LCD)
|
||||
Kernel::my_memory.destroy (c)
|
||||
Kernel::free_cap (c)
|
||||
Kernel::free_slot (slot)
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user