blob: 1cd453e6bbd3a7f651e0442a6f3ad9df633c96bb [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#ifndef _LINE_TSET_H
2#define _LINE_TSET_H
3
4/********************²âÊÔÏÒå***********************************/
5#define TI_BatteryVolt 0x1 /*²âÊÔSLC °å¶ÔÓû§ÏßµÄÀ¡µçµçѹ´óС·´¼«ÐÔ*/
6#define TI_RingVolt 0x2 /*²âÊÔSLC °å¶ÔÓû§ËÍÁåÁ÷ÊÇ·ñÕý³£¼°ÁåÁ÷µçѹ´óС£¨ ·åÖµ¡³*/
7#define TI_PulseRecv 0x3 /*²âÊÔSLC °å½ÓÊÕÂö³å»°»ú(Ä£Äâ)·¢ºÅµÄÇé¿ö*/
8#define TI_DTMFRecv 0x4 /*²âÊÔSLC °å½ÓÊÕDTMF»°»ú(Ä£Äâ)·¢ºÅµÄÇé¿ö*/
9#define TI_SendTone 0x5 /*²¦ºÅÒô£¬»ØÁåÒô£¬ÓµÈûÒô¼°Ã¦Òô¼ì²â*/
10#define TI_SendHowl 0x6 /*¶ÔÓû§ËÍ´ß¹ÒÒô*/
11#define TI_LoopCircuitAndRes 0x7 /*ÍâÏß»·Â·µçÁ÷¼°»·Â·µç×è²âÊÔ*/
12#define TI_PulseDial 0x8 /*²âÊÔÓû§»°»úÂö³å·¢ºÅµÄÄÜÁ¦*/
13#define TI_DTMFDial 0x9 /*²âÊÔÓû§»°»úµÄDTMF·¢ºÅÒÔ¼°Âö³å·¢ºÅµÄÇé¿ö*/
14#define TI_RingtoUser 0xA /*¶ÔÓû§»°»úËÍÁåÁ÷*/
15#define TI_LineVolt 0xB /*ÍâÏßÈ«µçѹ²âÊÔ*/
16#define TI_LineRes 0xC /*ÍâÏßÈ«¾øÔµµç×è²âÊÔ*/
17#define TI_LineCap 0xD /*ÍâÏßÈ«µçÈݲâÊÔ*/
18
19#define TI_Insert 0xF /*ÓëÓû§Í¨»°*/
20
21/*INVALID TEST ITEM*/
22#define TI_Hook 0x10 /*²âÊÔÓû§Õª¹Ò»ú״̬*/
23
24#define TI_VAB 0x11 /*ÍâÏßA-B¼äµçѹ²âÊÔ*/
25#define TI_VAG 0x12 /*ÍâÏßA-GND ¼äµçѹ²âÊÔ*/
26#define TI_VBG 0x13 /*ÍâÏßB-GND¼äµçѹ²âÊÔ*/
27#define TI_RAB 0x14 /*ÍâÏßA-B ¼ä¾øÔµµç×è²âÊÔ*/
28#define TI_RAG 0x15 /*ÍâÏßA-GND¼ä¾øÔµµç×è²âÊÔ*/
29#define TI_RBG 0x16 /*ÍâÏßB-GND ¼ä¾øÔµµç×è²âÊÔ*/
30#define TI_CAB 0x17 /*ÍâÏßA-B¼äµçÈݲâÊÔ*/
31#define TI_CAG 0x18 /*ÍâÏßA-GND¼äµçÈݲâÊÔ*/
32#define TI_CBG 0x19 /*ÍâÏßB-GND¼äµçÈݲâÊÔ*/
33#define TI_InverseBatt 0x1a /* ÎĵµÖÐÊDzâÄÚÏß»ØÂ·µçÁ÷²âÊÔ*/
34#define TI_InLoopCurrent 0x1B /* ÄÚÏß»ØÂ·µçÁ÷²âÊÔ*/
35#define TI_ISDNLoop 0x1C /* isdn loop Test*/
36#define TI_Outside12 0x1D /* ÍâÏß12Ïî²âÊÔ*/
37#define TI_REN 0x1e /* ÁåÁ÷Êý */
38#define TI_LineConnect 0x1f /* Ïß·Á¬½ÓÐÔ²âÊÔ*/
39
40#define TI_LineRes_reverse 0x20 /*·´¼«ÐÔ¾øÔµµç×è²âÊÔ*/
41
42#define TI_SimCaller 0x27 /*Ä£ÄâÖ÷½Ð*/
43#define TI_SimCallee 0x28 /*Ä£Äâ±»½Ð*/
44#define TI_Dual 0x29 /*41:Ë«Ïò·ÓÉ */
45
46#define TI_LeakCurrent 0x30 /*48:©µçµçÁ÷*/
47#define TI_OutsideNoise 0x31 /*49:ÍâÏßÔëÉù */
48#define TI_SimulateDial 0x33 /*51:Ä£ÄⲦÈë*/
49#define TI_Monitor 0x34 /*52:¸ß×è¼àÌý*/
50#define TI_TalkWithUser 0x35 /*53:ÓëÓû§Í¨»°*/
51#define TI_PolarityReversal 0x36 /*54:·´¼«ÐÔ²âÊÔ*/
52#define ROH_TEST 0x37 /*55 :Õª»ú²âÊÔ*/
53
54#define TI_CheckBoard 0xFF /*°åλ¼ì²éÃüÁî*/
55#define TI_SelfTest 0xFE /*×Ô²â*/
56
57/************************ÃüÁî×Ö***********************************/
58#define CMD_WRITE_START 0x01
59#define CMD_READ_STATE 0x02
60#define CMD_WRITE_ABORT 0x03
61#define CMD_READ_RESULT 0x04
62
63/*******************************²âÊÔ״̬**************************/
64#define NOT_TEST 0x00
65#define TESTING 0x01
66#define TEST_SUCC 0x02
67#define TEST_ERROR 0x03
68#define TEST_STARTING 0x04
69#define TEST_STOPING 0x05
70
71
72#define MAX_TIMOUT 12000 /* 2 min */
73
74/************************´íÎó±àºÅ*********************************/
75typedef enum{
76 NO_ERROR = 0,
77 ERR_UNKONW ,
78 TESTITEM_TIMEOVER, /* Time out!*/
79 COMMAND_ERR_NOTLINE, /* No available testing line! */
80 COMMAND_ERR_NOTEST_UNIT, /* No available testing data buffer! */
81 ASSIGN_DATA_ERR, /* Data assignment failed!*/
82 TESTITEM_FAIL, /* Testing failed!*/
83 COMMAND_ERR_USER_USED, /* The user card is in testing process!*/
84 UNFIND_TEST_RECORD, /* No available testing card!*/
85 DATABASE_FAIL, /* Database accessing failed!*/
86 ALC_OFFLINE, /* The user card is offline!*/
87 USER_BUSY, /* User is busy!*/
88 BOARD_ABNORMAL, /* Board is abnormal!*/
89 TEST_USER_BUSY, /* User is busy!*/
90 USER_IS_ONHOOK, /* User is onhook state!*/
91 USER_IS_OFFHOOK, /* User is offhook state!*/
92 ARGS_ERROR , /* Testing error, please check the user line state!*/
93 USER_LINE_RES, /* User line is resistive loop, maybe short circuit!*/
94 REN_GREATER, /* REN is greater than 5000 milli,check the user line.*/
95 REN_LOWER, /* REN is lower than 175 milli,check the user line.*/
96 RES_LOWER, /* The DC resistance measured from the rtg/rrg/rrt lead to ground is less than 150k.*/
97 RESULT_OC, /* The result is over the ouside the the specified criteria.Check the user line.*/
98 NO_PHONE, /* No signal between tip and ring, maybe there is no phone!*/
99 NOT_SURPPORT /* The test item is not surpported !*/
100}ErrMsg_t;
101
102typedef struct{
103 unsigned char port; /* ¶Ë¿Ú±àºÅ */
104 unsigned char port_type; /* ¶Ë¿ÚÀàÐÍ */
105 unsigned char item; /* ²âÊÔÏî±àºÅ£¬¼ûÉÏÃæ²âÊÔÏÒå */
106 unsigned char obligate; /* ÊÇ·ñÇ¿ÖÆ²âÊÔ 0£º²»Ç¿ÖÆ£»1£ºÇ¿ÖÆ*/
107 long num; /* ²âÊÔÐòºÅ */
108 unsigned char omci_item; /* ÓÃÓÚ¶àÏî²âÊÔÖмǼomci²âÊÔÏî±àºÅ */
109 unsigned char cmd; /* ²âÊÔÆô¶¯ºÍ¶Á״̬:1,write;2,read;3,abort. */
110 unsigned char flg; /* ²âÊÔÍê³É±ê¼Ç:³É¹¦»òÕßʧ°Ü */
111}WriteCmd_t;
112
113typedef struct{
114 unsigned char port; /* ¶Ë¿Ú±àºÅ */
115 unsigned char port_type; /* ¶Ë¿ÚÀàÐÍ */
116 unsigned char item; /* ²âÊÔÏî±àºÅ */
117 unsigned char obligate; /* ÊÇ·ñÇ¿ÖÆ²âÊÔ */
118 long num; /* ²âÊÔÐòºÅ */
119 unsigned char omci_item; /* ÓÃÓÚ¶àÏî²âÊÔÖмǼomci²âÊÔÏî±àºÅ */
120 unsigned char flg; /* ²âÊÔÍê³É±ê¼Ç:³É¹¦»òÕßʧ°Ü */
121 unsigned char user_flg; /* Óû§ÊÇ·ñÔÚÏß */
122 ErrMsg_t err_num; /* ²âÊÔʧ°ÜºóµÄ´íÎó±àºÅ,²âÊԳɹ¦ÔòÎÞÒâÒå */
123
124 /* TI_LineVolt */
125 signed long vac_tr; /* ½»Á÷µçѹ£ºTip-Ring */
126 signed long vac_tg; /* ½»Á÷µçѹ£ºTip-Gnd */
127 signed long vac_rg; /* ½»Á÷µçѹ£ºRing-Gnd */
128 signed long vdc_tr; /* Ö±Á÷µçѹ£ºTip-Ring */
129 signed long vdc_tg; /* Ö±Á÷µçѹ£ºTip-Gnd */
130 signed long vdc_rg; /* Ö±Á÷µçѹ£ºRing-Gnd */
131
132 /* TI_LineRes */
133 signed long res_tr; /* µç×裺Tip-Ring */
134 signed long res_tg; /* µç×裺Tip-Gnd */
135 signed long res_rg; /* µç×裺Ring-Gnd */
136
137 /* TI_LineCap */
138 signed long cap_tr; /* µçÈÝ£ºTip-Ring */
139 signed long cap_tg; /* µçÈÝ£ºTip-Gnd */
140 signed long cap_rg; /* µçÈÝ£ºRing-Gnd */
141
142 /* TI_RingVolt */
143 signed long ring_vol; /* ÕñÁåµçѹ */
144 signed long Hz; /* ÕñÁ寵ÂÊ */
145
146 /* TI_REN */
147 signed long ren; /* ÁåÁ÷Êý */
148
149 /* TI_InLoopCurrent */
150 signed long loop_curent; /* »ØÂ·µçÁ÷ */
151 signed long loop_res; /* »ØÂ·µç×è */
152
153 /* TI_BatteryVolt */
154 signed long battary; /* À¡µçµçѹ */
155}TestResult_t;
156
157#endif