17 #ifndef TEMU_SPACEWIRE_H
18 #define TEMU_SPACEWIRE_H
50 #define TEMU_SPW_FLAG_RMAP_HCRC_ERROR 0x01
51 #define TEMU_SPW_FLAG_RMAP_DCRC_ERROR 0x02
93 void (*
connect)(
void *Device, temu_SpwPortIfaceRef Dest);
111 temu_spwConnect(temu_SpwPortIfaceRef Dev1PortIface,
112 temu_SpwPortIfaceRef Dev2PortIface)
114 Dev1PortIface.Iface->connect(Dev1PortIface.Obj, Dev2PortIface);
115 Dev2PortIface.Iface->connect(Dev2PortIface.Obj, Dev1PortIface);
123 temu_spwDisconnect(temu_SpwPortIfaceRef Dev1PortIface,
124 temu_SpwPortIfaceRef Dev2PortIface)
126 Dev1PortIface.Iface->disconnect(Dev1PortIface.Obj);
127 Dev2PortIface.Iface->disconnect(Dev2PortIface.Obj);
139 uint8_t LS, uint8_t LD, uint8_t PortConnect,
147 #define TEMU_SPW_BITS_PER_DATA_CHAR 10
148 #define TEMU_SPW_BITS_PER_CTRL_CHAR 4
149 #define TEMU_SPW_EOP_BITS TEMU_SPW_BITS_PER_CTRL_CHAR
150 #define TEMU_SPW_FCT_BITS TEMU_SPW_BITS_PER_CTRL_CHAR
151 #define TEMU_SPW_EEP_BITS TEMU_SPW_BITS_PER_CTRL_CHAR
152 #define TEMU_SPW_ESC_BITS TEMU_SPW_BITS_PER_CTRL_CHAR
154 static inline uint64_t
155 temu_spwBitsForData(uint64_t Bytes)
161 #define TEMU_SPW_PROT_EXT 0
162 #define TEMU_SPW_PROT_RMAP 1
163 #define TEMU_SPW_PROT_CCSDSPKT 2
164 #define TEMU_SPW_PROT_GOES_R 238
165 #define TEMU_SPW_PROT_STUP 239
168 #define TEMU_SPW_LOGICAL_ADDRESS_DEFAULT 0xfe
175 uint8_t ReplyAddresses[12];
344 uint8_t *Data, uint32_t AllocatedDataSize,
346 uint32_t DataLength);
354 uint8_t *Data, uint32_t AllocatedDataSize,
356 uint32_t DataLength);
364 uint8_t *Data, uint32_t AllocatedDataSize,
380 #define TEMU_SPW_RMAP_INST_CMD 0x40;
381 #define TEMU_SPW_RMAP_INST_WRITE 0x20;
382 #define TEMU_SPW_RMAP_INST_VERIFY 0x10;
383 #define TEMU_SPW_RMAP_INST_ACK 0x8;
384 #define TEMU_SPW_RMAP_INST_INC 0x4;
temu_SpwRmapRmwCmdPacket RmwCmd
#define TEMU_SPW_BITS_PER_DATA_CHAR
uint32_t temu_spwRmapEncodeRmwHeaderForPacket(const temu_SpwRmapDecodedPacket *DCmdPkt, uint8_t *Data, uint32_t AllocatedDataSize, uint8_t Status, uint32_t DataLength)
uint32_t TotalSize
Total size of the packet received.
uint32_t AvailableDataLength
The amount of data available.
const uint8_t * Data
Pointer to the first data char.
#define TEMU_SPW_EOP_BITS
const uint8_t * Data
Pointer to the first data char.
uint8_t DataCrc
Data crc. Valid only if AvailableDataLength > Header.DataLength.
uint64_t(* timeToSendPacketNs)(void *Device, uint64_t PacketLength)
void(* signalLinkStateChange)(void *Device, temu_SpwLinkState LinkState)
temu_SpwRmapRawHeader RawHeader
Raw header data access.
void(* receive)(void *Device, void *Sender, temu_SpwPacket *Pkt)
temu_SpwPacketType MsgType
uint8_t ReplyAddressesNum
temu_SpwRmapDecodedPacketType DecodedPacketType
uint8_t temu_spwRmapCRCNextCode(uint8_t InCRC, uint8_t InByte)
void temu_spwLsmInit(temu_SpwLinkState *StatePtr)
void(* connect)(void *Device, temu_SpwPortIfaceRef Dest)
temu_SpwRmapDecodedCommandHeader Header
uint32_t temu_spwRmapEncodeReadReplyHeaderForPacket(const temu_SpwRmapDecodedPacket *DCmdPkt, uint8_t *Data, uint32_t AllocatedDataSize, uint8_t Status, uint32_t DataLength)
temu_SpwRmapDecodedWriteReply WriteReply
uint8_t temu_spwRmapCRC(const uint8_t *Data, uint32_t DataSize)
const uint8_t * Mask
Pointer to the first mask char.
temu_SpwLinkState(* getOtherSideLinkState)(void *Device)
uint8_t DataCrc
Data crc. Valid only if AvailableDataLength > Header.DataLength.
struct temu_SpwPacket temu_SpwPacket
temu_SpwRmapDecodedReadReply ReadReply
void(* disconnect)(void *Device)
temu_SpwRmapDecodedWriteReplyHeader Header
uint32_t temu_spwRmapHeaderReplySize(const temu_SpwRmapDecodedPacket *DCmdPkt)
#define TEMU_IFACE_REFERENCE_TYPE(N)
const uint8_t * Data
Pointer to the first data char.
uint32_t AvailableDataLength
The amount of data available.
temu_SpwRmapCommandType CmdType
temu_SpwRmapDecodingOutcome temu_spwRmapDecodeBuffer(const temu_Buff *PktDataBuffer, temu_SpwRmapDecodedPacket *PktDecoded)
temu_SpwRmapDecodingOutcome temu_spwRmapDecodePacket(const temu_SpwPacket *Pkt, temu_SpwRmapDecodedPacket *PktDecoded)
uint32_t AvailableDataLength
The amount of data available.
uint8_t AccessSize
Size of the access.
uint8_t DataCrc
Data crc. Valid only if AvailableDataLength > Header.DataLength.
temu_SpwRmapDecodedCommandHeader Header
temu_SpwRmapDecodedCommandHeader Header
temu_SpwRmapDecodingOutcome
temu_SpwRmapDecodedReadReplyHeader Header
temu_SpwRmapDecodedPacketType
temu_SpwRmapDecodedRmwReply RmwReply
temu_SpwRmapReadCmdPacket ReadCmd
uint32_t AvailableDataLength
The amount of data available.
const uint8_t * Data
Pointer to the first data char.
temu_SpwRmapPacketType PacketType
The packet type as identified by bits [7,6] in instruction.
temu_SpwRmapDecodedReadReplyHeader Header
uint8_t temu_spwLsmUpdate(temu_SpwLinkState *StatePtr, uint8_t AS, uint8_t LS, uint8_t LD, uint8_t PortConnect, temu_SpwLinkState otherSideLinkState)
temu_SpwRmapWriteCmdPacket WriteCmd
uint8_t TargetLogicalAddr
uint8_t DataCrc
Data crc. Valid only if AvailableDataLength > Header.DataLength.
const char * temu_spwLinkStateToStr(uint8_t linkState)
uint32_t temu_spwRmapEncodeWriteReplyHeaderForPacket(const temu_SpwRmapDecodedPacket *DCmdPkt, uint8_t *Data, uint32_t AllocatedDataSize, uint8_t Status)
uint8_t InitiatorLogicalAddr
temu_SpwRmapDecodedCmdField CmdField
The command field, bits [5,4,3,2] in instruction.