diff --git a/repos/os/include/os/pin_driver.h b/repos/os/include/os/pin_driver.h index 18f470f91c..edefddd807 100644 --- a/repos/os/include/os/pin_driver.h +++ b/repos/os/include/os/pin_driver.h @@ -39,6 +39,8 @@ namespace Pin { { using Pin::Root, Direction::IN>::Root; }; + + enum class Level { LOW, HIGH, HIGH_IMPEDANCE }; } @@ -53,7 +55,7 @@ struct Pin::Driver : Interface /** * Set pin state */ - virtual void pin_state(ID, bool enabled) = 0; + virtual void pin_state(ID, Level) = 0; /** * Return pin ID assigned to the specified session label diff --git a/repos/os/include/pin_control_session/component.h b/repos/os/include/pin_control_session/component.h index d82e90471c..1a52695c50 100644 --- a/repos/os/include/pin_control_session/component.h +++ b/repos/os/include/pin_control_session/component.h @@ -39,6 +39,12 @@ class Pin_control::Session_component : public Session_object using Session_object::label; + void _state(Pin::Level level) + { + if (_assignment.target.constructed()) + _assignment.driver.pin_state(_assignment.target->id, level); + } + public: using Pin_id = ID; @@ -57,8 +63,15 @@ class Pin_control::Session_component : public Session_object */ void state(bool enabled) override { - if (_assignment.target.constructed()) - _assignment.driver.pin_state(_assignment.target->id, enabled); + _state(enabled ? Pin::Level::HIGH : Pin::Level::LOW); + } + + /** + * Pin_control::Session interface + */ + void yield() override + { + _state(Pin::Level::HIGH_IMPEDANCE); } void update_assignment() diff --git a/repos/os/include/pin_control_session/connection.h b/repos/os/include/pin_control_session/connection.h index 3b2bf1782b..0806c2bf08 100644 --- a/repos/os/include/pin_control_session/connection.h +++ b/repos/os/include/pin_control_session/connection.h @@ -35,6 +35,8 @@ struct Pin_control::Connection : private Genode::Connection, { } void state(bool enabled) override { call(enabled); } + + void yield() override { call(); } }; #endif /* _INCLUDE__PIN_CONTROL_SESSION__CONNECTION_H_ */ diff --git a/repos/os/include/pin_control_session/pin_control_session.h b/repos/os/include/pin_control_session/pin_control_session.h index 909c55bf22..a222550d7a 100644 --- a/repos/os/include/pin_control_session/pin_control_session.h +++ b/repos/os/include/pin_control_session/pin_control_session.h @@ -40,8 +40,11 @@ struct Pin_control::Session : Genode::Session virtual void state(bool) = 0; + virtual void yield() = 0; + GENODE_RPC(Rpc_state, void, state, bool); - GENODE_RPC_INTERFACE(Rpc_state); + GENODE_RPC(Rpc_yield, void, yield); + GENODE_RPC_INTERFACE(Rpc_state, Rpc_yield); }; #endif /* _INCLUDE__PIN_CONTROL_SESSION__PIN_CONTROL_SESSION_H_ */