FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/tst_drv/ser.c @ 939:62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 31 Oct 2015 23:21:40 +0000 |
parents | 5d1e22505446 |
children |
rev | line source |
---|---|
322
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 +------------------------------------------------------------------------------ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 | File: ser.c |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 +------------------------------------------------------------------------------ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 | Copyright 2004 Texas Instruments Deutschland, AG |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 | All rights reserved. |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 | This file is confidential and a trade secret of Texas |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 | Instruments Berlin, AG |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 | The receipt of or possession of this file does not convey |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 | any rights to reproduce or disclose its contents or to |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 | manufacture, use, or sell anything it may describe, in |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 | whole, or in part, without the specific written consent of |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 | Texas Instruments Deutschland, AG. |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 +----------------------------------------------------------------------------- |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 | Purpose : This Modul contains the serial driver adaptation |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 +----------------------------------------------------------------------------- |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 #ifndef __SER_C__ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 #define __SER_C__ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 #include <windows.h> |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 #include <stdio.h> |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 #include "usart.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 #include "stdlib.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 #include "string.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 #include "tools.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 #include "typedefs.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 #include "tstheader.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 #include "os.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 #include "gdi.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 /*==== TYPES ======================================================*/ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 typedef struct |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 USHORT Handle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 USHORT EnabledSignalType; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 T_DRV_CB_FUNC Callback; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 #ifndef _TARGET_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 OS_HANDLE TaskHandle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 char Connected; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 } T_SER_DATA; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 /*==== CONSTANTS ==================================================*/ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 #define ALLOWED_SER_SIGNALS (DRV_SIGTYPE_READ|DRV_SIGTYPE_CONNECT) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 #define MAX_CONFIGSTR_LEN 50 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 /*==== EXTERNALS ==================================================*/ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 #ifndef _TARGET_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 extern OS_HANDLE ext_data_pool_handle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 /*==== VARIABLES ==================================================*/ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 T_SER_DATA SER_Data; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 static T_DRV_SIGNAL Signal; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 GLOBAL int extPort = 1; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 #ifndef _TARGET_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 static char m_last_config[MAX_CONFIGSTR_LEN+1]; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 #ifdef _TOOLS_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 OS_TIME extr_creation_time = 0; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 /*==== FUNCTIONS ==================================================*/ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 #ifndef RUN_INT_RAM |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 #ifdef _TOOLS_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 OS_TIME tst_get_init_time ( void ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 return extr_creation_time; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 | STATE : code ROUTINE : Callback | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 PURPOSE : callback function of the driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 void Callback ( void ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 if ( SER_Data.EnabledSignalType & DRV_SIGTYPE_READ ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 Signal.SignalType = DRV_SIGTYPE_READ; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 Signal.DrvHandle = SER_Data.Handle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 (SER_Data.Callback)( &Signal ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 #ifndef _TARGET_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 GLOBAL void SER_Receiver (void) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 for(;;) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 UT_IsChar (); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 Callback(); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 | STATE : code ROUTINE : SER_Exit | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 PURPOSE : exit a driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 void SER_Exit ( void ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 os_DestroyTask( 0, SER_Data.TaskHandle ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 SER_Data.TaskHandle = OS_ERROR; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 UT_Close(); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 | STATE : code ROUTINE : SER_Read | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 PURPOSE : read data from driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 USHORT SER_Read ( void *Buffer, ULONG *BytesToRead ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 *BytesToRead = (USHORT)UT_ReadNChars (UT_DEVICE_0, (BYTE *)Buffer, *BytesToRead); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 | STATE : code ROUTINE : SER_Write | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 PURPOSE : write data to driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 USHORT SER_Write ( void *Buffer, ULONG *BytesToWrite ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 ULONG ToWrite = *BytesToWrite & ~PRIM_FLAG_MASK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 UT_WriteNChars(UT_DEVICE_0, (void*)Buffer, ToWrite ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 return ( DRV_OK ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 | STATE : code ROUTINE : SER_SetSignal | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 PURPOSE : enable signal for the driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 USHORT SER_SetSignal ( USHORT SignalType ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 if ( !(SignalType & ALLOWED_SER_SIGNALS) ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 else |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 SER_Data.EnabledSignalType |= SignalType; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 | STATE : code ROUTINE : SER_ResetSignal | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
190 PURPOSE : disable signal for the driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
192 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 USHORT SER_ResetSignal ( USHORT SignalType ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
194 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
195 if ( !(SignalType & ALLOWED_SER_SIGNALS) ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 else |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 SER_Data.EnabledSignalType &= ~SignalType; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 | STATE : code ROUTINE : SER_SetConfig | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 PURPOSE : set configuration for the driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 USHORT SER_SetConfig ( char *Buffer ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 /*lint -e813, suppress Info 813: auto variable 'osver' has size '148' */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 char token [MAX_PATH+1]; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 /*lint +e813 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 unsigned int baudrate=0; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 int mode; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 char flow_ctrl='N'; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 unsigned int len; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 const char *fname=NULL; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 if ( !SER_Data.Connected ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 Signal.SignalType = DRV_SIGTYPE_CONNECT; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 Signal.DrvHandle = SER_Data.Handle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 Signal.UserData = NULL; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
228 (SER_Data.Callback)( &Signal ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
229 SER_Data.Connected = TRUE; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 extPort=0; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 if (strlen(m_last_config)) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 /* check if we are already configured right */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 if (strcmp(m_last_config,Buffer)==0) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 #ifdef _DEBUG |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 fprintf(stdout,"SER: keeping configuration\n"); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 if (!(strcmp(Buffer,"EXIT"))) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 SER_Exit(); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 /* save configuration string */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 strncpy(m_last_config,Buffer,MAX_CONFIGSTR_LEN); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 /* interprete configuration string */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 if ( (len = GetNextToken (Buffer, token, " #")) == 0 ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 else |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 Buffer += (len+1); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 /* set mode */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 if (!strcmp(token,"SIM")) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
263 mode=UT_MODE_SIM; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 printf("TST: simulated USART mode selected\n"); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
266 else if (!strcmp(token,"FILE")) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
267 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
268 if ( (len = GetNextToken (Buffer, token, "\"")) == 0 ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
269 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
270 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
271 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
272 mode=UT_MODE_FILE; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
273 fname=token; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
274 printf("TST: file mode selected\n"); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
275 strcpy(m_last_config,""); /* don't store file-mode */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
276 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
277 else |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
278 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
279 if (!strcmp(token,"NT")) { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
280 mode=UT_MODE_NT; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
281 } else if (!strcmp(token,"95")) { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
282 mode=UT_MODE_95; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
283 } else if (!strcmp(token,"REAL")) { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
284 /*lint -e813, suppress Info 813: auto variable 'osver' has size '148' */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
285 OSVERSIONINFO osver; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
286 /*lint +e813 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
287 osver.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
288 GetVersionEx( &osver); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
289 if (osver.dwPlatformId==VER_PLATFORM_WIN32_NT) { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
290 mode=UT_MODE_NT; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
291 } else { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
292 mode=UT_MODE_95; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
293 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
294 } else { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
295 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
296 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
297 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
298 if (mode==UT_MODE_NT) { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
299 printf("TST: real USART mode for winNT selected\n"); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
300 } else { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
301 printf("TST: real USART mode for win95 selected\n"); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
302 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
303 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
304 /* com port setting */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
305 if ( (len = GetNextToken (Buffer, token, " #")) == 0 ) { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
306 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
307 } else { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
308 Buffer += (len+1); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
309 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
310 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
311 extPort=atoi(&token[3]); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
312 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
313 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
314 * Get baudrate from configuration string |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
315 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
316 if ( (len = GetNextToken (Buffer, token, " #")) == 0 ) { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
317 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
318 } else { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
319 Buffer += (len+1); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
320 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
321 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
322 printf("SER: requested baudrate: %s\n",token); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
323 switch ( atoi(token) ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
324 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
325 case 38400: |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
326 baudrate = UT_BAUD_38400; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
327 break; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
328 case 19200: |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
329 baudrate = UT_BAUD_19200; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
330 break; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
331 case 9600: |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
332 baudrate = UT_BAUD_9600; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
333 break; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
334 case 57600: |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
335 baudrate = UT_BAUD_57600; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
336 break; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
337 case 115200: |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
338 baudrate = UT_BAUD_115200; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
339 break; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
340 case 128000: |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
341 baudrate = UT_BAUD_128000; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
342 break; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
343 case 256000: |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
344 baudrate = UT_BAUD_256000; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
345 break; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
346 default: |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
347 printf("SER: no CBR_xxx constant found for requested baudrate\n"); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
348 baudrate = atoi(token); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
349 break; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
350 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
351 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
352 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
353 * Get flow control from configuration string |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
354 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
355 if ( (len = GetNextToken (Buffer, token, " #")) == 0 ) { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
356 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
357 } else { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
358 Buffer += (len+1); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
359 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
360 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
361 flow_ctrl=token[0]; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
362 printf("SER: requested flow control: %c\n",flow_ctrl); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
363 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
364 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
365 /* exit receiver task */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
366 if ( SER_Data.TaskHandle != OS_ERROR ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
367 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
368 os_DestroyTask( 0, SER_Data.TaskHandle ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
369 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
370 #ifdef _TOOLS_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
371 os_GetTime ( 0, &extr_creation_time ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
372 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
373 UT_Close(); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
374 UT_set_mode(mode); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
375 if (UT_Init (baudrate, 100, flow_ctrl, NULL, fname)!=0) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
376 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
377 strcpy(m_last_config,""); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
378 return DRV_INITFAILURE; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
379 }; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
380 /* restart receiver task */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
381 if ( os_CreateTask ( 0, (char*)"EXTR", (void (*)(OS_HANDLE, ULONG))(SER_Receiver), 2048, 1, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
382 &SER_Data.TaskHandle, ext_data_pool_handle) != OS_OK || |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
383 os_StartTask ( 0, SER_Data.TaskHandle, 0 ) != OS_OK) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
384 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
385 return DRV_INITFAILURE; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
386 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
387 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
388 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
389 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
390 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
391 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
392 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
393 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
394 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
395 | STATE : code ROUTINE : SER_Init | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
396 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
397 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
398 PURPOSE : initialize driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
399 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
400 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
401 USHORT SER_Init ( USHORT DrvHandle, T_DRV_CB_FUNC CallbackFunc, T_DRV_EXPORT const **DrvInfo ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
402 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
403 static const T_DRV_EXPORT SER_Info = |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
404 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
405 "SER", |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
406 CALLED_FROM_ISR, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
407 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
408 #ifdef _TOOLS_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
409 SER_Init, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
410 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
411 SER_Exit, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
412 SER_Read, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
413 SER_Write, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
414 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
415 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
416 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
417 SER_SetSignal, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
418 SER_ResetSignal, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
419 SER_SetConfig, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
420 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
421 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
422 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
423 }; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
424 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
425 SER_Data.Handle = DrvHandle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
426 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
427 SER_Data.EnabledSignalType = 0; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
428 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
429 SER_Data.Callback = CallbackFunc; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
430 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
431 SER_Data.Connected = FALSE; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
432 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
433 SER_Data.TaskHandle = OS_ERROR; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
434 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
435 #ifndef _TOOLS_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
436 UT_set_mode(UT_MODE_SIM); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
437 UT_Init (2, 100, 'N', NULL, NULL); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
438 UT_SetFlowCtrl ('N'); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
439 if ( os_CreateTask ( 0, (char*)"EXTR", (void (*)(OS_HANDLE, ULONG))(SER_Receiver), 2048, 1, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
440 &SER_Data.TaskHandle, ext_data_pool_handle) == OS_OK ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
441 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
442 if ( os_StartTask ( 0, SER_Data.TaskHandle, 0 ) != OS_OK) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
443 printf ( "SYSTEM ERROR: Cannot start task EXTR" ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
444 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
445 else |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
446 printf ( "SYSTEM ERROR: Cannot create task EXTR" ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
447 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
448 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
449 m_last_config[0]='\0'; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
450 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
451 *DrvInfo = &SER_Info; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
452 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
453 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
454 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
455 |