TEMU  4.4
The Terma Emulator
Gpio.h
Go to the documentation of this file.
1 //===------------------------------------------------------------*- C++ -*-===//
2 //
3 // TEMU: The Terma Emulator
4 // (c) Terma 2015, 2020
5 // Authors: Mattias Holm <maho (at) terma.com>
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef TEMU_BUS_GPIO_H
10 #define TEMU_BUS_GPIO_H
11 
12 #include "temu-c/Support/Objsys.h"
13 #include <stdint.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 /*
20  * These interfaces have been deprecated,
21  * new GPIO devices should use the SignalIface
22  */
23 
24 /*!
25  * Interface implemented by the GPIO bus class.
26  *
27  * Normally this does not have to be implemented yourself. It exist
28  * for the bus model only. In-case you need a separate bus model, you
29  * can implement this interface.
30  *
31  * Note that this interface is deprecated for future models and it is
32  * expected that the signal interface is used instead.
33  */
34 typedef struct temu_GpioBusIface {
35  //! setGpioBits should set or clear the bits in Bits if they are set
36  //! in Mask. Upon a set, the GPIO bus model should notify any
37  //! connected GPIO clients about the changed bits. This is done
38  //! using the temu_GpioClientIface. In the built in bus model,
39  //! notifications are only delivered if any of the bits actually
40  //! changed.
41  void (*setGpioBits)(void *Obj, uint64_t Bits, uint64_t Mask);
42 
43  //! Get the gpio-bits currently on the bus. The bits in mask will be
44  //! extracted from the bus and returned in the result.
45  uint64_t (*getGpioBits)(void *Obj, uint64_t Mask);
46 } temu_GpioBusIface;
47 #define TEMU_GPIO_BUS_IFACE_TYPE "GpioBusIface"
48 TEMU_IFACE_REFERENCE_TYPE(temu_GpioBus);
49 
50 /*!
51  * Interface for GPIO clients.
52  *
53  * A GPIO client is a device that interface with the GPIO bus. Such a
54  * client can poll using the GpioBusIface, but it is likely better to
55  * be lazily notified about changes to the bus values. Such
56  * notifications will be delivered to the GpioClientIface.
57  *
58  * Note that this interface is deprecated for future models and it is
59  * expected that the signal interface is used instead.
60  */
61 typedef struct temu_GpioClientIface {
62  //! Notification function. A client will always be notified about
63  //! changed bus values. The Bus value is indicated in the Bits
64  //! param, and the values that where changed are indicated in the
65  //! Mask param.
66  void (*gpioBitsChanged)(void *Obj, uint64_t Bits, uint64_t Mask);
67 } temu_GpioClientIface;
68 #define TEMU_GPIO_CLIENT_IFACE_TYPE "GpioClientIface"
69 TEMU_IFACE_REFERENCE_TYPE(temu_GpioClient);
70 
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif /* ! TEMU_BUS_GPIO_H */
temu_GpioBusIface
Definition: Gpio.h:34
temu_GpioBusIface::setGpioBits
void(* setGpioBits)(void *Obj, uint64_t Bits, uint64_t Mask)
Definition: Gpio.h:41
temu_GpioClientIface
Definition: Gpio.h:61
temu_GpioClientIface::gpioBitsChanged
void(* gpioBitsChanged)(void *Obj, uint64_t Bits, uint64_t Mask)
Definition: Gpio.h:66