TEMU  2
The Terma Emulator
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Spacewire.h File Reference
#include "temu-c/Support/Objsys.h"
#include "temu-c/Support/Buffer.h"
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for Spacewire.h:

Go to the source code of this file.

Data Structures

struct  temu_SpwPacket
 
struct  temu_SpwPortIface
 
struct  temu_SpwRmapDecodedCommandHeader
 
struct  temu_SpwRmapDecodedReadReplyHeader
 
struct  temu_SpwRmapDecodedWriteReplyHeader
 
struct  temu_SpwRmapReadCmdPacket
 
struct  temu_SpwRmapWriteCmdPacket
 
struct  temu_SpwRmapRmwCmdPacket
 
struct  temu_SpwRmapRawHeader
 
struct  temu_SpwRmapDecodedReadReply
 
struct  temu_SpwRmapDecodedWriteReply
 
struct  temu_SpwRmapDecodedRmwReply
 
struct  temu_SpwRmapDecodedCmdField
 
struct  temu_SpwRmapDecodedPacket
 

Macros

#define TEMU_SPW_FLAG_RMAP_HCRC_ERROR   0x01
 
#define TEMU_SPW_FLAG_RMAP_DCRC_ERROR   0x02
 
#define TEMU_SPW_BITS_PER_DATA_CHAR   10
 
#define TEMU_SPW_BITS_PER_CTRL_CHAR   4
 
#define TEMU_SPW_EOP_BITS   TEMU_SPW_BITS_PER_CTRL_CHAR
 
#define TEMU_SPW_FCT_BITS   TEMU_SPW_BITS_PER_CTRL_CHAR
 
#define TEMU_SPW_EEP_BITS   TEMU_SPW_BITS_PER_CTRL_CHAR
 
#define TEMU_SPW_ESC_BITS   TEMU_SPW_BITS_PER_CTRL_CHAR
 
#define TEMU_SPW_PROT_EXT   0
 
#define TEMU_SPW_PROT_RMAP   1
 
#define TEMU_SPW_PROT_CCSDSPKT   2
 
#define TEMU_SPW_PROT_GOES_R   238
 
#define TEMU_SPW_PROT_STUP   239
 
#define TEMU_SPW_LOGICAL_ADDRESS_DEFAULT   0xfe
 
#define TEMU_SPW_RMAP_INST_CMD   0x40;
 
#define TEMU_SPW_RMAP_INST_WRITE   0x20;
 
#define TEMU_SPW_RMAP_INST_VERIFY   0x10;
 
#define TEMU_SPW_RMAP_INST_ACK   0x8;
 
#define TEMU_SPW_RMAP_INST_INC   0x4;
 

Typedefs

typedef struct temu_SpwPacket temu_SpwPacket
 
typedef struct temu_SpwPortIface temu_SpwPortIface
 

Enumerations

enum  temu_SpwPacketType { teSMT_Data = 1, teSMT_Err = 2, teSMT_Time = 3 }
 
enum  temu_SpwLinkState {
  teSPWLS_ErrorReset = 0, teSPWLS_ErrorWait = 1, teSPWLS_Ready = 2, teSPWLS_Started = 3,
  teSPWLS_Connecting = 4, teSPWLS_Run = 5
}
 
enum  temu_SpwRmapPacketType { teSPWRMAPPT_Response = 0, teSPWRMAPPT_Command = 1, teSPWRMAPPT_Invalid = 2 }
 
enum  temu_SpwRmapCommandType { teSPWRMAPCT_Read = 0, teSPWRMAPCT_Write = 1, teSPWRMAPCT_Rmw = 2 }
 
enum  temu_SpwRmapDecodedPacketType {
  teSPWRMAPDP_Invalid = 0, teSPWRMAPDP_ReadCmd = 1, teSPWRMAPDP_WriteCmd = 2, teSPWRMAPDP_RmwCmd = 3,
  teSPWRMAPDP_ReadReply = 4, teSPWRMAPDP_WriteReply = 5, teSPWRMAPDP_RmwReply = 6
}
 
enum  temu_SpwRmapDecodingOutcome { teSPWRMAPDO_NoError = 0, teSPWRMAPDO_HeaderIncomplete = 1, teSPWRMAPDO_InvalidPacketType = 2 }
 

