Dawn Framework 1.0
Universal data acquisition framework for embedded systems
gpo.hxx
1// dawn/include/dawn/io/gpo.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include "dawn/io/common.hxx"
9#include "dawn/porting/config.hxx"
10#include "dawn/porting/gpio.hxx"
11
12namespace dawn
13{
21class CIOGpo : public CIOCommon
22{
23public:
24 enum
25 {
26 IO_GPO_CFG_FIRST = 0,
27 IO_GPO_CFG_LAST = 31
28 };
29
30 explicit CIOGpo(CDescObject &desc)
31 : CIOCommon(desc)
32 , path()
33 , fd(-1)
34#ifdef CONFIG_DAWN_IO_TIMESTAMP
35 , ts(0)
36#endif
37 {
38 }
39
40 ~CIOGpo() override;
41
42#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
43 const char *getClassNameStr() const override
44 {
45 return "gpo";
46 }
47#endif
48
49 int configure() override;
50 int init() override;
51 int deinit() override;
52 int getDataImpl(IODataCmn &data, size_t len) override;
53 int setDataImpl(IODataCmn &data) override;
54 size_t getDataSize() const override;
55 size_t getDataDim() const override;
56
57 bool isRead() const override
58 {
59 return false;
60 };
61
62 bool isWrite() const override
63 {
64 return true;
65 };
66
67 bool isNotify() const override
68 {
69 return false;
70 };
71
72 bool isBatch() const override
73 {
74 return false;
75 };
76
78
79 constexpr static SObjectId::ObjectId objectId(bool ts, uint16_t inst)
80 {
81 return ObjectIdHelper::create(ts, inst);
82 }
83
84private:
85 char path[PATH_MAX];
86 int fd;
87#ifdef CONFIG_DAWN_IO_TIMESTAMP
88 uint64_t ts;
89#endif
90
91 int configureDesc(const CDescObject &desc);
92};
93} // Namespace dawn
Descriptor wrapper for individual object configuration.
Template helper for creating ObjectIDs for I/O types.
Definition common.hxx:236
static SObjectId::ObjectId create(bool ts, uint16_t inst)
Create ObjectID with default data type.
Definition common.hxx:246
Base class for all I/O objects.
Definition common.hxx:27
GPIO Output (GPO) I/O type for writing digital output states.
Definition gpo.hxx:22
int init()
One-time initialize object after bindings are resolved.
Definition gpo.cxx:75
bool isWrite() const
Check if IO supports write operations.
Definition gpo.hxx:62
int configure()
Configure object from descriptor data.
Definition gpo.cxx:36
bool isBatch() const
Check if IO supports batch operations.
Definition gpo.hxx:72
size_t getDataSize() const
Get data size in bytes.
Definition gpo.cxx:152
bool isNotify() const
Check if IO supports notifications.
Definition gpo.hxx:67
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
Definition gpo.cxx:94
int setDataImpl(IODataCmn &data)
Set data implementation (override in derived classes).
Definition gpo.cxx:128
size_t getDataDim() const
Get data vector dimension.
Definition gpo.cxx:157
bool isRead() const
Check if IO supports read operations.
Definition gpo.hxx:57
int deinit()
De-initialize object.
Definition gpo.cxx:86
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
Base interface for I/O data buffers (static and dynamic).
Definition idata.hxx:21
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44