Dawn Framework 1.0
Universal data acquisition framework for embedded systems
boardctl.hxx
1// dawn/include/dawn/io/boardctl.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include <mutex>
9
10#include "dawn/io/common.hxx"
11#include "dawn/porting/config.hxx"
12
13namespace dawn
14{
22class CIOBoardctl : public CIOCommon
23{
24public:
25 explicit CIOBoardctl(CDescObject &desc)
26 : CIOCommon(desc)
27 , dim(getDataDim(getCls()))
28 {
29 }
30
31 ~CIOBoardctl() override = default;
32
33#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
34 const char *getClassNameStr() const override
35 {
36 switch (getCls())
37 {
39 return "reset";
41 return "resetcause";
43 return "poweroff";
44 default:
45 return "boardctl";
46 }
47 }
48#endif
49
50 int getDataImpl(IODataCmn &data, size_t len) override;
51 int setDataImpl(IODataCmn &data) override;
52 size_t getDataSize() const override;
53 size_t getDataDim() const override;
54 bool isRead() const override;
55 bool isWrite() const override;
56
57 bool isNotify() const override
58 {
59 return false;
60 };
61
62 bool isBatch() const override
63 {
64 return false;
65 };
66
67#ifdef CONFIG_BOARDCTL_RESET
68 constexpr static SObjectId::ObjectId objectIdReset()
69 {
72 }
73#endif
74
75#ifdef CONFIG_BOARDCTL_RESET_CAUSE
76 constexpr static SObjectId::ObjectId objectIdResetCause()
77 {
80 }
81#endif
82
83#ifdef CONFIG_BOARDCTL_POWEROFF
84 constexpr static SObjectId::ObjectId objectIdPoweroff()
85 {
88 }
89#endif
90
91private:
92 size_t dim;
93
94 size_t getDataDim(uint16_t cls) const;
95};
96} // Namespace dawn
Descriptor wrapper for individual object configuration.
Board control I/O for system operations.
Definition boardctl.hxx:23
size_t getDataSize() const
Get data size in bytes.
Definition boardctl.cxx:150
bool isRead() const
Check if IO supports read operations.
Definition boardctl.cxx:182
bool isNotify() const
Check if IO supports notifications.
Definition boardctl.hxx:57
bool isWrite() const
Check if IO supports write operations.
Definition boardctl.cxx:215
bool isBatch() const
Check if IO supports batch operations.
Definition boardctl.hxx:62
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
Definition boardctl.cxx:57
size_t getDataDim() const
Get data vector dimension.
Definition boardctl.cxx:19
int setDataImpl(IODataCmn &data)
Set data implementation (override in derived classes).
Definition boardctl.cxx:112
Base class for all I/O objects.
Definition common.hxx:27
@ IO_CLASS_SYSTEM_RESETCAUSE
Reset cause.
Definition common.hxx:153
@ IO_CLASS_SYSTEM_POWEROFF
Power off control.
Definition common.hxx:154
@ IO_CLASS_SYSTEM_RESET
System reset control.
Definition common.hxx:152
uint16_t getCls() const
Get object class field.
Definition object.cxx:170
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
@ OBJTYPE_IO
Input/Output object type.
Definition objectid.hxx:184
@ DTYPE_INT32
Signed 32-bit integer (-2147483648 to 2147483647).
Definition objectid.hxx:92
@ DTYPE_UINT32
Unsigned 32-bit integer (0 to 4294967295).
Definition objectid.hxx:96
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
static ObjectId objectId(uint8_t type, uint16_t cls, uint8_t dtype, uint8_t flags, uint16_t priv)
Construct 32-bit ObjectID from component fields.
Definition objectid.hxx:290