blob: 87337252c243cc0379a24c963aa134ae5723d0d1 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/***********************************************************************
2 *Project Linux H100
3 *Modual USRLINE
4 *FileName slc_inf.c
5 *Description user line driver interface
6 *-----------------------------------------------------------------------
7 *modify History:
8 *
9 * Data author version modify description
10 * 2004/12/10 jiang.yuelong 1.0 create
11 ************************************************************************/
12#include <fcntl.h>
13#include <stdio.h>
14#include <unistd.h>
15#include <string.h>
16#include <stdlib.h>
17#include <sys/ioctl.h>
18/*lint -save -esym(18, LONG) */
19/*lint -restore */
20
21#include "slic_inf.h"
22#include "112.h"
23#include "libzte_log.h"
24
25static LONG SLIC_Fd;
26static S8 *SLIC_DeviceName = (S8 *)"/dev/slic";
27
28DWORD SLIC_Initial(VOID)
29{
30
31 SLIC_Fd = open(SLIC_DeviceName, O_RDONLY);
32 if(SLIC_Fd < 0)
33 {
34 printf("slctool: open device error.\n");
35 return SLIC_FAIL;
36 }
37 return SLIC_SUCCESS;
38}
39
40VOID SLIC_Release(VOID)
41{
42 close(SLIC_Fd);
43}
44
45VOID SLIC_DebugLevel(WORD wLevel)
46{
47 SLIC_IOCTL_DATA Tmp;
48
49 memset((VOID *)&Tmp,0,sizeof(Tmp));
50
51 //Tmp.unPara.wLevel = wLevel;
52
53 if (ioctl(SLIC_Fd, SLIC_DEBUG_LEVEL, (DWORD)&Tmp) < 0) {//cov m
54 printf("SLIC_DebugLevel ioctl fail\n");
55 }
56}
57
58DWORD SLIC_ResetPort(WORD wPort, BYTE bType)
59{
60 SLIC_IOCTL_DATA Tmp;
61
62 memset((VOID *)&Tmp,0,sizeof(Tmp));
63 //Tmp.wPort = wPort;
64 //Tmp.bPortType = bType;
65
66 if (ioctl(SLIC_Fd, SLIC_PORT_RESET, (DWORD) &Tmp) < 0)
67 {
68 return SLIC_FAIL;
69 }
70 return SLIC_SUCCESS;
71}
72
73DWORD SLIC_Port_Lock(WORD wPort, BYTE bType)
74{
75 SLIC_IOCTL_DATA Tmp;
76
77 memset((VOID *)&Tmp,0,sizeof(Tmp));
78 //Tmp.wPort = wPort;
79 //Tmp.bPortType = bType;
80
81 if (ioctl(SLIC_Fd, SLIC_PORT_LOCK, (DWORD) &Tmp) < 0)
82 {
83 return SLIC_FAIL;
84 }
85 return SLIC_SUCCESS;
86}
87
88DWORD SLIC_Port_UnLock(WORD wPort, BYTE bType)
89{
90 SLIC_IOCTL_DATA Tmp;
91
92 memset((VOID *)&Tmp,0,sizeof(Tmp));
93 //Tmp.wPort = wPort;
94 //Tmp.bPortType = bType;
95
96 if (ioctl(SLIC_Fd, SLIC_PORT_UNLOCK, (DWORD) &Tmp) < 0)
97 {
98 return SLIC_FAIL;
99 }
100 return SLIC_SUCCESS;
101}
102
103DWORD SLIC_FXS_PolarityReverse(WORD wPort)
104{
105 SLIC_IOCTL_DATA Tmp;
106
107 memset((VOID *)&Tmp,0,sizeof(Tmp));
108 //Tmp.wPort = wPort;
109
110 if (ioctl(SLIC_Fd, SLIC_POLARITY_REVERSE, (DWORD) &Tmp) < 0)
111 {
112 return SLIC_FAIL;
113 }
114 return SLIC_SUCCESS;
115}
116extern int get_polarity_reversal_flag(void);
117
118DWORD SLIC_PolarityReverse(WORD wPort, int is_active)
119{
120#ifdef USE_SLIC_TW
121
122 if (ioctl(SLIC_Fd, SLIC_POLARITY_REVERSE, (WORD) is_active) < 0)
123 {
124 return SLIC_FAIL;
125 }
126 #else
127
128 SLIC_IOCTL_DATA Tmp;
129
130 if(get_polarity_reversal_flag()==0)
131 return SLIC_SUCCESS;
132
133 memset((VOID *)&Tmp,0,sizeof(Tmp));
134 Tmp.dwSize = (WORD)is_active;
135
136 if (ioctl(SLIC_Fd, SLIC_POLARITY_REVERSE, (DWORD) &Tmp) < 0)
137 {
138 return SLIC_FAIL;
139 }
140#endif
141
142 return SLIC_SUCCESS;
143}
144
145
146DWORD SLIC_Play_Signal(WORD wPort, BYTE bType, SIGNAL_DATA *pSig)
147{
148#ifdef USE_SLIC_TW
149 if (!pSig)
150 {
151 return SLIC_FAIL;
152 }
153
154 if (ioctl(SLIC_Fd, SLIC_SIGNAL_START, (DWORD) pSig) < 0)
155 {
156 return SLIC_FAIL;
157 }
158 #else
159 SLIC_IOCTL_DATA Tmp;
160
161 memset((VOID *)&Tmp,0,sizeof(Tmp));
162
163 if (!pSig)
164 {
165 return SLIC_FAIL;
166 }
167
168 Tmp.pData = pSig;
169 Tmp.dwSize = sizeof(SIGNAL_DATA);
170
171 if (ioctl(SLIC_Fd, SLIC_SIGNAL_START, (DWORD) &Tmp) < 0)
172 {
173 return SLIC_FAIL;
174 }
175
176#endif
177 return SLIC_SUCCESS;
178
179}
180
181DWORD SLIC_Stop_Signal(WORD wPort, BYTE bType)
182{
183#ifdef USE_SLIC_TW
184
185 if (ioctl(SLIC_Fd, SLIC_SIGNAL_STOP, NULL) < 0)
186 {
187 return SLIC_FAIL;
188 }
189#else
190
191 SLIC_IOCTL_DATA Tmp;
192
193 memset((VOID *)&Tmp,0,sizeof(Tmp));
194 //Tmp.wPort = wPort;
195 //Tmp.bPortType = bType;
196
197 if (ioctl(SLIC_Fd, SLIC_SIGNAL_STOP, (DWORD) &Tmp) < 0)
198 {
199 return SLIC_FAIL;
200 }
201
202#endif
203 return SLIC_SUCCESS;
204}
205DWORD SLIC_Start_PCM()
206{
207 printf("ccapp:SLIC_Start_PCM! \n");
208#ifdef USE_SLIC_TW
209
210 if (ioctl(SLIC_Fd, SLIC_PCM_OPEN, NULL) < 0)
211 {
212 printf("ccapp:SLIC_Start_PCM fail!\n");
213 return SLIC_FAIL;
214 }
215#else
216 SLIC_IOCTL_DATA Tmp;
217
218 memset((VOID *)&Tmp,0,sizeof(Tmp));
219 if (ioctl(SLIC_Fd, SLIC_PCM_OPEN, (DWORD) &Tmp) < 0)
220 {
221 return SLIC_FAIL;
222 }
223#endif
224 return SLIC_SUCCESS;
225}
226
227DWORD SLIC_Stop_PCM()
228{
229 printf("[ccapp_debug]:SLIC_Stop_PCM!\n");
230#ifdef USE_SLIC_TW
231
232 if (ioctl(SLIC_Fd, SLIC_PCM_CLOSE, NULL) < 0)
233 {
234 printf("[ccapp_debug]:SLIC_Stop_PCM fail!\n");
235 return SLIC_FAIL;
236 }
237#else
238 SLIC_IOCTL_DATA Tmp;
239
240 memset((VOID *)&Tmp,0,sizeof(Tmp));
241 if (ioctl(SLIC_Fd, SLIC_PCM_CLOSE, (DWORD) &Tmp) < 0)
242 {
243 return SLIC_FAIL;
244 }
245#endif
246 return SLIC_SUCCESS;
247}
248
249DWORD SLIC_PCM_Set_NB()
250{
251 printf("ccapp:SLIC_PCM_Set_NB!\n");
252#ifdef USE_SLIC_TW
253
254 if (ioctl(SLIC_Fd, SLIC_PCM_SET_NB, NULL) < 0)
255 {
256 printf("ccapp:SLIC_PCM_Set_NB fail! \n");
257 return SLIC_FAIL;
258 }
259#else
260 SLIC_IOCTL_DATA Tmp;
261
262 memset((VOID *)&Tmp,0,sizeof(Tmp));
263 if (ioctl(SLIC_Fd, SLIC_PCM_SET_NB, (DWORD) &Tmp) < 0)
264 {
265 return SLIC_FAIL;
266 }
267 #endif
268 return SLIC_SUCCESS;
269}
270
271DWORD SLIC_PCM_Set_WB()
272{
273#ifdef USE_SLIC_TW
274 printf("ccapp:SLIC_PCM_Set_WB!\n");
275 if (ioctl(SLIC_Fd, SLIC_PCM_SET_WB, NULL) < 0)
276 {
277 printf("ccapp:SLIC_PCM_Set_WB fail! \n");
278 return SLIC_FAIL;
279 }
280#else
281 SLIC_IOCTL_DATA Tmp;
282
283 memset((VOID *)&Tmp,0,sizeof(Tmp));
284 if (ioctl(SLIC_Fd, SLIC_PCM_SET_WB, (DWORD) &Tmp) < 0)
285 {
286 return SLIC_FAIL;
287 }
288#endif
289 return SLIC_SUCCESS;
290}
291
292
293DWORD SLIC_SelectTimeSlot(WORD wPort, BYTE bType, BYTE bTX, BYTE bRX)
294{
295#ifdef USE_SLIC_TW
296#if 0
297 if (bType > 1)
298 {
299 return SLIC_FAIL;
300 }
301
302 if (ioctl(SLIC_Fd, SLIC_TIMESLOT_SET, NULL) < 0)
303 {
304 return SLIC_FAIL;
305 }
306#else
307
308 VpOptionTimeslotType timeslot={0};
309 timeslot.rx=bRX;
310 timeslot.tx=bTX;
311
312
313 if (ioctl(SLIC_Fd, SLIC_TIMESLOT_SET, (DWORD) &timeslot) < 0)
314 {
315 return SLIC_FAIL;
316 }
317#endif
318#else
319 SLIC_IOCTL_DATA Tmp;
320
321 memset((VOID *)&Tmp,0,sizeof(Tmp));
322 //Tmp.wPort = wPort;
323 //Tmp.bPortType = bType;
324 //Tmp.unPara.stTimeSlot.bTx = bTX;
325 //Tmp.unPara.stTimeSlot.bRx = bRX;
326
327
328 if (bType > 1)
329 {
330 return SLIC_FAIL;
331 }
332
333 if (ioctl(SLIC_Fd, SLIC_TIMESLOT_SET, (DWORD) &Tmp) < 0)
334 {
335 return SLIC_FAIL;
336 }
337#endif
338 return SLIC_SUCCESS;
339}
340
341DWORD SLIC_ReleaseTimeSlot(WORD wPort, BYTE bType)
342{
343#ifdef USE_SLIC_TW
344 if (bType > 1)
345 {
346 return SLIC_FAIL;
347 }
348
349 if (ioctl(SLIC_Fd, SLIC_TIMESLOT_RELEASE, NULL) < 0)
350 {
351 return SLIC_FAIL;
352 }
353#else
354 SLIC_IOCTL_DATA Tmp;
355
356 memset((VOID *)&Tmp,0,sizeof(Tmp));
357 //Tmp.wPort = wPort;
358 //Tmp.bPortType = bType;
359
360 if (bType > 1)
361 {
362 return SLIC_FAIL;
363 }
364
365 if (ioctl(SLIC_Fd, SLIC_TIMESLOT_RELEASE, (DWORD) &Tmp) < 0)
366 {
367 return SLIC_FAIL;
368 }
369#endif
370 return SLIC_SUCCESS;
371}
372
373DWORD SLIC_MsgRev(BYTE *bEvent, DWORD *pPayLoad)
374{
375#ifdef USE_SLIC_TW
376 LONG rev = 0;
377 MSG_DATA msg;
378 memset((VOID *)&msg,0,sizeof(msg));
379 rev = ioctl(SLIC_Fd, SLIC_MSG_REV, (DWORD) &msg);
380 if (rev < 0)
381 {
382 return SLIC_FAIL;
383 }
384#else
385 LONG rev = 0;
386 SLIC_IOCTL_DATA Tmp;
387 MSG_DATA msg;
388 memset((VOID *)&Tmp,0,sizeof(Tmp));
389 memset((VOID *)&msg,0,sizeof(msg));
390
391 Tmp.pData = &msg;
392 Tmp.dwSize = sizeof(MSG_DATA);
393
394 rev = ioctl(SLIC_Fd, SLIC_MSG_REV, (DWORD) &Tmp);
395 if (rev < 0)
396 {
397 return SLIC_FAIL;
398 }
399#endif
400 //*wPort = msg.wPort;
401 *bEvent = msg.bMsgId;
402 *pPayLoad = msg.dPayLoad;
403 return SLIC_SUCCESS;
404}
405
406DWORD SLIC_MsgClr(VOID)
407{
408 if (ioctl(SLIC_Fd, SLIC_MSG_CLR, NULL) < 0)
409 {
410 return SLIC_FAIL;
411 }
412 return SLIC_SUCCESS;
413}
414
415DWORD SLIC_Cfg_HookLowTime(WORD wPort, WORD wTime)
416{
417#ifdef USE_SLIC_TW
418
419 if (ioctl(SLIC_Fd, SLIC_CFG_HOOK_LOWLEN, NULL) < 0)
420 {
421 return SLIC_FAIL;
422 }
423#else
424 SLIC_IOCTL_DATA Tmp;
425
426 memset((VOID *)&Tmp,0,sizeof(Tmp));
427 //Tmp.wPort = wPort;
428 //Tmp.bPortType = PORT_TYPE_FXS;
429 //Tmp.unPara.wTime= wTime;
430
431 if (ioctl(SLIC_Fd, SLIC_CFG_HOOK_LOWLEN, (DWORD) &Tmp) < 0)
432 {
433 return SLIC_FAIL;
434 }
435 #endif
436 return SLIC_SUCCESS;
437}
438
439DWORD SLIC_Cfg_HookHighTime(WORD wPort, WORD wTime)
440{
441#ifdef USE_SLIC_TW
442
443 if (ioctl(SLIC_Fd, SLIC_CFG_HOOK_HIGLEN, NULL) < 0)
444 {
445 return SLIC_FAIL;
446 }
447#else
448 SLIC_IOCTL_DATA Tmp;
449
450 memset((VOID *)&Tmp,0,sizeof(Tmp));
451 //Tmp.wPort = wPort;
452 //Tmp.bPortType = PORT_TYPE_FXS;
453 //Tmp.unPara.wTime= wTime;
454
455 if (ioctl(SLIC_Fd, SLIC_CFG_HOOK_HIGLEN, (DWORD) &Tmp) < 0)
456 {
457 return SLIC_FAIL;
458 }
459#endif
460 return SLIC_SUCCESS;
461}
462
463DWORD SLIC_Cfg_PreHookHighTime(WORD wPort, WORD wTime)
464{
465#ifdef USE_SLIC_TW
466
467 if (ioctl(SLIC_Fd, SLIC_CFG_PREHOOK_HIGLEN, NULL) < 0)
468 {
469 return SLIC_FAIL;
470 }
471#else
472 SLIC_IOCTL_DATA Tmp;
473
474 memset((VOID *)&Tmp,0,sizeof(Tmp));
475 //Tmp.wPort = wPort;
476 //Tmp.bPortType = PORT_TYPE_FXS;
477 //Tmp.unPara.wTime= wTime;
478
479 if (ioctl(SLIC_Fd, SLIC_CFG_PREHOOK_HIGLEN, (DWORD) &Tmp) < 0)
480 {
481 return SLIC_FAIL;
482 }
483#endif
484 return SLIC_SUCCESS;
485}
486
487DWORD SLIC_Cfg_FlashLowMinTime(WORD wPort, WORD wTime)
488{
489#ifdef USE_SLIC_TW
490
491 if (ioctl(SLIC_Fd, SLIC_CFG_FLASH_LMIN, NULL) < 0)
492 {
493 return SLIC_FAIL;
494 }
495#else
496 SLIC_IOCTL_DATA Tmp;
497
498 memset((VOID *)&Tmp,0,sizeof(Tmp));
499 //Tmp.wPort = wPort;
500 //Tmp.bPortType = PORT_TYPE_FXS;
501 //Tmp.unPara.wTime= wTime;
502
503 if (ioctl(SLIC_Fd, SLIC_CFG_FLASH_LMIN, (DWORD) &Tmp) < 0)
504 {
505 return SLIC_FAIL;
506 }
507#endif
508 return SLIC_SUCCESS;
509}
510
511DWORD SLIC_Cfg_FlashLowMaxTime(WORD wPort, WORD wTime)
512{
513#ifdef USE_SLIC_TW
514
515 if (ioctl(SLIC_Fd, SLIC_CFG_FLASH_LMAX, NULL) < 0)
516 {
517 return SLIC_FAIL;
518 }
519#else
520 SLIC_IOCTL_DATA Tmp;
521
522 memset((VOID *)&Tmp,0,sizeof(Tmp));
523 //Tmp.wPort = wPort;
524 //Tmp.bPortType = PORT_TYPE_FXS;
525 //Tmp.unPara.wTime= wTime;
526
527 if (ioctl(SLIC_Fd, SLIC_CFG_FLASH_LMAX, (DWORD) &Tmp) < 0)
528 {
529 return SLIC_FAIL;
530 }
531#endif
532 return SLIC_SUCCESS;
533}
534
535DWORD SLIC_Cfg_FlashHighFixTime(WORD wPort, WORD wTime)
536{
537#ifdef USE_SLIC_TW
538
539 if (ioctl(SLIC_Fd, SLIC_CFG_FLASH_HFIX, NULL) < 0)
540 {
541 return SLIC_FAIL;
542 }
543#else
544 SLIC_IOCTL_DATA Tmp;
545
546 memset((VOID *)&Tmp,0,sizeof(Tmp));
547 //Tmp.wPort = wPort;
548 //Tmp.bPortType = PORT_TYPE_FXS;
549 //Tmp.unPara.wTime= wTime;
550
551 if (ioctl(SLIC_Fd, SLIC_CFG_FLASH_HFIX, (DWORD) &Tmp) < 0)
552 {
553 return SLIC_FAIL;
554 }
555#endif
556 return SLIC_SUCCESS;
557}
558
559DWORD SLIC_Cfg_DialLowMinTime(WORD wPort, WORD wTime)
560{
561#ifdef USE_SLIC_TW
562
563 if (ioctl(SLIC_Fd, SLIC_CFG_DIAL_LMIN, NULL) < 0)
564 {
565 return SLIC_FAIL;
566 }
567#else
568 SLIC_IOCTL_DATA Tmp;
569
570 memset((VOID *)&Tmp,0,sizeof(Tmp));
571 //Tmp.wPort = wPort;
572 //Tmp.bPortType = PORT_TYPE_FXS;
573 //Tmp.unPara.wTime= wTime;
574
575 if (ioctl(SLIC_Fd, SLIC_CFG_DIAL_LMIN, (DWORD) &Tmp) < 0)
576 {
577 return SLIC_FAIL;
578 }
579#endif
580 return SLIC_SUCCESS;
581}
582
583DWORD SLIC_Cfg_DialLowMaxTime(WORD wPort, WORD wTime)
584{
585#ifdef USE_SLIC_TW
586
587 if (ioctl(SLIC_Fd, SLIC_CFG_DIAL_LMAX, NULL) < 0)
588 {
589 return SLIC_FAIL;
590 }
591#else
592 SLIC_IOCTL_DATA Tmp;
593
594 memset((VOID *)&Tmp,0,sizeof(Tmp));
595 //Tmp.wPort = wPort;
596 //Tmp.bPortType = PORT_TYPE_FXS;
597 //Tmp.unPara.wTime= wTime;
598
599 if (ioctl(SLIC_Fd, SLIC_CFG_DIAL_LMAX, (DWORD) &Tmp) < 0)
600 {
601 return SLIC_FAIL;
602 }
603#endif
604 return SLIC_SUCCESS;
605}
606
607DWORD SLIC_Cfg_DialHighMinTime(WORD wPort, WORD wTime)
608{
609#ifdef USE_SLIC_TW
610
611 if (ioctl(SLIC_Fd, SLIC_CFG_DIAL_HMIN, NULL) < 0)
612 {
613 return SLIC_FAIL;
614 }
615#else
616 SLIC_IOCTL_DATA Tmp;
617
618 memset((VOID *)&Tmp,0,sizeof(Tmp));
619 //Tmp.wPort = wPort;
620 //Tmp.bPortType = PORT_TYPE_FXS;
621 //Tmp.unPara.wTime= wTime;
622
623 if (ioctl(SLIC_Fd, SLIC_CFG_DIAL_HMIN, (DWORD) &Tmp) < 0)
624 {
625 return SLIC_FAIL;
626 }
627#endif
628 return SLIC_SUCCESS;
629}
630
631DWORD SLIC_Cfg_DialHighFixTime(WORD wPort, WORD wTime)
632{
633#ifdef USE_SLIC_TW
634
635 if (ioctl(SLIC_Fd, SLIC_CFG_DIAL_HMAX, NULL) < 0)
636 {
637 return SLIC_FAIL;
638 }
639#else
640 SLIC_IOCTL_DATA Tmp;
641
642 memset((VOID *)&Tmp,0,sizeof(Tmp));
643 //Tmp.wPort = wPort;
644 //Tmp.bPortType = PORT_TYPE_FXS;
645 //Tmp.unPara.wTime= wTime;
646
647 if (ioctl(SLIC_Fd, SLIC_CFG_DIAL_HMAX, (DWORD) &Tmp) < 0)
648 {
649 return SLIC_FAIL;
650 }
651#endif
652 return SLIC_SUCCESS;
653}
654
655DWORD SLIC_Read_Codec(BYTE *pParm)
656{
657#ifdef USE_SLIC_TW
658 printf(" SLIC_Read_Codec not support!\n");
659 return SLIC_FAIL;
660#else
661 SLIC_IOCTL_DATA Tmp;
662
663 memset((VOID *)&Tmp,0,sizeof(Tmp));
664
665 Tmp.pData = pParm;
666 Tmp.dwSize = 2;
667
668 if (ioctl(SLIC_Fd, SLIC_CODEC_GET, (DWORD) &Tmp) < 0)
669 {
670 return SLIC_FAIL;
671 }
672#endif
673 return SLIC_SUCCESS;
674}
675DWORD SLIC_Read_Codec_ALL(VOID)
676{
677#ifdef USE_SLIC_TW
678 int ret = 0;
679 ret = ioctl(SLIC_Fd, SLIC_CODEC_GETALL, NULL) ;
680 if (ret< 0)
681 {
682 printf("SLIC_Read_Codec_ALL error ret=%d \n", ret);
683
684 return SLIC_FAIL;
685 }
686#endif
687 return SLIC_SUCCESS;
688}
689DWORD SLIC_Cfg_Codec(BYTE *pParm)
690{
691#ifdef USE_SLIC_TW
692 printf(" SLIC_Cfg_Codec not support!\n");
693 return SLIC_FAIL;
694#else
695 SLIC_IOCTL_DATA Tmp;
696
697 memset((VOID *)&Tmp,0,sizeof(Tmp));
698 Tmp.pData = pParm;
699 Tmp.dwSize = 2;
700
701 if (ioctl(SLIC_Fd, SLIC_CODEC_SET, (DWORD) &Tmp) < 0)
702 {
703 return SLIC_FAIL;
704 }
705#endif
706 return SLIC_SUCCESS;
707}
708
709DWORD SLIC_112TestStart(WriteCmd_t *pCmd)
710{
711#ifdef USE_SLIC_TW
712 printf(" SLIC_LINE_TEST_START not support!\n");
713 return SLIC_FAIL;
714#else
715 SLIC_IOCTL_DATA Tmp;
716
717 memset((VOID *)&Tmp,0,sizeof(Tmp));
718
719 //Tmp.wPort = pCmd->port;
720 //Tmp.bPortType = pCmd->port_type;
721 //Tmp.pData = pCmd;
722 //Tmp.dwSize = sizeof(WriteCmd_t);
723
724 if (ioctl(SLIC_Fd, SLIC_LINE_TEST_START, (DWORD) &Tmp) < 0)
725 {
726 return SLIC_FAIL;
727 }
728#endif
729 return SLIC_SUCCESS;
730}
731
732DWORD SLIC_112TestAbort( WORD wPort, BYTE bType )
733{
734#ifdef USE_SLIC_TW
735 printf(" SLIC_LINE_TEST_ABORT not support!\n");
736 return SLIC_FAIL;
737#else
738 SLIC_IOCTL_DATA Tmp;
739
740 memset((VOID *)&Tmp,0,sizeof(Tmp));
741 //Tmp.wPort = wPort;
742 //Tmp.bPortType = bType;
743
744 if (ioctl(SLIC_Fd, SLIC_LINE_TEST_ABORT, (DWORD) &Tmp) < 0)
745 {
746 return SLIC_FAIL;
747 }
748#endif
749 return SLIC_SUCCESS;
750}
751
752DWORD SLIC_112TestRead( WORD wPort, BYTE bType, TestResult_t *pResBuf)
753{
754#ifdef USE_SLIC_TW
755 printf(" SLIC_LINE_TEST_READ not support!\n");
756 return SLIC_FAIL;
757#else
758 SLIC_IOCTL_DATA Tmp;
759
760 memset((VOID *)&Tmp,0,sizeof(Tmp));
761 //Tmp.wPort = wPort;
762 //Tmp.bPortType = bType;
763
764 if (NULL == pResBuf)
765 {
766 return SLIC_FAIL;
767 }
768
769 Tmp.pData = pResBuf;
770 Tmp.dwSize = sizeof(TestResult_t);
771
772 if (ioctl(SLIC_Fd, SLIC_LINE_TEST_READ, (DWORD)&Tmp) < 0)
773 {
774 printf("Read error!!\n");
775 return SLIC_FAIL;
776 }
777 #endif
778 return SLIC_SUCCESS;
779}
780
781DWORD SLIC_Dev_Init()
782{
783 if (ioctl(SLIC_Fd, SLIC_DEV_INIT, 0) < 0)
784 {
785 return SLIC_FAIL;
786 }
787 return SLIC_SUCCESS;
788}
789
790DWORD SLIC_Read_Ram(BYTE *pParm)
791{
792#ifdef USE_SLIC_TW
793 printf(" SLIC_RAM_GET not support!\n");
794 return SLIC_FAIL;
795#else
796 SLIC_IOCTL_DATA Tmp;
797
798 memset((VOID *)&Tmp,0,sizeof(Tmp));
799
800 Tmp.pData = pParm;
801 Tmp.dwSize = 2;
802
803 if (ioctl(SLIC_Fd, SLIC_RAM_GET, (DWORD) &Tmp) < 0)
804 {
805 return SLIC_FAIL;
806 }
807#endif
808 return SLIC_SUCCESS;
809}
810
811
812DWORD SLIC_Cfg_Ram(BYTE *pParm)
813{
814#ifdef USE_SLIC_TW
815 printf(" SLIC_RAM_SET not support!\n");
816 return SLIC_FAIL;
817#else
818 SLIC_IOCTL_DATA Tmp;
819
820 memset((VOID *)&Tmp,0,sizeof(Tmp));
821 Tmp.pData = pParm;
822 Tmp.dwSize = 2;
823
824 if (ioctl(SLIC_Fd, SLIC_RAM_SET, (DWORD) &Tmp) < 0)
825 {
826 return SLIC_FAIL;
827 }
828#endif
829 return SLIC_SUCCESS;
830}
831
832DWORD SLIC_Cfg_Electric(WORD wPort, BYTE bType, ELECTRIC_CFG_CUSTOMIZED *pElec)
833{
834#ifdef USE_SLIC_TW
835 printf(" SLIC_ELECTRIC_CFG not support!\n");
836 return SLIC_FAIL;
837#else
838 SLIC_IOCTL_DATA Tmp;
839
840 memset((VOID *)&Tmp,0,sizeof(Tmp));
841 //Tmp.wPort = wPort;
842 //Tmp.bPortType = bType;
843
844 if (NULL == pElec)
845 {
846 return SLIC_FAIL;
847 }
848
849 Tmp.pData = pElec;
850 Tmp.dwSize = sizeof(ELECTRIC_CFG_CUSTOMIZED);
851
852 if (ioctl(SLIC_Fd, SLIC_ELECTRIC_CFG, (DWORD) &Tmp) < 0)
853 {
854 return SLIC_FAIL;
855 }
856#endif
857 return SLIC_SUCCESS;
858}