mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 02:01:38 +00:00
parent
71129fca2d
commit
9f9a5186e0
13
repos/base/board/pc/devices
Normal file
13
repos/base/board/pc/devices
Normal file
@ -0,0 +1,13 @@
|
||||
<devices>
|
||||
<device name="ps2">
|
||||
<irq number="1"/>
|
||||
<irq number="12"/>
|
||||
<io_port_range address="0x60" size="1"/>
|
||||
<io_port_range address="0x64" size="1"/>
|
||||
</device>
|
||||
|
||||
<device name="pit">
|
||||
<irq number="0"/>
|
||||
<io_port_range address="0x40" size="4"/>
|
||||
</device>
|
||||
</devices>
|
@ -6,9 +6,7 @@ assert_spec x86
|
||||
|
||||
set build_components { core init timer server/dynamic_rom server/event_dump }
|
||||
|
||||
source ${genode_dir}/repos/base/run/platform_drv.inc
|
||||
append_platform_drv_build_components
|
||||
|
||||
lappend_if [have_board pc] build_components drivers/platform
|
||||
lappend_if [have_board pc] build_components drivers/ps2
|
||||
lappend_if [have_board linux] build_components drivers/framebuffer/sdl
|
||||
lappend_if [have_board linux] build_components server/nitpicker
|
||||
@ -50,9 +48,24 @@ append config {
|
||||
</route>
|
||||
</start>}
|
||||
|
||||
append_platform_drv_config
|
||||
|
||||
append_if [have_board pc] config {
|
||||
<start name="platform_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Platform"/></provides>
|
||||
<route>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="IO_MEM"> <parent/> </service>
|
||||
<service name="IRQ"> <parent/> </service>
|
||||
<service name="IO_PORT"> <parent/> </service>
|
||||
</route>
|
||||
<config>
|
||||
<policy label="ps2_drv -> "> <device name="ps2"/> </policy>
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="ps2_drv">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config verbose_keyboard="no" verbose_mouse="no" verbose_scancodes="no"
|
||||
@ -151,12 +164,11 @@ install_config $config
|
||||
#
|
||||
|
||||
# generic modules
|
||||
file copy [select_from_repositories board/[board]/devices] [run_dir]/genode/devices
|
||||
set boot_modules { core ld.lib.so init timer dynamic_rom event_dump }
|
||||
|
||||
# platform-specific modules
|
||||
append_platform_drv_boot_modules
|
||||
|
||||
lappend_if [have_board pc] boot_modules ps2_drv
|
||||
lappend_if [have_board pc] boot_modules platform_drv
|
||||
lappend_if [have_board linux] boot_modules fb_sdl
|
||||
lappend_if [have_board linux] boot_modules nitpicker
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/entrypoint.h>
|
||||
#include <irq_session/client.h>
|
||||
#include <platform_session/device.h>
|
||||
|
||||
/* local includes */
|
||||
#include "input_driver.h"
|
||||
@ -25,14 +25,14 @@ class Irq_handler
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Irq_session_client _irq;
|
||||
Platform::Device::Irq _irq;
|
||||
Genode::Signal_handler<Irq_handler> _handler;
|
||||
Input_driver &_input_driver;
|
||||
Event::Session_client &_event_session;
|
||||
|
||||
void _handle()
|
||||
{
|
||||
_irq.ack_irq();
|
||||
_irq.ack();
|
||||
|
||||
_event_session.with_batch([&] (Event::Session_client::Batch &batch) {
|
||||
while (_input_driver.event_pending())
|
||||
@ -42,18 +42,18 @@ class Irq_handler
|
||||
|
||||
public:
|
||||
|
||||
Irq_handler(Genode::Entrypoint &ep,
|
||||
Input_driver &input_driver,
|
||||
Event::Session_client &event_session,
|
||||
Genode::Irq_session_capability irq_cap)
|
||||
Irq_handler(Genode::Entrypoint &ep,
|
||||
Input_driver &input_driver,
|
||||
Event::Session_client &event_session,
|
||||
Platform::Device &device,
|
||||
unsigned idx)
|
||||
:
|
||||
_irq(irq_cap),
|
||||
_irq(device, {idx}),
|
||||
_handler(ep, *this, &Irq_handler::_handle),
|
||||
_input_driver(input_driver),
|
||||
_event_session(event_session)
|
||||
{
|
||||
_irq.sigh(_handler);
|
||||
_irq.ack_irq();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef _DRIVERS__INPUT__SPEC__PS2__X86__I8042_H_
|
||||
#define _DRIVERS__INPUT__SPEC__PS2__X86__I8042_H_
|
||||
|
||||
#include <io_port_session/client.h>
|
||||
#include <platform_session/device.h>
|
||||
#include <os/ring_buffer.h>
|
||||
|
||||
#include "serial_interface.h"
|
||||
@ -179,8 +179,8 @@ class I8042
|
||||
|
||||
private:
|
||||
|
||||
Genode::Io_port_session_client _data_port; /* data port */
|
||||
Genode::Io_port_session_client _stat_port; /* status/command port */
|
||||
Platform::Device::Io_port_range _data_port; /* data port */
|
||||
Platform::Device::Io_port_range _stat_port; /* status/command port */
|
||||
|
||||
bool _kbd_xlate = false; /* translation mode to scan-code set 1 */
|
||||
|
||||
@ -266,11 +266,10 @@ class I8042
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
I8042(Genode::Io_port_session_capability cap_data,
|
||||
Genode::Io_port_session_capability cap_status)
|
||||
I8042(Platform::Device & device)
|
||||
:
|
||||
_data_port(cap_data),
|
||||
_stat_port(cap_status),
|
||||
_data_port(device, {0}),
|
||||
_stat_port(device, {1}),
|
||||
_kbd_interface(*this, false),
|
||||
_aux_interface(*this, true)
|
||||
{
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
/* os includes */
|
||||
#include <event_session/connection.h>
|
||||
#include <legacy/x86/platform_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
/* local includes */
|
||||
@ -44,21 +43,11 @@ struct Ps2::Main
|
||||
Event::Connection _event { _env };
|
||||
|
||||
Platform::Connection _platform { _env };
|
||||
Platform::Device _device { _platform };
|
||||
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
Platform::Device_capability _ps2_device_cap()
|
||||
{
|
||||
return _platform.with_upgrade([&] () {
|
||||
return _platform.device("PS2"); });
|
||||
}
|
||||
|
||||
Platform::Device_client _device_ps2 { _ps2_device_cap() };
|
||||
|
||||
enum { REG_IOPORT_DATA = 0, REG_IOPORT_STATUS = 1 };
|
||||
|
||||
I8042 _i8042 { _device_ps2.io_port(REG_IOPORT_DATA),
|
||||
_device_ps2.io_port(REG_IOPORT_STATUS) };
|
||||
I8042 _i8042 { _device };
|
||||
|
||||
Attached_rom_dataspace _config { _env, "config" };
|
||||
|
||||
@ -70,8 +59,8 @@ struct Ps2::Main
|
||||
|
||||
Mouse _mouse { _i8042.aux_interface(), _timer, *_verbose };
|
||||
|
||||
Irq_handler _keyboard_irq { _env.ep(), _keyboard, _event, _device_ps2.irq(0) };
|
||||
Irq_handler _mouse_irq { _env.ep(), _mouse, _event, _device_ps2.irq(1) };
|
||||
Irq_handler _keyboard_irq { _env.ep(), _keyboard, _event, _device, 0 };
|
||||
Irq_handler _mouse_irq { _env.ep(), _mouse, _event, _device, 1 };
|
||||
|
||||
Led_state _capslock { _env, "capslock" },
|
||||
_numlock { _env, "numlock" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user