14#ifndef ZEPHYR_INCLUDE_DRIVERS_PS2_H_
15#define ZEPHYR_INCLUDE_DRIVERS_PS2_H_
48typedef int (*ps2_config_t)(
const struct device *dev,
50typedef int (*ps2_read_t)(
const struct device *dev,
uint8_t *value);
51typedef int (*ps2_write_t)(
const struct device *dev,
uint8_t value);
52typedef int (*ps2_disable_callback_t)(
const struct device *dev);
53typedef int (*ps2_enable_callback_t)(
const struct device *dev);
55__subsystem
struct ps2_driver_api {
59 ps2_disable_callback_t disable_callback;
60 ps2_enable_callback_t enable_callback;
79static inline int z_impl_ps2_config(
const struct device *dev,
82 const struct ps2_driver_api *api =
83 (
struct ps2_driver_api *)dev->
api;
85 return api->config(dev, callback_isr);
99static inline int z_impl_ps2_write(
const struct device *dev,
uint8_t value)
101 const struct ps2_driver_api *api =
102 (
const struct ps2_driver_api *)dev->
api;
104 return api->write(dev, value);
117static inline int z_impl_ps2_read(
const struct device *dev,
uint8_t *value)
119 const struct ps2_driver_api *api =
120 (
const struct ps2_driver_api *)dev->
api;
122 return api->read(dev, value);
134static inline int z_impl_ps2_enable_callback(
const struct device *dev)
136 const struct ps2_driver_api *api =
137 (
const struct ps2_driver_api *)dev->
api;
139 if (api->enable_callback == NULL) {
143 return api->enable_callback(dev);
155static inline int z_impl_ps2_disable_callback(
const struct device *dev)
157 const struct ps2_driver_api *api =
158 (
const struct ps2_driver_api *)dev->
api;
160 if (api->disable_callback == NULL) {
164 return api->disable_callback(dev);
175#include <syscalls/ps2.h>
int ps2_config(const struct device *dev, ps2_callback_t callback_isr)
Configure a ps2 instance.
int ps2_enable_callback(const struct device *dev)
Enables callback.
int ps2_read(const struct device *dev, uint8_t *value)
Read slave-to-host values from PS/2 device.
void(* ps2_callback_t)(const struct device *dev, uint8_t data)
PS/2 callback called when user types or click a mouse.
Definition: ps2.h:39
int ps2_disable_callback(const struct device *dev)
Disables callback.
int ps2_write(const struct device *dev, uint8_t value)
Write to PS/2 device.
#define ENOSYS
Function not implemented.
Definition: errno.h:83
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition: device.h:399
void * data
Address of the device instance private data.
Definition: device.h:409
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:405