Functions

 TEMU_IFACE_REFERENCE_TYPE (temu_SpwPort)
 
void temu_spwLsmInit (temu_SpwLinkState *StatePtr)
 
uint8_t temu_spwLsmUpdate (temu_SpwLinkState *StatePtr, uint8_t AS, uint8_t LS, uint8_t LD, uint8_t PortConnect, temu_SpwLinkState otherSideLinkState)
 
const char * temu_spwLinkStateToStr (uint8_t linkState)
 
temu_SpwRmapDecodingOutcome temu_spwRmapDecodePacket (const temu_SpwPacket *Pkt, temu_SpwRmapDecodedPacket *PktDecoded)
 
temu_SpwRmapDecodingOutcome temu_spwRmapDecodeBuffer (const temu_Buff *PktDataBuffer, temu_SpwRmapDecodedPacket *PktDecoded)
 
uint32_t temu_spwRmapHeaderReplySize (const temu_SpwRmapDecodedPacket *DCmdPkt)
 
uint32_t temu_spwRmapEncodeReadReplyHeaderForPacket (const temu_SpwRmapDecodedPacket *DCmdPkt, uint8_t *Data, uint32_t AllocatedDataSize, uint8_t Status, uint32_t DataLength)
 
uint32_t temu_spwRmapEncodeRmwHeaderForPacket (const temu_SpwRmapDecodedPacket *DCmdPkt, uint8_t *Data, uint32_t AllocatedDataSize, uint8_t Status, uint32_t DataLength)
 
uint32_t temu_spwRmapEncodeWriteReplyHeaderForPacket (const temu_SpwRmapDecodedPacket *DCmdPkt, uint8_t *Data, uint32_t AllocatedDataSize, uint8_t Status)
 
uint8_t temu_spwRmapCRCNextCode (uint8_t InCRC, uint8_t InByte)
 
uint8_t temu_spwRmapCRC (const uint8_t *Data, uint32_t DataSize)
 

Macro Definition Documentation

#define TEMU_SPW_BITS_PER_CTRL_CHAR   4

Definition at line 148 of file Spacewire.h.

#define TEMU_SPW_BITS_PER_DATA_CHAR   10

Definition at line 147 of file Spacewire.h.

#define TEMU_SPW_EEP_BITS   TEMU_SPW_BITS_PER_CTRL_CHAR

Definition at line 151 of file Spacewire.h.

#define TEMU_SPW_EOP_BITS   TEMU_SPW_BITS_PER_CTRL_CHAR

Definition at line 149 of file Spacewire.h.

#define TEMU_SPW_ESC_BITS   TEMU_SPW_BITS_PER_CTRL_CHAR

Definition at line 152 of file Spacewire.h.

#define TEMU_SPW_FCT_BITS   TEMU_SPW_BITS_PER_CTRL_CHAR

Definition at line 150 of file Spacewire.h.

#define TEMU_SPW_FLAG_RMAP_DCRC_ERROR   0x02

Definition at line 51 of file Spacewire.h.

#define TEMU_SPW_FLAG_RMAP_HCRC_ERROR   0x01

Definition at line 50 of file Spacewire.h.

#define TEMU_SPW_LOGICAL_ADDRESS_DEFAULT   0xfe

Definition at line 168 of file Spacewire.h.

#define TEMU_SPW_PROT_CCSDSPKT   2

Definition at line 163 of file Spacewire.h.

#define TEMU_SPW_PROT_EXT   0

Definition at line 161 of file Spacewire.h.

#define TEMU_SPW_PROT_GOES_R   238

Definition at line 164 of file Spacewire.h.

#define TEMU_SPW_PROT_RMAP   1

Definition at line 162 of file Spacewire.h.

#define TEMU_SPW_PROT_STUP   239

Definition at line 165 of file Spacewire.h.

#define TEMU_SPW_RMAP_INST_ACK   0x8;

Definition at line 383 of file Spacewire.h.

#define TEMU_SPW_RMAP_INST_CMD   0x40;

Definition at line 380 of file Spacewire.h.

#define TEMU_SPW_RMAP_INST_INC   0x4;

Definition at line 384 of file Spacewire.h.

#define TEMU_SPW_RMAP_INST_VERIFY   0x10;

Definition at line 382 of file Spacewire.h.

