6#include "dawn/proto/nxscope/serial.hxx"
8#include "dawn/io/common.hxx"
9#include "dawn/io/sdata.hxx"
13int CProtoNxscopeSerial::configureDesc(
const CDescObject &desc)
18 for (
size_t i = 0; i < desc.
getSize(); i++)
24 DAWNERR(
"unsupported nxscope cfg 0x08%" PRIx32
"\n", item->
cfgid.
v);
32 const size_t wpe =
sizeof(SProtoNxscopeIOBind) / 4;
37 SProtoNxscopeIOBind *tmp =
38 reinterpret_cast<SProtoNxscopeIOBind *
>(item->
data + j * wpe);
48 const size_t wpe =
sizeof(SProtoNxscopeIOBind2) / 4;
49 const size_t entry_count = item->
cfgid.
s.
size / wpe;
54 DAWNERR(
"unsupported nxscope cfg 0x08%" PRIx32
"\n", item->
cfgid.
v);
58 for (j = 0; j < entry_count; j++)
60 SProtoNxscopeIOBind2 *tmp =
61 reinterpret_cast<SProtoNxscopeIOBind2 *
>(item->
data + j * wpe);
63 allocObject(&tmp->bind);
64 allocNames(j, &tmp->name);
72 path =
reinterpret_cast<const char *
>(&item->
data);
78 baud =
static_cast<uint32_t
>(item->
data[0]);
84 DAWNERR(
"unsupported nxscope cfg 0x08%" PRIx32
"\n", item->
cfgid.
v);
93int CProtoNxscopeSerial::confgureNxscopePriv()
100 nxsSerCfg.path =
const_cast<char *
>(path);
101 nxsSerCfg.baud = baud;
102 nxsSerCfg.nonblock = NXSCOPE_RECV_NONBLOCK;
104 DAWNINFO(
"nxscope serial path = %s baud = %ld\n", nxsSerCfg.path, nxsSerCfg.baud);
106 ret = nxscope_ser_init(&
nxsIntf, &nxsSerCfg);
109 DAWNERR(
"nxscope_ser_init failed: %d\n", ret);
117CProtoNxscopeSerial::~CProtoNxscopeSerial()
121int CProtoNxscopeSerial::initPriv()
127 ret = configureDesc(
getDesc());
133 ret = confgureNxscopePriv();
139 ret = configureNxscope();
148int CProtoNxscopeSerial::deinitPriv()
159int CProtoNxscopeSerial::startPriv()
164int CProtoNxscopeSerial::stopPriv()
Descriptor wrapper for individual object configuration.
size_t getSize() const
Get number of configuration items for this object.
SObjectCfg::SObjectCfgItem * objectCfgItemNext(size_t &offset) const
Get config item at current offset and advance past it.
CDescObject & getDesc()
Get descriptor object for this object.
@ PROTO_CLASS_NXSCOPE_SERIAL
NxScope real-time visualization (serial interface).
@ PROTO_NXSCOPE_SERIAL_CFG_BAUD
Baud rate.
@ PROTO_NXSCOPE_SERIAL_CFG_IOBIND2
I/O bindings with names.
@ PROTO_NXSCOPE_SERIAL_CFG_IOBIND
I/O bindings.
@ PROTO_NXSCOPE_SERIAL_CFG_PATH
Serial device path.
struct nxscope_intf_s nxsIntf
NXScope interface structure (from logging library).
Out-of-tree user-extension hooks for Dawn.
Single configuration item within object.
ObjectCfgData_t data[]
Configuration data array (flexible, size from cfgid.s.size).
UObjectCfgId cfgid
Configuration ID header (type, class, id, size, rw, dtype).
ObjectCfgId v
Raw 32-bit ConfigID value (for storage, comparison).
uint32_t cls
Object class (bits 21-29, max 511).
uint32_t id
Configuration identifier (bits 0-4, max 31).
uint32_t size
Configuration data size in 32-bit words (bits 5-14, max 1023).
struct dawn::SObjectCfg::UObjectCfgId::@10 s
Bit-field structure for named member access.