Initial snapshot: Aliro applet, harness, Nucleo NFC10A1 reader port

Three components, all bench-validated to varying depths:

- applet/: CSA Aliro v1.0 Java Card applet for J3R180. AUTH0 + AUTH1
  expedited-standard flow end-to-end green via PC/SC bench reader
  (aliro-bench-test). Userland AES-256-GCM and HMAC-SHA-256 layered
  on top of J3R180's primitives because the card lacks both natively.
  P-256 curve params seeded explicitly per J3R180's quirk.

- harness/: Python orchestrator (aliro-trustgen, aliro-personalize,
  aliro-bench-test) for trust-bundle generation, card personalization
  via PersonalizationApplet, and PC/SC AUTH0+AUTH1 transactions. 126
  pytest cases passing.

- reader/STM32CubeExpansion_ALIRO_V1_0_0/: ST X-CUBE-ALIRO V1.0.0
  with our NFC10A1 port (NUCLEO-U545RE-Q + X-NUCLEO-NFC10A1, ST25R200
  shared with NFC09A1). nfc10-only/ project, NFC10A1 BSP shim,
  ALIRO_TRUST_OVERRIDE include into vendor's provisioning.c, and an
  ALIRO_APDU_TRACE wrapper around demoTransceiveBlocking. Boots,
  detects the J3R180, completes SELECT + AUTH0; AUTH1 currently fails
  with RFAL ERR_PROTO (0xB) — under investigation, see
  docs/plans/2026-04-20-nucleo-nfc10a1-port.md and bench-notes/.

Excluded: x-cube-aliro.zip vendor archive, harness/.venv, build dirs,
generated aliro_trust.h (contains private reader scalar), all PEMs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-02 10:17:46 -07:00
commit 782074f6ae
8786 changed files with 2902373 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
Copyright 2019-2021 STMicroelectronics.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,6 @@
This software component is provided to you as part of a software package and
applicable license terms are in the Package_license file. If you received this
software component outside of a package or without applicable license terms,
the terms of the BSD-3-Clause license shall apply.
You may obtain a copy of the BSD-3-Clause at:
https://opensource.org/licenses/BSD-3-Clause

View File