#define TEMU_SPW_RMAP_INST_WRITE   0x20;

Definition at line 381 of file Spacewire.h.

Typedef Documentation

Definition at line 53 of file Spacewire.h.

Enumeration Type Documentation

Enumerator
teSPWLS_ErrorReset 
teSPWLS_ErrorWait 
teSPWLS_Ready 
teSPWLS_Started 
teSPWLS_Connecting 
teSPWLS_Run 

Definition at line 57 of file Spacewire.h.

This is the spacewire device modelling API. It provides an interface to be used for implementing routers, spacewire controllers and devices.

The spacewire device interface is EXPERIMENTAL at the moment.

Enumerator
teSMT_Data 
teSMT_Err 
teSMT_Time 

Definition at line 33 of file Spacewire.h.

Enumerator
teSPWRMAPCT_Read 
teSPWRMAPCT_Write 
teSPWRMAPCT_Rmw 

Definition at line 208 of file Spacewire.h.

Enumerator
teSPWRMAPDP_Invalid 
teSPWRMAPDP_ReadCmd 
teSPWRMAPDP_WriteCmd 
teSPWRMAPDP_RmwCmd 
teSPWRMAPDP_ReadReply 
teSPWRMAPDP_WriteReply 
teSPWRMAPDP_RmwReply 

Definition at line 272 of file Spacewire.h.

Enumerator
teSPWRMAPDO_NoError 
teSPWRMAPDO_HeaderIncomplete 
teSPWRMAPDO_InvalidPacketType 

Definition at line 313 of file Spacewire.h.

Enumerator
teSPWRMAPPT_Response 
teSPWRMAPPT_Command 
teSPWRMAPPT_Invalid 

Definition at line 202 of file Spacewire.h.

Function Documentation

TEMU_IFACE_REFERENCE_TYPE ( temu_SpwPort  )
const char* temu_spwLinkStateToStr ( uint8_t  linkState)

Returns the string name for the link state.

void temu_spwLsmInit ( temu_SpwLinkState StatePtr)

Initialize the link state.

uint8_t temu_spwLsmUpdate ( temu_SpwLinkState StatePtr,
uint8_t  AS,
uint8_t  LS,
uint8_t  LD,
uint8_t  PortConnect,
temu_SpwLinkState  otherSideLinkState 
)

Updates the link state.

uint8_t temu_spwRmapCRC ( const uint8_t *  Data,
uint32_t  DataSize 
)

Calculates the CRC over the specified data.

uint8_t temu_spwRmapCRCNextCode ( uint8_t  InCRC,
uint8_t  InByte 
)

Provided the previous calculated crc and a the current byte returns the next CRC value.

temu_SpwRmapDecodingOutcome temu_spwRmapDecodeBuffer ( const temu_Buff PktDataBuffer,
temu_SpwRmapDecodedPacket PktDecoded 
)

Provided a buffer containing a SpaceWire Rmap packet attempts to decode it.

temu_SpwRmapDecodingOutcome temu_spwRmapDecodePacket ( const temu_SpwPacket Pkt,
temu_SpwRmapDecodedPacket PktDecoded 
)

Provided a SpaceWire Rmap packet attempts to decode it.

uint32_t temu_spwRmapEncodeReadReplyHeaderForPacket ( const temu_SpwRmapDecodedPacket DCmdPkt,
uint8_t *  Data,
uint32_t  AllocatedDataSize,
uint8_t  Status,
uint32_t  DataLength 
)

Encodes the reply for a read command.

uint32_t temu_spwRmapEncodeRmwHeaderForPacket ( const temu_SpwRmapDecodedPacket DCmdPkt,
uint8_t *  Data,
uint32_t  AllocatedDataSize,
uint8_t  Status,
uint32_t  DataLength 
)

Encodes the reply for a rmw command.

uint32_t temu_spwRmapEncodeWriteReplyHeaderForPacket ( const temu_SpwRmapDecodedPacket DCmdPkt,
uint8_t *  Data,
uint32_t  AllocatedDataSize,
uint8_t  Status 
)

Encodes the reply for a write command.

uint32_t temu_spwRmapHeaderReplySize ( const temu_SpwRmapDecodedPacket DCmdPkt)

Returns the total packet-size required to reply to the command.