comparison src/g23m-gprs/sndcp/sndcp_ndp.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 : sndcp_ndp.c
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 | functions to handles the incoming primitives as described in
19 | the SDL-documentation (ND-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
35 #include "sndcp.h" /* to get the global entity definitions */
36 #include "sndcp_f.h" /* to get the functions to access the global arrays*/
37
38 #include "sndcp_sds.h" /* to get signals to sd service */
39 #include "sndcp_sdas.h" /* to get signals to sda service */
40 #include "sndcp_sdf.h"
41
42
43
44 /*==== CONST ================================================================*/
45
46 /*==== LOCAL VARS ===========================================================*/
47
48 /*==== PRIVATE FUNCTIONS ====================================================*/
49
50 /*==== PUBLIC FUNCTIONS =====================================================*/
51
52 /*
53 +------------------------------------------------------------------------------
54 | Function : nd_dti_buffer_ready
55 +------------------------------------------------------------------------------
56 | Description : Is called from DTI callback function when reason was
57 | DTI_REASON_TX_BUFFER_READY. Does the same as old
58 | nd_sn_get(unit)data_req.
59 |
60 | Parameters : affected nsapi
61 |
62 +------------------------------------------------------------------------------
63 */
64 GLOBAL void nd_dti_buffer_ready (UBYTE nsapi)
65 {
66 UBYTE sapi = 0;
67 BOOL used = FALSE;
68
69 TRACE_FUNCTION( "nd_dti_buffer_ready" );
70
71 /*
72 * set service instance according to nsapi in primitive
73 */
74 sndcp_data->nd = & sndcp_data->nd_base[nsapi];
75
76 switch( GET_STATE( ND ) )
77 {
78 case ND_DEFAULT:
79 case ND_RECOVER:
80 case ND_SUSPEND:
81 /*
82 * Is NSAPI used at all?
83 */
84 sndcp_is_nsapi_used(nsapi, &used);
85 if (used) {
86 BOOL ack = FALSE;
87 sndcp_get_nsapi_ack(nsapi, &ack);
88 if (ack) {
89 sndcp_get_nsapi_sapi(nsapi, &sapi);
90 sig_nd_sda_getdata_req(sapi, nsapi);
91 } else {
92 sndcp_get_nsapi_sapi(nsapi, &sapi);
93 sig_nd_sd_getunitdata_req(sapi, nsapi);
94 }
95 /* dti ready called from mg_sm_activate_ind again */
96 TRACE_EVENT("FLOW CONTROL falg is set to false");
97 sndcp_data->tcp_flow = FALSE;
98 }
99 else
100 {
101 sndcp_data->nsapi_rcv_rdy_b4_used |= 0x001 << nsapi;
102 TRACE_EVENT("FLOW CONTROL falg is set to true");
103 /* We have received a flow control before receiving a snsm_activate_ind */
104 sndcp_data->tcp_flow = TRUE;
105 }
106 break;
107 default:
108 TRACE_ERROR( "Function nd_dti_buffer_ready unexpected" );
109 break;
110 }
111
112 } /* nd_buffer_ready() */