mbed OS5
Fork of UIPEthernet by
utility/millis.cpp@4:d774541a34da, 2015-03-08 (annotated)
- Committer:
- hudakz
- Date:
- Sun Mar 08 20:26:56 2015 +0000
- Revision:
- 4:d774541a34da
- Child:
- 6:10e42359e217
Version 1.09 (fixed leaking client-data caused by race-condition on remote close)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 4:d774541a34da | 1 | /* |
hudakz | 4:d774541a34da | 2 | uip_millis.cpp |
hudakz | 4:d774541a34da | 3 | Copyright (c) 2015 Zoltan Hudak <hudakz@inbox.com> |
hudakz | 4:d774541a34da | 4 | All rights reserved. |
hudakz | 4:d774541a34da | 5 | |
hudakz | 4:d774541a34da | 6 | This program is free software: you can redistribute it and/or modify |
hudakz | 4:d774541a34da | 7 | it under the terms of the GNU General Public License as published by |
hudakz | 4:d774541a34da | 8 | the Free Software Foundation, either version 3 of the License, or |
hudakz | 4:d774541a34da | 9 | (at your option) any later version. |
hudakz | 4:d774541a34da | 10 | |
hudakz | 4:d774541a34da | 11 | This program is distributed in the hope that it will be useful, |
hudakz | 4:d774541a34da | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
hudakz | 4:d774541a34da | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
hudakz | 4:d774541a34da | 14 | GNU General Public License for more details. |
hudakz | 4:d774541a34da | 15 | |
hudakz | 4:d774541a34da | 16 | You should have received a copy of the GNU General Public License |
hudakz | 4:d774541a34da | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
hudakz | 4:d774541a34da | 18 | */ |
hudakz | 4:d774541a34da | 19 | #include "millis.h" |
hudakz | 4:d774541a34da | 20 | #include <mbed.h> |
hudakz | 4:d774541a34da | 21 | |
hudakz | 4:d774541a34da | 22 | volatile unsigned int _millis; |
hudakz | 4:d774541a34da | 23 | |
hudakz | 4:d774541a34da | 24 | /** |
hudakz | 4:d774541a34da | 25 | * @brief |
hudakz | 4:d774541a34da | 26 | * @note |
hudakz | 4:d774541a34da | 27 | * @param |
hudakz | 4:d774541a34da | 28 | * @retval |
hudakz | 4:d774541a34da | 29 | */ |
hudakz | 4:d774541a34da | 30 | void millis_start(void) { |
hudakz | 4:d774541a34da | 31 | SysTick_Config(SystemCoreClock / 1000); |
hudakz | 4:d774541a34da | 32 | } |
hudakz | 4:d774541a34da | 33 | |
hudakz | 4:d774541a34da | 34 | /** |
hudakz | 4:d774541a34da | 35 | * @brief |
hudakz | 4:d774541a34da | 36 | * @note |
hudakz | 4:d774541a34da | 37 | * @param |
hudakz | 4:d774541a34da | 38 | * @retval |
hudakz | 4:d774541a34da | 39 | */ |
hudakz | 4:d774541a34da | 40 | extern "C" void SysTick_Handler(void) { |
hudakz | 4:d774541a34da | 41 | _millis += 1; |
hudakz | 4:d774541a34da | 42 | } |
hudakz | 4:d774541a34da | 43 | |
hudakz | 4:d774541a34da | 44 | /** |
hudakz | 4:d774541a34da | 45 | * @brief |
hudakz | 4:d774541a34da | 46 | * @note |
hudakz | 4:d774541a34da | 47 | * @param |
hudakz | 4:d774541a34da | 48 | * @retval |
hudakz | 4:d774541a34da | 49 | */ |
hudakz | 4:d774541a34da | 50 | extern "C" unsigned int millis(void) { |
hudakz | 4:d774541a34da | 51 | return _millis; |
hudakz | 4:d774541a34da | 52 | } |