spacewire_usb.h
205 lines
| 7.8 KiB
| text/x-c
|
CLexer
r0 | /******************************************************************************/ | |||
/* */ | ||||
/* spacewire_usb.h */ | ||||
/* */ | ||||
/* Header file for all constants which may be used with the STAR-Dundee */ | ||||
/* SpaceWire USB driver. */ | ||||
/* */ | ||||
/* Version 2.61, September 17th 2012 */ | ||||
/* */ | ||||
/* Version 2.61, 17/09/12 */ | ||||
/* ====================== */ | ||||
/* Added support for STAR Fire and WBS II. */ | ||||
/* */ | ||||
/* Version 2.60, 04/01/12 */ | ||||
/* ====================== */ | ||||
/* Added support for EGSE and SPLT. */ | ||||
/* */ | ||||
/* Version 2.59, 15/08/11 */ | ||||
/* ====================== */ | ||||
/* Added support for RTC. */ | ||||
/* */ | ||||
/* Version 2.58, 12/10/10 */ | ||||
/* ===================== */ | ||||
/* Added support for Link Analyser Mk2. */ | ||||
/* */ | ||||
/* Version 2.51 */ | ||||
/* ============ */ | ||||
/* Added use of star_dundee_types.h. */ | ||||
/* */ | ||||
/* Version 2.5 */ | ||||
/* =========== */ | ||||
/* Initial version, following change to new architecture. */ | ||||
/* */ | ||||
/* Copyright (2012), STAR-Dundee Ltd., */ | ||||
/* STAR House, */ | ||||
/* 166 Nethergate, */ | ||||
/* Dundee, DD1 4EE, */ | ||||
/* Scotland, UK. */ | ||||
/* e-mail: support@star-dundee.com */ | ||||
/* */ | ||||
/******************************************************************************/ | ||||
#ifndef SPACEWIRE_USB_H | ||||
#define SPACEWIRE_USB_H | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/* The types used by the API */ | ||||
#include "star_dundee_types.h" | ||||
/* End of packet marker types */ | ||||
#define SPACEWIRE_USB_EOP_CHAR ((U8)0x80) | ||||
#define SPACEWIRE_USB_EEP_CHAR ((U8)0x40) | ||||
/* The protocol byte used to identify LODI packets */ | ||||
#define SPACEWIRE_USB_LODI_PROTOCOL (0xd1) | ||||
/* Possible results of read and send operations */ | ||||
typedef enum | ||||
{ | ||||
TRANSFER_NOT_STARTED = 0, | ||||
TRANSFER_STARTED = 1, | ||||
TRANSFER_SUCCESS = 2, | ||||
TRANSFER_ERROR_DISCONNECT = 3, | ||||
TRANSFER_ERROR_PARITY = 4, | ||||
TRANSFER_ERROR_UNKNOWN = 5, | ||||
TRANSFER_ERROR_TIMEOUT = 6, | ||||
TRANSFER_ERROR_LINK_NOT_STARTED = 7, | ||||
TRANSFER_ERROR_USER_BUFFER_LOCK_FAILED = 8, | ||||
TRANSFER_ERROR_LINK_ALREADY_IN_USE = 9, | ||||
TRANSFER_ERROR_RECEIVE_BUFFER_FULL = 0xa, | ||||
TRANSFER_ERROR_OUT_OF_MEMORY = 0xb, | ||||
TRANSFER_ERROR_NOT_FOUND = 0xc, | ||||
TRANSFER_ERROR_USB_ERROR = 0xd, | ||||
TRANSFER_ERROR_NOT_REGISTERED_TO_RECEIVE = 0xe | ||||
} USB_SPACEWIRE_STATUS, *PUSB_SPACEWIRE_STATUS; | ||||
/* Possible traffic types */ | ||||
typedef enum | ||||
{ | ||||
SPACEWIRE_TRAFFIC_UNKNOWN = -1, | ||||
SPACEWIRE_TRAFFIC_PACKET = 0, | ||||
SPACEWIRE_TRAFFIC_TIMECODE = 1, | ||||
SPACEWIRE_TRAFFIC_CONTROL = 2 | ||||
} SPACEWIRE_TRAFFIC_TYPE, *PSPACEWIRE_TRAFFIC_TYPE; | ||||
/* The different end of packet marker types */ | ||||
typedef enum | ||||
{ | ||||
SPACEWIRE_USB_NO_EOP = 0, | ||||
SPACEWIRE_USB_EOP = SPACEWIRE_USB_EOP_CHAR, | ||||
SPACEWIRE_USB_EEP = SPACEWIRE_USB_EEP_CHAR | ||||
} USB_SPACEWIRE_EOP_TYPE, *PUSB_SPACEWIRE_EOP_TYPE; | ||||
/* Possible device types */ | ||||
typedef enum | ||||
{ | ||||
SPACEWIRE_DEVICE_UNKNOWN = -1, | ||||
SPACEWIRE_ROUTER_USB = 0, | ||||
SPACEWIRE_BRICK = 1, | ||||
SPACEWIRE_LINK_ANALYSER = 2, | ||||
SPACEWIRE_CONFORMANCE_TESTER = 3, | ||||
SPACEWIRE_TUNNEL_BRICK = 4, | ||||
SPACEWIRE_LINK_ANALYSER_MK2 = 5, | ||||
SPACEWIRE_RTC = 6, | ||||
SPACEWIRE_EGSE = 7, | ||||
SPACEWIRE_PHYSICAL_LAYER_TESTER = 8, | ||||
STAR_FIRE = 9, | ||||
WBS_II = 10 | ||||
} SPACEWIRE_DEVICE_TYPE, *PSPACEWIRE_DEVICE_TYPE; | ||||
/* Structure used to store packet lengths and EOPs for a read request */ | ||||
typedef struct | ||||
{ | ||||
unsigned long len; | ||||
USB_SPACEWIRE_EOP_TYPE eop; | ||||
SPACEWIRE_TRAFFIC_TYPE type; | ||||
} USB_SPACEWIRE_PACKET_PROPERTIES, *PUSB_SPACEWIRE_PACKET_PROPERTIES; | ||||
/* The type of all send and receive identifiers */ | ||||
typedef void * USB_SPACEWIRE_ID; | ||||
/* Structure used to represent the firmware version of a device */ | ||||
typedef struct | ||||
{ | ||||
U8 major; | ||||
U8 minor; | ||||
U16 edit; | ||||
U8 patch; | ||||
} SPACEWIRE_FIRMWARE_VERSION; | ||||
/* The product ID used by each STAR-Dundee SpaceWire device */ | ||||
/** The product ID used by a device with no EEPROM */ | ||||
#define SPACEWIRE_PRODUCT_ID_NO_EEPROM (0x8613) | ||||
/** The product ID used by an old device in the power check state */ | ||||
#define SPACEWIRE_PRODUCT_ID_POWER_CHECK (0x461f) | ||||
/** The product ID used by an old device with no ID set */ | ||||
#define SPACEWIRE_PRODUCT_ID_NO_ID (0x1002) | ||||
/** The product ID used by the SpaceWire Router-USB */ | ||||
#define SPACEWIRE_PRODUCT_ID_ROUTER_USB (0x1011) | ||||
/** The product ID used by the SpaceWire-USB Brick */ | ||||
#define SPACEWIRE_PRODUCT_ID_BRICK (0x1012) | ||||
/** The product ID used by the SpaceWire Link Analyser */ | ||||
#define SPACEWIRE_PRODUCT_ID_LINK_ANALYSER (0x1013) | ||||
/** The product ID used by the SpaceWire Conformance Tester */ | ||||
#define SPACEWIRE_PRODUCT_ID_CONFORMANCE_TESTER (0x1014) | ||||
/** The product ID used by the SpaceWire-IP Tunnel */ | ||||
#define SPACEWIRE_PRODUCT_ID_TUNNEL_BRICK (0x1015) | ||||
/** The product ID used by the SpaceWire Router-USB with multiple channels */ | ||||
#define SPACEWIRE_PRODUCT_ID_ROUTER_MULTIPLE_CHANNELS (0x1016) | ||||
/** The product ID used by the SpaceWire Router-USB II Rev 4 */ | ||||
#define SPACEWIRE_PRODUCT_ID_ROUTER_USB_II_REV4 (0x1017) | ||||
/** The product ID used by the SpaceWire Link Analyser Mk2 */ | ||||
#define SPACEWIRE_PRODUCT_ID_LINK_ANALYSER_MK2 (0x1018) | ||||
/** The product ID used by the SpaceWire RTC */ | ||||
#define SPACEWIRE_PRODUCT_ID_RTC (0x1019) | ||||
/** The product ID used by the SpaceWire EGSE */ | ||||
#define SPACEWIRE_PRODUCT_ID_EGSE (0x101a) | ||||
/** The product ID used by the SpaceWire SPLT */ | ||||
#define SPACEWIRE_PRODUCT_ID_SPLT (0x101b) | ||||
/** The product ID used by the STAR Fire device */ | ||||
#define SPACEWIRE_PRODUCT_ID_STAR_FIRE (0x101c) | ||||
/** The product ID used by the WBS II device */ | ||||
#define SPACEWIRE_PRODUCT_ID_WBS_II (0x101d) | ||||
/** A product ID to be used by a future device */ | ||||
#define SPACEWIRE_PRODUCT_ID_FUTURE_101E (0x101e) | ||||
/** A product ID to be used by a future device */ | ||||
#define SPACEWIRE_PRODUCT_ID_FUTURE_101F (0x101f) | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#endif /* SPACEWIRE_USB_H */ | ||||