FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/bsp/timer1.c @ 305:4dccc9d3305f
gsm-fw: checking in DAR from Leonardo source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 16 Mar 2014 05:48:58 +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 : timer1.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 : Set of useful functions for TIMER module test cases |
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.4 |
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 : 08/18/00 14:42:35 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 Previous delta : 06/30/00 11:40:43 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 SCCS file : /db/gsm_asp/db_ht96/dsp_0/gsw/rel_0/mcu_l1/release_gprs/RELEASE_GPRS/drivers1/common/SCCS/s.timer1.c |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 Sccs Id (SID) : '@(#) timer1.c 1.4 08/18/00 14:42:35 ' |
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 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 #include "../include/sys_types.h" |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 #include "mem.h" |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 #include "timer1.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 /* Dtimer1_Get_cntlreg() */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 /* Parameters : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 /* Return : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 /* Functionality : read one of the TIMER register */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 /*--------------------------------------------------------------*/ |
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 Dtimer1_Get_cntlreg(void) |
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 timerReg = (( * (volatile SYS_UWORD16 *) D_TIMER_CNTL) & D_TIMER_CNTL_MASK); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 return(timerReg); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 } |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 /* Dtimer_Init_cntl() */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 /* Parameters :start/stop,reload yes/no,pre scale,ext clk on/off*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 /* Return : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 /* Functionality : initialize the timer start, autoreload, Ptv */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 /* and clock enable */ |
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 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 void Dtimer1_Init_cntl (SYS_UWORD16 St, SYS_UWORD16 Reload, SYS_UWORD16 clockScale, SYS_UWORD16 clkon) |
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 SYS_UWORD16 cntl = * (volatile SYS_UWORD16 *) D_TIMER_CNTL; |
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 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 cntl &= ~(D_TIMER_ST | D_TIMER_PTV); /* stop and reset values */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 (Reload) ? (cntl |= D_TIMER_AR) : (cntl &= ~D_TIMER_AR); |
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 cntl |= (clockScale << 2 ); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 cntl |= ( clkon << 5 ); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 |
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 * (volatile SYS_UWORD16 *) D_TIMER_LOAD = St; |
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 * (volatile SYS_UWORD16 *) D_TIMER_CNTL = 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 |
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 /* Dtimer1_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 /* Parameters :start/stop,reload yes/no,pre scale,ext clk on/off*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 /* Return : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 /* Functionality : set the AR bit Ar = 0 | 1 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 /*--------------------------------------------------------------*/ |
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 void Dtimer1_AR(SYS_UWORD16 Ar) |
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 SYS_UWORD16 cntl = * (volatile SYS_UWORD16 *) D_TIMER_CNTL; |
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 &= ~(D_TIMER_ST); /* stop the timer */ |
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 &= ~(D_TIMER_AR); |
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 cntl |= ( Ar << 1 ); |
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 * (volatile SYS_UWORD16 *) D_TIMER_CNTL = cntl; |
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 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 /* Dtimer1_PTV() */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 /* Parameters : pre scale */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 /* Return : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 /* Functionality : set the Ptv bits Ptv = 0 => 7 */ |
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 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 void Dtimer1_PTV(SYS_UWORD16 Ptv) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 SYS_UWORD16 cntl = * (volatile SYS_UWORD16 *) D_TIMER_CNTL; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 cntl &= ~(D_TIMER_ST); /* stop the timer */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 cntl &= ~(D_TIMER_PTV); /* Ptv[4:0] set to 0 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 cntl |= ( Ptv << 2 ); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 * (volatile SYS_UWORD16 *) D_TIMER_CNTL = cntl; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 } |
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 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 /* Dtimer1_Clken() */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 /* Parameters : ext clk on/off */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 /* Return : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 /* Functionality : set the clock_enable bit En = 0 | 1 */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 /*--------------------------------------------------------------*/ |
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 void Dtimer1_Clken(SYS_UWORD16 En) |
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 SYS_UWORD16 cntl = * (volatile SYS_UWORD16 *) D_TIMER_CNTL; |
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 cntl &= ( ~D_TIMER_CLK_EN); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 cntl |= ( En << 5 ); |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 * (volatile SYS_UWORD16 *) D_TIMER_CNTL = cntl; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 } |
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 |
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 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 /* Dtimer_Start() */ |
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 /* Parameters : on/off */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 /* Return : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 /* Functionality : Start or stop the timer */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 /*--------------------------------------------------------------*/ |
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 void Dtimer1_Start (SYS_UWORD16 startStop) |
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 (startStop == D_TIMER_ST) ? |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 ((* (SYS_UWORD16 *) D_TIMER_CNTL) |= D_TIMER_ST) : /* condition vrai */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 ((* (SYS_UWORD16 *) D_TIMER_CNTL) &= ~D_TIMER_ST); /* condition fausse */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 } |
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 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 /* Dtimer_ReadValue() */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 /* Parameters : on/off */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 /* Return : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 /* Functionality : Read timer value */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 SYS_UWORD16 Dtimer1_ReadValue (void) |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 { |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 return(* (SYS_UWORD16 *) D_TIMER_READ); |
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 |
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 /* Parameters : on/off */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 /* Return : none */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 /* Functionality : Write timer value */ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 /*--------------------------------------------------------------*/ |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 void Dtimer1_WriteValue (SYS_UWORD16 value) |
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 (* (SYS_UWORD16 *) D_TIMER_LOAD) = value; |
17b0511b243c
nuc-fw: continuing lowest-level BSP integration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 } |