📄 testopposing.h
字号:
/*
* description: Test Opposing
* Maker : Mie.Ono
* Copyright : (C)2005,SEIKO EPSON Corp. All Rights Reserved.
*/
//------- include gurd ------------------------------------------------------
#ifndef TEST_OPPOSING_H
#define TEST_OPPOSING_H
// ------- Linkage specification ------------------------------------------------------
#ifdef __cpulusplus
extern "C" {
#endif /* cplusplus */
//=============================================================================
//Constants declaration
//=============================================================================
#define OFF (0) // OFF
#define ON (1) // ON
#define TEST_REQUEST_SIZE (36) // Test Request Size
#define DATA_OUT (0x00) /* Out */
#define DATA_IN (0x80) /* In */
#define VENDOR_REQUEST (0x40) /* VendorRequest */
#define EP_NUM (6) /* Number of Endpoints */
#define ENDPOINT_0 (0) /* Endpoint 0 */
#define ENDPOINT_A (1) /* Endpoint a */
#define ENDPOINT_B (2) /* Endpoint b */
#define ENDPOINT_C (3) /* Endpoint c */
#define ENDPOINT_D (4) /* Endpoint d */
#define ENDPOINT_E (5) /* Endpoint e */
#define TEST_TYPE_SETTING_REQ (0x00) /* Opposing examination: Set test environment request */
#define TEST_TYPE_START_REQ (0x01) /* Opposing examination: Start test request */
#define TEST_TYPE_RESULT_REQ (0x02) /* Opposing examination: Test result request */
#define TEST_TYPE_SETTING_REQ_LEN (0x0004) /* Opposing examination: The Length of the setting test environment request */
#define TEST_TYPE_START_REQ_LEN (0x000A) /* Opposing examination: The Length of the Start test request */
#define TEST_TYPE_RESULT_REQ_LEN (0x000A) /* Opposing examination: The Length of the test result request */
#define TEST_CONTROL (0) /* Control */
#define TEST_ISOCHRONOUS (1) /* Isocronos */
#define TEST_BULK (2) /* Bulk*/
#define TEST_INTERRUPT (3) /* Interrupt */
#define TEST_DATA_INC (0) /* 0 = Increment */
#define TEST_DATA_ALL_00 (1) /* 1 = All 0x00 */
#define TEST_DATA_ALL_FF (2) /* 2 = All 0xFF */
#define TEST_DATA_ALL_7C (3) /* 3 = All 0x7C */
#define TEST_DATA_ALL_7E (4) /* 4 = All 0x7E */
#define TEST_RESULT_COMPLETE (0x00) /* 0x00 = Normal termination */
#define TEST_RESULT_SHORT_PKT (0x01) /* 0x01 = Stop on receiving short packet */
#define TEST_RESULT_RUNNING (0xFF) /* 0xFF = Test on executing.*/
//=============================================================================
//Structures declaration
//=============================================================================
// request used for opposing examination
typedef struct tagTEST_REQUEST {
unsigned char bmRequestType; /* The feature of request.*/
/* Bit7 : Trnasfer direction. ( OUT = 0 / IN = 1 ) */
/* Bit6-5 : Vendor request = 10 */
/* Bit4-0 : Receive point of others = 0x03*/
unsigned char bRequest; /* Request type */
/* 0x00 : Test environment setting*/
/* 0x01 : Test start */
/* 0x01 : Test complete */
unsigned char wValue_L; /* 0 fixed. */
unsigned char wValue_H; /* 0 fixed. */
unsigned char wIndex_L; /* 0 fixed. */
unsigned char wIndex_H; /* 0 fixed. */
unsigned char wLength_L; /* Transfer number (lower byte)*/
unsigned char wLength_H; /* Transfer number (higher byte)*/
} TEST_REQUEST;
// request data used for opposing examination(test environment setting)
typedef struct tagTEST_SETTING_REQUEST {
unsigned char epAddress; /* 1Byte : EP Address */
unsigned char tranType; /* 2Byte : Transsfer type */
unsigned char maxPktSizeL; /* 3Byte : MaxPacketSize(L) */
unsigned char maxPktSizeH; /* 4Byte : MaxPacketSize(H) */
} TEST_SETTING_REQUEST;
// request data used for opposing examination(test start)
typedef struct tagTEST_START_REQUEST {
unsigned char epAddress; /* 1Byte : EP Address */
unsigned char incStartData; /* 2Byte : The initial value of increment data */
unsigned char reserved3; /* 3Byte : Reserved */
unsigned char reserved4; /* 4Byte : Reserved */
union {
unsigned long tranSize;
struct {
unsigned char tranSizeLL; /* 5Byte : Transfer number (LL)*/
unsigned char tranSizeLH; /* 6Byte : Transfer number (LH)*/
unsigned char tranSizeHL; /* 7Byte : Transfer number (HL)*/
unsigned char tranSizeHH; /* 8Byte : Transfer number (HH)*/
} byte;
} access;
/* 9Byte : Option*/
unsigned char compareDis : 1; /* Bit0 : Compare disable ( 0 = OFF / 1 = ON )*/
unsigned char dataType : 3; /* Bit3-1 : Data type ( 0 = Increment / 1 = has bit staff / 2 = bit staff none. )*/
unsigned char reservedBit : 4; /* Bit7-4 : Reserved */
unsigned char reserved; /* 10Byte : Reserved */
} TEST_START_REQUEST;
// request data used for opposing examination(test result)
typedef struct tagTEST_RESULT_REQUEST {
union {
unsigned long tranSize;
struct {
unsigned char tranSizeLL; /* 1Byte : Transfer number (LL)*/
unsigned char tranSizeLH; /* 2Byte : Transfer number (LH)*/
unsigned char tranSizeHL; /* 3Byte : Transfer number (HL)*/
unsigned char tranSizeHH; /* 4Byte : Transfer number (HH)*/
} byte;
} access1;
union {
unsigned long errorCount; /* the number of compare errors(OUT transfer only) */
struct {
unsigned char errorCountLL; /* 5Byte : The number of compare errors (LL) */
unsigned char errorCountLH; /* 6Byte : The number of compare errors (LH) */
unsigned char errorCountHL; /* 7Byte : The number of compare errors (HL) */
unsigned char errorCountHH; /* 8Byte : The number of compare errors (HH) */
} byte;
} access2;
unsigned char tranResult; /* 9Byte : Transfer result ( 0 = TranCmp / 1 = TranErr / 2 = ShortPacket )*/
unsigned char reserved; /* 10Byte : Reserved */
} TEST_RESULT_REQUEST;
//==========================================================================//
// //
// Test API Applicasion Interface //
// //
//==========================================================================//
extern long TestOpposingRequest( TEST_REQUEST reqParam, unsigned short *pReqData ); //Send opposing examination request
extern unsigned long TestOpposingCompare( unsigned char *pReceiveData, unsigned long receiveSize, unsigned char testDataType, unsigned char startData );
// Compare check for opposing examination
#ifdef __cplusplus
}
#endif /* cplusplus */
#endif /* TEST_OPPOSING_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -