FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/tst_drv/ser_sd.c @ 525:98c6be4d3d8d
CONFIG_GSM vs CONFIG_INCLUDE_L1: a few changes in preparation
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 14 Jul 2014 18:42:38 +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_sd.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_SD_C__ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 #define __SER_SD_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 "typedefs.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 #include "stack1_serial.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 #include "gdi.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 #include "tstheader.h" |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 /*==== TYPES ======================================================*/ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 typedef struct |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 USHORT Handle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 USHORT EnabledSignalType; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 T_DRV_CB_FUNC Callback; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 char Connected; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 } T_SER_SD_DATA; |
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 /*==== CONSTANTS ==================================================*/ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 #define ALLOWED_SER_SD_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
|
42 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 /*==== EXTERNALS ==================================================*/ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 /*==== VARIABLES ==================================================*/ |
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 T_SER_SD_DATA SER_SD_Data; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 static T_DRV_SIGNAL Signal; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 /*==== FUNCTIONS ==================================================*/ |
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 /* |
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 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 | STATE : code ROUTINE : Callback | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 +--------------------------------------------------------------------+ |
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 PURPOSE : callback function of the driver |
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 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 void Callback ( void ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 if ( SER_SD_Data.EnabledSignalType & DRV_SIGTYPE_READ ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 Signal.SignalType = DRV_SIGTYPE_READ; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 Signal.DrvHandle = SER_SD_Data.Handle; |
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 (SER_SD_Data.Callback)( &Signal ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 } |
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 /* |
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 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 | STATE : code ROUTINE : SER_SD_Exit | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 +--------------------------------------------------------------------+ |
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 PURPOSE : exit a driver |
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 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 void SER_SD_Exit ( void ) |
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 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 /* |
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 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 | STATE : code ROUTINE : SER_SD_Read | |
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 PURPOSE : read data from driver |
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 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 USHORT SER_SD_Read ( void *Buffer, ULONG *BytesToRead ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 *BytesToRead = stack1_Serial_receiveData ( (unsigned char*)Buffer, *BytesToRead ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 } |
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 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 | STATE : code ROUTINE : SER_SD_Write | |
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 PURPOSE : write data to driver |
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 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 USHORT SER_SD_Write ( void *Buffer, ULONG *BytesToWrite ) |
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 ULONG ToWrite = *BytesToWrite & ~PRIM_FLAG_MASK; |
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 /* stack1_Serial_sendData() returns TRUE/FALSE but not the number of written bytes */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 stack1_Serial_sendData( (unsigned char*)Buffer, ToWrite ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 return ( DRV_OK ); |
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 /* |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 | STATE : code ROUTINE : SER_SD_SetSignal | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 +--------------------------------------------------------------------+ |
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 PURPOSE : enable signal for the driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 |
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 USHORT SER_SD_SetSignal ( USHORT SignalType ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 if ( !(SignalType & ALLOWED_SER_SD_SIGNALS) ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 else |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 SER_SD_Data.EnabledSignalType |= SignalType; |
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 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 } |
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 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 | STATE : code ROUTINE : SER_SD_ResetSignal | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 +--------------------------------------------------------------------+ |
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 PURPOSE : disable signal for the driver |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 |
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 USHORT SER_SD_ResetSignal ( USHORT SignalType ) |
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 if ( !(SignalType & ALLOWED_SER_SD_SIGNALS) ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 return DRV_INVALID_PARAMS; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 else |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 SER_SD_Data.EnabledSignalType &= ~SignalType; |
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 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 } |
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 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 | STATE : code ROUTINE : SER_SD_SetConfig | |
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 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 PURPOSE : set configuration for the driver |
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 USHORT SER_SD_SetConfig ( char *Buffer ) |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 if ( !SER_SD_Data.Connected ) |
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 Signal.SignalType = DRV_SIGTYPE_CONNECT; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 Signal.DrvHandle = SER_SD_Data.Handle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 Signal.UserData = NULL; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 (SER_SD_Data.Callback)( &Signal ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 SER_SD_Data.Connected = TRUE; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 } |
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 |
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 | PROJECT : GSM-Frame (8415) MODULE : SER | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 | STATE : code ROUTINE : SER_SD_Init | |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 +--------------------------------------------------------------------+ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 PURPOSE : initialize driver |
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 */ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 USHORT SER_SD_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
|
192 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 static const T_DRV_EXPORT SER_SD_Info = |
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 "SER", |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 CALLED_FROM_ISR, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 { |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 #ifdef _TOOLS_ |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 SER_SD_Init, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 #endif |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 SER_SD_Exit, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 SER_SD_Read, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 SER_SD_Write, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 SER_SD_SetSignal, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 SER_SD_ResetSignal, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 SER_SD_SetConfig, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 NULL, |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 } |
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 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 SER_SD_Data.Handle = DrvHandle; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 SER_SD_Data.EnabledSignalType = 0; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 SER_SD_Data.Callback = CallbackFunc; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 SER_SD_Data.Connected = FALSE; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 stack1_Serial_PowerUp ( Callback ); |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 *DrvInfo = &SER_SD_Info; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 return DRV_OK; |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 } |
5d1e22505446
GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 |