comparison chipsetsw/drivers/drv_core/timer/timer_sec.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*******************************************************************************
2 TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
3
4 Property of Texas Instruments -- For Unrestricted Internal Use Only
5 Unauthorized reproduction and/or distribution is strictly prohibited. This
6 product is protected under copyright law and trade secret law as an
7 unpublished work. Created 1987, (C) Copyright 1997 Texas Instruments. All
8 rights reserved.
9
10
11 Filename : timer_sec.c
12
13 Description : timer_sec.c
14
15 Project : drivers
16
17 Author : pmonteil@tif.ti.com Patrice Monteil.
18
19 Version number : 1.3
20
21 Date and time : 07/23/98 16:25:32
22 Previous delta : 07/23/98 16:25:32
23
24 SCCS file : /db/gsm_asp/db_ht96/dsp_0/gsw/rel_0/mcu_l1/release1.5/mod/emu/EMU_MCMP/eva3_drivers/source/SCCS/s.timer.c
25
26 Sccs Id (SID) : '@(#) timer.c 1.3 07/23/98 16:25:32 '
27
28
29 *****************************************************************************/
30
31 #include "l1sw.cfg"
32 #include "chipset.cfg"
33
34 #if (CHIPSET == 12)
35
36 #if (OP_L1_STANDALONE == 0)
37 #include "main/sys_types.h"
38 #else
39 #include "sys_types.h"
40 #endif
41 #include "memif/mem.h"
42 #include "inth/iq.h"
43 #include "timer.h"
44 #include "timer_sec.h"
45
46
47 /*--------------------------------------------------------------*/
48 /* TIMER_Read() */
49 /*--------------------------------------------------------------*/
50 /* Parameters : num of the register to be read */
51 /* Return :value of the timer register read */
52 /* Functionality : read one of the TIMER Secure register */
53 /*--------------------------------------------------------------*/
54
55 SYS_UWORD16 TIMER_SEC_Read (SYS_UWORD16 regNum)
56 {
57 volatile SYS_UWORD16 timerReg;
58
59 switch (regNum) {
60 case 0:
61 timerReg = (( * (SYS_UWORD16 *) TIMER_SEC_CNTL_REG) & TIMER_CNTL_MASK);
62 break;
63 case 1:
64 timerReg = ( * (SYS_UWORD16 *) TIMER_SEC_READ_REG);
65 break;
66 case 2:
67 timerReg = (( * (SYS_UWORD16 *) TIMER_SEC_MODE_REG) & TIMER_MODE_MASK);
68 break;
69 default:
70 break;
71 }
72 return(timerReg);
73 }
74
75
76 void TM_SEC_DisableWatchdog (void)
77 {
78 /* volatile variable needed due C to optimization */
79 volatile SYS_UWORD16 *reg = (volatile SYS_UWORD16 *) TIMER_SEC_MODE_REG;
80
81 * reg = 0xf5;
82 * reg = 0xa0;
83 }
84
85
86 /*
87 * TM_SEC_EnableWatchdog
88 *
89 */
90 void TM_SEC_EnableWatchdog(void)
91 {
92 * ((volatile SYS_UWORD16 *) TIMER_SEC_MODE_REG) = TIMER_WDOG;
93 }
94
95 /*
96 * TM_SEC_ResetWatchdog
97 *
98 * Parameter : Tick count
99 * Use a different value each time, otherwise watchdog bites
100 */
101 void TM_SEC_ResetWatchdog(SYS_UWORD16 count)
102 {
103 * ((volatile SYS_UWORD16 *) TIMER_SEC_LOAD_REG) = count;
104 }
105
106
107 /*--------------------------------------------------------------*/
108 /* TIMER_SEC_ReadValue() */
109 /*--------------------------------------------------------------*/
110 /* Parameters : none */
111 /* Return : none */
112 /* Functionality : Read timer value */
113 /*--------------------------------------------------------------*/
114
115 SYS_UWORD16 TIMER_SEC_ReadValue (void)
116 {
117 return(* (SYS_UWORD16 *) TIMER_SEC_READ_REG);
118
119 }
120
121 /*--------------------------------------------------------------*/
122 /* TIMER_SEC_WriteValue() */
123 /*--------------------------------------------------------------*/
124 /* Parameters : none */
125 /* Return : none */
126 /* Functionality : Write timer value */
127 /*--------------------------------------------------------------*/
128
129 SYS_UWORD16 TIMER_SEC_WriteValue (SYS_UWORD16 value)
130 {
131 * (SYS_UWORD16 *) TIMER_SEC_LOAD_REG = value; /*load the value */
132
133 }
134
135 #endif /* CHIPSET == 12 */
136