comparison src/g23m-gprs/cci/cci_gea_start.c @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : cci_gea_start.c
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This module implements local functions for service FBS of
18 | entity CCI.
19 +-----------------------------------------------------------------------------
20 */
21
22 #define CCI_GEA_START_C
23
24 #ifndef CCI_THREAD
25 #define ENTITY_LLC
26 #else
27 #define ENTITY_CCI
28 #endif
29
30
31 /*==== INCLUDES =============================================================*/
32
33 #include "typedefs.h" /* to get Condat data types */
34 #include "vsi.h" /* to get a lot of macros */
35 #include "macdef.h"
36 #include "gprs.h"
37 #include "gsm.h" /* to get a lot of macros */
38 #include "cnf_llc.h" /* to get cnf-definitions */
39 #include "mon_llc.h" /* to get mon-definitions */
40 #include "prim.h" /* to get the definitions of used SAP and directions */
41 #include "cci.h" /* to get the global entity definitions */
42 #ifndef CCI_THREAD
43 #include "llc.h" /* to get the global entity definitions */
44 #endif
45
46 #ifndef _SIMULATION_
47 #include "config/chipset.cfg"
48 #endif /* ifdef SIMULATION */
49
50
51 /*==== CONST ================================================================*/
52
53 /*==== LOCAL VARS ===========================================================*/
54
55 /*==== PRIVATE FUNCTIONS ====================================================*/
56
57 /*==== PUBLIC FUNCTIONS =====================================================*/
58
59
60 /*
61 +------------------------------------------------------------------------------
62 | Function : gea_start
63 +------------------------------------------------------------------------------
64 | Description : The function ....
65 |
66 | Parameters : void
67 |
68 +------------------------------------------------------------------------------
69 */
70
71
72 /* GEA work-around only affects Calypso+ chipset. */
73 #ifndef CCI_FLASH_ROM
74 /* Assembly routine gea_start() should be executed from the Internal RAM */
75 void gea_start(void){
76 #if (CHIPSET == 12) || (CHIPSET == 14)
77 /* Enable Timer1 clock */
78 *(volatile USHORT *) 0xfffe3800 |= 0x0020;
79
80 /* Save into the stack ARM registers r0 to r4 */
81 asm(" push {r0-r4}");
82
83 /* Load in r0 READ_TIMER1 address */
84 asm(" ldr r0, READ_TIMER1_ADDR");
85
86 /* Set bit START in GEA_CNTL register */
87 asm(" ldr r1, GEA_CNTL_ADDR");
88 asm(" mov r4,#4");
89 asm(" ldrh r2, [r1]");
90 asm(" orr r2,r4");
91 asm(" strh r2,[r1]");
92
93 /* Load Timer1 in r3 in order to prevent DMA access on strobe0 during the
94 GEA clock switch. This reading of Timer1 generates around 13 cycles of
95 MCU clock activity on strobe1 and so guaranties that strobe0 will be
96 quiet during that time. */
97 asm(" ldrh r3,[r0]");
98
99 /* Restore ARM registers r0 to r4 from the stack */
100 asm(" pop {r0-r4}");
101
102 /* Branch to end of the function, to avoid that the 2 following constant
103 definitions are mistaken with code instructions. */
104 asm(" br $gea_end_func");
105
106 /* Must be defined inside the function body, else depending on the compiler
107 version, they are not inserted in the right section */
108 asm("READ_TIMER1_ADDR .long 0xFFFE3804");
109 asm("GEA_CNTL_ADDR .long 0xffffc000");
110
111 asm("$gea_end_func:");
112 }
113 #else
114 }
115 #endif /*(CHIPSET == 12)*/
116
117 #endif /* CCI_FLASH_ROM */
118