FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/sndcp/sndcp_ciaf.c @ 183:219afcfc6250
src/g23m-gprs: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Oct 2016 04:24:13 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
182:f02d0a0e1849 | 183:219afcfc6250 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GPRS (8441) | |
4 | Modul : tgen_gprs.cpp | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This modul is part of the entity SNDCP and implements all | |
18 | procedures and functions as described in the | |
19 | SDL-documentation (CIA-statemachine) | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 | |
24 #define ENTITY_SNDCP | |
25 | |
26 /*==== INCLUDES =============================================================*/ | |
27 | |
28 #include "typedefs.h" /* to get Condat data types */ | |
29 #include "vsi.h" /* to get a lot of macros */ | |
30 #include "macdef.h" | |
31 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
32 | |
33 #include "dti.h" | |
34 #include "sndcp.h" /* to get the global entity definitions */ | |
35 #include "sndcp_f.h" /* to get the functions to access the global arrays*/ | |
36 | |
37 #ifdef _SNDCP_DTI_2_ | |
38 #include <string.h> /* to get memcpy() */ | |
39 #endif | |
40 | |
41 | |
42 /*==== CONST ================================================================*/ | |
43 | |
44 /*==== LOCAL VARS ===========================================================*/ | |
45 | |
46 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
47 | |
48 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
49 | |
50 /* | |
51 +------------------------------------------------------------------------------ | |
52 | Function : cia_compress_init | |
53 +------------------------------------------------------------------------------ | |
54 | Description : This routine initializes the state structure for both the transmit | |
55 | and receive halves of some serial line. It must be called each | |
56 | time the line is brought up. | |
57 | | |
58 | Parameters : number of slots (from 0 to MAX_STATES) | |
59 | | |
60 +------------------------------------------------------------------------------ | |
61 */ | |
62 | |
63 GLOBAL void cia_compress_init(UBYTE number_of_slots) | |
64 { | |
65 UBYTE i; | |
66 struct cstate *tstate = sndcp_data->cia.comp.tstate; | |
67 struct cstate *rstate = sndcp_data->cia.comp.rstate; | |
68 | |
69 TRACE_FUNCTION( "cia_compress_init"); | |
70 | |
71 memset((char *)&(sndcp_data->cia.comp), 0, sizeof(sndcp_data->cia.comp)); | |
72 for (i = number_of_slots; i > 0; --i) { | |
73 tstate[i].cs_id = i; | |
74 tstate[i].cs_next = &tstate[i - 1]; | |
75 tstate[i].cs_ip = (T_SNDCP_IP_HEADER*)tstate[i].cs_hdr; | |
76 } | |
77 tstate[0].cs_next = &tstate[number_of_slots]; | |
78 tstate[0].cs_id = 0; | |
79 tstate[0].cs_ip = (T_SNDCP_IP_HEADER*)tstate[0].cs_hdr; | |
80 sndcp_data->cia.comp.last_cs = &tstate[0]; | |
81 sndcp_data->cia.comp.last_recv = 255; | |
82 sndcp_data->cia.comp.last_xmit = 255; | |
83 sndcp_data->cia.comp.flags = SLF_TOSS; | |
84 | |
85 for (i = number_of_slots; i > 0; --i) { | |
86 rstate[i].cs_id = i; | |
87 rstate[i].cs_next = &rstate[i - 1]; | |
88 rstate[i].cs_ip = (T_SNDCP_IP_HEADER*)rstate[i].cs_hdr; | |
89 } | |
90 rstate[0].cs_next = &rstate[number_of_slots]; | |
91 rstate[0].cs_id = 0; | |
92 rstate[0].cs_ip = (T_SNDCP_IP_HEADER*)rstate[0].cs_hdr; | |
93 | |
94 sndcp_data->cia.comp.slots_to_use = number_of_slots + 1; | |
95 } | |
96 | |
97 | |
98 /* | |
99 +------------------------------------------------------------------------------ | |
100 | Function : cia_init | |
101 +------------------------------------------------------------------------------ | |
102 | Description : | |
103 | | |
104 | Parameters : | |
105 | | |
106 +------------------------------------------------------------------------------ | |
107 */ | |
108 GLOBAL void cia_init (void) | |
109 { | |
110 UBYTE nsapi; | |
111 TRACE_FUNCTION( "cia_init" ); | |
112 INIT_STATE(CIA, CIA_DEFAULT); | |
113 | |
114 sndcp_reset_xid_block(&sndcp_data->cia.cur_xid_block); | |
115 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi ++){ | |
116 sndcp_data->cia.cur_cia_decomp_ind[nsapi] = NULL; | |
117 #ifdef SNDCP_TRACE_ALL | |
118 sndcp_data->cia.cia_decomp_ind_number[nsapi] = 0; | |
119 #endif | |
120 | |
121 } | |
122 | |
123 | |
124 } /* cia_init() */ | |
125 | |
126 | |
127 |