blob: 3e7deeeef04d80fa75d678ede02cc0dc6f200f8b [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
53#define ROH_TEST 0x37 /*55 : Receiver Off-Hook indication */
54
55#define TI_CheckBoard 0xFF /*°åλ¼ì²éÃüÁî*/
56#define TI_SelfTest 0xFE /*×Ô²â*/
57
58/************************ÃüÁî×Ö***********************************/
59#define CMD_WRITE_START 0x01
60#define CMD_READ_STATE 0x02
61#define CMD_WRITE_ABORT 0x03
62#define CMD_READ_RESULT 0x04
63
64/*******************************²âÊÔ״̬**************************/
65#define TESTING 0x01
66#define TEST_SUCC 0x02
67#define TEST_ERROR 0x03
68
69#define NOT_TEST 0xFF
70
71#define MAX_TIMOUT 12000 /* 2 min */
72/************************´íÎó±àºÅ*********************************/
73typedef enum{
74 NO_ERROR = 0,
75 ERR_UNKONW ,
76 TESTITEM_TIMEOVER, /* Time out!*/
77 COMMAND_ERR_NOTLINE, /* No available testing line! */
78 COMMAND_ERR_NOTEST_UNIT, /* No available testing data buffer! */
79 ASSIGN_DATA_ERR, /* Data assignment failed!*/
80 TESTITEM_FAIL, /* Testing failed!*/
81 COMMAND_ERR_USER_USED, /* The user card is in testing process!*/
82 UNFIND_TEST_RECORD, /* No available testing card!*/
83 DATABASE_FAIL, /* Database accessing failed!*/
84 ALC_OFFLINE, /* The user card is offline!*/
85 USER_BUSY, /* User is busy!*/
86 BOARD_ABNORMAL, /* Board is abnormal!*/
87 TEST_USER_BUSY, /* User is busy!*/
88 USER_IS_ONHOOK, /* User is onhook state!*/
89 USER_IS_OFFHOOK, /* User is offhook state!*/
90 ARGS_ERROR , /* Testing error, please check the user line state!*/
91 USER_LINE_RES, /* User line is resistive loop, maybe short circuit!*/
92 REN_GREATER, /* REN is greater than 5000 milli,check the user line.*/
93 REN_LOWER, /* REN is lower than 175 milli,check the user line.*/
94 RES_LOWER, /* The DC resistance measured from the rtg/rrg/rrt lead to ground is less than 150k.*/
95 RESULT_OC, /* The result is over the ouside the the specified criteria.Check the user line.*/
96 NO_PHONE, /* No signal between tip and ring, maybe there is no phone!*/
97 NOT_SURPPORT /* The test item is not surpported !*/
98}ErrMsg_t;
99
100typedef struct{
101 unsigned char port; /* ¶Ë¿Ú±àºÅ */
102 unsigned char port_type; /* ¶Ë¿ÚÀàÐÍ */
103 unsigned char item; /* ²âÊÔÏî±àºÅ£¬¼ûÉÏÃæ²âÊÔÏÒå */
104 unsigned char obligate; /* ÊÇ·ñÇ¿ÖÆ²âÊÔ 0£º²»Ç¿ÖÆ£»1£ºÇ¿ÖÆ*/
105 long num; /* ²âÊÔÐòºÅ */
106 unsigned char omci_item; /* ÓÃÓÚ¶àÏî²âÊÔÖмǼomci²âÊÔÏî±àºÅ */
107 unsigned char cmd; /* ²âÊÔÆô¶¯ºÍ¶Á״̬:1,write;2,read;3,abort. */
108 unsigned char flg; /* ²âÊÔÍê³É±ê¼Ç:³É¹¦»òÕßʧ°Ü */
109}WriteCmd_t;
110
111typedef struct{
112 unsigned char port; /* ¶Ë¿Ú±àºÅ */
113 unsigned char port_type; /* ¶Ë¿ÚÀàÐÍ */
114 unsigned char item; /* ²âÊÔÏî±àºÅ */
115 unsigned char obligate; /* ÊÇ·ñÇ¿ÖÆ²âÊÔ */
116 long num; /* ²âÊÔÐòºÅ */
117 unsigned char omci_item; /* ÓÃÓÚ¶àÏî²âÊÔÖмǼomci²âÊÔÏî±àºÅ */
118 unsigned char flg; /* ²âÊÔÍê³É±ê¼Ç:³É¹¦»òÕßʧ°Ü */
119 unsigned char user_flg; /* Óû§ÊÇ·ñÔÚÏß */
120 ErrMsg_t err_num; /* ²âÊÔʧ°ÜºóµÄ´íÎó±àºÅ,²âÊԳɹ¦ÔòÎÞÒâÒå */
121
122 /* TI_LineVolt */
123 signed long vac_tr; /* ½»Á÷µçѹ£ºTip-Ring */
124 signed long vac_tg; /* ½»Á÷µçѹ£ºTip-Gnd */
125 signed long vac_rg; /* ½»Á÷µçѹ£ºRing-Gnd */
126 signed long vdc_tr; /* Ö±Á÷µçѹ£ºTip-Ring */
127 signed long vdc_tg; /* Ö±Á÷µçѹ£ºTip-Gnd */
128 signed long vdc_rg; /* Ö±Á÷µçѹ£ºRing-Gnd */
129
130 /* TI_LineRes */
131 signed long res_tr; /* µç×裺Tip-Ring */
132 signed long res_tg; /* µç×裺Tip-Gnd */
133 signed long res_rg; /* µç×裺Ring-Gnd */
134
135 /* TI_LineCap */
136 signed long cap_tr; /* µçÈÝ£ºTip-Ring */
137 signed long cap_tg; /* µçÈÝ£ºTip-Gnd */
138 signed long cap_rg; /* µçÈÝ£ºRing-Gnd */
139
140 /* TI_RingVolt */
141 signed long ring_vol; /* ÕñÁåµçѹ */
142 signed long Hz; /* ÕñÁ寵ÂÊ */
143
144 /* TI_REN */
145 signed long ren; /* ÁåÁ÷Êý */
146
147 /* TI_InLoopCurrent */
148 signed long loop_curent; /* »ØÂ·µçÁ÷ */
149 signed long loop_res; /* »ØÂ·µç×è */
150
151 /* TI_BatteryVolt */
152 signed long battary; /* À¡µçµçѹ */
153}TestResult_t;
154
155#endif