mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 09:46:20 +00:00
parent
29b8d609c9
commit
4f8804c334
@ -15,7 +15,7 @@
|
||||
#define _INCLUDE__PLATFORM_SESSION__CLIENT_H_
|
||||
|
||||
#include <base/capability.h>
|
||||
#include <base/rpc.h>
|
||||
#include <base/rpc_client.h>
|
||||
#include <platform_session/platform_session.h>
|
||||
|
||||
namespace Platform { struct Client; }
|
||||
|
@ -37,38 +37,40 @@ class Input::Tablet_driver
|
||||
GPIO_BUTTON = 132,
|
||||
};
|
||||
|
||||
Timer::Connection _timer;
|
||||
Event_queue &_ev_queue;
|
||||
Gpio::Connection _gpio_ts;
|
||||
Gpio::Connection _gpio_bt;
|
||||
Genode::Irq_session_client _irq_ts;
|
||||
Genode::Irq_session_client _irq_bt;
|
||||
Genode::Signal_rpc_member<Tablet_driver> _ts_dispatcher;
|
||||
Genode::Signal_rpc_member<Tablet_driver> _bt_dispatcher;
|
||||
Genode::Signal_handler<Tablet_driver> _ts_dispatcher;
|
||||
Genode::Signal_handler<Tablet_driver> _bt_dispatcher;
|
||||
Touchscreen _touchscreen;
|
||||
Buttons _buttons;
|
||||
|
||||
void _handle_ts(unsigned)
|
||||
void _handle_ts()
|
||||
{
|
||||
_touchscreen.event(_ev_queue);
|
||||
_irq_ts.ack_irq();
|
||||
}
|
||||
|
||||
void _handle_bt(unsigned)
|
||||
void _handle_bt()
|
||||
{
|
||||
_buttons.event(_ev_queue);
|
||||
_irq_bt.ack_irq();
|
||||
}
|
||||
|
||||
Tablet_driver(Server::Entrypoint &ep, Event_queue &ev_queue)
|
||||
Tablet_driver(Genode::Env &env, Event_queue &ev_queue)
|
||||
:
|
||||
_timer(env),
|
||||
_ev_queue(ev_queue),
|
||||
_gpio_ts(GPIO_TOUCH),
|
||||
_gpio_bt(GPIO_BUTTON),
|
||||
_gpio_ts(env, GPIO_TOUCH),
|
||||
_gpio_bt(env, GPIO_BUTTON),
|
||||
_irq_ts(_gpio_ts.irq_session(Gpio::Session::LOW_LEVEL)),
|
||||
_irq_bt(_gpio_bt.irq_session(Gpio::Session::FALLING_EDGE)),
|
||||
_ts_dispatcher(ep, *this, &Tablet_driver::_handle_ts),
|
||||
_bt_dispatcher(ep, *this, &Tablet_driver::_handle_bt),
|
||||
_touchscreen(ep), _buttons(ep)
|
||||
_ts_dispatcher(env.ep(), *this, &Tablet_driver::_handle_ts),
|
||||
_bt_dispatcher(env.ep(), *this, &Tablet_driver::_handle_bt),
|
||||
_touchscreen(env, _timer), _buttons(env, _timer)
|
||||
{
|
||||
/* GPIO touchscreen handling */
|
||||
_gpio_ts.direction(Gpio::Session::OUT);
|
||||
@ -89,15 +91,7 @@ class Input::Tablet_driver
|
||||
|
||||
public:
|
||||
|
||||
static Tablet_driver* factory(Server::Entrypoint &ep, Event_queue &ev_queue);
|
||||
static Tablet_driver* factory(Genode::Env &env, Event_queue &ev_queue);
|
||||
};
|
||||
|
||||
|
||||
Input::Tablet_driver* Input::Tablet_driver::factory(Server::Entrypoint &ep,
|
||||
Event_queue &ev_queue)
|
||||
{
|
||||
static Input::Tablet_driver driver(ep, ev_queue);
|
||||
return &driver;
|
||||
}
|
||||
|
||||
#endif /* _DRIVERS__INPUT__SPEC__IMX53__DRIVER_H_ */
|
||||
|
@ -44,12 +44,14 @@ class Input::Touchscreen {
|
||||
|
||||
public:
|
||||
|
||||
Touchscreen(Server::Entrypoint &ep)
|
||||
Touchscreen(Genode::Env &env, Timer::Connection &timer)
|
||||
:
|
||||
_irq_handler(ep, Genode::Board_base::I2C_3_IRQ),
|
||||
_i2c_ds(Genode::Board_base::I2C_3_BASE,
|
||||
_irq_handler(env, Genode::Board_base::I2C_3_IRQ),
|
||||
_i2c_ds(env,
|
||||
Genode::Board_base::I2C_3_BASE,
|
||||
Genode::Board_base::I2C_3_SIZE),
|
||||
_i2c((Genode::addr_t)_i2c_ds.local_addr<void>(),
|
||||
_i2c(timer,
|
||||
(Genode::addr_t)_i2c_ds.local_addr<void>(),
|
||||
_irq_handler),
|
||||
_state(RELEASED)
|
||||
{
|
||||
|
@ -64,8 +64,7 @@ class I2c::I2c : Genode::Mmio
|
||||
|
||||
class No_ack : Genode::Exception {};
|
||||
|
||||
|
||||
Timer::Connection _timer;
|
||||
Timer::Connection &_timer;
|
||||
Irq_handler &_irq_handler;
|
||||
|
||||
void _busy() { while (!read<Status::Busy>()); }
|
||||
@ -113,8 +112,9 @@ class I2c::I2c : Genode::Mmio
|
||||
|
||||
public:
|
||||
|
||||
I2c(Genode::addr_t const base, Irq_handler &irq_handler)
|
||||
: Mmio(base), _irq_handler(irq_handler)
|
||||
I2c(Timer::Connection &timer,
|
||||
Genode::addr_t const base, Irq_handler &irq_handler)
|
||||
: Mmio(base), _timer(timer), _irq_handler(irq_handler)
|
||||
{
|
||||
write<Control>(0);
|
||||
write<Status>(0);
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <irq_session/connection.h>
|
||||
#include <os/server.h>
|
||||
|
||||
class Irq_handler
|
||||
{
|
||||
@ -31,9 +30,9 @@ class Irq_handler
|
||||
|
||||
public:
|
||||
|
||||
Irq_handler(Server::Entrypoint &ep, int irq_number)
|
||||
Irq_handler(Genode::Env &env, int irq_number)
|
||||
:
|
||||
_irq(irq_number),
|
||||
_irq(env, irq_number),
|
||||
_dispatcher(_sig_rec, *this, &Irq_handler::_handle)
|
||||
{
|
||||
_irq.sigh(_dispatcher);
|
||||
|
@ -14,10 +14,9 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/env.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/rpc_server.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <input/component.h>
|
||||
#include <input/root.h>
|
||||
@ -30,39 +29,39 @@
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Input::Tablet_driver* Input::Tablet_driver::factory(Genode::Env &env,
|
||||
Event_queue &ev_queue)
|
||||
{
|
||||
static Input::Tablet_driver driver(env, ev_queue);
|
||||
return &driver;
|
||||
}
|
||||
|
||||
|
||||
struct Main
|
||||
{
|
||||
Server::Entrypoint &ep;
|
||||
Genode::Env &env;
|
||||
|
||||
Input::Session_component session;
|
||||
Input::Root_component root;
|
||||
Input::Session_component session { env, env.ram() };
|
||||
Input::Root_component root { env.ep().rpc_ep(), session };
|
||||
|
||||
Main(Server::Entrypoint &ep)
|
||||
: ep(ep), root(ep.rpc_ep(), session)
|
||||
Main(Genode::Env &env) : env(env)
|
||||
{
|
||||
Platform::Connection plat_drv;
|
||||
Platform::Connection plat_drv { env };
|
||||
switch (plat_drv.revision()) {
|
||||
case Platform::Session::SMD:
|
||||
plat_drv.enable(Platform::Session::I2C_2);
|
||||
plat_drv.enable(Platform::Session::I2C_3);
|
||||
plat_drv.enable(Platform::Session::BUTTONS);
|
||||
Input::Tablet_driver::factory(ep, session.event_queue());
|
||||
Input::Tablet_driver::factory(env, session.event_queue());
|
||||
break;
|
||||
default:
|
||||
PWRN("No input driver available for this board");
|
||||
}
|
||||
|
||||
/* tell parent about the service */
|
||||
env()->parent()->announce(ep.manage(root));
|
||||
env.parent().announce(env.ep().manage(root));
|
||||
}
|
||||
};
|
||||
|
||||
/************
|
||||
** Server **
|
||||
************/
|
||||
|
||||
namespace Server {
|
||||
char const *name() { return "input_drv_ep"; }
|
||||
size_t stack_size() { return 16*1024*sizeof(long); }
|
||||
void construct(Entrypoint &ep) { static Main server(ep); }
|
||||
}
|
||||
void Component::construct(Genode::Env &env) { static Main main(env); }
|
||||
|
@ -52,13 +52,16 @@ class Input::Buttons {
|
||||
|
||||
public:
|
||||
|
||||
Buttons(Server::Entrypoint &ep) :
|
||||
_irq_handler(ep, Genode::Board_base::I2C_2_IRQ),
|
||||
_i2c_ds(Genode::Board_base::I2C_2_BASE,
|
||||
Genode::Board_base::I2C_2_SIZE),
|
||||
_i2c((Genode::addr_t)_i2c_ds.local_addr<void>(),
|
||||
_irq_handler),
|
||||
_state(0)
|
||||
Buttons(Genode::Env &env, Timer::Connection &timer)
|
||||
:
|
||||
_irq_handler(env, Genode::Board_base::I2C_2_IRQ),
|
||||
_i2c_ds(env,
|
||||
Genode::Board_base::I2C_2_BASE,
|
||||
Genode::Board_base::I2C_2_SIZE),
|
||||
_i2c(timer,
|
||||
(Genode::addr_t)_i2c_ds.local_addr<void>(),
|
||||
_irq_handler),
|
||||
_state(0)
|
||||
{
|
||||
static Genode::uint8_t init_cmd[][2] = {
|
||||
{0x41, 0x8 }, {0x42, 0x5 }, {0x43, 0x8 },
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = input_drv
|
||||
REQUIRES = imx53
|
||||
SRC_CC = main.cc
|
||||
LIBS = base server
|
||||
LIBS = base
|
||||
INC_DIR += $(PRG_DIR)
|
||||
|
Loading…
x
Reference in New Issue
Block a user