@@ -0,0 +1,393 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Release Notes for STM32 timer server</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
<link rel="stylesheet" href="_htmresc/mini-st.css" />
<link rel="icon" type="image/x-icon" href="_htmresc/favicon.png" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="col-sm-12 col-lg-4">
<center>
<h1 id="release-notes-for-stm32-timer-server">Release Notes for
<mark>STM32 timer server</mark></h1>
<p>Copyright © 2019 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img
src="_htmresc/st_logo_2020.png" alt="ST logo" /></a>
</center>
<h1 id="purpose">Purpose</h1>
<p>The source code delivered is an utility to help managing timer
services within an embedded application.</p>
</div>
<section id="update-history" class="col-sm-12 col-lg-8">
<h1>Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section10" checked aria-hidden="true">
<label for="collapse-section10" aria-hidden="true">V1.3.1 /
15-Decembre-2023</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<h2 id="contents">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ticket 149846 - The user callback shall not be called from critical
section</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations">known limitations</h2>
<h2 id="development-toolchains-and-compilers">Development Toolchains and
Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards">Supported Devices and boards</h2>
<h2 id="backward-compatibility">backward compatibility</h2>
<h2 id="dependencies">Dependencies</h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section9" aria-hidden="true">
<label for="collapse-section9" aria-hidden="true">V1.3.0 /
27-October-2022</label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<h2 id="contents-1">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ticket 137606 - [CodeSpell] Mistake in timer module</td>
</tr>
<tr class="even">
<td>Ticket 127700 - add UTIL_TIMER_GetTimerList function</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations-1">known limitations</h2>
<h2 id="development-toolchains-and-compilers-1">Development Toolchains
and Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards-1">Supported Devices and
boards</h2>
<h2 id="backward-compatibility-1">backward compatibility</h2>
<h2 id="dependencies-1">Dependencies</h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section9" aria-hidden="true">
<label for="collapse-section9" aria-hidden="true">V1.2.1 /
17-June-2022</label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<h2 id="contents-2">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Release note format update</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations-2">known limitations</h2>
<h2 id="development-toolchains-and-compilers-2">Development Toolchains
and Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards-2">Supported Devices and
boards</h2>
<h2 id="backward-compatibility-2">backward compatibility</h2>
<h2 id="dependencies-2">Dependencies</h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section8" aria-hidden="true">
<label for="collapse-section8" aria-hidden="true">V1.2.0 /
09-November-2021</label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<h2 id="contents-3">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ticket 115234 - [Licensing] Update the way to declare licenses in
Cube and X-CUBE components</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations-3">known limitations</h2>
<h2 id="development-toolchains-and-compilers-3">Development Toolchains
and Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards-3">Supported Devices and
boards</h2>
<h2 id="backward-compatibility-3">backward compatibility</h2>
<h2 id="dependencies-3">Dependencies</h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section7" aria-hidden="true">
<label for="collapse-section7" aria-hidden="true">V1.1.2 /
10-September-2020</label>
<div>
<h2 id="main-changes-4">Main Changes</h2>
<h3 id="release-v1.1.2">release V1.1.2</h3>
<h2 id="contents-4">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ticket 86948 - CodeSpell : Correct some english words typo</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations-4">known limitations</h2>
<h2 id="development-toolchains-and-compilers-4">Development Toolchains
and Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards-4">Supported Devices and
boards</h2>
<h2 id="backward-compatibility-4">backward compatibility</h2>
<h2 id="dependencies-4">Dependencies</h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section6" aria-hidden="true">
<label for="collapse-section6" aria-hidden="true">V1.1.1 /
3-September-2020</label>
<div>
<h2 id="main-changes-5">Main Changes</h2>
<h3 id="release-v1.1.1">release V1.1.1</h3>
<h2 id="contents-5">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ticket 89624 - Utilities Releases Notes Improvements - Link on
openorg BSD-3-Clause</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations-5">known limitations</h2>
<h2 id="development-toolchains-and-compilers-5">Development Toolchains
and Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards-5">Supported Devices and
boards</h2>
<h2 id="backward-compatibility-5">backward compatibility</h2>
<h2 id="dependencies-5">Dependencies</h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section5" aria-hidden="true">
<label for="collapse-section5" aria-hidden="true">V1.1.0 /
29-June-2020</label>
<div>
<h2 id="main-changes-6">Main Changes</h2>
<h3 id="release-v1.1.0">release V1.1.0</h3>
<h2 id="contents-6">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ticket 86948 - CodeSpell : Correct some english words typo</td>
</tr>
<tr class="even">
<td>Ticket 75887 - [UTILITIES] add TIMER_START_XXXXXX function with
parameter Period + Type</td>
</tr>
<tr class="odd">
<td>MISRA update</td>
</tr>
<tr class="even">
<td>Doxygen tag update</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations-6">known limitations</h2>
<h2 id="development-toolchains-and-compilers-6">Development Toolchains
and Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards-6">Supported Devices and
boards</h2>
<h2 id="backward-compatibility-6">backward compatibility</h2>
<h2 id="dependencies-6">Dependencies</h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section4" aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">V1.0.1 /
12-December-2019</label>
<div>
<h2 id="main-changes-7">Main Changes</h2>
<h3 id="release-v1.0.1">release V1.0.1</h3>
<h2 id="contents-7">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Release note correction</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations-7">known limitations</h2>
<h2 id="development-toolchains-and-compilers-7">Development Toolchains
and Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards-7">Supported Devices and
boards</h2>
<h2 id="backward-compatibility-7">backward compatibility</h2>
<h2 id="dependencies-7">Dependencies</h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">V1.0.0 /
08-October-2019</label>
<div>
<h2 id="main-changes-8">Main Changes</h2>
<h3 id="release-v1.0.0">release V1.0.0</h3>
<h2 id="contents-8">Contents</h2>
<p><strong>Fixed bugs list</strong></p>
<table>
<thead>
<tr class="header">
<th>Headline</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>[Ticket 73263] insert default definition for the critical
section</td>
</tr>
</tbody>
</table>
<h2 id="known-limitations-8">known limitations</h2>
<h2 id="development-toolchains-and-compilers-8">Development Toolchains
and Compilers</h2>
<ul>
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain
V5.25</li>
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
</ul>
<h2 id="supported-devices-and-boards-8">Supported Devices and
boards</h2>
<h2 id="backward-compatibility-8">backward compatibility</h2>
<h2 id="dependencies-8">Dependencies</h2>
</div>
</div>
</section>
</div>
<footer class="sticky">
<div class="columns">
<div class="column" style="width:95%;">
</div><div class="column" style="width:5%;">
<p><abbr title="Based on template cx566953 version 2.1">Info</abbr></p>
</div>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,339 @@
---
pagetitle: Release Notes for STM32 timer server
lang: en
header-includes: <link rel="icon" type="image/x-icon" href="_htmresc/favicon.png" />
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
<center>
# Release Notes for <mark>STM32 timer server</mark>
Copyright &copy; 2019 STMicroelectronics\
[![ST logo](_htmresc/st_logo_2020.png)](https://www.st.com){.logo}
</center>
# Purpose
The source code delivered is an utility to help managing timer services within an embedded application.
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section10" checked aria-hidden="true">
<label for="collapse-section10" aria-hidden="true">V1.3.1 / 15-Decembre-2023</label>
<div>
## Main Changes
## Contents
**Fixed bugs list**
Headline
--------
Ticket 149846 - The user callback shall not be called from critical section
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section9" aria-hidden="true">
<label for="collapse-section9" aria-hidden="true">V1.3.0 / 27-October-2022</label>
<div>
## Main Changes
## Contents
**Fixed bugs list**
Headline
--------
Ticket 137606 - [CodeSpell] Mistake in timer module
Ticket 127700 - add UTIL_TIMER_GetTimerList function
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section9" aria-hidden="true">
<label for="collapse-section9" aria-hidden="true">V1.2.1 / 17-June-2022</label>
<div>
## Main Changes
## Contents
**Fixed bugs list**
Headline
--------
Release note format update
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section8" aria-hidden="true">
<label for="collapse-section8" aria-hidden="true">V1.2.0 / 09-November-2021</label>
<div>
## Main Changes
## Contents
**Fixed bugs list**
Headline
--------
Ticket 115234 - [Licensing] Update the way to declare licenses in Cube and X-CUBE components
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section7" aria-hidden="true">
<label for="collapse-section7" aria-hidden="true">V1.1.2 / 10-September-2020</label>
<div>
## Main Changes
### release V1.1.2
## Contents
**Fixed bugs list**
Headline
--------
Ticket 86948 - CodeSpell : Correct some english words typo
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section6" aria-hidden="true">
<label for="collapse-section6" aria-hidden="true">V1.1.1 / 3-September-2020</label>
<div>
## Main Changes
### release V1.1.1
## Contents
**Fixed bugs list**
Headline
--------
Ticket 89624 - Utilities Releases Notes Improvements - Link on openorg BSD-3-Clause
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section5" aria-hidden="true">
<label for="collapse-section5" aria-hidden="true">V1.1.0 / 29-June-2020</label>
<div>
## Main Changes
### release V1.1.0
## Contents
**Fixed bugs list**
Headline
--------
Ticket 86948 - CodeSpell : Correct some english words typo
Ticket 75887 - [UTILITIES] add TIMER_START_XXXXXX function with parameter Period + Type
MISRA update
Doxygen tag update
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section4" aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">V1.0.1 / 12-December-2019</label>
<div>
## Main Changes
### release V1.0.1
## Contents
**Fixed bugs list**
Headline
--------
Release note correction
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section3" aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">V1.0.0 / 08-October-2019</label>
<div>
## Main Changes
### release V1.0.0
## Contents
**Fixed bugs list**
Headline
--------
[Ticket 73263] insert default definition for the critical section
## known limitations
## Development Toolchains and Compilers
- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2
## Supported Devices and boards
## backward compatibility
## Dependencies
</div>
:::
:::
:::
<footer class="sticky">
::: {.columns}
::: {.column width="95%"}
:::
::: {.column width="5%"}
<abbr title="Based on template cx566953 version 2.1">Info</abbr>
:::
:::
</footer>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -0,0 +1,559 @@
/*!
* \file timer.c
*
* \brief Timer objects and scheduling management implementation
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
* ______ _
* / _____) _ | |
* ( (____ _____ ____ _| |_ _____ ____| |__
* \____ \| ___ | (_ _) ___ |/ ___) _ \
* _____) ) ____| | | || |_| ____( (___| | | |
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
* (C)2013-2017 Semtech
*
* \endcode
*
* \author Miguel Luis ( Semtech )
*
* \author Gregory Cristian ( Semtech )
*/
/******************************************************************************
* @file stm32_timer.c
* @author MCD Application Team
* @brief Time server utility
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32_timer.h"
/** @addtogroup TIMER_SERVER
* @{
*/
/* Private macro -----------------------------------------------------------*/
/**
* @defgroup TIMER_SERVER_private_macro TIMER_SERVER private macros
* @{
*/
/**
* @brief macro definition to initialize a critical section.
*
*/
#ifndef UTIL_TIMER_INIT_CRITICAL_SECTION
#define UTIL_TIMER_INIT_CRITICAL_SECTION( )
#endif
/**
* @brief macro definition to enter a critical section.
*
*/
#ifndef UTIL_TIMER_ENTER_CRITICAL_SECTION
#define UTIL_TIMER_ENTER_CRITICAL_SECTION( ) UTILS_ENTER_CRITICAL_SECTION( )
#endif
/**
* @brief macro definition to exit a critical section.
*
*/
#ifndef UTIL_TIMER_EXIT_CRITICAL_SECTION
#define UTIL_TIMER_EXIT_CRITICAL_SECTION( ) UTILS_EXIT_CRITICAL_SECTION( )
#endif
/**
* @}
*/
/* Private variables -----------------------------------------------------------*/
/**
* @defgroup TIMER_SERVER_private_varaible TIMER_SERVER private variable
* @{
*/
/**
* @brief Timers list head pointer
*
*/
static UTIL_TIMER_Object_t *TimerListHead = NULL;
/**
* @}
*/
/**
* @defgroup TIMER_SERVER_private_function TIMER_SERVER private function
* @{
*/
void TimerInsertNewHeadTimer( UTIL_TIMER_Object_t *TimerObject );
void TimerInsertTimer( UTIL_TIMER_Object_t *TimerObject );
void TimerSetTimeout( UTIL_TIMER_Object_t *TimerObject );
bool TimerExists( UTIL_TIMER_Object_t *TimerObject );
/**
* @}
*/
/* Functions Definition ------------------------------------------------------*/
/**
* @addtogroup TIMER_SERVER_exported_function
* @{
*/
UTIL_TIMER_Status_t UTIL_TIMER_Init(void)
{
UTIL_TIMER_INIT_CRITICAL_SECTION();
TimerListHead = NULL;
return UTIL_TimerDriver.InitTimer();
}
UTIL_TIMER_Status_t UTIL_TIMER_DeInit(void)
{
return UTIL_TimerDriver.DeInitTimer();
}
UTIL_TIMER_Status_t UTIL_TIMER_Create( UTIL_TIMER_Object_t *TimerObject, uint32_t PeriodValue, UTIL_TIMER_Mode_t Mode, void ( *Callback )( void *), void *Argument)
{
if((TimerObject != NULL) && (Callback != NULL))
{
TimerObject->Timestamp = 0U;
TimerObject->ReloadValue = UTIL_TimerDriver.ms2Tick(PeriodValue);
TimerObject->IsPending = 0U;
TimerObject->IsRunning = 0U;
TimerObject->IsReloadStopped = 0U;
TimerObject->Callback = Callback;
TimerObject->argument = Argument;
TimerObject->Mode = Mode;
TimerObject->Next = NULL;
return UTIL_TIMER_OK;
}
else
{
return UTIL_TIMER_INVALID_PARAM;
}
}
UTIL_TIMER_Status_t UTIL_TIMER_Start( UTIL_TIMER_Object_t *TimerObject)
{
UTIL_TIMER_Status_t ret = UTIL_TIMER_OK;
uint32_t elapsedTime;
uint32_t minValue;
uint32_t ticks;
if(( TimerObject != NULL ) && ( TimerExists( TimerObject ) == false ) && (TimerObject->IsRunning == 0U))
{
UTIL_TIMER_ENTER_CRITICAL_SECTION();
ticks = TimerObject->ReloadValue;
minValue = UTIL_TimerDriver.GetMinimumTimeout( );
if( ticks < minValue )
{
ticks = minValue;
}
TimerObject->Timestamp = ticks;
TimerObject->IsPending = 0U;
TimerObject->IsRunning = 1U;
TimerObject->IsReloadStopped = 0U;
if( TimerListHead == NULL )
{
UTIL_TimerDriver.SetTimerContext();
TimerInsertNewHeadTimer( TimerObject ); /* insert a timeout at now+obj->Timestamp */
}
else
{
elapsedTime = UTIL_TimerDriver.GetTimerElapsedTime( );
TimerObject->Timestamp += elapsedTime;
if( TimerObject->Timestamp < TimerListHead->Timestamp )
{
TimerInsertNewHeadTimer( TimerObject);
}
else
{
TimerInsertTimer( TimerObject);
}
}
UTIL_TIMER_EXIT_CRITICAL_SECTION();
}
else
{
ret = UTIL_TIMER_INVALID_PARAM;
}
return ret;
}
UTIL_TIMER_Status_t UTIL_TIMER_StartWithPeriod( UTIL_TIMER_Object_t *TimerObject, uint32_t PeriodValue)
{
UTIL_TIMER_Status_t ret = UTIL_TIMER_OK;
if(NULL == TimerObject)
{
ret = UTIL_TIMER_INVALID_PARAM;
}
else
{
TimerObject->ReloadValue = UTIL_TimerDriver.ms2Tick(PeriodValue);
if(TimerExists(TimerObject))
{
(void)UTIL_TIMER_Stop(TimerObject);
}
ret = UTIL_TIMER_Start(TimerObject);
}
return ret;
}
UTIL_TIMER_Status_t UTIL_TIMER_Stop( UTIL_TIMER_Object_t *TimerObject )
{
UTIL_TIMER_Status_t ret = UTIL_TIMER_OK;
if (NULL != TimerObject)
{
UTIL_TIMER_ENTER_CRITICAL_SECTION();
UTIL_TIMER_Object_t* prev = TimerListHead;
UTIL_TIMER_Object_t* cur = TimerListHead;
TimerObject->IsReloadStopped = 1U;
/* List is empty or the Obj to stop does not exist */
if(NULL != TimerListHead)
{
TimerObject->IsRunning = 0U;
if( TimerListHead == TimerObject ) /* Stop the Head */
{
TimerListHead->IsPending = 0;
if( TimerListHead->Next != NULL )
{
TimerListHead = TimerListHead->Next;
TimerSetTimeout( TimerListHead );
}
else
{
UTIL_TimerDriver.StopTimerEvt( );
TimerListHead = NULL;
}
}
else /* Stop an object within the list */
{
while( cur != NULL )
{
if( cur == TimerObject )
{
if( cur->Next != NULL )
{
cur = cur->Next;
prev->Next = cur;
}
else
{
cur = NULL;
prev->Next = cur;
}
break;
}
else
{
prev = cur;
cur = cur->Next;
}
}
}
ret = UTIL_TIMER_OK;
}
UTIL_TIMER_EXIT_CRITICAL_SECTION();
}
else
{
ret = UTIL_TIMER_INVALID_PARAM;
}
return ret;
}
UTIL_TIMER_Status_t UTIL_TIMER_SetPeriod(UTIL_TIMER_Object_t *TimerObject, uint32_t NewPeriodValue)
{
UTIL_TIMER_Status_t ret = UTIL_TIMER_OK;
if(NULL == TimerObject)
{
ret = UTIL_TIMER_INVALID_PARAM;
}
else
{
TimerObject->ReloadValue = UTIL_TimerDriver.ms2Tick(NewPeriodValue);
if(TimerExists(TimerObject))
{
(void)UTIL_TIMER_Stop(TimerObject);
ret = UTIL_TIMER_Start(TimerObject);
}
}
return ret;
}
UTIL_TIMER_Status_t UTIL_TIMER_SetReloadMode(UTIL_TIMER_Object_t *TimerObject, UTIL_TIMER_Mode_t ReloadMode)
{
UTIL_TIMER_Status_t ret = UTIL_TIMER_OK;
if(NULL == TimerObject)
{
ret = UTIL_TIMER_INVALID_PARAM;
}
else
{
TimerObject->Mode = ReloadMode;
}
return ret;
}
UTIL_TIMER_Status_t UTIL_TIMER_GetRemainingTime(UTIL_TIMER_Object_t *TimerObject, uint32_t *ElapsedTime)
{
UTIL_TIMER_Status_t ret = UTIL_TIMER_OK;
if(TimerExists(TimerObject))
{
uint32_t time = UTIL_TimerDriver.GetTimerElapsedTime();
if (TimerObject->Timestamp < time )
{
*ElapsedTime = 0;
}
else
{
*ElapsedTime = TimerObject->Timestamp - time;
}
}
else
{
ret = UTIL_TIMER_INVALID_PARAM;
}
return ret;
}
uint32_t UTIL_TIMER_IsRunning( UTIL_TIMER_Object_t *TimerObject )
{
if( TimerObject != NULL )
{
return TimerObject->IsRunning;
}
else
{
return 0;
}
}
uint32_t UTIL_TIMER_GetFirstRemainingTime(void)
{
uint32_t NextTimer = 0xFFFFFFFFU;
if(TimerListHead != NULL)
{
(void)UTIL_TIMER_GetRemainingTime(TimerListHead, &NextTimer);
}
return NextTimer;
}
void UTIL_TIMER_IRQ_Handler( void )
{
UTIL_TIMER_Object_t *cur, *exec = NULL;
uint32_t old, now, DeltaContext;
void ( *FunctionCallback )( void *) = NULL;
void *argument = NULL;
UTIL_TIMER_ENTER_CRITICAL_SECTION();
old = UTIL_TimerDriver.GetTimerContext( );
now = UTIL_TimerDriver.SetTimerContext( );
DeltaContext = now - old; /*intentional wrap around */
/* update timeStamp based upon new Time Reference*/
/* because delta context should never exceed 2^32*/
if ( TimerListHead != NULL )
{
cur = TimerListHead;
do {
if (cur->Timestamp > DeltaContext)
{
cur->Timestamp -= DeltaContext;
}
else
{
cur->Timestamp = 0;
/* get the first expired timer and save it context callback */
if (FunctionCallback == NULL)
{
/* remove the current from the chain list as it is the first expired */
TimerListHead = TimerListHead->Next;
cur->IsPending = 0;
cur->IsRunning = 0;
/* save for execution when chain list is fully update */
if(( cur->Mode == UTIL_TIMER_PERIODIC) && (cur->IsReloadStopped == 0U))
{
exec = cur;
}
argument = cur->argument;
FunctionCallback = cur->Callback;
}
}
cur = cur->Next;
} while(cur != NULL);
if (exec != NULL) (void)UTIL_TIMER_Start(exec);
/* start the next TimerListHead if it exists and it is not pending*/
if(( TimerListHead != NULL ) && (TimerListHead->IsPending == 0U))
{
TimerSetTimeout( TimerListHead );
}
}
UTIL_TIMER_EXIT_CRITICAL_SECTION();
// Call user call back
if (FunctionCallback != NULL)
{
FunctionCallback(argument);
}
}
UTIL_TIMER_Time_t UTIL_TIMER_GetCurrentTime(void)
{
uint32_t now = UTIL_TimerDriver.GetTimerValue( );
return UTIL_TimerDriver.Tick2ms(now);
}
UTIL_TIMER_Time_t UTIL_TIMER_GetElapsedTime(UTIL_TIMER_Time_t past )
{
uint32_t nowInTicks = UTIL_TimerDriver.GetTimerValue( );
uint32_t pastInTicks = UTIL_TimerDriver.ms2Tick( past );
/* intentional wrap around. Works Ok if tick duation below 1ms */
return UTIL_TimerDriver.Tick2ms( nowInTicks- pastInTicks );
}
UTIL_TIMER_Object_t *UTIL_TIMER_GetTimerList(void)
{
return TimerListHead;
}
/**
* @}
*/
/**************************** Private functions *******************************/
/**
* @addtogroup TIMER_SERVER_private_function
*
* @{
*/
/**
* @brief Check if the Object to be added is not already in the list
*
* @param TimerObject Structure containing the timer object parameters
* @retval 1 (the object is already in the list) or 0
*/
bool TimerExists( UTIL_TIMER_Object_t *TimerObject )
{
UTIL_TIMER_Object_t* cur = TimerListHead;
while( cur != NULL )
{
if( cur == TimerObject )
{
return true;
}
cur = cur->Next;
}
return false;
}
/**
* @brief Sets a timeout with the duration "timestamp"
*
* @param TimerObject Structure containing the timer object parameters
*/
void TimerSetTimeout( UTIL_TIMER_Object_t *TimerObject )
{
uint32_t minTicks= UTIL_TimerDriver.GetMinimumTimeout( );
TimerObject->IsPending = 1;
/* In case deadline too soon */
if(TimerObject->Timestamp < (UTIL_TimerDriver.GetTimerElapsedTime( ) + minTicks) )
{
TimerObject->Timestamp = UTIL_TimerDriver.GetTimerElapsedTime( ) + minTicks;
}
UTIL_TimerDriver.StartTimerEvt( TimerObject->Timestamp );
}
/**
* @brief Adds a timer to the list.
*
* @remark The list is automatically sorted. The list head always contains the
* next timer to expire.
*
* @param TimerObject Structure containing the timer object parameters
*/
void TimerInsertTimer( UTIL_TIMER_Object_t *TimerObject)
{
UTIL_TIMER_Object_t* cur = TimerListHead;
UTIL_TIMER_Object_t* next = TimerListHead->Next;
while (cur->Next != NULL )
{
if( TimerObject->Timestamp > next->Timestamp )
{
cur = next;
next = next->Next;
}
else
{
cur->Next = TimerObject;
TimerObject->Next = next;
return;
}
}
cur->Next = TimerObject;
TimerObject->Next = NULL;
}
/**
* @brief Adds or replace the head timer of the list.
*
* @param TimerObject Structure containing the timer object parameters
*
* @remark The list is automatically sorted. The list head always contains the
* next timer to expire.
*/
void TimerInsertNewHeadTimer( UTIL_TIMER_Object_t *TimerObject )
{
UTIL_TIMER_Object_t* cur = TimerListHead;
if( cur != NULL )
{
cur->IsPending = 0;
}
TimerObject->Next = cur;
TimerListHead = TimerObject;
TimerSetTimeout( TimerListHead );
}
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,303 @@
/*!
* \file timer.h
*
* \brief Timer objects and scheduling management implementation
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
* ______ _
* / _____) _ | |
* ( (____ _____ ____ _| |_ _____ ____| |__
* \____ \| ___ | (_ _) ___ |/ ___) _ \
* _____) ) ____| | | || |_| ____( (___| | | |
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
* (C)2013-2017 Semtech
*
* \endcode
*
* \author Miguel Luis ( Semtech )
*
* \author Gregory Cristian ( Semtech )
*/
/******************************************************************************
* @file stm32_timer.h
* @author MCD Application Team
* @brief This is the header of the timer server driver
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef UTIL_TIME_SERVER_H__
#define UTIL_TIME_SERVER_H__
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup TIMER_SERVER timer server
* @{
*/
/* Includes ------------------------------------------------------------------*/
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <cmsis_compiler.h>
#include "utilities_conf.h"
/* Exported types ------------------------------------------------------------*/
/** @defgroup TIMER_SERVER_exported_TypeDef TIMER_SERVER exported Typedef
* @{
*/
/**
* @brief Timer mode
*/
typedef enum {
UTIL_TIMER_ONESHOT = 0, /*!<One-shot timer. */
UTIL_TIMER_PERIODIC = 1 /*!<Periodic timer. */
} UTIL_TIMER_Mode_t;
/**
* @brief Timer status
*/
typedef enum {
UTIL_TIMER_OK = 0, /*!<Operation terminated successfully.*/
UTIL_TIMER_INVALID_PARAM = 1, /*!<Invalid Parameter. */
UTIL_TIMER_HW_ERROR = 2, /*!<Hardware Error. */
UTIL_TIMER_UNKNOWN_ERROR = 3 /*!<Unknown Error. */
} UTIL_TIMER_Status_t;
/**
* @brief Timer object description
*/
typedef struct TimerEvent_s
{
uint32_t Timestamp; /*!<Expiring timer value in ticks from TimerContext */
uint32_t ReloadValue; /*!<Reload Value when Timer is restarted */
uint8_t IsPending; /*!<Is the timer waiting for an event */
uint8_t IsRunning; /*!<Is the timer running */
uint8_t IsReloadStopped; /*!<Is the reload stopped */
UTIL_TIMER_Mode_t Mode; /*!<Timer type : one-shot/continuous */
void ( *Callback )( void *); /*!<callback function */
void *argument; /*!<callback argument */
struct TimerEvent_s *Next; /*!<Pointer to the next Timer object. */
} UTIL_TIMER_Object_t;
/**
* @brief Timer driver definition
*/
typedef struct
{
UTIL_TIMER_Status_t (* InitTimer )( void ); /*!< Initialisation of the low layer timer */
UTIL_TIMER_Status_t (* DeInitTimer )( void ); /*!< Un-Initialisation of the low layer timer */
UTIL_TIMER_Status_t (* StartTimerEvt )( uint32_t timeout ); /*!< Start the low layer timer */
UTIL_TIMER_Status_t (* StopTimerEvt )( void); /*!< Stop the low layer timer */
uint32_t (* SetTimerContext)( void ); /*!< Set the timer context */
uint32_t (* GetTimerContext)( void ); /*!< Get the timer context */
uint32_t (* GetTimerElapsedTime)( void ); /*!< Get elapsed time */
uint32_t (* GetTimerValue)( void ); /*!< Get timer value */
uint32_t (* GetMinimumTimeout)( void ); /*!< Get Minimum timeout */
uint32_t (* ms2Tick)( uint32_t timeMicroSec ); /*!< convert ms to tick */
uint32_t (* Tick2ms)( uint32_t tick ); /*!< convert tick into ms */
} UTIL_TIMER_Driver_s;
/**
* @brief Timer value on 32 bits
*/
typedef uint32_t UTIL_TIMER_Time_t;
/**
* @}
*/
/* Exported variables ------------------------------------------------------------*/
/** @defgroup TIMER_SERVER_exported_Variable TIMER_SERVER exported Variable
* @{
*/
/**
* @brief low layer interface to handle timing execution
*
* @remark This structure is defined and initialized in the specific platform
* timer implementation
*/
extern const UTIL_TIMER_Driver_s UTIL_TimerDriver;
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/** @defgroup TIMER_SERVER_exported_function TIMER_SERVER exported function
* @{
*/
/**
* @brief Initialize the timer server
*
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_Init(void);
/**
* @brief Un-Initialize the timer server
*
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_DeInit(void);
/**
* @brief Create the timer object
*
* @remark TimerSetValue function must be called before starting the timer.
* this function initializes timestamp and reload value at 0.
*
* @param TimerObject Structure containing the timer object parameters
* @param PeriodValue Period value of the timer in ms
* @param Mode @ref UTIL_TIMER_Mode_t
* @param Callback Function callback called at the end of the timeout
* @param Argument argument for the callback function
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_Create( UTIL_TIMER_Object_t *TimerObject, uint32_t PeriodValue, UTIL_TIMER_Mode_t Mode, void ( *Callback )( void *) , void *Argument);
/**
* @brief Start and adds the timer object to the list of timer events
*
* @param TimerObject Structure containing the timer object parameters
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_Start( UTIL_TIMER_Object_t *TimerObject );
/**
* @brief Start and adds the timer object to the list of timer events
*
* @param TimerObject Structure containing the timer object parameters
* @param PeriodValue period value of the timer
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_StartWithPeriod( UTIL_TIMER_Object_t *TimerObject, uint32_t PeriodValue);
/**
* @brief Stop and removes the timer object from the list of timer events
*
* @param TimerObject Structure containing the timer object parameters
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_Stop( UTIL_TIMER_Object_t *TimerObject );
/**
* @brief update the period and start the timer
*
* @param TimerObject Structure containing the timer object parameters
* @param NewPeriodValue new period value of the timer
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_SetPeriod(UTIL_TIMER_Object_t *TimerObject, uint32_t NewPeriodValue);
/**
* @brief update the period and start the timer
*
* @param TimerObject Structure containing the timer object parameters
* @param ReloadMode new reload mode @ref UTIL_TIMER_Mode_t
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_SetReloadMode(UTIL_TIMER_Object_t *TimerObject, UTIL_TIMER_Mode_t ReloadMode);
/**
* @brief get the remaining time before timer expiration
* *
* @param TimerObject Structure containing the timer object parameters
* @param Time time before expiration in ms
* @retval Status based on @ref UTIL_TIMER_Status_t
*/
UTIL_TIMER_Status_t UTIL_TIMER_GetRemainingTime(UTIL_TIMER_Object_t *TimerObject, uint32_t *Time);
/**
* @brief return timer state
*
* @param TimerObject Structure containing the timer object parameters
* @retval boolean value is returned 0 = false and 1 = true
*/
uint32_t UTIL_TIMER_IsRunning( UTIL_TIMER_Object_t *TimerObject );
/**
* @brief return the remaining time of the first timer in the chain list
*
* @retval return the time in ms, the value 0xFFFFFFFF means no timer running
*/
uint32_t UTIL_TIMER_GetFirstRemainingTime(void);
/**
* @brief return the current time
*
* @retval time value
*/
UTIL_TIMER_Time_t UTIL_TIMER_GetCurrentTime(void);
/**
* @brief return the elapsed time
*
* @param past a value returned by the function UTIL_TIMER_GetCurrentTime
* @retval elapsed time value
*/
UTIL_TIMER_Time_t UTIL_TIMER_GetElapsedTime(UTIL_TIMER_Time_t past );
/**
* @brief return the list of the current timer
*
* @retval pointer on @ref UTIL_TIMER_Object_t
*
* @Note : the use of this function is dangerous and must be done with precaution, the risks are:
* 1 - an update of this data structure may affect the operation of timer server
* 2 - data structure is moving according the events, so read must be under critical section
*/
UTIL_TIMER_Object_t *UTIL_TIMER_GetTimerList(void);
/**
* @brief Timer IRQ event handler
*
* @note Head Timer Object is automatically removed from the List
*
* @note e.g. it is not needed to stop it
*/
void UTIL_TIMER_IRQ_Handler( void );
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* UTIL_TIME_SERVER_H__*/

View File

@@ -0,0 +1,166 @@
/*******************************************************************************
* File Name : stm32_timer_if.c
* Description : This file provides the ll driver for the time server
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include <math.h>
#include "stm32_timer_if.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Exported variables ---------------------------------------------------------*/
const UTIL_TIMER_Driver_s UTIL_TimerDriver =
{
PPP_Init,
PPP_DeInit,
PPP_StartTimer,
PPP_StopTimer,
PPP_SetTimerContext,
PPP_GetTimerContext,
PPP_GetTimerElapsedTime,
PPP_GetTimerValue,
PPP_GetMinimumTimeout,
PPP_ms2Tick,
PPP_Tick2ms,
};
/*!
* @brief Initializes the PPP timer
* @note The timer is based on the PPP
* @param none
* @retval none
*/
UTIL_TIMER_Status_t PPP_Init( void )
{
return UTIL_TIMER_OK;
}
/*!
* @brief Initializes the PPP timer
* @note The timer is based on the PPP
* @param none
* @retval none
*/
UTIL_TIMER_Status_t PPP_DeInit( void )
{
return UTIL_TIMER_OK;
}
/*!
* @brief Set the timer
* @note The timer is set at now (read in this function) + timeout
* @param timeout Duration of the Timer ticks
*/
UTIL_TIMER_Status_t PPP_StartTimer( uint32_t timeout )
{
return UTIL_TIMER_OK;
}
/*!
* @brief Stop the timer
* @param none
* @retval none
*/
UTIL_TIMER_Status_t PPP_StopTimer( void )
{
return UTIL_TIMER_OK;
}
/*!
* @brief returns the wake up time in ticks
* @param none
* @retval wake up time in ticks
*/
uint32_t PPP_GetMinimumTimeout( void )
{
return ( 0 );
}
/*!
* @brief converts time in ms to time in ticks
* @param [IN] time in milliseconds
* @retval returns time in timer ticks
*/
uint32_t PPP_ms2Tick( uint32_t timeMicroSec )
{
return ( 0 );
}
/*!
* @brief converts time in ticks to time in ms
* @param [IN] time in timer ticks
* @retval returns time in milliseconds
*/
uint32_t PPP_Tick2ms( uint32_t tick )
{
return ( 0 );
}
/*!
* @brief Get the PPP timer elapsed time since the last timer was set
* @param none
* @retval PPP Elapsed time in ticks
*/
uint32_t PPP_GetTimerElapsedTime( void )
{
return ( 0 );
}
/*!
* @brief Get the PPP timer value
* @param none
* @retval PPP Timer value in ticks
*/
uint32_t PPP_GetTimerValue( void )
{
return ( 0 );
}
/*!
* @brief PPP IRQ Handler on the PPP timer
* @param none
* @retval none
*/
void PPP_IrqHandler ( void )
{
}
/*!
* @brief set Time Reference set also the sDate and sTime
* @param none
* @retval Timer Value
*/
uint32_t PPP_SetTimerContext( void )
{
return ( 0 );
}
/*!
* @brief Get the PPP timer Reference
* @param none
* @retval Timer Value in Ticks
*/
uint32_t PPP_GetTimerContext( void )
{
return ( 0 );
}

View File

@@ -0,0 +1,120 @@
/**
******************************************************************************
* File Name : stm32_timer_if.h
* Description : This file provides the ll driver for the time server
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef STM32_TIMER_IF_H__
#define STM32_TIMER_IF_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32_timer.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/*!
* @brief Initialize the PPP timer
* @note The timer is based on the PPP
*/
UTIL_TIMER_Status_t PPP_Init( void );
/*!
* @brief Un-initialize the PPP timer
* @note The timer is based on the PPP
*/
UTIL_TIMER_Status_t PPP_DeInit( void );
/*!
* @brief Start the timer
* @note The timer is set at Reference + timeout
* @param timeout Duration of the Timer in ticks
*/
UTIL_TIMER_Status_t PPP_StartTimer( uint32_t timeout );
/*!
* @brief Stop the timer
* @param none
* @retval none
*/
UTIL_TIMER_Status_t PPP_StopTimer( void );
/*!
* @brief Return the minimum timeout the PPP is able to handle
* @param none
* @retval minimum value for a timeout
*/
uint32_t PPP_GetMinimumTimeout( void );
/*!
* @brief Get the PPP timer elapsed time since the last Reference was set
* @retval PPP Elapsed time in ticks
*/
uint32_t PPP_GetTimerElapsedTime( void );
/*!
* @brief Get the PPP timer value
* @retval none
*/
uint32_t PPP_GetTimerValue( void );
/*!
* @brief Set the PPP timer Reference
* @retval Timer Reference Value in Ticks
*/
uint32_t PPP_SetTimerContext( void );
/*!
* @brief Get the PPP timer Reference
* @retval Timer Value in Ticks
*/
uint32_t PPP_GetTimerContext( void );
/*!
* @brief PPP IRQ Handler on the PPP timer
* @param none
* @retval none
*/
void PPP_IrqHandler ( void );
/*!
* @brief converts time in ms to time in ticks
* @param [IN] time in milliseconds
* @retval returns time in ticks
*/
uint32_t PPP_ms2Tick( uint32_t timeMicroSec );
/*!
* @brief converts time in ticks to time in ms
* @param [IN] time in ticks
* @retval returns time in milliseconds
*/
uint32_t PPP_Tick2ms( uint32_t tick );
#ifdef __cplusplus
}
#endif
#endif /* STM32_TIMER_IF_H__ */