blob: c76bbcac63da03cc216c49c7ff41a11b06eb92db [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*******************************************************************************
2* Modification Notice:
3* --------------------------
4* This software is modified by MediaTek Inc. and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2005
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*******************************************************************************/
35
36
37 /*******************************************************************************
38 * Filename:
39 * ---------
40 * l1_public.h
41 *
42 * Project:
43 * --------
44 * Maui_Software
45 *
46 * Description:
47 * ------------
48 * Layer1 public interface
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *------------------------------------------------------------------------------
55 * removed!
56 * removed!
57 * removed!
58 *
59 * removed!
60 * removed!
61 *
62 * removed!
63 * removed!
64 * removed!
65 *
66 * removed!
67 * removed!
68 * removed!
69 * removed!
70 *
71 * removed!
72 * removed!
73 * removed!
74 * removed!
75 *
76 * removed!
77 * removed!
78 *
79 * removed!
80 * removed!
81 * removed!
82 * removed!
83 *
84 * removed!
85 * removed!
86 *
87 * removed!
88 * removed!
89 *
90 * removed!
91 * removed!
92 * removed!
93 *
94 * removed!
95 * removed!
96 *
97 * removed!
98 * removed!
99 *
100 * removed!
101 * removed!
102 *
103 * removed!
104 * removed!
105 *
106 * removed!
107 * removed!
108 *
109 * removed!
110 * removed!
111 *
112 * removed!
113 * removed!
114 * removed!
115 *
116 * removed!
117 * removed!
118 *
119 * removed!
120 * removed!
121 *
122 * removed!
123 * removed!
124 * removed!
125 *
126 * removed!
127 * removed!
128 * removed!
129 *
130 * removed!
131 * removed!
132 * removed!
133 * removed!
134 *
135 * removed!
136 * removed!
137 * removed!
138 * removed!
139 *
140 * removed!
141 * removed!
142 * removed!
143 *
144 * removed!
145 * removed!
146 *
147 * removed!
148 * removed!
149 *
150 * removed!
151 * removed!
152 * removed!
153 * removed!
154 *
155 * removed!
156 * removed!
157 *
158 * removed!
159 * removed!
160 * removed!
161 *
162 * removed!
163 * removed!
164 * removed!
165 *
166 * removed!
167 * removed!
168 * removed!
169 *
170 * removed!
171 * removed!
172 * removed!
173 *
174 * removed!
175 * removed!
176 * removed!
177 *
178 * removed!
179 * removed!
180 * removed!
181 *
182 * removed!
183 * removed!
184 * removed!
185 *
186 * removed!
187 * removed!
188 * removed!
189 *
190 * removed!
191 * removed!
192 * removed!
193 *
194 * removed!
195 * removed!
196 * removed!
197 *
198 * removed!
199 * removed!
200 * removed!
201 *
202 * removed!
203 * removed!
204 * removed!
205 *
206 * removed!
207 * removed!
208 * removed!
209 *
210 * removed!
211 * removed!
212 * removed!
213 *
214 * removed!
215 * removed!
216 * removed!
217 *
218 * removed!
219 * removed!
220 * removed!
221 *
222 * removed!
223 * removed!
224 * removed!
225 *
226 * removed!
227 * removed!
228 * removed!
229 *
230 * removed!
231 * removed!
232 * removed!
233 *
234 * removed!
235 * removed!
236 * removed!
237 *
238 * removed!
239 * removed!
240 * removed!
241 *
242 * removed!
243 * removed!
244 * removed!
245 * removed!
246 * removed!
247 * removed!
248 * removed!
249 * removed!
250 * removed!
251 * removed!
252 * removed!
253 * removed!
254 * removed!
255 * removed!
256 * removed!
257 *
258 * removed!
259 * removed!
260 * removed!
261 *
262 * removed!
263 * removed!
264 * removed!
265 *
266 * removed!
267 * removed!
268 * removed!
269 *
270 * removed!
271 * removed!
272 * removed!
273 *
274 * removed!
275 * removed!
276 * removed!
277 *
278 * removed!
279 * removed!
280 * removed!
281 *
282 * removed!
283 * removed!
284 * removed!
285 *
286 * removed!
287 * removed!
288 * removed!
289 *
290 * removed!
291 * removed!
292 * removed!
293 *
294 * removed!
295 * removed!
296 * removed!
297 *
298 * removed!
299 * removed!
300 * removed!
301 *
302 * removed!
303 * removed!
304 * removed!
305 *
306 * removed!
307 * removed!
308 * removed!
309 *
310 * removed!
311 * removed!
312 * removed!
313 *
314 * removed!
315 * removed!
316 * removed!
317 *
318 * removed!
319 * removed!
320 * removed!
321 *
322 * removed!
323 * removed!
324 * removed!
325 *
326 * removed!
327 * removed!
328 * removed!
329 *
330 * removed!
331 * removed!
332 * removed!
333 *
334 * removed!
335 * removed!
336 * removed!
337 *
338 * removed!
339 * removed!
340 * removed!
341 *
342 * removed!
343 * removed!
344 * removed!
345 *
346 * removed!
347 * removed!
348 * removed!
349 *
350 * removed!
351 * removed!
352 * removed!
353 *
354 * removed!
355 * removed!
356 * removed!
357 *
358 * removed!
359 * removed!
360 * removed!
361 *
362 * removed!
363 * removed!
364 * removed!
365 *
366 * removed!
367 * removed!
368 * removed!
369 *
370 * removed!
371 * removed!
372 * removed!
373 *
374 * removed!
375 * removed!
376 * removed!
377 *
378 * removed!
379 * removed!
380 * removed!
381 *
382 * removed!
383 * removed!
384 * removed!
385 *
386 * removed!
387 * removed!
388 * removed!
389 *
390 * removed!
391 * removed!
392 * removed!
393 *
394 * removed!
395 * removed!
396 * removed!
397 *
398 * removed!
399 * removed!
400 * removed!
401 *
402 * removed!
403 * removed!
404 * removed!
405 *
406 * removed!
407 * removed!
408 * removed!
409 *
410 * removed!
411 * removed!
412 * removed!
413 *
414 * removed!
415 * removed!
416 * removed!
417 *
418 * removed!
419 * removed!
420 * removed!
421 *
422 * removed!
423 * removed!
424 * removed!
425 *
426 * removed!
427 * removed!
428 * removed!
429 *
430 * removed!
431 * removed!
432 * removed!
433 *
434 * removed!
435 * removed!
436 * removed!
437 *
438 * removed!
439 * removed!
440 * removed!
441 *
442 * removed!
443 * removed!
444 * removed!
445 *
446 * removed!
447 * removed!
448 * removed!
449 *
450 * removed!
451 * removed!
452 * removed!
453 *
454 * removed!
455 * removed!
456 *
457 *
458 * removed!
459 * removed!
460 *
461 *
462 * removed!
463 * removed!
464 *
465 *
466 * removed!
467 * removed!
468 *
469 *
470 * removed!
471 * removed!
472 *
473 *
474 * removed!
475 * removed!
476 *
477 *
478 * removed!
479 * removed!
480 *
481 *
482 * removed!
483 * removed!
484 * removed!
485 *
486 * removed!
487 * removed!
488 *
489 *
490 * removed!
491 * removed!
492 *
493 *
494 * removed!
495 * removed!
496 * removed!
497 *
498 * removed!
499 * removed!
500 * removed!
501 *
502 * removed!
503 * removed!
504 *
505 *
506 *
507 * removed!
508 * removed!
509 *
510 *
511 * removed!
512 * removed!
513 *
514 * removed!
515 * removed!
516 *
517 * removed!
518 * removed!
519 * removed!
520 *
521 * removed!
522 * removed!
523 * removed!
524 *
525 * removed!
526 * removed!
527 *
528 * removed!
529 * removed!
530 *
531 * removed!
532 * removed!
533 * removed!
534 *
535 * removed!
536 * removed!
537 * removed!
538 *
539 * removed!
540 * removed!
541 * removed!
542 *
543 * removed!
544 * removed!
545 * removed!
546 *
547 * removed!
548 * removed!
549 * removed!
550 *
551 * removed!
552 * removed!
553 * removed!
554 *
555 * removed!
556 * removed!
557 * removed!
558 *
559 * removed!
560 * removed!
561 * removed!
562 *
563 * removed!
564 * removed!
565 * removed!
566 * removed!
567 *
568 * removed!
569 * removed!
570 * removed!
571 *
572 * removed!
573 * removed!
574 * removed!
575 *
576 * removed!
577 * removed!
578 * removed!
579 *
580 * removed!
581 * removed!
582 * removed!
583 *
584 * removed!
585 * removed!
586 * removed!
587 *
588 * removed!
589 * removed!
590 * removed!
591 *
592 * removed!
593 * removed!
594 * removed!
595 *
596 * removed!
597 * removed!
598 * removed!
599 *
600 * removed!
601 * removed!
602 * removed!
603 *
604 * removed!
605 * removed!
606 *
607 * removed!
608 * removed!
609 *
610 * removed!
611 * removed!
612 *
613 * removed!
614 * removed!
615 *
616 * removed!
617 * removed!
618 *
619 * removed!
620 * removed!
621 *
622 * removed!
623 * removed!
624 *
625 * removed!
626 * removed!
627 *
628 * removed!
629 * removed!
630 *
631 * removed!
632 * removed!
633 *
634 * removed!
635 * removed!
636 * removed!
637 *
638 * removed!
639 * removed!
640 * removed!
641 *
642 * removed!
643 * removed!
644 *
645 * removed!
646 * removed!
647 * removed!
648 * removed!
649 *
650 * removed!
651 * removed!
652 *
653 * removed!
654 * removed!
655 *
656 * removed!
657 * removed!
658 * removed!
659 *
660 * removed!
661 * removed!
662 *
663 * removed!
664 * removed!
665 *
666 * removed!
667 * removed!
668 *
669 * removed!
670 * removed!
671 *
672 * removed!
673 * removed!
674 *
675 * removed!
676 * removed!
677 *
678 * removed!
679 * removed!
680 *
681 * removed!
682 * removed!
683 *
684 * removed!
685 * removed!
686 *
687 * removed!
688 * removed!
689 *
690 * removed!
691 * removed!
692 *
693 * removed!
694 * removed!
695 *
696 * removed!
697 * removed!
698 *
699 * removed!
700 * removed!
701 *
702 * removed!
703 * removed!
704 *
705 * removed!
706 * removed!
707 *
708 *
709 *******************************************************************************/
710
711/******************************************************************************
712 *
713 * File: /MTKteam/source/gprsmtk/l1/generic/SCCS/s.l1_public.h
714 * -----
715 *
716 * SCCS Version: 2.21
717 * -------------
718 *
719 * Copyright Statement:
720 * --------------------
721 * This software is protected by Copyright and the information contained
722 * herein is confidential. The software may not be copied and the information
723 * contained herein may not be used or disclosed except with the written
724 * permission of Communications Consultants Worldwide Limited (C) 2001
725 *
726 * Project:
727 * --------
728 *
729 * Software Unit: Layer1 public interface.
730 * --------------
731 *
732 * Description:
733 * ------------
734 *
735 *
736 * Modification History:
737 * ---------------------
738 * Date Vers Auth Details
739 * ---- ---- ---- -------
740 * 28-Mar-01 2.1 VKL Initial version
741 * 25-Apr-01 2.2 APB Add prototype for strdup
742 * 27-Apr-01 2.3 VKL Added AGCGroupPTCCh and AGCGroupMax.
743 * Changed prototypes of L1D_ReportPeriod() and
744 * L1D_PTCChStart().
745 * Added prototypes for L1D_DChSetTxPower() and
746 * L1D_PDTChSetHoppingSequence()
747 * 01-May-01 2.4 VKL Renames PSM functions
748 * 01-May-01 2.5 DBT Fix merge errors
749 * Change prototype for PDTCh drivers
750 * 21-May-01 2.6 VKL removed ifdef WIN32 ( now in l1_const.h)
751 * replaces L1_PSM* functions by new power measurement
752 * manager functions
753 * renamed parameter to L1D_CBChStart and
754 * L1D_PBCChStart
755 * change parameters to L1D_PTCChStart
756 * surround cell power measurements now done in
757 * separate module, not in report period any more.
758 * L1D_ReportPeriod therfore no longer gets scan list
759 * added functions for PCh, PAGCh, PRACh, and
760 * interference measurements.
761 * 15-Jul-01 2.7 VKL Added ARFCN conversion functions
762 * Added L1I_GetUplinkPDTCh()
763 * Added MAC functions
764 * Added driver to adjust frequency
765 * TCh drv now get param to mark if a blk can be DTXed
766 * PAGCh driver now gets time slot parameters
767 * PDTCh driver no longer gets time slot allocation.
768 * MAC now handles this.
769 * Add burstLength param to L1D_RACh() and L1D_PRACh()
770 * Removed rachData parameter from L1D_PTCChUp()
771 * 08-Aug-01 2.8 VKL Added L1I_ReportRxBurstData()
772 * Added startTimeSlot parameter to L1D_FCChTStart()
773 * and L1D_FCChT()
774 * 02-Sep-01 2.9 VKL Change params to L1I_GetUplinkPDTCh(), add dtxAllowed
775 * parameter to L1D_ReportPeriod(), pass DChParams
776 * structure to L1D_DChStart() instead of individual ones
777 * pass timeSlotPosition to L1D_PTCChUp(), ..Down() instead
778 * add L1D_PDTChStart() and L1D_PDTChStop()
779 * change L1D_PTDCh() params, cleanup BSIC vs. TSC usage,
780 * add bsic field to TBFParams, add subBlock field to RxData
781 * replace reportPeriodLock field by monitorReport field
782 * 12-Sep-01 2.10 VKL Add ARFCN2INDEX for backward compatibility, add AGC parameter
783 * structure and variable declaration
784 * 13-Sep-01 2.11 VKL Add drivers for neighbour PBCCh receive
785 * 26-Sep-01 2.12 VKL Added tsc parameter to L1D_PTCChStart()
786 * Added L1D_PollResp() and L1D_PDTChSetHoppingSequence()
787 * 28-Sep-01 2.13 VKL Changed parameters of L1I_GetUplinkPDTCh()
788 * Changed AGC completely.
789 * Added prototype for L1D_GetHardwareGain()
790 * 28-Sep-01 2.14 SGB Add temporary OLD_AGC conditional compile option
791 * 09-Oct-01 2.15 VKL Add new AGC constants
792 * 09-Oct-01 2.16 VKL Add new AGC constant
793 * 09-Oct-01 2.17 VKL Add AGC algorithm for NPBCCh and interference
794 * measurements
795 * 10-Oct-01 2.18 VKL Add per cell AFC support
796 * 12-Oct-01 2.19 VKL Add sacchPosition parameter to L1D_DChStart
797 * 11-Oct-01 2.20 SY Revise AGC interface and add paramter of L1D_DChStart
798 * 26-Oct-01 2.21 VKL Remove L1D_AdjustFrequency() prototype
799 * Increse size of agcScaleBetaServingCell array
800 * 26-Oct-01 2.21 SGB Correct File history
801 * 17-Nov-01 2.22 VKL Change AGC interface
802 * Replace AGCGroup values by #defines to temporarily
803 * patch in new AGC
804 * Move AGCParams to l1_types.h
805 * 21-Nov-01 2.23 VKL Make PRACh aware of syncTimeSlot
806 * Remove frequencyError param from L1I_ReportRxBurstData
807 * 04-Dec-01 2.24 VKL Add flags parameter to L1I_GetUplinkFACCh()
808 * Replace L1D_TChF() by L1D_TCh().
809 * Add fn parameter to L1D_NPBCCh()
810 *
811 *****************************************************************************/
812
813#ifndef l1_generic_l1_public_h
814#define l1_generic_l1_public_h
815
816#if !defined(GEN_FOR_PC)
817#include <stdarg.h>
818#include <stdlib.h>
819#include <stdio.h>
820#include <string.h>
821#endif // GEN_FOR_PC
822
823#include "l1_const.h"
824#include "l1_types_public.h"
825#include "l1_tool.h"
826#include "l1_types.h"
827
828#if !defined(IC_BURNIN_TEST) && !defined(GEN_FOR_PC) && !defined(__NO_L1TRC_GEN__)
829#include "TrcMod.h"
830#endif
831
832#include "mph_types.h"
833#include "l1d_cid.h"
834#include "kal_general_types.h"
835#include "l1d_public.h"
836#ifdef __MTK_TARGET__
837#include "perf_api.h"
838#endif
839
840/* -------------------------------------------------------------------------- */
841/* --- layer1 functions accessible by hardware driver ----------------------- */
842/* -------------------------------------------------------------------------- */
843
844#define ARFCN2INDEX L1_ARFCNToIndex /* backward compatibility */
845
846intx L1_ARFCNToIndex( ARFCN arfcn );
847ARFCN L1_IndexToARFCN( intx index );
848FrequencyBand L1_ARFCNToFrequencyBand( ARFCN arfcn );
849
850#if IS_DYNAMICAL_NOISE_FLOOR_AND_SATURATION_SUPPORT
851intx L1_PowerToIndex( Power power );
852#endif
853
854
855typedef enum
856{
857 caller_l1c,
858 caller_tst,
859 caller_l1d,
860}L1D_APIcaller_id;
861
862/* --- getting uplink data -------------------------------------------------- */
863
864#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
865void L1I_GetUplinkSACCh( kal_uint32 ul_data_index, QueryTxDataCallback* callback);
866#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
867BlockData* L1I_GetUplinkSACCh( void );
868#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
869#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
870void L1I_GetUplinkFACCh( intx flags, kal_uint32 ul_data_index, QueryTxDataCallback* callback);
871#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
872BlockData* L1I_GetUplinkFACCh( intx flags );
873#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
874/*AMR_ENABLE*/
875BlockData* L1I_GetUplinkRATSCCh( intx flags );
876/*end of AMR_ENABLE*/
877#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
878void L1I_GetUplinkSDCCh( kal_uint32 ul_data_index, QueryTxDataCallback* callback);
879#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
880BlockData* L1I_GetUplinkSDCCh( void );
881#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT*/
882BlockData* L1I_GetUplinkCSD( intx flags );
883
884/* --- replying reports ----------------------------------------------------- */
885#if defined(__2G_RX_DIVERSITY_PATH_SUPPORT__)
886 #if IS_2G_C_VALUE_SUPPORT
887 #if IS_2G_RAS_DECISION_INCLUDE_DSP_POW_SUPPORT
888 void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, Power power_dBm_rxd, Power dspPower_dBm, Power dspPower_dBm_drx, int16 dsp_c_value, int16 dsp_c_value_drx, int16 snr );
889 #else
890 void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, Power power_dBm_rxd, int16 dsp_c_value, int16 dsp_c_value_drx, int16 snr );
891 #endif /* IS_2G_RAS_DECISION_INCLUDE_DSP_POW_SUPPORT */
892 #else
893 #if IS_2G_RAS_DECISION_INCLUDE_DSP_POW_SUPPORT
894 void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, Power power_dBm_rxd, Power dspPower_dBm, Power dspPower_dBm_drx, int16 snr );
895 #else
896 void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, Power power_dBm_rxd, int16 snr );
897 #endif /* IS_2G_RAS_DECISION_INCLUDE_DSP_POW_SUPPORT */
898 #endif /* IS_2G_C_VALUE_SUPPORT */
899#else
900void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, int16 snr );
901#endif
902void L1I_PutReport( Report *report );
903
904/* --- hopping -------------------------------------------------------------- */
905
906ARFCN L1_CalcHoppingARFCN( HoppingSequence *hs, FrameNumber frame );
907
908/* --- power scan ----------------------------------------------------------- */
909
910#if IS_2G_TAS_ANT_IDX_FOR_PM_WINDOW_SUPPORT
911#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
912bool L1I_MeasurementsGetARFCN( ARFCN* arfcn, l1c_sim_mode_enum* sim_mode, GL1_AntennaInfo *antenna_assigned);
913#else
914bool L1I_MeasurementsGetARFCN( ARFCN* arfcn, l1c_sim_mode_enum* sim_mode);
915#endif /* IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 ) */
916#endif
917
918void L1I_MeasurementsPutResult( PMResult pmResult );
919
920/* --- MAC ------------------------------------------------------------------ */
921
922void L1I_MACSetReceivedUSF(TimeSlot timeSlot, intx usf, Report* report);
923bool L1I_MACFrameTick( PacketTransferSpec *pts );
924#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
925void L1I_PreGetUplinkPDTCh( Report* report, kal_uint32 ul_data_index, QueryTxDataCallback *callback );
926#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
927void L1I_PreGetUplinkPDTCh(PrePacketUplinkSpec *ppus, Report* report);
928#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
929bool L1I_PRAChCheckUSFFree( void );
930
931/* --- AFC ------------------------------------------------------------------ */
932typedef struct
933{
934 Power burstpower;
935 uint16 snr;
936 int16 freq_offset;
937
938#if IS_SAIC_CHIP_MT6223_AND_LATTER_VERSION
939 int16 tx_freq_offset;
940 int16 c_value;
941 #if IS_2G_C_VALUE_SUPPORT
942 int16 c_value_drx;
943 #endif
944 bool isSAIC;
945 #if IS_EGPRS
946 bool isEPSK;
947 #endif
948#endif /* End of "IS_SAIC_CHIP_MT6223_AND_LATTER_VERSION" */
949
950} BurstAfcDB;
951
952typedef struct
953{
954 BurstAfcDB burstafc[4];
955
956#if IS_ACC_NC_AFC_DB_UPDATE_SUPPORT
957 bool AfcForNbcch;
958#endif /* IS_ACC_NC_AFC_DB_UPDATE_SUPPORT */
959
960} AfcUpdateParams;
961
962#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
963int32 L1I_AFCGetFBSBFreqSetting( AfcParams *p, bool beginfreqcorrection );
964int32 L1I_AFCAdjustFBSBFreqSetting( AfcParams *p, uint8 sub_stage );
965#else
966uint16 L1I_AFCGetFBSBFreqSetting( AfcParams *p, bool beginfreqcorrection );
967
968uint16 L1I_AFCAdjustFBSBFreqSetting( AfcParams *p, uint8 sub_stage );
969#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
970void L1I_AFCFBSBUpdate( AfcParams *p, intx freq_offset, int8 freqcorrectionstepcnt, bool decodeOk, FrequencyBand band );
971
972void L1I_AFCBeforeTick( AfcParams *p );
973#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
974int32 L1I_AFCGetNBFreqSetting( void );
975#else
976uint16 L1I_AFCGetNBFreqSetting( void );
977#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
978void L1I_AFCNBUpdate( AfcUpdateParams *p, TimeSlotMask timeSlots, FrequencyBand band );
979void L1I_AFCAfterTick( void );
980#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
981void L1I_SetAFcData( int32 calibrated_dac_default, intx calibrated_int_slope );
982#else
983void L1I_SetAFcData( int16 calibrated_dac_default, intx calibrated_int_slope );
984#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
985
986#if IS_GEMINI_SUPPORT
987void L1I_AFCSetDatabaseToSIMx( uint8 simIndex );
988#endif
989
990//extern intx afc_inv_slope;
991//extern int16 afc_dac_default; /* move to l1d_public.h */
992#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
993extern int32 onek_hz_dac;
994#else
995extern int16 onek_hz_dac;
996#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
997
998#if IS_TDD_DUAL_MODE_SUPPORT
999extern int16 GSM_afc_inv_slope;
1000extern intx GSM_afc_dac_default;
1001#endif
1002
1003extern Power agc_gainoffset_h2l;
1004extern Power agc_gprs_gainoffset;
1005#if IS_EGPRS
1006extern Power agc_edge_gainoffset;
1007#endif
1008
1009/*XO*//* --XO AFC------------------------------------------------------------ */
1010/*XO*/ void L1IXO_PrepareTuneSlope( bool freq_crt );
1011/*XO*/ void L1DXO_PrepareTuneSlope( Report *report );
1012/*XO*/ void L1DXO_TuneSlope( void );
1013/*XO*/ bool L1DXO_IsSlopeCorrected( void );
1014
1015/* --- AGC ------------------------------------------------------------------ */
1016
1017typedef Report* AGCGroup;
1018
1019#define AGCGroupPowerMeasurement NULL
1020#define AGCGroupFCCh report
1021#define AGCGroupSCh report
1022#define AGCGroupNBCCh report
1023#define AGCGroupBCCh report
1024#define AGCGroupPCh report
1025#define AGCGroupCBCh report
1026#define AGCGroupSACChC report
1027#define AGCGroupSDCCh report
1028#define AGCGroupTCh report
1029#define AGCGroupSACChT report
1030#define AGCGroupFCChT report
1031#define AGCGroupSChT report
1032#define AGCGroupPTCCh report
1033#define AGCGroupPBCCh report
1034#define AGCGroupNPBCCh report
1035#define AGCGroupPPCh report
1036#define AGCGroupPAGCh report
1037#define AGCGroupPDTCh report
1038#define AGCGroupInterference imm.params.report
1039
1040/*
1041 first beta (forgetting factor) in the table. This is used if the delay
1042 between the measurements is zero after scaling the delay.
1043 This is a floating point number used to init the AGCs internal tables.
1044*/
1045#define BETA0 (0.1)
1046
1047/*
1048 The AGC uses fixed point arithmetic for scales and forgetting factors (beta).
1049 This constant defines the number of bits after the decimal point.
1050*/
1051#define AGC_PRECISION 10
1052
1053/*
1054 Convert a floating point number to the AGCs internal fixed point format
1055*/
1056#define AGC_TOFIX(n) ((int16)((1<<AGC_PRECISION)*(n)))
1057
1058extern const AGCParams agcParams[ FrequencyBandCount ];
1059#if IS_DYNAMICAL_NOISE_FLOOR_AND_SATURATION_SUPPORT
1060extern AGCParams_T agcParams_p[];
1061#endif
1062
1063
1064void L1I_AGCBeforeBlock( Report *report, TimeSlotMask timeSlots );
1065Gain L1I_AGCGetGain( Report *report, ARFCN arfcn, TimeSlot timeSlot );
1066#if defined(__2G_RX_DIVERSITY_PATH_SUPPORT__)
1067L1D_RX_POWER L1I_AGCGetInputPower( Report *report, ARFCN arfcn, TimeSlot timeSlot );
1068 #if IS_2G_EXTERNAL_LNA_SUPPORT
1069L1D_RX_POWER L1I_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, BurstAfcDB *pBurstData, L1D_RX_ELNA_TYPE elna_status );
1070L1D_RX_POWER L1I_AGCMeasurementUpdate( ARFCN arfcn, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, L1D_RX_ELNA_TYPE elna_status );
1071 #else
1072L1D_RX_POWER L1I_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, BurstAfcDB *pBurstData );
1073L1D_RX_POWER L1I_AGCMeasurementUpdate( ARFCN arfcn, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain );
1074 #endif
1075L1D_RX_POWER L1I_AGCMeasurementGetInputPower( ARFCN arfcn );
1076#else
1077 #if IS_2G_EXTERNAL_LNA_SUPPORT
1078Power L1I_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, Power observedDSPOutputPower, Gain usedGain, BurstAfcDB *pBurstData, MMRF_ELNA_TYPE_E elna_status );
1079Power L1I_AGCMeasurementUpdate( ARFCN arfcn, Power observedDSPOutputPower, Gain usedGain, MMRF_ELNA_TYPE_E elna_status );
1080 #else
1081Power L1I_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, Power observedDSPOutputPower, Gain usedGain, BurstAfcDB *pBurstData );
1082Power L1I_AGCMeasurementUpdate( ARFCN arfcn, Power observedDSPOutputPower, Gain usedGain );
1083 #endif
1084Gain L1I_AGCMeasurementGetGain( ARFCN arfcn );
1085#endif
1086void L1I_AGCAfterBlock( Report *report, TimeSlotMask timeSlots );
1087
1088
1089
1090
1091
1092/* -------------------------------------------------------------------------- */
1093/* --- hardware driver functions -------------------------------------------- */
1094/* -------------------------------------------------------------------------- */
1095
1096/* --- starting and stopping ------------------------------------------------ */
1097
1098void L1D_Init0( void );
1099void L1D_Init( void );
1100void L1D_Init2(void);
1101void L1D_Exit( L1D_APIcaller_id caller );
1102void L1D_Meta_Init( void );
1103
1104void L1D_Start( void );
1105void L1D_Stop( L1D_APIcaller_id caller );
1106
1107/* --- ticking and sleeping ------------------------------------------------- */
1108
1109void L1D_FrameTick( void );
1110
1111bool L1D_PowerDown( intx frames );
1112void L1D_PowerUp( void );
1113
1114/* --- drivers -------------------------------------------------------------- */
1115
1116#if IS_TDD_DUAL_MODE_SUPPORT
1117/*TDD*/ /*--------------------------- GSM Using Only ------------------------------*/
1118 #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
1119/*TDD*/ void L1D_AFCSetDACValue_DM( AfcParams *p, int32 DacValue, L1D_APIcaller_id caller );
1120 #else
1121/*TDD*/ void L1D_AFCSetDACValue_DM( AfcParams *p, int16 DacValue, L1D_APIcaller_id caller );
1122 #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
1123/*TDD*/ bool L1D_check_3g_reli( void );
1124/*TDD*/ void L1D_AFCResetParams_DM( AfcParams *p, L1D_APIcaller_id caller );
1125/*TDD*/ /*--------------------------- TDD Using Only ------------------------------*/
1126/*TDD*/ kal_uint16 L1D_GetInitMode( void );
1127/*TDD*/ void L1D_ErrorCheck_DM_RF_Conflict( uint32 start_subfn, uint16 start_chip, uint32 end_subfn, uint16 end_chip );
1128/*TDD*/ /*--------------------------- GSM/TDD Using ------------------------------*/
1129 #if L1D_WT_COBIN_ARCHITECTURE_SUPPORT
1130 #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
1131/*TDD*/ kal_int32 L1D_AFCGetDAC_Value_DM_TDD( bool is_2g_2_3g );
1132 #else
1133/*TDD*/ kal_int16 L1D_AFCGetDAC_Value_DM_TDD( bool is_2g_2_3g );
1134 #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
1135 #else
1136 #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
1137/*TDD*/ kal_int32 L1D_AFCGetDAC_Value_DM( bool is_2g_2_3g );
1138 #else
1139/*TDD*/ kal_int16 L1D_AFCGetDAC_Value_DM( bool is_2g_2_3g );
1140 #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
1141 #endif
1142/*TDD*/ void L1D_AFCChangeTDReliable_DM( bool is_afc_reliable );
1143#endif
1144void L1D_AFC_Control_Switch_DM( kal_bool is_2G_control );
1145
1146void L1D_AFC_Update_Mode(kal_uint8 sim_num, kal_uint8 new_mode, L1D_APIcaller_id caller );
1147void L1D_AFC_Update_Gap_Start(kal_uint8 sim_num, L1D_APIcaller_id caller);
1148#ifdef __UMTS_FDD_MODE__
1149/*FDD*/ bool L1D_AFC_2G_ACTIVE_ASK_FreqCorrect( uint8 simIndex, kal_bool correction, kal_bool is_l1c, AfcParams *afcParams );
1150#endif
1151
1152#if !IS_MultiMode_AFC_Support
1153 #ifdef __UMTS_FDD_MODE__
1154 #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
1155/*FDD*/ void L1D_AFCSetDACValue_DM( AfcParams *p, int32 DacValue, L1D_APIcaller_id caller );
1156 #else
1157/*FDD*/ void L1D_AFCSetDACValue_DM( AfcParams *p, int16 DacValue, L1D_APIcaller_id caller );
1158 #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
1159/*FDD*/ int16 L1D_AFCGetServingDACValue_DM( void );
1160/*FDD*/ void L1D_AFCResetParams_DM( AfcParams *p, L1D_APIcaller_id caller );
1161 #endif
1162#endif
1163
1164void L1D_Update_DSP_2G_TimeStamp( kal_uint32 timestamp );
1165void L1D_Update_DSP_3G_TimeStamp( kal_uint16 timestamp );
1166
1167void L1D_AFCSetParams( uint8 simIndex, AfcParams *afc, L1D_APIcaller_id caller );
1168bool L1D_AFCGetServingReliable( uint8 simIndex );
1169
1170#if IS_GEMINI_SUPPORT
1171kal_bool L1D_AFC_Ask_FreqCorrection_2( uint8 simIndex, kal_bool correction, AfcParams *afcParams);
1172#endif
1173
1174void L1D_SCDedicateModeStart( L1D_APIcaller_id caller );
1175void L1D_SCDedicateModeEnd( L1D_APIcaller_id caller );
1176void L1D_SCAccessModeStart( L1D_APIcaller_id caller );
1177void L1D_SCAccessModeEnd( L1D_APIcaller_id caller );
1178void L1D_SetInitMode( int16 mode );
1179int L1D_CheckIfMetaMode( void );
1180uint8 L1D_IRDMA_Power_GetHandle( void );
1181void L1D_IRDMA_Power_On( uint8 handle );
1182void L1D_IRDMA_Power_Off( uint8 handle );
1183
1184Gain L1D_SetHardwareGain( FrequencyBand band, Gain gain );
1185void L1D_AGCControl( void *privateData );
1186
1187void L1D_ExtendFrame( intx extendFrameEBits, L1D_APIcaller_id caller );
1188void L1D_AdjustFrame( intx adjustFrameEBits, L1D_APIcaller_id caller );
1189void L1D_SetSync( FrameNumber setSyncFrame, intx setSyncEBits, L1D_APIcaller_id caller );
1190void L1D_Write_HW_TQWRAP( uint16 tq );
1191
1192#if IS_GEMINI_SUPPORT
1193void L1D_SetSIM2FrameNumber( FrameNumber setSyncFrame );
1194void L1D_SetSIM2FrameNumber_ForRx( uint8 simIndex, FrameNumber setSyncFrame, int8 burstCnt );
1195void L1D_SetSIM2FrameNumber_ForTx( uint8 simIndex, FrameNumber setSyncFrame, int8 burstCnt );
1196#endif
1197
1198void L1D_FCCh( Report *report, ARFCN arfcn, bool frequencyCorrect, AfcParams *afc, L1D_APIcaller_id caller );
1199void L1D_FCChStop( L1D_APIcaller_id caller );
1200
1201void L1D_SCh( Report *report, ARFCN arfcn, AfcParams *afc, L1D_APIcaller_id caller );
1202void L1D_SChStop( uint8 simIndex, L1D_APIcaller_id caller );
1203
1204void L1D_NBCCh( Report *report, ARFCN arfcn, BSIC bsic, AfcParams *afc, L1D_APIcaller_id caller );
1205
1206void L1D_BCCh( Report *report, ARFCN arfcn, BSIC bsic, L1D_APIcaller_id caller );
1207
1208void L1D_PCh( Report *report, ARFCN arfcn, BSIC bsic, L1D_APIcaller_id caller );
1209#ifdef __L1_CB__
1210void L1D_CBChStart( HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, L1D_APIcaller_id caller );
1211void L1D_CBCh( Report *report, L1D_APIcaller_id caller );
1212void L1D_CBChStop( L1D_APIcaller_id caller );
1213#endif
1214#if IS_GSM_INCREASE_RACH_TX_POWER_SUPPORT
1215 #if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || IS_2G_Gen97_UTAS_SUPPORT
1216void L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc ,l1c_d_intf_params* l1c_d_intf_params, int8 rachTxCount, L1D_APIcaller_id caller );
1217 #else
1218void L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc, int8 rachTxCount, L1D_APIcaller_id caller );
1219 #endif
1220#else
1221 #if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || IS_2G_Gen97_UTAS_SUPPORT
1222void L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc ,l1c_d_intf_params* l1c_d_intf_params, L1D_APIcaller_id caller );
1223 #else
1224void L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc, L1D_APIcaller_id caller );
1225 #endif
1226#endif
1227void L1D_ReportPeriod( Report *report, TimingAdvance timingAdvance, int8 dtxsetting, L1D_APIcaller_id caller );
1228void L1D_ReportPeriodStop( L1D_APIcaller_id caller );
1229
1230#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1231void L1D_DChAB( bool isTCh, l1c_d_intf_params* l1c_d_intf_params, L1D_APIcaller_id caller);
1232#else
1233void L1D_DChAB( bool isTCh, L1D_APIcaller_id caller );
1234#endif /* IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )*/
1235void L1D_DChStart( DChParams *params, intx sacchPosition, L1D_APIcaller_id caller );
1236void L1D_DChStop( bool releaseDCh, L1D_APIcaller_id caller );
1237void L1D_DChStopHandoverASAP( L1D_APIcaller_id caller );
1238void L1D_DChSetHoppingSequence( HoppingSequence *hoppingSequence, L1D_APIcaller_id caller );
1239void L1D_DChSetCiphering( bool enable, int8 algorithm, uint8 key[ 8 ], L1D_APIcaller_id caller );
1240void L1D_DChSetChannelMode( TChMode channelMode, SubChannel subChannel, bool dtxAllowed, L1D_APIcaller_id caller );
1241void L1D_DChSetAMRChannelMode( TChMode channelMode, SubChannel subChannel, bool dtxAllowed, TChAMRConfig *amrConfig, L1D_APIcaller_id caller );
1242void L1D_DChSetAMRConfig( TChAMRConfig *amrConfig, L1D_APIcaller_id caller );
1243void L1D_DChSetAMRQICompensated( uint16 amrCompensated );
1244void L1D_DChInitAMRQICompensated( void );
1245void L1D_DChSetLoopMode( LoopMode mode, L1D_APIcaller_id caller );
1246void L1D_DChSetTxPower( Power txPower, L1D_APIcaller_id caller );
1247#ifdef __EGPRS_MODE__
1248void L1D_EGPRSSetSRBMode( bool isOn, TimeSlot dnTsOffset, bool mBit, L1D_APIcaller_id caller );
1249#endif /*__EGPRS_MODE__*/
1250
1251void L1D_SDCChDown( Report *report, L1D_APIcaller_id caller );
1252#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1253void L1D_SDCChUp( bool handover ,l1c_d_intf_params* intf_params, L1D_APIcaller_id caller);
1254#else
1255void L1D_SDCChUp( bool handover , L1D_APIcaller_id caller);
1256#endif
1257void L1D_SACChCDown( Report *report, L1D_APIcaller_id caller );
1258#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1259void L1D_SACChCUp( bool handover, l1c_d_intf_params* intf_params, L1D_APIcaller_id caller );
1260#else
1261void L1D_SACChCUp( bool handover, L1D_APIcaller_id caller );
1262#endif /* IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 ) */
1263#if IS_DUAL_CORE_MODEM_SUPPORT
1264void L1D_SetSABMData( BlockData *data, L1D_APIcaller_id caller );
1265#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
1266
1267#define TCH_BLOCK 0x01 /* interleaved block starts and other one ends */
1268#define TCH_FACCHU 0x02 /* uplink FACCh block start */
1269#define TCH_FACCHD 0x04 /* downlink FACCh block end */
1270#define TCH_NODTXD 0x08 /* no downlink DTX allowed on this block */
1271#define TCH_NODTXU 0x10 /* no uplink DTX allowed on this block */
1272#define TCH_QSUB 0x20 /* monitor block quality to sub for normal block */
1273#define TCH_QFACCHSUB 0x40 /* monitor block quality to sub for FACCh block */
1274#define TCH_FORCEFACCH 0x80 /* interleaved block starts and other one ends */
1275
1276#define SACCH_NONE_SHIFT 0x0000
1277#define SACCH_RIGHT_SHIFT 0x0100
1278#define SACCH_LEFT_SHIFT 0x0200
1279
1280#if IS_DUAL_LOOP_AFC_CONTROL_SUPPORT
1281#define MAX_FBCORRECTION_SEARCH_TIME (110) //(110+52) // FB Search time increase 13*4 caused by USE_3_SUBSTAGES_FB_STAGE1=1
1282#else
1283#define MAX_FBCORRECTION_SEARCH_TIME (110)
1284#endif
1285
1286void L1D_TCh( Report *report, intx flags, HandoverState handover, L1D_APIcaller_id caller );
1287void L1D_SACChT( Report *report, intx subBlock, bool handover, L1D_APIcaller_id caller );
1288void L1D_DChGetCsdASAP( Report *report , Report *oldreport, L1D_APIcaller_id caller );
1289
1290void L1D_FCChTStart( Report *report, ARFCN arfcn, TimeSlot startTimeSlot, AfcParams *afc, L1D_APIcaller_id caller );
1291void L1D_FCChT( L1D_APIcaller_id caller );
1292void L1D_FCChTStop( L1D_APIcaller_id caller );
1293
1294void L1D_SChT( Report *report, ARFCN arfcn, intx ebitPosition, AfcParams *afc, L1D_APIcaller_id caller );
1295
1296void L1D_PTCChStart( HoppingSequence *hoppingSequence, BSIC bsic, TSC tsc, intx burstLength, L1D_APIcaller_id caller );
1297void L1D_PTCChSetHoppingSequence( HoppingSequence *hoppingSequence );
1298void L1D_PTCChStop( L1D_APIcaller_id caller );
1299void L1D_PTCChDown( Report *report, intx subBlock, TimeSlot timeSlotPosition, L1D_APIcaller_id caller );
1300#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1301void L1D_PTCChUp( Power txPower, TimeSlot timeSlotPosition, l1c_d_intf_params* intf_params, L1D_APIcaller_id caller);
1302 #else
1303void L1D_PTCChUp( Power txPower, TimeSlot timeSlotPosition , L1D_APIcaller_id caller);
1304 #endif
1305
1306void L1D_PBCChStart( HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition );
1307void L1D_PBCCh( Report *report, bool decodeUSF, L1D_APIcaller_id caller );
1308void L1D_PBCChStop( L1D_APIcaller_id caller );
1309
1310void L1D_NPBCChStart( HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, AfcParams *afc, L1D_APIcaller_id caller );
1311void L1D_NPBCCh( Report *report, FrameNumber fn, L1D_APIcaller_id caller );
1312void L1D_NPBCChStop( L1D_APIcaller_id caller );
1313
1314void L1D_PPChStart( HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, L1D_APIcaller_id caller );
1315void L1D_PPCh( Report *report, bool decodeUSF, L1D_APIcaller_id caller );
1316void L1D_PPChStop( L1D_APIcaller_id caller );
1317
1318void L1D_PAGCh( Report *report, HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, bool decodeUSF, L1D_APIcaller_id caller );
1319
1320#if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1321void L1D_PRACh( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, TimeSlot timeSlotPosition, Power txPower, RAChData rachData, intx burstLength, TSC tsc , l1c_d_intf_params* intf_params, L1D_APIcaller_id caller );
1322#else
1323void L1D_PRACh( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, TimeSlot timeSlotPosition, Power txPower, RAChData rachData, intx burstLength, TSC tsc, L1D_APIcaller_id caller );
1324#endif
1325
1326 #if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1327void L1D_PollResp( HoppingSequence *hoppingSequence, BSIC bsicOrTSC, Power txPower, TimingAdvance timingAdvance, BlockData *blockData, int burstLength , l1c_d_intf_params *intf_params, L1D_APIcaller_id caller);
1328 #else
1329void L1D_PollResp( HoppingSequence *hoppingSequence, BSIC bsicOrTSC, Power txPower, TimingAdvance timingAdvance, BlockData *blockData, int burstLength , L1D_APIcaller_id caller);
1330 #endif
1331
1332void L1D_PDTChStart( HoppingSequence *hoppingSequence, TSC tsc, BSIC bsic, bool egprs, L1D_APIcaller_id caller );
1333#if IS_RTTI_EDGE_SUPPORT
1334void L1D_PDTCh( Report *report, bool ccReset, bool egprs, bool isEven, L1D_APIcaller_id caller );
1335#else
1336void L1D_PDTCh( Report *report, bool ccReset, bool egprs, L1D_APIcaller_id caller );
1337#endif
1338void L1D_PDTChSetHoppingSequence( HoppingSequence *hoppingSequence );
1339void L1D_PDTChStop( bool released, L1D_APIcaller_id caller );
1340void L1D_PDTChS_StopTxProcess( int16 forceDSPTXNoProcess );
1341
1342void L1D_PACChDown( Report *report, HoppingSequence *hs, TSC tsc, L1D_APIcaller_id caller );
1343
1344void L1D_Interference( Report *report, ARFCN arfcn, L1D_APIcaller_id caller );
1345
1346void L1D_DChUpdateTA( uint8 timingAdvance, L1D_APIcaller_id caller );
1347
1348void L1D_PM_FillPMQueue( void );
1349
1350kal_bool L1D_FBSB_Status_Querry(char querry_mode, char SIM_index);
1351
1352void L1D_Suspend_PM( bool suspend, L1D_APIcaller_id caller );
1353void L1D_PM_ConsumePMQueue( void );
1354#if defined(__GEMINI__) && defined(__UMTS_RAT__)
1355extern kal_bool UL1D_UMTS_Is_In_Dedi_Mode( void );
1356#endif
1357
1358void L1D_GetCurrentTime( uint32 *frame_number, uint16 *tq_count );
1359void L1D_MeasureMaxDuration_Start( sMTMAXTIME *data );
1360void L1D_MeasureMaxDuration_Stop( sMTMAXTIME *data );
1361#if IS_DUAL_CORE_MODEM_SUPPORT
1362void L1D_MeasureMaxDuration_SetStopTime( sMTMAXTIME *data, int16 stop_time );
1363#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
1364void L1D_MeasureMaxEnd_Start( sMTMAXTIME *data );
1365void L1D_MeasureMaxEnd_Stop( sMTMAXTIME *data );
1366void L1D_MeasureTime_L1I_Start( void );
1367void L1D_MeasureTime_L1I_Stop( void );
1368void L1D_MeasureTime_L1I_Skip( void );
1369
1370/* --- sleep mode manager --------------------------------------------------- */
1371
1372void L1SM_FrameTick( uint16 *frames, uint16 *ebit );
1373void L1SM_BeginCalibration( void );
1374
1375/* --- test mode ------------------------------------------------------------ */
1376
1377void L1ITST_AGCBeforeBlock( Report *report, TimeSlotMask timeSlots );
1378Gain L1ITST_AGCGetGain( Report *report, ARFCN arfcn, TimeSlot timeSlot );
1379#if defined(__2G_RX_DIVERSITY_PATH_SUPPORT__)
1380L1D_RX_POWER L1ITST_AGCGetInputPower( Report *report, ARFCN arfcn, TimeSlot timeSlot );
1381 #if IS_2G_EXTERNAL_LNA_SUPPORT
1382L1D_RX_POWER L1ITST_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, BurstAfcDB *pBurstData, L1D_RX_ELNA_TYPE elna_status);
1383 #else
1384L1D_RX_POWER L1ITST_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, BurstAfcDB *pBurstData );
1385 #endif
1386#else
1387 #if IS_2G_EXTERNAL_LNA_SUPPORT
1388Power L1ITST_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, Power observedDSPOutputPower, Gain usedGain, BurstAfcDB *pBurstData, MMRF_ELNA_TYPE_E elna_status );
1389 #else
1390Power L1ITST_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, Power observedDSPOutputPower, Gain usedGain, BurstAfcDB *pBurstData );
1391 #endif
1392#endif
1393void L1ITST_AGCAfterBlock( Report *report, TimeSlotMask timeSlots );
1394
1395#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
1396int32 L1ITST_AFCGetFBSBFreqSetting( AfcParams *p, bool beginfreqcorrection );
1397#else
1398uint16 L1ITST_AFCGetFBSBFreqSetting( AfcParams *p, bool beginfreqcorrection );
1399#endif
1400void L1ITST_AFCFBSBUpdate( AfcParams *p, intx freq_offset, intx freqcorrectionstepcnt, bool decodeOk, FrequencyBand band );
1401
1402void L1ITST_AFCBeforeTick( AfcParams *p );
1403#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
1404int32 L1ITST_AFCGetNBFreqSetting( void );
1405#else
1406uint16 L1ITST_AFCGetNBFreqSetting( void );
1407#endif
1408void L1ITST_AFCNBUpdate( AfcUpdateParams *afcupdate, TimeSlotMask timeSlots, FrequencyBand band );
1409void L1ITST_AFCAfterTick( void );
1410
1411bool L1ITST_MACFrameTick( PacketTransferSpec *pts );
1412#if IS_DUAL_CORE_MODEM_SUPPORT
1413void L1ITST_PreGetUplinkPDTCh( Report* report, kal_uint32 ul_data_index, QueryTxDataCallback *callback );
1414#else
1415void L1ITST_PreGetUplinkPDTCh( PrePacketUplinkSpec *ppus, Report *report );
1416#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
1417void L1ITST_MACSetReceivedUSF( TimeSlot timeSlot, intx usf, Report *report );
1418bool L1ITST_PRAChCheckUSFFree( void );
1419
1420#if IS_DUAL_CORE_MODEM_SUPPORT
1421void L1ITST_GetUplinkSACCh( kal_uint32 ul_data_index, QueryTxDataCallback *callback );
1422void L1ITST_GetUplinkFACCh( intx flags, kal_uint32 ul_data_index, QueryTxDataCallback *callback );
1423#else
1424BlockData* L1ITST_GetUplinkSACCh( void );
1425BlockData* L1ITST_GetUplinkFACCh( intx flags );
1426#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
1427BlockData* L1ITST_GetUplinkRATSCCh( intx flags ); /*AMR_ENABLE*/
1428#if IS_DUAL_CORE_MODEM_SUPPORT
1429void L1ITST_GetUplinkSDCCh( kal_uint32 ul_data_index, QueryTxDataCallback *callback );
1430#else
1431BlockData* L1ITST_GetUplinkSDCCh( void );
1432#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
1433BlockData* L1ITST_GetUplinkCSD( intx flags );
1434
1435void L1D_RXWin_On( ARFCN arfcn );
1436void L1D_RXWin_Off( void );
1437#if defined(__EPSK_TX__)
1438void L1D_RF_SetRampApcLevelEPSK( int rf_band, int power_in_dBm, int apc_dac );
1439#endif
1440void L1D_TXWin_On( ARFCN arfcn, uint8 modtype, uint8 powerlev );
1441void L1D_TXWin_Off( void );
1442void L1D_SetBBTXCfg( const sBBTXCfg *bbtx );
1443void L1D_ReadBBTXCfg( sBBTXCfg *bbtx );
1444intx L1D_ReadBBTXCfgVer( void );
1445void L1D_RF_SetBBTXParameters( void *table );
1446void L1D_RF_SetRampApcLevel( int rf_band, int power_in_dBm, int apc_dac );
1447
1448#if IS_EGPRS
1449 #if !defined(__NEW_TBF_ARCH__)
1450void L1D_SetIRParams( TFI tfi, bool dnRlcAckMode, int16 WS, bool resetIR, L1D_APIcaller_id caller );
1451 #else
1452void L1D_SetIRParams( uint8 idx, TFI tfi, IRParams *ir, L1D_APIcaller_id caller );
1453void L1D_BackupRestore_AllVQ( uint8 ctrl, bool isNextTbfEdge, L1D_APIcaller_id caller ); // 0: restore, 1: backup
1454 #endif
1455 #if IS_RTTI_EDGE_SUPPORT || IS_FANR_EDGE_SUPPORT
1456#define __2G_R7_L1_WORKAROUND__
1457void L1D_SetULTBFParams( UpSpecParams *up, uint8 idx2 );
1458 #endif
1459#endif
1460
1461void L1D_GetBatteryMeasurementSetting( SBATMEASARG *meas_args );
1462void L1D_SetBatteryVoltage( int volt );
1463void L1D_SetBatteryTemperature( int temp );
1464void L1D_SetRFTemperature( int temp );
1465#if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1466void L1D_SetRFTxPowerDecrementTable_TAS( bool valid, uint8 op_code, uint8 tx_reduction_table[4][2][4], uint8 tx_reduction_table_tas[4][2][4]);
1467#else
1468void L1D_SetRFTxPowerDecrementTable( bool valid, uint8 op, uint8 tx_reduction_table[4][2][4] );
1469#endif
1470void L1D_SIM_Notify_DSP( uint8 simIndex );
1471void L1D_SIM_Notify( uint8 simIndex, uint8 status, L1D_APIcaller_id caller );
1472uint8 L1D_IS_GetRFTemperatureFromADC( void );
1473uint8 L1D_IS_GetBatteryInfoFromADC( void );
1474int32 L1D_UpdateVoltInfoPeriod( void );
1475
1476void L1D_VOLTCOM_Enable_in_Meta( void *data );
1477void L1D_VOLTCOM_Disable_in_Meta( void *data );
1478
1479#if IS_TX_POWER_CONTROL_SUPPORT
1480void L1D_TXPC_Enable_in_Meta( void *data );
1481void L1D_TXPC_Disable_in_Meta( void *data );
1482#endif
1483
1484#define CHECK_PM_AVAILABLE 0x00
1485#define CHECK_FBM_IN_QUEUE 0x01
1486#define CHECK_SBM_IN_QUEUE 0x02
1487#define CHECK_IMM_IN_QUEUE 0x04
1488#define CHECK_FSIWIN_USING 0x08
1489#define CHECK_PM_SUSPENDED 0x10
1490#define CHECK_PM_SKIPPED 0x20
1491#define CHECK_ONE_PM_BYPASS 0x40
1492
1493/* --- Feature of Modem Hard Real Time Recovery --------------------------------------------------------- */
1494
1495typedef enum
1496{
1497 MDTR_MSG_PENDING_FLAG, /* 0*/
1498 MDTR_MSG_TIMER_CONFLICT, /* 1*/
1499 MDTR_MSG_L1C_TR_COMPLETE, /* 2*/
1500 MDTR_MSG_32K_WRAP, /* 3*/
1501 MDTR_MSG_PRE_EQ_ASSERT, /* 4*/
1502 MDTR_MSG_POST_EQ_ASSERT, /* 5*/
1503 MDTR_MSG_CD_DONE_ASSERT, /* 6*/
1504 MDTR_MSG_PENDING_PARAMS, /* 7*/
1505 MDTR_MSG_TIMING_PARAMS, /* 8*/
1506 MDTR_MSG_DLY_RESUME_SET, /* 9*/
1507 MDTR_MSG_DLY_RESUME_CLR, /*10*/
1508 MDTR_MSG_ALIGN_FRAME /*11*/
1509} MDTR_DBG_MSG;
1510
1511bool L1D_MDTR_TimingAbnormal(void);
1512void L1D_MDTR_DebugMessage(MDTR_DBG_MSG msgID, int32 param1, int32 param2);
1513void L1I_MDTR_RaisePendingFlag(void);
1514void L1I_MDTR_RaiseRecoverFlag(intx frames, intx ebits);
1515
1516void L1_Get_Cal_Data_Download_Info( void );
1517void L1T_UpdateCalibrationData( kal_uint32 cal_lid, L1dOperationMode mode );
1518uint16 L1D_Check_PM_Window_Is_Available( void );
1519#if IS_FORCE_ENHENCE_PM_SUPPORT
1520void L1D_Set_Force_Enhence_PM(bool enable, L1D_APIcaller_id caller);
1521#endif
1522int16 L1D_Get_RFOnTime( void );
1523
1524#ifdef __SGTDS_STANDBY_AFC_TRACKING__
1525Standby_AfcParams_list* L1I_GetStandbyAFCList_TDD( void );
1526bool L1I_IsTDDinDedicate( void );
1527bool L1I_IsSpecialGAPHandlingStarted( void );
1528#ifdef __GL1_GEMINI__
1529void L1I_ClearReservation_SGTDS( void );
1530#endif
1531#endif
1532
1533#ifdef __GL1_GEMINI_WCDMA__
1534bool L1I_QueryAnyPLMN_BSIC_NBCCh( void );
1535#endif
1536
1537#if IS_2G_RXD_SUPPORT
1538uint16 L1D_RAS_NVRAM_LID_QUERY(void);
1539#endif /* IS_2G_RXD_SUPPORT */
1540
1541#if IS_2G_TAS_SUPPORT||IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1542 #if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
1543void L1I_AssignUTASParameters( TASPublicParams* custom_param, MMRFD_ANT_HW_LAYOUT_INFO_T* ant_hw_layout_info);
1544#if IS_GSM_TX_DETECTOR_SUPPORT
1545void L1I_UpdateTxDValue( Power avg_txPower_det ); //L1C->L1D
1546#endif /* End of IS_GSM_TX_DETECTOR_SUPPORT*/
1547 #elif IS_2G_TAS_SUPPORT
1548void L1I_AssignTASParameters( TASPublicParams* public ); //L1C->L1D
1549 #else
1550 #endif
1551uint16 L1D_TAS_NVRAM_LID_QUERY(void); //L1D->L1C
1552bool L1_CheckSimMode(l1c_sim_mode_enum local_sim_mode); //L1C->L1D
1553 #if IS_2G_TAS_INHERIT_4G_ANT
1554bool L1I_QueryInheritAntennaFromLteBand(kal_uint8 g_band,kal_uint8* l_band); //L1C->L1D
1555 #endif
1556#endif
1557
1558#if defined(__MD93__)
1559#if IS_2G_RXD_SUPPORT
1560AntennaStatus L1I_QueryAntennaStatus( FrequencyBand band, l1c_sim_mode_enum local_sim_mode, uint8 *rxd_mode);
1561#elif IS_2G_TAS_SUPPORT
1562AntennaStatus L1I_QueryAntennaStatus( FrequencyBand band, l1c_sim_mode_enum local_sim_mode);
1563#endif /*IS_2G_RXD_SUPPORT*/
1564#endif /* __MD93__*/
1565
1566#if IS_2G_RXD_SUPPORT
1567void L1I_AssignRASParameters( RASPublicParams* public ); /* for l1d to assign RAS public parameter from NVRAM */
1568#endif
1569
1570#if IS_2G_DYNAMIC_HW_CLOCK_SUPPORT
1571void L1I_AssignParameters_HW_CLOCK( L1D_RF_INTERFERENCE_ARFCN_INDICATION_T* HWClockParams );
1572#endif
1573
1574void L1D_CheckAllGl1dActDone( Report *report, L1D_APIcaller_id caller );
1575
1576#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
1577uint8 L1D_Apply_Frequent_Wakeup(void);
1578#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
1579
1580#if IS_FAST_TIMING_ADJUST_SUPPORT
1581void L1I_Set_TCh_timing_adjustment(l1c_sim_mode_enum local_sim_mode, int16 timing_adj);
1582#endif
1583
1584/****************************************************************************
1585 FUNCTION NAME: GL1_FLIGHT_MODE_SWITCH
1586
1587 DESCRIPTION: GL1 PERF recovery API
1588
1589 PARAMETERS: None
1590
1591 RETURNED VALUES: None
1592
1593*****************************************************************************/
1594#define GL1_ASSERT_Reboot( st ) if(!(st)) ASSERT( 0 )
1595
1596#ifdef __MTK_TARGET__
1597#define GL1_WARNING(expr) MODEM_WARNING_MESSAGE( expr )
1598
1599#if defined(__GL1_GEMINI__)
1600#define GL1_FLIGHT_MODE_SWITCH \
1601{ \
1602 protocol_exception_recovery_info_struct info; \
1603 info.protocol_id = l1c_sim_mode; \
1604 info.disable_escalate_recovery = KAL_TRUE; \
1605 info.debug.p_buf = NULL; \
1606 info.debug.size = 0; \
1607 PROTOCOL_EXCEPTION_RECOVERY( MOD_L1, RECOVERY_TYPE_FLIGHT_MODE, &info );\
1608}
1609#else
1610#define GL1_FLIGHT_MODE_SWITCH \
1611{ \
1612 protocol_exception_recovery_info_struct info; \
1613 info.protocol_id = 0; \
1614 info.disable_escalate_recovery = KAL_TRUE; \
1615 info.debug.p_buf = NULL; \
1616 info.debug.size = 0; \
1617 PROTOCOL_EXCEPTION_RECOVERY( MOD_L1, RECOVERY_TYPE_FLIGHT_MODE, &info );\
1618}
1619#endif /* End of defined(__GL1_GEMINI__)*/
1620#else /* XlSIM*/
1621#define GL1_WARNING(expr) GL1_ASSERT_Reboot( expr )
1622#define GL1_FLIGHT_MODE_SWITCH (void)0
1623#endif /* __MTK_TARGET__ */
1624
1625#endif /*l1_generic_l1_public_h*/