genode/repos/os/include/pin_control_session/connection.h
Norman Feske f2a627c107 os: Pin_control and Pin_state session interfaces
The new interfaces are meant to gradually replace the existing
Gpio_session interface.

- Each session refers to a single pin.
- The session types distiguish the direction of the signal as input or
  output.
- Pin coordinates can be selected via session labels.
- GPIO interrupts are covered by the regular IRQ session interface.

The interfaces are accompanied by framework utilities and interfaces:

- os/pin_driver.h
- pin_control_session/component.h
- pin_state_session/component.h

These headers relieve GPIO drivers from implementing boilerplate code by
providing device-agnostic portions. The A64 pio driver serves as
reference for using those utilities.

  https://github.com/nfeske/genode-allwinner/tree/master/src/drivers/pin/a64

Fixes #4315
2021-11-29 15:10:52 +01:00

41 lines
1.1 KiB
C++

/*
* \brief Connection to pin-control service
* \author Norman Feske
* \date 2021-04-20
*/
/*
* Copyright (C) 2021 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__PIN_CONTROL_SESSION__CONNECTION_H_
#define _INCLUDE__PIN_CONTROL_SESSION__CONNECTION_H_
#include <pin_control_session/pin_control_session.h>
#include <base/rpc_client.h>
#include <base/connection.h>
namespace Pin_control { struct Connection; }
struct Pin_control::Connection : private Genode::Connection<Session>,
private Rpc_client<Session>
{
enum { RAM_QUOTA = 8*1024UL };
Connection(Env &env, char const *label = "")
:
Genode::Connection<Session>(env,
session(env.parent(),
"ram_quota=%u, cap_quota=%u, label=\"%s\"",
RAM_QUOTA, CAP_QUOTA, label)),
Rpc_client<Session>(cap())
{ }
void state(bool enabled) override { call<Rpc_state>(enabled); }
};
#endif /* _INCLUDE__PIN_CONTROL_SESSION__CONNECTION_H_ */