Files
bacnet_stack/ports/stm32f10x/mstimer-init.c
T
Kari Argillander cb243c36a8 Improve SPDX identifier coverage (#716)
* Change MIT license texts to SPDX-License-Identifier

SPDX-License-Identifier is much easier to understand and grep than
license text so use that instead.

* Change GPL exception license texts to SPDX-License-Identifier

SPDX-License-Identifier is much easier to understand and grep than
license text so use that instead.

* Change misc license texts to SPDX-License-Identifier

There are some external code in repo which are not licenses as most of
the stuff in this repo. We still want every file to have SPDX identifier
to easily grep licenses.

* Add currently used license files

Even though Bacnet-Stack is using SPDX identifiers we still need to give
those license files with source. For this reason add all license files
to license/ folder.

SPDX has also files which would make same thing but this is style which
example Linux kernel is using and it is quite clear so I choose that one
for now.

I choosed not yet bring CC-PDDC as that is not right license for those
files.

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
2024-08-12 15:33:02 -05:00

53 lines
1.2 KiB
C

/**************************************************************************
*
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
*
* SPDX-License-Identifier: MIT
*
* Module Description:
* Generate a periodic timer tick for use by generic timers in the code.
*
*************************************************************************/
#include <stdbool.h>
#include <stdint.h>
#include "hardware.h"
#include "bacnet/basic/sys/mstimer.h"
/* counter for the various timers */
static volatile unsigned long Millisecond_Counter;
/**
* Handles the interrupt from the timer
*/
void SysTick_Handler(void)
{
/* increment the tick count */
Millisecond_Counter++;
/* run any callbacks */
mstimer_callback_handler();
}
/**
* Returns the continuous milliseconds count, which rolls over
*
* @return the current milliseconds count
*/
unsigned long mstimer_now(void)
{
return Millisecond_Counter;
}
/**
* Timer setup for 1 millisecond timer
*/
void mstimer_init(void)
{
/* Setup SysTick Timer for 1ms interrupts */
if (SysTick_Config(SystemCoreClock / 1000)) {
while (1) {
/* config error? return 1 = failed, 0 = successful */
}
}
NVIC_EnableIRQ(SysTick_IRQn);
}