annotate chipsetsw/layer1/tpu_drivers/source/tpudrv.c @ 332:00332897676c

l1p_sync.c: l1pddsp_meas_read() fixed
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 29 Oct 2017 08:16:17 +0000
parents c933041d07bd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
187
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1 /************* Revision Controle System Header *************
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
2 * GSM Layer 1 software
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
3 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
4 * Filename tpudrv.c
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
5 * Copyright 2003 (C) Texas Instruments
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
6 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
7 ************* Revision Controle System Header *************/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
8 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
9 * TPUDRV.C
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
10 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
11 * TPU driver for Pole Star
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
12 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
13 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
14 * Copyright (c) Texas Instruments 1996
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
15 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
16 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
17
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
18 #include "l1_macro.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
19 #include "iq.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
20 #include "l1_confg.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
21 #include "l1_const.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
22 #include "l1_types.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
23
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
24 #if (AUDIO_TASK == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
25 #include "l1audio_const.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
26 #include "l1audio_cust.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
27 #include "l1audio_defty.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
28 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
29
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
30 #if (L1_GTT == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
31 #include "l1gtt_const.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
32 #include "l1gtt_defty.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
33 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
34
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
35 #if (L1_MIDI == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
36 #include "l1midi_defty.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
37 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
38
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
39 #include "sys_types.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
40
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
41 #if TESTMODE
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
42 #include "l1tm_defty.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
43 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
44
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
45 #if (L1_MP3 == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
46 #include "l1mp3_defty.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
47 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
48
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
49 #if (L1_MIDI == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
50 #include "l1midi_defty.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
51 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
52
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
53 #if (L1_AAC == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
54 #include "l1aac_defty.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
55 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
56 #include "l1_defty.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
57 #include "tpudrv.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
58 #include "sys_types.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
59 #include "clkm.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
60 #include "l1_time.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
61 #include "l1_varex.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
62 #include "l1_trace.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
63
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
64 #if (L1_MADC_ON == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
65 #if (RF_FAM == 61)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
66 #include "drp_api.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
67 #include "l1_rf61.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
68 #include "drp_drive.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
69 #include "tpudrv61.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
70 extern T_DRP_REGS_STR *drp_regs;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
71 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
72 #endif //L1_MADC_ON
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
73
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
74 /* RFTime environment */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
75 #if defined (HOST_TEST)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
76 #include "hostmacros.h"
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
77 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
78
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
79
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
80 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
81 * VEGA and OMEGA receive windows - Defined in Customer-specific file
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
82 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
83
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
84 extern UWORD32 debug_tpu;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
85
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
86 #if ( OP_WCP == 1 ) && ( OP_L1_STANDALONE != 1 )
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
87 // WCS Patch : ADC during RX or TX
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
88 extern inline void GC_SetAdcInfo(unsigned char bTxBasedAdc);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
89 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
90
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
91 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
92 * Global Variables
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
93 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
94 // GSM1.5 : TPU MEMORY is 16-bit instead of 32 in Gemini/Polxx
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
95 //------------------------------------------------------------
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
96 SYS_UWORD16 *TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
97
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
98
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
99 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
100 /* TPU_Reset : Reset the TPU */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
101 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
102 /* Parameters : on/off(1/0) */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
103 /* Return : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
104 /* Functionality : ) Reset the TPU */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
105 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
106 void TPU_Reset(SYS_UWORD16 on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
107 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
108 if (on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
109 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
110 * ((volatile SYS_UWORD16 *) TPU_CTRL) |= TPU_CTRL_RESET;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
111 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
112 while (!((*(volatile SYS_UWORD16 *) TPU_CTRL) & TPU_CTRL_RESET));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
113 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
114 else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
115 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
116 * ((volatile SYS_UWORD16 *) TPU_CTRL) &= ~TPU_CTRL_RESET;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
117 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
118 while (((*(volatile SYS_UWORD16 *) TPU_CTRL) & TPU_CTRL_RESET));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
119 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
120 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
121
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
122 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
123 /* TSP_Reset : Reset the TSP */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
124 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
125 /* Parameters : on/off(1/0) */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
126 /* Return : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
127 /* Functionality : ) Reset the TSP */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
128 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
129 void TSP_Reset(SYS_UWORD16 on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
130 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
131 if (on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
132 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
133 * ((volatile SYS_UWORD16 *) TPU_CTRL) |= TSP_CTRL_RESET;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
134 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
135 while (!((*(volatile SYS_UWORD16 *) TPU_CTRL) & TSP_CTRL_RESET));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
136 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
137 else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
138 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
139 * ((volatile SYS_UWORD16 *) TPU_CTRL) &= ~TSP_CTRL_RESET;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
140 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
141 while (((*(volatile SYS_UWORD16 *) TPU_CTRL) & TSP_CTRL_RESET));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
142 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
143 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
144
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
145 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
146 /* TPU_SPIReset : Reset the SPI of the TPU */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
147 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
148 /* Parameters : on/off(1/0) */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
149 /* Return : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
150 /* Functionality : ) the SPI of the TPU */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
151 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
152
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
153 void TPU_SPIReset(SYS_UWORD16 on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
154 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
155 if (on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
156 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
157 * ((volatile SYS_UWORD16 *) TPU_CTRL) |= TPU_CTRL_SPI_RST;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
158 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
159 while (!((*(volatile SYS_UWORD16 *) TPU_CTRL) & TPU_CTRL_SPI_RST));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
160 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
161 else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
162 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
163 * ((volatile SYS_UWORD16 *) TPU_CTRL) &= ~TPU_CTRL_SPI_RST;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
164 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
165 while (((*(volatile SYS_UWORD16 *) TPU_CTRL) & TPU_CTRL_SPI_RST));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
166 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
167 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
168
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
169 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
170 /* TPU_ClkEnable : */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
171 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
172 /* Parameters : on/off(1/0) */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
173 /* Return : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
174 /* Functionality : Enable the TPU clock */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
175 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
176
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
177 void TPU_ClkEnable(SYS_UWORD16 on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
178 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
179 if (on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
180 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
181 * ((volatile SYS_UWORD16 *) TPU_CTRL) |= TPU_CTRL_CLK_EN;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
182 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
183 while (!((*(volatile SYS_UWORD16 *) TPU_CTRL) & TPU_CTRL_CLK_EN));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
184 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
185 else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
186 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
187 * ((volatile SYS_UWORD16 *) TPU_CTRL) &= ~TPU_CTRL_CLK_EN;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
188 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
189 while (((*(volatile SYS_UWORD16 *) TPU_CTRL) & TPU_CTRL_CLK_EN));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
190 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
191 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
192
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
193 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
194 /* TPU_Frame_ItOn : */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
195 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
196 /* Parameters : bit of it to enable */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
197 /* Return : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
198 /* Functionality : Enable frame it */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
199 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
200
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
201 /*-----------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
202 /* Warning read modify write access to TPU_INT_CTRL register */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
203 /* may generate problems using Hyperion. */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
204 /*-----------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
205
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
206 void TPU_FrameItOn(SYS_UWORD16 it)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
207 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
208 * ((volatile SYS_UWORD16 *) TPU_INT_CTRL) &= ~it;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
209 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
210
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
211 void TPU_FrameItEnable(void)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
212 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
213 #if W_A_ITFORCE
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
214 (*(volatile SYS_UWORD16 *)TPU_INT_CTRL) |= TPU_INT_ITD_F;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
215 #else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
216 // enable IT_DSP generation on next frame
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
217 // reset by DSP when IT occurs
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
218 (*(volatile SYS_UWORD16 *) TPU_CTRL) |= TPU_CTRL_D_ENBL;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
219 // WA for read/modify/write access problem with REG_TPU_CTRL present on Ulysse/Samson/Calypso
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
220 while (!((*(volatile SYS_UWORD16 *) TPU_CTRL) & TPU_CTRL_D_ENBL));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
221 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
222 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
223
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
224 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
225 /* TPU_check_IT_DSP : */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
226 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
227 /* Parameters : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
228 /* Return : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
229 /* Functionality : check if an IT DSP still pending */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
230 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
231 BOOL TPU_check_IT_DSP(void)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
232 { // return TRUE if an IT DSP still pending.
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
233 return( (((*(volatile SYS_UWORD16 *) TPU_CTRL) & TPU_CTRL_D_ENBL) == TPU_CTRL_D_ENBL));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
234 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
235
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
236 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
237 /* TPU_DisableAllIt : */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
238 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
239 /* Parameters : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
240 /* Return : none */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
241 /* Functionality : Disabl all it */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
242 /*--------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
243 void TPU_DisableAllIt()
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
244 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
245 * ((volatile SYS_UWORD16 *) TPU_INT_CTRL) |= TPU_INT_ITF_M | TPU_INT_ITP_M | TPU_INT_ITD_M;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
246
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
247 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
248
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
249
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
250 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
251 * TP_Program
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
252 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
253 * Write a null-terminated scenario into TPU memory at a given start address
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
254 * (Do not write terminating 0)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
255 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
256 */
189
8ab19f00e40d tpudrv.c: TP_Program() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
257 void TP_Program(const SYS_UWORD16 *src)
187
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
258 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
259 /* Write TPU instructions until SLEEP */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
260 while (*src)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
261 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
262 *TP_Ptr++ = *src++;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
263 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
264 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
265
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
266
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
267 void TP_Reset(SYS_UWORD16 on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
268 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
269 if (on) {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
270 * ((volatile SYS_UWORD16 *) TPU_CTRL) |= (TPU_CTRL_RESET | TSP_CTRL_RESET);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
271 while (!((*(volatile SYS_UWORD16 *) TPU_CTRL) & (TPU_CTRL_RESET | TSP_CTRL_RESET)));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
272 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
273 else {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
274 * ((volatile SYS_UWORD16 *) TPU_CTRL) &= ~(TPU_CTRL_RESET | TSP_CTRL_RESET);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
275 while (((*(volatile SYS_UWORD16 *) TPU_CTRL) & (TPU_CTRL_RESET | TSP_CTRL_RESET)));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
276 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
277 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
278
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
279 void TP_Enable(SYS_UWORD16 on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
280 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
281 if(on)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
282 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
283 * ((volatile SYS_UWORD16 *) TPU_CTRL) |= TPU_CTRL_T_ENBL;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
284
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
285 // Some time shall be wait before leaving the function to ensure that bit has been taken
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
286 // in account by the TPU. A while loop such as in function TP_reset can't be used as the
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
287 // ARM can be interrupted within this loop and in that case the pulse will be missed (CQ20781).
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
288 // The bit is updated in the worst case 24 cycles of 13MHz later it as been written by the MCU.
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
289 // 24 ticks of 13MHz = 1.84us. Lets take 3us to keep some margin.
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
290 wait_ARM_cycles(convert_nanosec_to_cycles(3000)); // wait 3us
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
291 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
292 else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
293 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
294 * ((volatile SYS_UWORD16 *) TPU_CTRL) &= ~TPU_CTRL_T_ENBL;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
295 // Some time shall be wait before leaving the function to ensure that bit has been taken
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
296 // in account by the TPU. A while loop such as in function TP_reset can't be used as the
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
297 // ARM can be interrupted within this loop and in that case the pulse will be missed (CQ20781).
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
298 // The bit is updated in the worst case 24 cycles of 13MHz later it as been written by the MCU.
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
299 // 24 ticks of 13MHz = 1.84us. Lets take 3us to keep some margin.
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
300 wait_ARM_cycles(convert_nanosec_to_cycles(3000)); // wait 3us
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
301 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
302 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
303
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
304
188
81064b792cc8 tpudrv.c: passes compilation, started disasm diffing
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
305 #if 0 /* FreeCalypso: function not present in TCS211 */
187
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
306 /*-----------------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
307 /* Function name: TPU_wait_idle */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
308 /*-----------------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
309 /* */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
310 /* Parameters: None */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
311 /* */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
312 /* Return: None */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
313 /* */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
314 /*-----------------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
315 /* Description: Wait until TPU scenario execution is complete */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
316 /* */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
317 /*-----------------------------------------------------------------------*/
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
318 void TPU_wait_idle(void)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
319 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
320 while( ((*(volatile SYS_UWORD16 *) (TPU_CTRL)) & TPU_CTRL_TPU_IDLE) == TPU_CTRL_TPU_IDLE)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
321 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
322 wait_ARM_cycles(convert_nanosec_to_cycles(3000));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
323 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
324 }
188
81064b792cc8 tpudrv.c: passes compilation, started disasm diffing
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
325 #endif
187
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
326
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
327
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
328 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
329 * l1dmacro_idle
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
330 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
331 * Write SLEEP instruction, start TPU and reset pointer
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
332 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
333 void l1dmacro_idle (void)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
334 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
335 *TP_Ptr++ = TPU_SLEEP;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
336
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
337 /* start TPU */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
338 TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
339 TP_Enable(1);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
340 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
341
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
342 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
343 * l1dmacro_offset
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
344 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
345 * Set OFFSET register
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
346 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
347 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
348 void l1dmacro_offset (UWORD32 offset_value, WORD32 relative_time)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
349 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
350 // WARNING: 'relative time' and 'offset_value' must always be comprised
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
351 // between 0 and TPU_CLOCK_RANGE !!!
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
352
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
353 if (relative_time != IMM) // IMM indicates to set directly without AT
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
354 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
355 *TP_Ptr++ = TPU_FAT(relative_time);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
356 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
357 *TP_Ptr++ = TPU_OFFSET(offset_value);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
358 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
359
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
360 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
361 * l1dmacro_synchro
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
362 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
363 * Set synchro register
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
364 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
365 void l1dmacro_synchro (UWORD32 when, UWORD32 value)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
366 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
367 // WARNING: 'when' must always be comprised between 0 and TPU_CLOCK_RANGE !!!
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
368 #if (TRACE_TYPE!=0) && (TRACE_TYPE!=5)
190
c933041d07bd tpudrv.c fully reconstructed, matches TCS211 object
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
369 trace_fct(CST_L1DMACRO_SYNCHRO, -1);
187
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
370 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
371
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
372 if (value != IMM) // IMM indicates to set directly without AT
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
373 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
374 *TP_Ptr++ = TPU_FAT(when);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
375 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
376
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
377 *TP_Ptr++ = TPU_SYNC(value);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
378 l1s.tpu_offset_hw = value; // memorize the offset set into the TPU.
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
379 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
380
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
381
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
382 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
383 * l1dmacro_adc_read
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
384 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
385 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
386 void l1dmacro_adc_read_rx(void)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
387 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
388
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
389 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
390 // TSP needs to be configured in order to send serially to Omega
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
391
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
392 // *TP_Ptr++ = TPU_MOVE (TSP_SPI_SET1, TSP_CLK_RISE); // Clock configuration
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
393 *TP_Ptr++ = TPU_WAIT (5);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
394 *TP_Ptr++ = TPU_MOVE (TSP_CTRL1,6); // Device and Nb of bits configuration
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
395 *TP_Ptr++ = TPU_MOVE (TSP_TX_REG_1,STARTADC); // Load data to send
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
396 *TP_Ptr++ = TPU_MOVE (TSP_CTRL2, TC2_WR); // Start serialization command and adc conversion
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
397 *TP_Ptr++ = TPU_WAIT (5);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
398 *TP_Ptr++ = TPU_MOVE (TSP_TX_REG_1,0x00);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
399 *TP_Ptr++ = TPU_MOVE (TSP_CTRL2, TC2_WR); // Reset startadc pulse
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
400
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
401 #if (TRACE_TYPE==1)||(TRACE_TYPE ==4)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
402 #if (GSM_IDLE_RAM == 0)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
403 l1_trace_ADC(0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
404 #else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
405 l1_trace_ADC_intram(0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
406 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
407 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
408 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
409
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
410 #if (L1_MADC_ON == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
411 #if (ANLG_FAM == 11)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
412
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
413 #if (TRACE_TYPE==1)||(TRACE_TYPE ==4)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
414 #if (GSM_IDLE_RAM == 0)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
415 l1_trace_ADC(0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
416 #else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
417 l1_trace_ADC_intram(0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
418 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
419 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
420 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
421
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
422 #if (OP_WCP == 1) && (OP_L1_STANDALONE != 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
423 // WCS patch: ADC during RX
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
424 GC_SetAdcInfo(0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
425 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
426 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
427 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
428
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
429
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
430 #if (CODE_VERSION != SIMULATION)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
431 #if (L1_MADC_ON ==1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
432 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
433 * l1dmacro_adc_read_rx_cs_mode0
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
434 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
435 * Purpose:
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
436 * ======
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
437 * MADC is not enabled during CS_MODE0 periodically. MADC is enabled in CS_MODE0
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
438 * when Layer 1 receives MPHC_RXLEV_REQ from L23. However in CS_MODE0, MPHC_RXLEV_REQ
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
439 * is not received periodically. In case network is not found, the period between 2 MPHC_RXLEV_REQ
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
440 * increases and can be as high as 360 seconds (Maximum Value)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
441 * This can result in battery related issues like phone powering off without MMI indication.
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
442 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
443
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
444
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
445 void l1dmacro_adc_read_rx_cs_mode0(void)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
446 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
447 *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_U,START_ADC);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
448 *TP_Ptr++ = TPU_WAIT (2);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
449 *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_U,0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
450
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
451 #if (L1_MADC_ON == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
452 #if (ANLG_FAM == 11)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
453
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
454 #if (TRACE_TYPE==1)||(TRACE_TYPE ==4)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
455 #if (GSM_IDLE_RAM == 0)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
456 l1_trace_ADC(0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
457 #else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
458 l1_trace_ADC_intram(0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
459 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
460 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
461 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
462
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
463 #if (OP_WCP == 1) && (OP_L1_STANDALONE != 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
464 // WCS patch: ADC during RX
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
465 GC_SetAdcInfo(0);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
466 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
467 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
468 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
469
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
470
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
471 #endif //If MADC is enabled
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
472 #endif //If Not Simulation
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
473
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
474 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
475 * l1dmacro_adc_read_tx
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
476 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
477 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
478
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
479
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
480 #if (ANLG_FAM != 11)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
481 void l1dmacro_adc_read_tx(UWORD32 when)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
482 #else
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
483 void l1dmacro_adc_read_tx(UWORD32 when, UWORD8 tx_up_state)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
484 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
485 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
486
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
487 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
488
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
489 *TP_Ptr++ = TPU_FAT (when);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
490 *TP_Ptr++ = TPU_MOVE (TSP_CTRL1,6); // Device and Nb of bits configuration
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
491 *TP_Ptr++ = TPU_MOVE (TSP_TX_REG_1, STARTADC|BULON|BULENA); // Load data to send
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
492 *TP_Ptr++ = TPU_MOVE (TSP_CTRL2, TC2_WR); // Start serialization command and adc conversion
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
493 *TP_Ptr++ = TPU_WAIT (5);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
494 *TP_Ptr++ = TPU_MOVE (TSP_TX_REG_1, BULON|BULENA);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
495 *TP_Ptr++ = TPU_MOVE (TSP_CTRL2, TC2_WR); // Reset startadc pulse
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
496
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
497 #if (TRACE_TYPE==1)||(TRACE_TYPE ==4)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
498 l1_trace_ADC(1);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
499 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
500 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
501
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
502 #if (L1_MADC_ON == 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
503 #if (ANLG_FAM == 11)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
504 *TP_Ptr++ = TPU_FAT (when);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
505 *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_U,tx_up_state | START_ADC);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
506 *TP_Ptr++ = TPU_WAIT (2);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
507 *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_U,tx_up_state);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
508
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
509 #if 1 // TEMP MEASUREMENT - uncomment and test after MADC
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
510 #if (RF_FAM == 61)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
511 *TP_Ptr++ = TPU_MOVE(OCP_DATA_MSB, ((START_SCRIPT(DRP_TEMP_CONV))>>8) & 0xFF); \
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
512 *TP_Ptr++ = TPU_MOVE(OCP_DATA_LSB, (START_SCRIPT(DRP_TEMP_CONV)) & 0xFF); \
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
513 *TP_Ptr++ = TPU_MOVE(OCP_ADDRESS_MSB, (((UWORD16)( ((UWORD32)(&drp_regs->SCRIPT_STARTL))&0xFFFF)>>8) & 0xFF)); \
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
514 *TP_Ptr++ = TPU_MOVE(OCP_ADDRESS_LSB, ((UWORD16)( ((UWORD32)(&drp_regs->SCRIPT_STARTL))&0xFFFF)) & 0xFF); \
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
515 *TP_Ptr++ = TPU_MOVE(OCP_ADDRESS_START, 0x01); \
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
516 //TEMP_MEAS: Call TEMP Conv Script in DRP
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
517 //MOVE_REG_TSP_TO_RF(START_SCRIPT(DRP_TEMP_CONV),(UWORD16)(&drp_regs->SCRIPT_STARTL));
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
518 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
519
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
520 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
521
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
522 #if (TRACE_TYPE==1)||(TRACE_TYPE ==4)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
523 l1_trace_ADC(1);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
524 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
525
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
526 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
527 #endif //L1_MADC_ON
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
528
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
529 #if (OP_WCP == 1) && (OP_L1_STANDALONE != 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
530 // WCS patch: ADC during TX
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
531 GC_SetAdcInfo(1);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
532 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
533
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
534
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
535 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
536
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
537
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
538 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
539 #if (RF_FAM == 61)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
540
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
541 void l1dmacro_adc_read_tx(UWORD32 when, UWORD8 tx_up_state)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
542 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
543 int i;
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
544
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
545 *TP_Ptr++ = TPU_FAT (when);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
546 *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_U,tx_up_state | START_ADC);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
547 *TP_Ptr++ = TPU_WAIT (2);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
548 *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_U,tx_up_state);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
549
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
550 #if (TRACE_TYPE==1)||(TRACE_TYPE ==4)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
551 l1_trace_ADC(1);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
552 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
553
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
554
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
555 #if (OP_WCP == 1) && (OP_L1_STANDALONE != 1)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
556 // WCS patch: ADC during TX
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
557 GC_SetAdcInfo(1);
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
558 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
559 }
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
560
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
561 #endif
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
562 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
563
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
564 /*
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
565 * l1dmacro_set_frame_it
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
566 *
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
567 */
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
568 void l1dmacro_set_frame_it(void)
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
569 {
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
570 TPU_FrameItEnable();
7b2986d6f272 tpudrv.c: initial import of LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
571 }