LPCOpen Platform
v1.03
LPCOpen Platform for NXP LPC Microcontrollers
Main Page
Modules
Data Structures
Files
Related Pages
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
lpc17xx_40xx_systick_arch.c
Go to the documentation of this file.
1
/**********************************************************************
2
* @brief Setups up the LWIP timebase (tick)
3
*
4
* @note
5
* Copyright(C) NXP Semiconductors, 2012
6
* All rights reserved.
7
*
8
* @par
9
* Software that is described herein is for illustrative purposes only
10
* which provides customers with programming information regarding the
11
* LPC products. This software is supplied "AS IS" without any warranties of
12
* any kind, and NXP Semiconductors and its licensor disclaim any and
13
* all warranties, express or implied, including all implied warranties of
14
* merchantability, fitness for a particular purpose and non-infringement of
15
* intellectual property rights. NXP Semiconductors assumes no responsibility
16
* or liability for the use of the software, conveys no license or rights under any
17
* patent, copyright, mask work right, or any other intellectual property rights in
18
* or to any products. NXP Semiconductors reserves the right to make changes
19
* in the software without notification. NXP Semiconductors also makes no
20
* representation or warranty that such application will be suitable for the
21
* specified use without further testing or modification.
22
*
23
* @par
24
* Permission to use, copy, modify, and distribute this software and its
25
* documentation is hereby granted, under NXP Semiconductors' and its
26
* licensor's relevant copyrights in the software, without fee, provided that it
27
* is used in conjunction with NXP Semiconductors microcontrollers. This
28
* copyright, permission, and disclaimer notice must appear in all copies of
29
* this code.
30
*/
31
32
#include "lwip/opt.h"
33
34
#if NO_SYS == 1
35
36
#include "chip.h"
37
#include "
lpc_arch.h
"
38
43
/*****************************************************************************
44
* Private types/enumerations/variables
45
****************************************************************************/
46
47
/* Saved reference period foe standalone mode */
48
static
uint32_t
saved_period
;
49
50
/* Saved total time in mS since timer was enabled */
51
static
volatile
u32_t
systick_timems
;
52
53
/*****************************************************************************
54
* Public types/enumerations/variables
55
****************************************************************************/
56
57
/* Current system clock rate, mainly used for sysTick */
58
extern
uint32_t
SystemCoreClock
;
59
60
/*****************************************************************************
61
* Private functions
62
****************************************************************************/
63
64
/*****************************************************************************
65
* Public functions
66
****************************************************************************/
67
68
/* Enable LWIP tick and interrupt */
69
void
SysTick_Enable
(
uint32_t
period)
70
{
71
/* Initialize System Tick with time interval */
72
// SYSTICK_InternalInit(period); // FIXME
73
// saved_period = period; // FIXME
74
// systick_timems = 0; // FIXME
75
76
/* Enable System Tick interrupt */
77
// SYSTICK_IntCmd(ENABLE); // FIXME
78
79
/* Enable System Tick Counter */
80
// SYSTICK_Cmd(ENABLE); // FIXME
81
82
saved_period
= period;
83
SysTick_Config((
SystemCoreClock
* period) / 1000);
84
}
85
86
/* Disable LWIP tick */
87
void
SysTick_Disable
(
void
)
88
{
89
/* Disable System Tick Counter */
90
// SYSTICK_Cmd(DISABLE); // FIXME
91
92
/* Disable System Tick interrupt */
93
// SYSTICK_IntCmd(DISABLE); // FIXME
94
95
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
96
}
97
104
void
SysTick_Handler
(
void
)
105
{
106
/* Clear System Tick counter flag */
107
// SYSTICK_ClearCounterFlag(); // FIXME
108
109
/* Increment tick count */
110
systick_timems
+=
saved_period
;
111
}
112
113
114
/* Get the current systick time in milliSeconds */
115
uint32_t
SysTick_GetMS(
void
)
116
{
117
return
systick_timems
;
118
}
119
120
/* Delay for the specified number of milliSeconds */
121
void
msDelay
(
uint32_t
ms)
122
{
123
uint32_t
to = ms +
systick_timems
;
124
125
while
(to > systick_timems) {}
126
}
127
133
u32_t
sys_now
(
void
)
134
{
135
return
(
u32_t
) SysTick_GetMS();
136
}
137
142
#endif
/* NO_SYS == 1 */
software
lwip
lpclwip
arch
lpc17xx_40xx_systick_arch.c
Generated on Fri May 10 2013 10:42:24 for LPCOpen Platform by
1.8.2