FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/bsp/timer.c @ 913:091ebd46a9cc
user-friendly set-rfcap implemented in fc-fsio
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Tue, 08 Sep 2015 08:55:21 +0000 |
parents | afceeeb2cba1 |
children |
rev | line source |
---|---|
114
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /******************************************************************************* |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 Property of Texas Instruments -- For Unrestricted Internal Use Only |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 Unauthorized reproduction and/or distribution is strictly prohibited. This |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 product is protected under copyright law and trade secret law as an |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 unpublished work. Created 1987, (C) Copyright 1997 Texas Instruments. All |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 rights reserved. |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 Filename : timer.c |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 Description : timer.c |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 Project : drivers |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 Author : pmonteil@tif.ti.com Patrice Monteil. |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 Version number : 1.3 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 Date and time : 07/23/98 16:25:32 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 Previous delta : 07/23/98 16:25:32 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
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 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 Sccs Id (SID) : '@(#) timer.c 1.3 07/23/98 16:25:32 ' |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 *****************************************************************************/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 #include "../include/sys_types.h" |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 #include "mem.h" |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 #include "iq.h" |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 #include "timer.h" |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 /*-------------------------------------------------------------- |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 * TIMER_Read() |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 *-------------------------------------------------------------- |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 * Parameters : num of the register to be read |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 * Return :value of the timer register read |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 * Functionality : read one of the TIMER register |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 *--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 SYS_UWORD16 TIMER_Read (unsigned short regNum) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 SYS_UWORD16 timerReg; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 switch (regNum) { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 case 0: |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 timerReg = ( * (volatile SYS_UWORD16 *) TIMER_CNTL_REG) & TIMER_CNTL_MASK; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 break; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 case 1: |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 timerReg = *(volatile SYS_UWORD16 *) TIMER_READ_REG; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 break; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 case 2: |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 timerReg = ( * (volatile SYS_UWORD16 *) TIMER_MODE_REG) & TIMER_MODE_MASK; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 break; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 default: |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 break; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 return(timerReg); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 /*-------------------------------------------------------------- |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 * TM_ResetTimer() |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 *-------------------------------------------------------------- |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 * Parameters : timer number (1 or 2) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 * timer value, reload yes or not, scale |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 * Return : none |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 * Functionality : Give the timewr state |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 *--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 void TM_ResetTimer (SYS_UWORD16 timerNum, SYS_UWORD16 countValue, |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 SYS_UWORD16 autoReload, SYS_UWORD16 clockScale) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 volatile SYS_UWORD16 *cntl; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 if (timerNum == 1) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 cntl = (volatile SYS_UWORD16 *) TIMER1_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 *cntl &= ~(START_STOP | PTV); /* stop and reset values */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 (autoReload) ? (*cntl |= AR) : (*cntl &= ~AR); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 *cntl |= (clockScale << 2 ); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 /*load the value */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 *(volatile SYS_UWORD16 *) TIMER1_LOAD_TIM = countValue; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 *cntl |= START_STOP; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 else |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 cntl = (volatile SYS_UWORD16 *) TIMER2_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 *cntl &= ~(START_STOP | PTV); /* stop and reset values */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 (autoReload) ? (*cntl |= AR) : (*cntl &= ~AR); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 *cntl |= (clockScale << 2 ); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 /*load the value */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 *(volatile SYS_UWORD16 *) TIMER2_LOAD_TIM = countValue; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 *cntl |= START_STOP; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 /* |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 * TM_StopTimer |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 * Parameters : timer number (1 or 2) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 void TM_StopTimer (int timerNum) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 volatile SYS_UWORD16 *cntl; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 if (timerNum == 1) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 cntl = (volatile SYS_UWORD16 *) TIMER1_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 else |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 cntl = (volatile SYS_UWORD16 *) TIMER2_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 *cntl &= ~START_STOP; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 /* |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 * TM_ReadTimer |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 * Returns current timer value |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 * Parameters : timer number (1 or 2) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 SYS_UWORD16 TM_ReadTimer (int timerNum) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 if (timerNum == 1) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 return (* (SYS_UWORD16 *) TIMER1_READ_TIM); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 else |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 return (* (SYS_UWORD16 *) TIMER2_READ_TIM); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 /* |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 * TM_StartTimer |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 * Parameters : timer number (1 or 2) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 void TM_StartTimer (int timerNum) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 volatile SYS_UWORD16 *cntl; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 if (timerNum == 1) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 cntl = (volatile SYS_UWORD16 *) TIMER1_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 else |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 cntl = (volatile SYS_UWORD16 *) TIMER2_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 *cntl |= START_STOP; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 void TM_DisableWatchdog (void) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 /* volatile variable needed due C to optimization */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 volatile SYS_UWORD16 *reg = (volatile SYS_UWORD16 *) TIMER_MODE_REG; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 *reg = 0xf5; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 *reg = 0xa0; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 /* |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 * TM_EnableWatchdog |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 void TM_EnableWatchdog(void) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 * ((volatile SYS_UWORD16 *) TIMER_MODE_REG) = TIMER_WDOG; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
190 /* |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 * TM_ResetWatchdog |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
192 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 * Parameter : Tick count |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
194 * Use a different value each time, otherwise watchdog bites |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
195 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 void TM_ResetWatchdog(SYS_UWORD16 count) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 * ((volatile SYS_UWORD16 *) TIMER_LOAD_REG) = count; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 /* |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 * TM_EnableTimer (int TimerNum) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 * Parameter : TimerNum : timer to enable (timer1 or timer2) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 void TM_EnableTimer (int TimerNum) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 volatile SYS_UWORD16 *cntl; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 if (TimerNum == 1) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 cntl = (volatile SYS_UWORD16 *) TIMER1_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 else |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 cntl = (volatile SYS_UWORD16 *) TIMER2_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 *cntl |= TIMER_CLK_EN; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 /* |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 * TM_DisableTimer (int TimerNum) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 * Parameter : TimerNum : timer to enable (timer1 or timer2) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 * |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
228 void TM_DisableTimer (int TimerNum) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
229 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 volatile SYS_UWORD16 *cntl; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 if (TimerNum == 1) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 cntl = (volatile SYS_UWORD16 *) TIMER1_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 else |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 cntl = (volatile SYS_UWORD16 *) TIMER2_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 *cntl &= ~TIMER_CLK_EN; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 /*-------------------------------------------------------------- |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 * TIMER_ReadValue() |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 *-------------------------------------------------------------- |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 * Parameters : none |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 * Return : none |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 * Functionality : Read timer value |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 *--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 unsigned short TIMER_ReadValue (void) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 return(* (SYS_UWORD16 *) TIMER_READ_REG); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 /*-------------------------------------------------------------- |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 * TIMER_WriteValue() |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 *-------------------------------------------------------------- |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 * Parameters : none |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 * Return : none |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 * Functionality : Write timer value |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 *--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
263 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 void TIMER_WriteValue (SYS_UWORD16 value) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
266 * (SYS_UWORD16 *) TIMER_LOAD_REG = value; /*load the value */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
267 } |