FreeCalypso > hg > fc-magnetite
comparison src/g23m-fad/l2r/tra_upp.c @ 174:90eb61ecd093
src/g23m-fad: initial import from TCS3.2/LoCosto
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 12 Oct 2016 05:40:46 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 173:bf64d785238a | 174:90eb61ecd093 |
|---|---|
| 1 /* | |
| 2 +----------------------------------------------------------------------------- | |
| 3 | Project : CSD (8411) | |
| 4 | Modul : tra_upp.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 defines the functions for processing | |
| 18 | of incomming primitives for the component TRA | |
| 19 +----------------------------------------------------------------------------- | |
| 20 */ | |
| 21 | |
| 22 #ifndef TRA_UPP_C | |
| 23 #define TRA_UPP_C | |
| 24 #endif | |
| 25 | |
| 26 #define ENTITY_L2R | |
| 27 | |
| 28 /*==== INCLUDES ===================================================*/ | |
| 29 | |
| 30 #include "typedefs.h" | |
| 31 #include "pconst.cdg" | |
| 32 #include "vsi.h" | |
| 33 #include "macdef.h" | |
| 34 #include "custom.h" | |
| 35 #include "gsm.h" | |
| 36 #include "prim.h" | |
| 37 #include "pei.h" | |
| 38 #include "tok.h" | |
| 39 #include "dti.h" | |
| 40 | |
| 41 #include "cl_ribu.h" | |
| 42 #include "tra_pei.h" | |
| 43 #include "tra.h" | |
| 44 | |
| 45 /*==== CONST =======================================================*/ | |
| 46 | |
| 47 /*==== TYPES =======================================================*/ | |
| 48 | |
| 49 /*==== VAR EXPORT ==================================================*/ | |
| 50 | |
| 51 /*==== VAR LOCAL ===================================================*/ | |
| 52 | |
| 53 /*==== FUNCTIONS ===================================================*/ | |
| 54 | |
| 55 /* | |
| 56 +------------------------------------------------------------------------------ | |
| 57 | Function : rcv_ra_ready_ind | |
| 58 +------------------------------------------------------------------------------ | |
| 59 | Description : Process primitive RA_READY_IND received from RA. | |
| 60 | This function is called if the RA_READY_IND primtive | |
| 61 | is received | |
| 62 | | |
| 63 | Parameters : ra_ready_ind - | |
| 64 | | |
| 65 | | |
| 66 | Return : - | |
| 67 +------------------------------------------------------------------------------ | |
| 68 */ | |
| 69 | |
| 70 GLOBAL void rcv_ra_ready_ind(T_RA_READY_IND *ra_ready_ind) | |
| 71 { | |
| 72 T_TRA_UP *dul = &tra_data->up; | |
| 73 | |
| 74 #ifdef _SIMULATION_ | |
| 75 TRACE_EVENT_P1 ("rcv_ra_ready_ind(), req_frames: 0x%x", ra_ready_ind->req_frames); | |
| 76 PACCESS (ra_ready_ind); | |
| 77 #endif | |
| 78 | |
| 79 dul->req_frames = ra_ready_ind->req_frames; | |
| 80 | |
| 81 switch (GET_STATE (UP)) | |
| 82 { | |
| 83 case UP_IDLE: | |
| 84 SET_STATE (UP, UP_WAIT); | |
| 85 break; | |
| 86 | |
| 87 case UP_SEND: | |
| 88 snd_data_to_RA(); | |
| 89 if (dul->Prim->desc_list2.first EQ 0) | |
| 90 { | |
| 91 if (dul->Prim NEQ NULL) | |
| 92 { | |
| 93 PFREE(dul->Prim); | |
| 94 dul->Prim = NULL; | |
| 95 } | |
| 96 up_start_dti_flow(); | |
| 97 SET_STATE (UP, UP_IDLE); | |
| 98 } | |
| 99 break; | |
| 100 } | |
| 101 #ifdef _SIMULATION_ | |
| 102 PFREE (ra_ready_ind); | |
| 103 #endif | |
| 104 } | |
| 105 | |
| 106 /* | |
| 107 +------------------------------------------------------------------------------ | |
| 108 | Function : sig_dti_tra_up_data_received_ind | |
| 109 +------------------------------------------------------------------------------ | |
| 110 | Description : Process primitive DTI2_DATA_REQ received from CSDIWF. | |
| 111 | | |
| 112 | Parameters : dti_data_req | |
| 113 | | |
| 114 | | |
| 115 | Return : - | |
| 116 +------------------------------------------------------------------------------ | |
| 117 */ | |
| 118 | |
| 119 GLOBAL void sig_dti_tra_up_data_received_ind(T_DTI2_DATA_REQ *dti_data_req) | |
| 120 { | |
| 121 T_TRA_UP *dul = &tra_data->up; | |
| 122 | |
| 123 TRACE_FUNCTION ("sig_dti_tra_up_data_received_ind()"); | |
| 124 | |
| 125 PACCESS (dti_data_req); | |
| 126 | |
| 127 dul->Prim = dti_data_req; | |
| 128 | |
| 129 dul->sa = dti_data_req->parameters.st_lines.st_line_sa; | |
| 130 dul->sb = dti_data_req->parameters.st_lines.st_line_sb; | |
| 131 dul->x = dti_data_req->parameters.st_lines.st_flow; | |
| 132 | |
| 133 /* | |
| 134 TRACE_EVENT_P1("new data: %02X", dti_data_req->desc_list2.list_len); | |
| 135 */ | |
| 136 | |
| 137 if (GET_STATE(DTI) NEQ DTI_CLOSED) | |
| 138 { | |
| 139 /* | |
| 140 * do not send flow control primitives automatically | |
| 141 */ | |
| 142 dti_stop(l2r_hDTI, TRA_DTI_UP_INSTANCE, TRA_DTI_UP_INTERFACE, TRA_DTI_UP_CHANNEL); | |
| 143 } | |
| 144 | |
| 145 /* Detect break request */ | |
| 146 if (dti_data_req->parameters.st_lines.st_break_len NEQ DTI_BREAK_OFF) | |
| 147 { | |
| 148 USHORT break_len = dti_data_req->parameters.st_lines.st_break_len; | |
| 149 | |
| 150 PFREE(dti_data_req); /* no more used */ | |
| 151 | |
| 152 switch (GET_STATE (UP)) | |
| 153 { | |
| 154 case UP_SEND: | |
| 155 /* | |
| 156 * No more data to send | |
| 157 */ | |
| 158 SET_STATE (UP, UP_IDLE); | |
| 159 /* Fall through */ | |
| 160 | |
| 161 case UP_IDLE: | |
| 162 case UP_WAIT: | |
| 163 sig_up_tra_mgt_break_ind(break_len); | |
| 164 up_start_dti_flow(); | |
| 165 break; | |
| 166 } | |
| 167 return; /* xxxxx - send data or do not send it??! */ | |
| 168 } | |
| 169 | |
| 170 switch (GET_STATE (UP)) | |
| 171 { | |
| 172 case UP_SEND: | |
| 173 TRACE_EVENT("still in UP_SEND!"); | |
| 174 break; | |
| 175 | |
| 176 case UP_IDLE: | |
| 177 SET_STATE (UP, UP_SEND); | |
| 178 break; | |
| 179 | |
| 180 case UP_WAIT: | |
| 181 snd_data_to_RA(); | |
| 182 if (dti_data_req->desc_list2.list_len EQ 0) /* data is copied completely */ | |
| 183 { | |
| 184 up_start_dti_flow(); | |
| 185 SET_STATE (UP, UP_IDLE); | |
| 186 PFREE(dti_data_req); | |
| 187 dul->Prim = NULL; | |
| 188 } | |
| 189 else | |
| 190 { | |
| 191 SET_STATE (UP, UP_SEND); | |
| 192 } | |
| 193 break; | |
| 194 } | |
| 195 } | |
| 196 |
