6#include "dawn/io/boardctl.hxx"
8#include <sys/boardctl.h>
12#ifdef CONFIG_BOARDCTL_RESET
14#ifdef CONFIG_BOARDCTL_RESET_CAUSE
16#ifdef CONFIG_BOARDCTL_POWEROFF
28#ifdef CONFIG_BOARDCTL_RESET_CAUSE
35#ifdef CONFIG_BOARDCTL_RESET
42#ifdef CONFIG_BOARDCTL_POWEROFF
51 DAWNERR(
"Invalid boardctl class %d\n", cls);
79#ifdef CONFIG_BOARDCTL_RESET_CAUSE
82 uint32_t *tmp =
static_cast<uint32_t *
>(data.
getDataPtr());
83 struct boardioc_reset_cause_s cause;
85 std::memset(&cause, 0,
sizeof(
struct boardioc_reset_cause_s));
87 ret = boardctl(BOARDIOC_RESET_CAUSE, (uintptr_t)&cause);
90 DAWNERR(
"BOARDIOC_RESET_CAUSE failed %d\n", ret);
127#ifdef CONFIG_BOARDCTL_RESET
130 int32_t *outvalue =
static_cast<int32_t *
>(data.
getDataPtr());
131 return boardctl(BOARDIOC_RESET, (
int)*outvalue);
135#ifdef CONFIG_BOARDCTL_POWEROFF
138 int32_t *outvalue =
static_cast<int32_t *
>(data.
getDataPtr());
139 return boardctl(BOARDIOC_POWEROFF, (
int)*outvalue);
154#ifdef CONFIG_BOARDCTL_RESET
157 return sizeof(int32_t) * dim;
161#ifdef CONFIG_BOARDCTL_RESET_CAUSE
164 return sizeof(uint32_t) * dim;
168#ifdef CONFIG_BOARDCTL_POWEROFF
171 return sizeof(int32_t) * dim;
186#ifdef CONFIG_BOARDCTL_RESET
193#ifdef CONFIG_BOARDCTL_RESET_CAUSE
200#ifdef CONFIG_BOARDCTL_POWEROFF
209 DAWNERR(
"Unknown boardctl class %d for isRead\n",
getCls());
219#ifdef CONFIG_BOARDCTL_RESET
226#ifdef CONFIG_BOARDCTL_RESET_CAUSE
233#ifdef CONFIG_BOARDCTL_POWEROFF
242 DAWNERR(
"Unknown boardctl class %d for isWrite\n",
getCls());
size_t getDataSize() const
Get data size in bytes.
bool isRead() const
Check if IO supports read operations.
bool isWrite() const
Check if IO supports write operations.
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
size_t getDataDim() const
Get data vector dimension.
int setDataImpl(IODataCmn &data)
Set data implementation (override in derived classes).
@ IO_CLASS_SYSTEM_RESETCAUSE
Reset cause.
@ IO_CLASS_SYSTEM_POWEROFF
Power off control.
@ IO_CLASS_SYSTEM_RESET
System reset control.
uint16_t getCls() const
Get object class field.
Out-of-tree user-extension hooks for Dawn.
Base interface for I/O data buffers (static and dynamic).
virtual void * getDataPtr(size_t batch=0)=0
Get pointer to data only (skips timestamp if present).