Initial commit
This commit is contained in:
commit
66c5a26d69
1145 changed files with 938088 additions and 0 deletions
64
USB-PD_Provider_1port/Utilities/Fonts/Release_Notes.html
Normal file
64
USB-PD_Provider_1port/Utilities/Fonts/Release_Notes.html
Normal file
|
@ -0,0 +1,64 @@
|
|||
<!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 STM32Cube Fonts Utilities Driver</title>
|
||||
<style type="text/css">
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../_htmresc/mini-st.css" />
|
||||
<!--[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">
|
||||
<div class="card fluid">
|
||||
<div class="sectione dark">
|
||||
<center>
|
||||
<h1 id="release-notes-for-stm32cube-fonts-utilities-driver"><small>Release Notes for</small> <mark>STM32Cube Fonts Utilities Driver</mark></h1>
|
||||
<p>Copyright © 2014 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="../../_htmresc/st_logo.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<h1 id="license">License</h1>
|
||||
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
|
||||
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This directory contains the driver for STM32Cube Fonts Utilities.</p>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-8">
|
||||
<h1 id="update-history">Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.0.1 / 03-April-2019</label>
|
||||
<div>
|
||||
<h2 id="changes">Changes</h2>
|
||||
<ul>
|
||||
<li>Update release notes to new format</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.0.0 / 18-February-2014</label>
|
||||
<div>
|
||||
<h2 id="changes-1">Changes</h2>
|
||||
<ul>
|
||||
<li>First official release</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
1429
USB-PD_Provider_1port/Utilities/Fonts/font12.c
Normal file
1429
USB-PD_Provider_1port/Utilities/Fonts/font12.c
Normal file
File diff suppressed because it is too large
Load diff
1809
USB-PD_Provider_1port/Utilities/Fonts/font16.c
Normal file
1809
USB-PD_Provider_1port/Utilities/Fonts/font16.c
Normal file
File diff suppressed because it is too large
Load diff
2188
USB-PD_Provider_1port/Utilities/Fonts/font20.c
Normal file
2188
USB-PD_Provider_1port/Utilities/Fonts/font20.c
Normal file
File diff suppressed because it is too large
Load diff
2582
USB-PD_Provider_1port/Utilities/Fonts/font24.c
Normal file
2582
USB-PD_Provider_1port/Utilities/Fonts/font24.c
Normal file
File diff suppressed because it is too large
Load diff
1049
USB-PD_Provider_1port/Utilities/Fonts/font8.c
Normal file
1049
USB-PD_Provider_1port/Utilities/Fonts/font8.c
Normal file
File diff suppressed because it is too large
Load diff
116
USB-PD_Provider_1port/Utilities/Fonts/fonts.h
Normal file
116
USB-PD_Provider_1port/Utilities/Fonts/fonts.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file fonts.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides definition for fonts to be used for STM32
|
||||
* board's LCD driver
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2014 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __FONTS_H
|
||||
#define __FONTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_EVAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Common
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup FONTS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FONTS_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct _tFont
|
||||
{
|
||||
const uint8_t *table;
|
||||
uint16_t Width;
|
||||
uint16_t Height;
|
||||
} sFONT;
|
||||
|
||||
extern sFONT Font24;
|
||||
extern sFONT Font20;
|
||||
extern sFONT Font16;
|
||||
extern sFONT Font12;
|
||||
extern sFONT Font8;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup FONTS_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
#define LINE(x) ((x) * (((sFONT *)BSP_LCD_GetFont())->Height))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup FONTS_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup FONTS_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FONTS_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
462
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/Release_Notes.html
Normal file
462
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/Release_Notes.html
Normal file
|
@ -0,0 +1,462 @@
|
|||
<!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>STM32 USB-C Power Delivery Graphical User Interface (GUI_INTERFACE)</title>
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="_htmresc/mini-st_2020.css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="icon" type="image/x-icon" href="_htmresc/favicon.png" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<center>
|
||||
<h1 id="release-notes-for-stm32-usb-c-power-delivery-graphical-user-interface-gui_interface">Release Notes for STM32 USB-C Power Delivery Graphical User Interface (GUI_INTERFACE)</h1>
|
||||
<p>Copyright © 2018 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="license">License</h1>
|
||||
<p>This software component is licensed by ST under BSD 3-Clause license, the “License”; You may not use this component except in compliance with the License. You may obtain a copy of the License at:</p>
|
||||
<p><a href="http://www.opensource.org/licenses/BSD-3-Clause">http://www.opensource.org/licenses/BSD-3-Clause</a></p>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This driver is used in a STM32 application (embedded side) communicating with STM32CubeMonitor-UCPD.</p>
|
||||
<p>The application can be found in ST website:</p>
|
||||
<p><a href="https://www.st.com/en/development-tools/stm32cubemonucpd.html">https://www.st.com/en/development-tools/stm32cubemonucpd.html</a></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-section16" checked aria-hidden="true"> <label for="collapse-section16" aria-hidden="true">V1.12.0 / 16-Oct.-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<h3 id="maintenance-release">Maintenance release</h3>
|
||||
<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>[Codespell] minor typo corrections</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Ticket 93706 - Errors occurred with GUI_API</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Ticket 93830 - Not possible to modify parameters Responds_to_discov and Attempts_disco</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Ticket 92751 - Add applications for STM32G0C1E-EV board</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations">Known Limitations</h2>
|
||||
<p>Outstanding bugs list : None</p>
|
||||
<p>Requirements not met or planned in a forthcoming release : None</p>
|
||||
<h2 id="development-toolchains-and-compilers">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.26</li>
|
||||
<li>STM32CubeIDE v1.2.0</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards">Supported Devices and boards</h2>
|
||||
<p>All STM32xx devices implementing a USBPD application able to communicate with CubeMonitor_UCPD</p>
|
||||
<h2 id="backward-compatibility">Backward compatibility</h2>
|
||||
<p>This version should be used after TRACER_EMB version V1.4.0 due to a remove of the prototype TRACER_EMB_WakeUpProcess</p>
|
||||
<h2 id="dependencies">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section15" aria-hidden="true"> <label for="collapse-section15" aria-hidden="true">V1.11.0 / 12-June-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<h3 id="maintenance-release-1">Maintenance release</h3>
|
||||
<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>Increase stack size linked to issue during tests</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Ticket 86356 - Correct misspelled words</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Ticket 87173 - Add a mechanism to check that GUI FLASH area is not corrupted</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Remove few parameters not used in NO_PD config</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Add “usbpd_def.h” include in gui_api.h (usbpd_def.h types used in gui_api.h)</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>GUI_PARAM_NB_TAG value not correct</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Remove wakeup trace (TRACER_EMB_WakeUpProcess prototype has been removed from TRACER_EMB)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations-1">Known Limitations</h2>
|
||||
<p>Outstanding bugs list : None</p>
|
||||
<p>Requirements not met or planned in a forthcoming release : None</p>
|
||||
<h2 id="development-toolchains-and-compilers-1">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.26</li>
|
||||
<li>STM32CubeIDE v1.2.0</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-1">Supported Devices and boards</h2>
|
||||
<p>All STM32xx devices implementing a USBPD application able to communicate with CubeMonitor_UCPD</p>
|
||||
<h2 id="backward-compatibility-1">Backward compatibility</h2>
|
||||
<p>This version should be used after TRACER_EMB version V1.4.0 due to a remove of the prototype TRACER_EMB_WakeUpProcess</p>
|
||||
<h2 id="dependencies-1">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section14" aria-hidden="true"> <label for="collapse-section14" aria-hidden="true">V1.10.2 / 13-May-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">Main Changes</h2>
|
||||
<h3 id="maintenance-release-2">Maintenance release</h3>
|
||||
<h2 id="contents-2">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Add “usbpd_def.h” include in gui_api.h (usbpd_def.h types used in gui_api.h)</p>
|
||||
<h2 id="known-limitations-2">Known Limitations</h2>
|
||||
<p>Outstanding bugs list : None</p>
|
||||
<p>Requirements not met or planned in a forthcoming release : None</p>
|
||||
<h2 id="development-toolchains-and-compilers-2">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.26</li>
|
||||
<li>STM32CubeIDE v1.2.0</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-2">Supported Devices and boards</h2>
|
||||
<p>All STM32xx devices implementing a USBPD application able to communicate with CubeMonitor_UCPD</p>
|
||||
<h2 id="backward-compatibility-2">Backward compatibility</h2>
|
||||
<p>No compatibility break with previous version</p>
|
||||
<h2 id="dependencies-2">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section13" aria-hidden="true"> <label for="collapse-section13" aria-hidden="true">V1.10.1 / 14-Apr.-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<h3 id="maintenance-release-3">Maintenance release</h3>
|
||||
<h2 id="contents-3">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– User functions for VDM display port should be under switch VDM only</p>
|
||||
<h2 id="known-limitations-3">Known Limitations</h2>
|
||||
<p>Outstanding bugs list : None</p>
|
||||
<p>Requirements not met or planned in a forthcoming release : None</p>
|
||||
<h2 id="development-toolchains-and-compilers-3">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.26</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-3">Supported Devices and boards</h2>
|
||||
<p>All STM32xx devices implementing a USBPD application able to communicate with CubeMonitor_UCPD</p>
|
||||
<h2 id="backward-compatibility-3">Backward compatibility</h2>
|
||||
<p>No compatibility break with previous version</p>
|
||||
<h2 id="dependencies-3">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section12" aria-hidden="true"> <label for="collapse-section12" aria-hidden="true">V1.10.0 / 07-Apr.-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-4">Main Changes</h2>
|
||||
<h3 id="maintenance-release-4">Maintenance release</h3>
|
||||
<h2 id="contents-4">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Move TASK ID from Core/inc/usbpd_task.h yo applications/inc/utilities_conf.h Add switch USE_STM32_UTILITY_OS to integrate SEQUENCER utility - bis Add switch USE_STM32_UTILITY_OS to integrate SEQUENCER utility Ticket 81002 - unwanted include file in gui_api.h integration of the new utilities SEQ to handle GUI task in non RTOS mode</p>
|
||||
<h2 id="known-limitations-4">Known Limitations</h2>
|
||||
<p>Outstanding bugs list : None</p>
|
||||
<p>Requirements not met or planned in a forthcoming release : None</p>
|
||||
<h2 id="development-toolchains-and-compilers-4">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.26</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-4">Supported Devices and boards</h2>
|
||||
<p>All STM32xx devices implementing a USBPD application able to communicate with CubeMonitor_UCPD</p>
|
||||
<h2 id="backward-compatibility-4">Backward compatibility</h2>
|
||||
<p>No compatibility break with previous version</p>
|
||||
<h2 id="dependencies-4">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section12" aria-hidden="true"> <label for="collapse-section12" aria-hidden="true">V1.9.0 / 15-Nov-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-5">Main Changes</h2>
|
||||
<h3 id="maintenance-release-5">Maintenance release</h3>
|
||||
<h2 id="contents-5">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Ticket 74534 - clean code linked to USBPD_CORE_DATATYPE_REQUEST_DO Ticket 71492 - PE_Dataswap parameter needs to be duplicated in gui_api Ticket 74120 - Compilation issue in case of GUI_INTERFACE use without FreeRTOS Ticket 73678 - Initialize CAD_tDRP & CAD_dcSRC_DRP at GUI initialization Ticket 73064 - SNK_extended_cap must be answered while SNK or DRP Remove warning in NRTOS mode Remove dependence with USBPD internal variable</p>
|
||||
<h2 id="known-limitations-5">Known Limitations</h2>
|
||||
<p>Outstanding bugs list : None</p>
|
||||
<p>Requirements not met or planned in a forthcoming release : None</p>
|
||||
<h2 id="development-toolchains-and-compilers-5">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.26</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-5">Supported Devices and boards</h2>
|
||||
<p>All STM32xx devices implementing a USBPD application able to communicate with CubeMonitor_UCPD</p>
|
||||
<h2 id="backward-compatibility-5">Backward compatibility</h2>
|
||||
<p>No compatibility break with previous version</p>
|
||||
<h2 id="dependencies-5">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section11" aria-hidden="true"> <label for="collapse-section11" aria-hidden="true">V1.8.0 / 06-Sept-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-6">Main Changes</h2>
|
||||
<h3 id="maintenance-release-6">Maintenance release</h3>
|
||||
<h2 id="contents-6">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– [USBPD][GUI] Increase GUI_STACK_SIZE_ADDON_FOR_CMSIS in case of CMSIS OS V2. [USBPD][GUI] Ticket 66690 - [FOSS-Audit] SLA0044 headers in Utilities files [USBPD][GUI] Ticket 71488 - project settings (and also behavior) differs vs _Gui_Interface switch activation [USBPD][GUI] Remove useless include file + use of Nb ports define for USBPD_NbPDO initialisation [USBPD][GUI] Update in template of usbpd_gui_memmap_template.h [USBPD][GUI] Ticket 70835 - PE_Dataswap parameter needs to be duplicated in gui_api [USBPD][GUI] Update in Flash erase function to be able to address F0/G0/G4 and L5 Dual bank flashes [USBPD][GUI]rename GUI_NbPDO to USBPD_NbPDO [USBPD][GUI] All the DPM_User_Settings should be initialized to be able to pass MQP tests [USBPD][GUI] Set DataRoleSwap as TRUE when GUI is enabled [USBPD][GUI] Move PE_DataSwap & PE_VconnSwap in the USBPD_USER_SettingsTypeDef for integration in cubeMX [USBPD][GUI] Ticket 67078 - Use common defines for XID, VID & PID [USBPD][GUI] Ticket 66284 - [CubeMx-UBSPD] Update generated code to make it compatible with CMSIS-RTOS v2</p>
|
||||
<h2 id="known-limitations-6">Known Limitations</h2>
|
||||
<p>Outstanding bugs list : None</p>
|
||||
<p>Requirements not met or planned in a forthcoming release : None</p>
|
||||
<h2 id="development-toolchains-and-compilers-6">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.26</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-6">Supported Devices and boards</h2>
|
||||
<p>All STM32xx devices implementing a USBPD application able to communicate with CubeMonitor_UCPD</p>
|
||||
<h2 id="backward-compatibility-6">Backward compatibility</h2>
|
||||
<p>No compatibility break with previous version</p>
|
||||
<h2 id="dependencies-6">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section10" aria-hidden="true"> <label for="collapse-section10" aria-hidden="true">V1.7.0 / 23-May-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-7">Main Changes</h2>
|
||||
<h3 id="maintenance-release-7">Maintenance release</h3>
|
||||
<h2 id="contents-7">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Ticket 62471 - Solve Hard Fault called from usage of UCPD voltage calculation using FPU for UCPD Ticket 66412 - Allow communication with CubeMonitor-UCPD from CubeMx generated examples (from CubeMx 5.2.1) Ticket 66638 - SLA0044 headers in files updated to BSD-3-Clause Ticket 67146 - Add memory mapping template in GUI utility (template to be used in user code)</p>
|
||||
<h2 id="known-limitations-7">Known Limitations</h2>
|
||||
<p>Outstanding bugs list : None</p>
|
||||
<p>Requirements not met or planned in a forthcoming release : None</p>
|
||||
<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>
|
||||
<p>All STM32xx devices implementing a USBPD application able to communicate with CubeMonitor_UCPD</p>
|
||||
<h2 id="backward-compatibility-7">Backward compatibility</h2>
|
||||
<p>No compatibility break with previous version</p>
|
||||
<h2 id="dependencies-7">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section9" aria-hidden="true"> <label for="collapse-section9" aria-hidden="true">V1.6.0 / 10-April-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-8">Main Changes</h2>
|
||||
<h3 id="maintenance-release-8">Maintenance release</h3>
|
||||
<h2 id="contents-8">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Update to wakeup the TX send Ticket 62412 - Sink request using GUI seems not coherent with registered SNKPDOs (GUI impact) Ticket 62344 - [GUI] Display a warning message in GUI in case of information comes from previous saving done by user Remove sModesInfo as no more used Re-enable IT when FreeRTOS is used Renable SYSTICK after calling FreeRTOS function Ticket 61311 - [MB1303] integration of GUI interface Add Free text outside _VDM switch GUI regression after moving GUI from DPM - use GUIMsgBox instead of DPMMsgBox GUIMsgBox used only in case of _RTOS Remove dependencies with GUI in DPM USER code Manage Free Text Ticket 60213 - STM32G071B-DISCO_Demonstrations_USBPD_Analyzer_SW4STM32_Compilation Warnings Add include for G4</p>
|
||||
<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>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section8" aria-hidden="true"> <label for="collapse-section8" aria-hidden="true">V1.5.0 / 28-Jan-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-9">Main Changes</h2>
|
||||
<h3 id="maintenance-release-9">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-9">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Ticket 60213 - STM32G071B-DISCO_Demonstrations_USBPD_Analyzer_SW4STM32_Compilation Warnings. Modifications in GUI_INTERFACE module for solving compilation warnings under SW4STM32 (Gcc)</p>
|
||||
<h2 id="known-limitations-9">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-9">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-9">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-9">backward compatibility</h2>
|
||||
<h2 id="dependencies-9">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true">V1.4.0 / 19-Dec-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-10">Main Changes</h2>
|
||||
<h3 id="maintenance-release-10">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-10">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– correction link with renaming toogle toggle Ticket 57478 - SKEDB not implemented Remove extern GUI_Flag variable from application</p>
|
||||
<h2 id="known-limitations-10">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-10">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-10">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-10">backward compatibility</h2>
|
||||
<h2 id="dependencies-10">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section6" aria-hidden="true"> <label for="collapse-section6" aria-hidden="true">V1.3.0 / 10-Dec-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-11">Main Changes</h2>
|
||||
<h3 id="maintenance-release-11">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-11">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Ticket 57478 - SKEDB not implemented Remove extern GUI_Flag variable from application</p>
|
||||
<h2 id="known-limitations-11">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-11">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-11">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-11">backward compatibility</h2>
|
||||
<h2 id="dependencies-11">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section5" aria-hidden="true"> <label for="collapse-section5" aria-hidden="true">V1.2.0 / 15-Nov-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-12">Main Changes</h2>
|
||||
<h3 id="maintenance-release-12">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-12">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– rename DPM_User_Params to GUI_User_Params add a link with TRACER_EMB solve compilation issue</p>
|
||||
<h2 id="known-limitations-12">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-12">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-12">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-12">backward compatibility</h2>
|
||||
<h2 id="dependencies-12">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true">V1.1.2 / 25-Sept.-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-13">Main Changes</h2>
|
||||
<h3 id="maintenance-release-13">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-13">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Update License information Solve compilation issue when using IAR V8.30.1 Add ping feature</p>
|
||||
<h2 id="known-limitations-13">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-13">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-13">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-13">backward compatibility</h2>
|
||||
<h2 id="dependencies-13">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section3" aria-hidden="true"> <label for="collapse-section3" aria-hidden="true">V1.1.1 / 10-Sept.-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-14">Main Changes</h2>
|
||||
<h3 id="maintenance-release-14">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-14">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Remove compilation warning</p>
|
||||
<h2 id="known-limitations-14">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-14">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-14">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-14">backward compatibility</h2>
|
||||
<h2 id="dependencies-14">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.1.0 / 06-Sept.-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-15">Main Changes</h2>
|
||||
<h3 id="maintenance-release-15">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-15">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– Add cable information management Update around the VDM data (SVID, SVDM modes, … )</p>
|
||||
<h2 id="known-limitations-15">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-15">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-15">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-15">backward compatibility</h2>
|
||||
<h2 id="dependencies-15">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.0.0 / 19-Jun-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-16">Main Changes</h2>
|
||||
<h3 id="maintenance-release-16">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-16">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong> Headline ——– First official version for STM32 USB-PD GUI Interface utility. This utility enables communication between USB-PD device (controlled on STM32 side) and USB-PD PC tool</p>
|
||||
<h2 id="known-limitations-16">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-16">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-16">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-16">backward compatibility</h2>
|
||||
<h2 id="dependencies-16">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
<p>For complete documentation on STM32,visit: [<a href="http://www.st.com">www.st.com/stm32</a>]</p>
|
||||
This release note uses up to date web standards and, for this reason, should not be opened with Internet Explorer but preferably with popular browsers such as Google Chrome, Mozilla Firefox, Opera or Microsoft Edge.
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 4 KiB |
1700
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/_htmresc/mini-st.css
Normal file
1700
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/_htmresc/mini-st.css
Normal file
File diff suppressed because it is too large
Load diff
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 |
398
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/bsp_gui.c
Normal file
398
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/bsp_gui.c
Normal file
|
@ -0,0 +1,398 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file bsp_gui.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains phy interface control functions.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#if defined(_GUI_INTERFACE)
|
||||
#include "bsp_gui.h"
|
||||
#include "usbpd_dpm_conf.h"
|
||||
#if GUI_FLASH_MAGIC_NUMBER
|
||||
#include "usbpd_trace.h"
|
||||
#include "tracer_emb.h"
|
||||
#endif /* GUI_FLASH_MAGIC_NUMBER */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private Defines */
|
||||
extern USBPD_SettingsTypeDef DPM_Settings[USBPD_PORT_COUNT];
|
||||
extern uint8_t USBPD_NbPDO[4];
|
||||
#if defined(_VDM)
|
||||
extern USBPD_VDM_SettingsTypeDef DPM_VDM_Settings[USBPD_PORT_COUNT];
|
||||
#endif /* _VDM */
|
||||
#if GUI_FLASH_MAGIC_NUMBER
|
||||
uint64_t MagicNumber = 0xDEADBABEDEADF00DU;
|
||||
#endif /* GUI_FLASH_MAGIC_NUMBER */
|
||||
/* Private Macro */
|
||||
#if GUI_FLASH_MAGIC_NUMBER
|
||||
#define GUI_CHECK_IF_MEMORY_IS_CORRUPTED(__ADDR__)
|
||||
#else
|
||||
#define GUI_CHECK_IF_MEMORY_IS_CORRUPTED(__ADDR__) if (0xFFFFFFFFu != *((uint32_t*)(__ADDR__)))
|
||||
#endif /* GUI_FLASH_MAGIC_NUMBER */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
static GUI_StatusTypeDef LoadPDOFromFlash(uint32_t Address, uint32_t *pListOfPDO);
|
||||
static GUI_StatusTypeDef LoadSettingsFromFlash(uint32_t Address, uint32_t *pSettings, uint32_t Size);
|
||||
static GUI_StatusTypeDef SavePDOInFlash(uint32_t Address, uint32_t* pListOfPDO);
|
||||
static GUI_StatusTypeDef SaveSettingsInFlash(uint32_t Address, uint32_t *pSettings, uint32_t Size);
|
||||
|
||||
GUI_StatusTypeDef BSP_GUI_LoadDataFromFlash(void)
|
||||
{
|
||||
GUI_StatusTypeDef _status = GUI_ERROR;
|
||||
#if GUI_FLASH_MAGIC_NUMBER
|
||||
uint32_t _addr = GUI_FLASH_MAGIC_NUMBER;
|
||||
#else
|
||||
uint32_t _addr = GUI_FLASH_ADDR_NB_PDO_SNK_P0;
|
||||
#endif /* GUI_FLASH_MAGIC_NUMBER */
|
||||
|
||||
/* Check that we did not reach the end of page */
|
||||
if (GUI_FLASH_SIZE_RESERVED < 0)
|
||||
{
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
#if GUI_FLASH_MAGIC_NUMBER
|
||||
/* check that GUI area has not been corrupted */
|
||||
if ((0xFFFFFFFFu != *((uint32_t*)_addr)) && (MagicNumber != *((uint64_t*)_addr)))
|
||||
{
|
||||
/* Memory has been corrupted */
|
||||
USBPD_TRACE_Add(USBPD_TRACE_DEBUG, 0U, 0U, (uint8_t*)"GUI Memory is corrupted", sizeof("GUI Memory is corrupted"));
|
||||
goto _exit;
|
||||
}
|
||||
if (0xFFFFFFFFu == *((uint32_t*)_addr))
|
||||
{
|
||||
/* Memory is empty no need to retrieve data from GUI area */
|
||||
goto _exit;
|
||||
}
|
||||
_addr = GUI_FLASH_ADDR_NB_PDO_SNK_P0;
|
||||
#endif /* GUI_FLASH_MAGIC_NUMBER */
|
||||
|
||||
GUI_CHECK_IF_MEMORY_IS_CORRUPTED(_addr)
|
||||
{
|
||||
uint32_t* _ptr = (uint32_t*)USBPD_NbPDO;
|
||||
USPBPD_WRITE32 (_ptr,*((uint32_t*)_addr));
|
||||
_status = GUI_OK;
|
||||
}
|
||||
|
||||
#if defined(_SRC) || defined(_DRP)
|
||||
/* Save PORT0_PDO_ListSRC */
|
||||
_status |= LoadPDOFromFlash(GUI_FLASH_ADDR_PDO_SRC_P0, PORT0_PDO_ListSRC);
|
||||
#endif /* _SRC || _DRP */
|
||||
|
||||
#if defined(_SNK) || defined(_DRP)
|
||||
/* Save PORT0_PDO_ListSNK */
|
||||
_status |= LoadPDOFromFlash(GUI_FLASH_ADDR_PDO_SNK_P0, PORT0_PDO_ListSNK);
|
||||
#endif /* _SNK || _DRP */
|
||||
|
||||
#if USBPD_PORT_COUNT==2
|
||||
#if defined(_SRC) || defined(_DRP)
|
||||
/* Save PORT1_PDO_ListSRC */
|
||||
_status |= LoadPDOFromFlash(GUI_FLASH_ADDR_PDO_SRC_P1, PORT1_PDO_ListSRC);
|
||||
#endif /* _SRC || _DRP */
|
||||
|
||||
#if defined(_SNK) || defined(_DRP)
|
||||
/* Save PORT1_PDO_ListSNK */
|
||||
_status |= LoadPDOFromFlash(GUI_FLASH_ADDR_PDO_SNK_P1, PORT1_PDO_ListSNK);
|
||||
#endif /* _SNK || _DRP */
|
||||
#endif /* USBPD_PORT_COUNT==2 */
|
||||
|
||||
/* Save DPM_Settings of port 0 */
|
||||
_status |= LoadSettingsFromFlash(GUI_FLASH_ADDR_DPM_SETTINGS, (uint32_t*)DPM_Settings, sizeof(USBPD_SettingsTypeDef) * USBPD_PORT_COUNT);
|
||||
|
||||
#if defined(GUI_FLASH_ADDR_DPM_ID_SETTINGS)
|
||||
/* Save DPM_ID_Settings */
|
||||
_status |= LoadSettingsFromFlash(GUI_FLASH_ADDR_DPM_ID_SETTINGS, (uint32_t*)DPM_ID_Settings, sizeof(USBPD_IdSettingsTypeDef) * USBPD_PORT_COUNT);
|
||||
#endif /* GUI_FLASH_ADDR_DPM_ID_SETTINGS */
|
||||
|
||||
/* Save DPM_Settings of port 0 */
|
||||
_status |= LoadSettingsFromFlash(GUI_FLASH_ADDR_DPM_USER_SETTINGS, (uint32_t*)DPM_USER_Settings, sizeof(USBPD_USER_SettingsTypeDef) * USBPD_PORT_COUNT);
|
||||
#if defined(GUI_FLASH_ADDR_DPM_ID_SETTINGS)
|
||||
/* Overwrite ID Settings in DPM_USER_Settings */
|
||||
#if defined(USBPD_REV30_SUPPORT)
|
||||
#if _SRC_CAPA_EXT && (defined(_SRC)||defined(_DRP))
|
||||
DPM_USER_Settings[USBPD_PORT_0].DPM_SRCExtendedCapa.XID = DPM_ID_Settings[USBPD_PORT_0].XID;
|
||||
DPM_USER_Settings[USBPD_PORT_0].DPM_SRCExtendedCapa.VID = DPM_ID_Settings[USBPD_PORT_0].VID;
|
||||
DPM_USER_Settings[USBPD_PORT_0].DPM_SRCExtendedCapa.PID = DPM_ID_Settings[USBPD_PORT_0].PID;
|
||||
#if USBPD_PORT_COUNT==2
|
||||
DPM_USER_Settings[USBPD_PORT_1].DPM_SRCExtendedCapa.XID = DPM_ID_Settings[USBPD_PORT_1].XID;
|
||||
DPM_USER_Settings[USBPD_PORT_1].DPM_SRCExtendedCapa.VID = DPM_ID_Settings[USBPD_PORT_1].VID;
|
||||
DPM_USER_Settings[USBPD_PORT_1].DPM_SRCExtendedCapa.PID = DPM_ID_Settings[USBPD_PORT_1].PID;
|
||||
#endif /* USBPD_PORT_COUNT==2 */
|
||||
#endif /* _SRC_CAPA_EXT && (_SRC || _DRP) */
|
||||
#if defined(_SNK)||defined(_DRP)
|
||||
DPM_USER_Settings[USBPD_PORT_0].DPM_SNKExtendedCapa.XID = DPM_ID_Settings[USBPD_PORT_0].XID;
|
||||
DPM_USER_Settings[USBPD_PORT_0].DPM_SNKExtendedCapa.VID = DPM_ID_Settings[USBPD_PORT_0].VID;
|
||||
DPM_USER_Settings[USBPD_PORT_0].DPM_SNKExtendedCapa.PID = DPM_ID_Settings[USBPD_PORT_0].PID;
|
||||
#if USBPD_PORT_COUNT==2
|
||||
DPM_USER_Settings[USBPD_PORT_1].DPM_SNKExtendedCapa.XID = DPM_ID_Settings[USBPD_PORT_1].XID;
|
||||
DPM_USER_Settings[USBPD_PORT_1].DPM_SNKExtendedCapa.VID = DPM_ID_Settings[USBPD_PORT_1].VID;
|
||||
DPM_USER_Settings[USBPD_PORT_1].DPM_SNKExtendedCapa.PID = DPM_ID_Settings[USBPD_PORT_1].PID;
|
||||
#endif /* USBPD_PORT_COUNT==2 */
|
||||
#endif /* _SNK || _DRP */
|
||||
#if _MANU_INFO
|
||||
DPM_USER_Settings[USBPD_PORT_0].DPM_ManuInfoPort.VID = DPM_ID_Settings[USBPD_PORT_0].VID;
|
||||
DPM_USER_Settings[USBPD_PORT_0].DPM_ManuInfoPort.PID = DPM_ID_Settings[USBPD_PORT_0].PID;
|
||||
#if USBPD_PORT_COUNT==2
|
||||
DPM_USER_Settings[USBPD_PORT_1].DPM_ManuInfoPort.VID = DPM_ID_Settings[USBPD_PORT_1].VID;
|
||||
DPM_USER_Settings[USBPD_PORT_1].DPM_ManuInfoPort.PID = DPM_ID_Settings[USBPD_PORT_1].PID;
|
||||
#endif /* USBPD_PORT_COUNT==2 */
|
||||
#endif /* _MANU_INFO */
|
||||
#endif /* USBPD_REV30_SUPPORT */
|
||||
#endif /* GUI_FLASH_ADDR_DPM_ID_SETTINGS */
|
||||
|
||||
#if defined(_VDM)
|
||||
/* Save DPM_Settings of port 0 */
|
||||
_status |= LoadSettingsFromFlash(GUI_FLASH_ADDR_DPM_VDM_SETTINGS, (uint32_t*)DPM_VDM_Settings, sizeof(USBPD_VDM_SettingsTypeDef) * USBPD_PORT_COUNT);
|
||||
#if defined(GUI_FLASH_ADDR_DPM_ID_SETTINGS)
|
||||
/* Overwrite ID Settings in VDM settings */
|
||||
DPM_VDM_Settings[USBPD_PORT_0].VDM_XID_SOP = DPM_ID_Settings[USBPD_PORT_0].XID;
|
||||
DPM_VDM_Settings[USBPD_PORT_0].VDM_USB_VID_SOP = DPM_ID_Settings[USBPD_PORT_0].VID;
|
||||
DPM_VDM_Settings[USBPD_PORT_0].VDM_PID_SOP = DPM_ID_Settings[USBPD_PORT_0].PID;
|
||||
#if USBPD_PORT_COUNT==2
|
||||
DPM_VDM_Settings[USBPD_PORT_1].VDM_XID_SOP = DPM_ID_Settings[USBPD_PORT_1].XID;
|
||||
DPM_VDM_Settings[USBPD_PORT_1].VDM_USB_VID_SOP = DPM_ID_Settings[USBPD_PORT_1].VID;
|
||||
DPM_VDM_Settings[USBPD_PORT_1].VDM_PID_SOP = DPM_ID_Settings[USBPD_PORT_1].PID;
|
||||
#endif /* USBPD_PORT_COUNT==2 */
|
||||
#endif /* _VDM */
|
||||
#endif /* GUI_FLASH_ADDR_DPM_ID_SETTINGS */
|
||||
|
||||
_exit:
|
||||
return _status;
|
||||
}
|
||||
|
||||
GUI_StatusTypeDef BSP_GUI_SaveDataInFlash(void)
|
||||
{
|
||||
GUI_StatusTypeDef status = GUI_ERROR;
|
||||
FLASH_EraseInitTypeDef erase_init;
|
||||
uint32_t page_error;
|
||||
|
||||
/* Disable interrupts */
|
||||
__disable_irq();
|
||||
|
||||
/* Init Flash registers for writing */
|
||||
HAL_FLASH_Unlock();
|
||||
|
||||
/* Erase the page associated to the GUI parameters */
|
||||
erase_init.TypeErase = FLASH_TYPEERASE_PAGES;
|
||||
#if defined(STM32F072xB)|| defined(STM32F051x8)
|
||||
erase_init.PageAddress = ADDR_FLASH_LAST_PAGE;
|
||||
#else
|
||||
erase_init.Page = INDEX_PAGE;
|
||||
#endif /* STM32F072xB || STM32F051x8 */
|
||||
#if defined (FLASH_OPTR_DBANK)
|
||||
erase_init.Banks = FLASH_BANK_2;
|
||||
#endif /* FLASH_OPTR_DBANK */
|
||||
erase_init.NbPages = 1;
|
||||
|
||||
#if defined(FLASH_SR_OPTVERR)
|
||||
/* Specific handling of STM32G0 and STM32G4 flash devices for allowing erase operations */
|
||||
if(FLASH->SR != 0x00)
|
||||
{
|
||||
FLASH->SR = FLASH_SR_OPTVERR;
|
||||
}
|
||||
#endif
|
||||
status = (HAL_OK == HAL_FLASHEx_Erase(&erase_init, &page_error)) ? GUI_OK : GUI_ERASE_ERROR;
|
||||
|
||||
/* If Erase is OK, program the new data */
|
||||
if ((0xFFFFFFFF == page_error) && (GUI_OK == status))
|
||||
{
|
||||
#if GUI_FLASH_MAGIC_NUMBER
|
||||
/* Save magic Number */
|
||||
status = (HAL_OK == HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, GUI_FLASH_MAGIC_NUMBER, MagicNumber)) ? GUI_OK : GUI_WRITE_ERROR;
|
||||
#endif /* GUI_FLASH_MAGIC_NUMBER */
|
||||
|
||||
#ifdef GUI_FLASH_ADDR_NB_PDO_SNK_P0
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
/* Save the nb of sink and src PDO */
|
||||
uint64_t value = 0;
|
||||
value |= USBPD_NbPDO[0];
|
||||
value |= (USBPD_NbPDO[1] << 8);
|
||||
value |= (USBPD_NbPDO[2] << 16);
|
||||
value |= (USBPD_NbPDO[3] << 24);
|
||||
status = (HAL_OK == HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, GUI_FLASH_ADDR_NB_PDO_SNK_P0, value)) ? GUI_OK : GUI_WRITE_ERROR;
|
||||
}
|
||||
#endif /* GUI_FLASH_ADDR_NB_PDO_SNK_P0 */
|
||||
|
||||
#if defined(_SRC) || defined(_DRP)
|
||||
/* Save PORT0_PDO_ListSRC */
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
status = SavePDOInFlash(GUI_FLASH_ADDR_PDO_SRC_P0, PORT0_PDO_ListSRC);
|
||||
}
|
||||
#endif /* _SRC || _DRP */
|
||||
|
||||
#if defined(_SNK) || defined(_DRP)
|
||||
/* Save PORT0_PDO_ListSNK */
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
status = SavePDOInFlash(GUI_FLASH_ADDR_PDO_SNK_P0, PORT0_PDO_ListSNK);
|
||||
}
|
||||
#endif /* _SNK || _DRP */
|
||||
|
||||
#if USBPD_PORT_COUNT==2
|
||||
#if defined(_SRC) || defined(_DRP)
|
||||
/* Save PORT1_PDO_ListSRC */
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
status = SavePDOInFlash(GUI_FLASH_ADDR_PDO_SRC_P1, PORT1_PDO_ListSRC);
|
||||
}
|
||||
#endif /* _SRC || _DRP */
|
||||
|
||||
#if defined(_SNK) || defined(_DRP)
|
||||
/* Save PORT1_PDO_ListSNK */
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
status = SavePDOInFlash(GUI_FLASH_ADDR_PDO_SNK_P1, PORT1_PDO_ListSNK);
|
||||
}
|
||||
#endif /* _SNK || _DRP */
|
||||
#endif /* USBPD_PORT_COUNT==2 */
|
||||
|
||||
/* Save DPM_Settings of port 0 */
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
status = SaveSettingsInFlash(GUI_FLASH_ADDR_DPM_SETTINGS, (uint32_t*)DPM_Settings, sizeof(USBPD_SettingsTypeDef) * USBPD_PORT_COUNT);
|
||||
}
|
||||
|
||||
#if defined(GUI_FLASH_ADDR_DPM_ID_SETTINGS)
|
||||
/* Save DPM_ID_Settings */
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
status = SaveSettingsInFlash(GUI_FLASH_ADDR_DPM_ID_SETTINGS, (uint32_t*)DPM_ID_Settings, sizeof(USBPD_IdSettingsTypeDef));
|
||||
}
|
||||
#endif /* GUI_FLASH_ADDR_DPM_ID_SETTINGS */
|
||||
|
||||
/* Save DPM_Settings of port 0 */
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
status = SaveSettingsInFlash(GUI_FLASH_ADDR_DPM_USER_SETTINGS, (uint32_t*)DPM_USER_Settings, sizeof(USBPD_USER_SettingsTypeDef) * USBPD_PORT_COUNT);
|
||||
}
|
||||
|
||||
#if defined(_VDM)
|
||||
/* Save DPM_Settings of port 0 */
|
||||
if (GUI_OK == status)
|
||||
{
|
||||
status = SaveSettingsInFlash(GUI_FLASH_ADDR_DPM_VDM_SETTINGS, (uint32_t*)DPM_VDM_Settings, sizeof(USBPD_VDM_SettingsTypeDef) * USBPD_PORT_COUNT);
|
||||
}
|
||||
#endif /* _VDM */
|
||||
}
|
||||
|
||||
/* Lock the flash after end of operations */
|
||||
HAL_FLASH_Lock();
|
||||
|
||||
/* Enable interrupts */
|
||||
__enable_irq();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static GUI_StatusTypeDef SavePDOInFlash(uint32_t Address, uint32_t *pListOfPDO)
|
||||
{
|
||||
uint64_t data_in_64;
|
||||
uint32_t index, index_flash;
|
||||
uint32_t value[2];
|
||||
GUI_StatusTypeDef status = GUI_OK;
|
||||
|
||||
for (index = 0, index_flash = 0; ((index < USBPD_MAX_NB_PDO) && (GUI_OK == status)); index++, index_flash++)
|
||||
{
|
||||
value[0] = pListOfPDO[index];
|
||||
index++;
|
||||
if (index < USBPD_MAX_NB_PDO)
|
||||
{
|
||||
value[1] = pListOfPDO[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
value[1] = (0xFFFFFFFF);
|
||||
}
|
||||
|
||||
data_in_64 = value[0] | (uint64_t)value[1] << 32;
|
||||
|
||||
/* Save in the FLASH */
|
||||
status = HAL_OK == HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, (Address + (8 * index_flash)) , data_in_64) ? GUI_OK : GUI_WRITE_ERROR;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static GUI_StatusTypeDef SaveSettingsInFlash(uint32_t Address, uint32_t *pSettings, uint32_t Size)
|
||||
{
|
||||
uint64_t data_in_64;
|
||||
uint32_t index, index_flash;
|
||||
uint32_t value[2];
|
||||
GUI_StatusTypeDef status = GUI_OK;
|
||||
|
||||
uint32_t nb_double = ((Size * USBPD_PORT_COUNT) / 4);
|
||||
uint8_t remaining = ((Size * USBPD_PORT_COUNT) % 4);
|
||||
|
||||
/* Save Settings in the FLASH */
|
||||
for (index = 0, index_flash = 0; ((index < nb_double) && (GUI_OK == status)); index++, index_flash++)
|
||||
{
|
||||
value[0] = pSettings[index];
|
||||
index++;
|
||||
if (index < nb_double)
|
||||
{
|
||||
value[1] = pSettings[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 == remaining)
|
||||
value[1] = (0xFFFFFFFF);
|
||||
else
|
||||
while(1);
|
||||
}
|
||||
|
||||
data_in_64 = value[0] | (uint64_t)value[1] << 32;
|
||||
|
||||
/* Save in the FLASH */
|
||||
status = HAL_OK == HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, (Address + (8 * index_flash)) , data_in_64)? GUI_OK : GUI_WRITE_ERROR;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static GUI_StatusTypeDef LoadPDOFromFlash(uint32_t Address, uint32_t *pListOfPDO)
|
||||
{
|
||||
uint32_t _addr = Address;
|
||||
GUI_StatusTypeDef _status = GUI_ERROR;
|
||||
|
||||
/* Check if FLASH is not empty to retrieve the data. Nethertheless keep data in the RAM */
|
||||
GUI_CHECK_IF_MEMORY_IS_CORRUPTED(_addr)
|
||||
{
|
||||
uint32_t _index;
|
||||
for (_index = 0; _index < USBPD_MAX_NB_PDO; _index++)
|
||||
{
|
||||
pListOfPDO[_index] = *((uint32_t*)_addr);
|
||||
_addr = _addr + 4u;
|
||||
}
|
||||
_status = GUI_OK;
|
||||
}
|
||||
return _status;
|
||||
}
|
||||
|
||||
static GUI_StatusTypeDef LoadSettingsFromFlash(uint32_t Address, uint32_t *pSettings, uint32_t Size)
|
||||
{
|
||||
uint32_t _addr = Address;
|
||||
GUI_StatusTypeDef _status = GUI_ERROR;
|
||||
|
||||
/* Check if FLASH is not empty to retrieve the data. Nethertheless keep data in the RAM */
|
||||
GUI_CHECK_IF_MEMORY_IS_CORRUPTED(_addr)
|
||||
{
|
||||
memcpy(pSettings, ((uint32_t*)_addr), Size);
|
||||
_status = GUI_OK;
|
||||
}
|
||||
return _status;
|
||||
}
|
||||
#endif /* _GUI_INTERFACE */
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
56
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/bsp_gui.h
Normal file
56
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/bsp_gui.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file bsp_gui.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains bsp interface control functions.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef BSP_GUI_H
|
||||
#define BSP_GUI_H
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usbpd_gui_memmap.h"
|
||||
#include "gui_api.h"
|
||||
#if defined(_VDM)
|
||||
#include "usbpd_vdm_user.h"
|
||||
#endif /* _VDM */
|
||||
#include "string.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
typedef enum {
|
||||
GUI_OK,
|
||||
GUI_ERASE_ERROR,
|
||||
GUI_WRITE_ERROR,
|
||||
GUI_ERROR
|
||||
} GUI_StatusTypeDef;
|
||||
|
||||
/* Variable containing ADC conversions results */
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Load User settings from FLASH if GUI saving area is not empty (0xFFFFFFFF)
|
||||
* @retval GUI status state (GUI_OK: USER Settings from GUI saving area else from original FW)
|
||||
*/
|
||||
GUI_StatusTypeDef BSP_GUI_LoadDataFromFlash(void);
|
||||
|
||||
/**
|
||||
* @brief Save User settings in GUI saving area
|
||||
* @retval GUI status state
|
||||
*/
|
||||
GUI_StatusTypeDef BSP_GUI_SaveDataInFlash(void);
|
||||
|
||||
#endif /* BSP_GUI_H */
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
256
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/data_struct_tlv.c
Normal file
256
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/data_struct_tlv.c
Normal file
|
@ -0,0 +1,256 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file data_struct_tlv.c
|
||||
* @author MCD Application Team
|
||||
* @brief data_struct_tlv provides function to manipulate TLV structures
|
||||
* and/or strings.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#if defined(_GUI_INTERFACE)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "data_struct_tlv.h"
|
||||
|
||||
/**
|
||||
* @brief TLV_init_encode initializes a TLV_ToSend_Data structure, to have it ready to be used with TLV_add.
|
||||
* @note TLV_add and TLV_deinit_encode must not be called without calling this function first.
|
||||
* SOF and EOF are created too.
|
||||
* @param ToSendTLV The TLV_ToSend_Data structure that will be used.
|
||||
* @param Tag The Tag to put as the master Tag in this instruction.
|
||||
* @param SizeMax The maximal size of the instruction. Will be used to protect writing against overflow.
|
||||
* @param Ptr A pointer to the value. This function does not allocate memory, it is the user's responsibility to allocate this.
|
||||
* @return 0 if everything went fine, 0xFF otherwise.
|
||||
*/
|
||||
uint8_t TLV_init_encode(TLV_ToSend_Data *ToSendTLV, uint8_t Tag, uint16_t SizeMax, uint8_t *Ptr)
|
||||
{
|
||||
if(Ptr == NULL) return 0xFF; /* Buffer is NULL*/
|
||||
if(SizeMax < 11) return 0xFF; /* Because of his small max size, the buffer can't even receive one empty TLV*/
|
||||
|
||||
ToSendTLV->data = Ptr;
|
||||
ToSendTLV->maxSize = SizeMax;
|
||||
|
||||
ToSendTLV->data[0]
|
||||
= ToSendTLV->data[1]
|
||||
= ToSendTLV->data[2]
|
||||
= ToSendTLV->data[3] = TLV_SOF; /* SOF*/
|
||||
|
||||
ToSendTLV->data[4] = Tag; /* Tag*/
|
||||
|
||||
ToSendTLV->data[5]
|
||||
= ToSendTLV->data[6] = 0; /* Size*/
|
||||
|
||||
ToSendTLV->data[7]
|
||||
= ToSendTLV->data[8]
|
||||
= ToSendTLV->data[9]
|
||||
= ToSendTLV->data[10] = TLV_EOF; /* EOF*/
|
||||
|
||||
ToSendTLV->EOFposition = 7;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TLV_add inserts data in the TLV format inside the value of a host TLV instruction.
|
||||
* @note Refer to the USB-PD GUI INTERFACE SPECIFICATION DOCUMENT for more info about this practice (part 5.3.1)
|
||||
* TLV_init_encode must be called with the same TLV_ToSend_Data structure before calling this function.
|
||||
* This function can add data to the same TLV_ToSend_Data structure indefinitely as long as the maximal size defined during initialization of the structure isn't reached.
|
||||
* SOF and EOF keeps being handled as data is added.
|
||||
* @param ToSendTLV The TLV_ToSend_Data structure in which we add data.
|
||||
* @param Tag The byte to put as Tag of the data we add
|
||||
* @param Size The Size of the data, in bytes.
|
||||
* @param Value A pointer to the Value to add.
|
||||
* @return The number of bytes written if everything went fine, 0xFFFF otherwise.
|
||||
*
|
||||
*/
|
||||
uint16_t TLV_add(TLV_ToSend_Data *ToSendTLV, uint8_t Tag, uint16_t Size, const uint8_t *Value)
|
||||
{
|
||||
if(ToSendTLV->data[ToSendTLV->EOFposition] != TLV_EOF) return 0xFFFF; /* EOF has been lost. Has any TLV operation failed, or went interrupted ?*/
|
||||
if((ToSendTLV->EOFposition + 4 + 3 + Size) > ToSendTLV->maxSize) return 0xFFFF; /* Can't add this TLV, because it will overflow the provided buffer.*/
|
||||
if(ToSendTLV->data == NULL) return 0xFFFF; /* Data points to NULL. Has the encoding been initialized with TLV_init_encode ?*/
|
||||
if(ToSendTLV->EOFposition == 0xFFFF) return 0xFFFF; /* EOF at -1. Has the decoding been initialized with TLV_init_decode ?*/
|
||||
|
||||
ToSendTLV->data[ToSendTLV->EOFposition] = Tag; /* Tag*/
|
||||
ToSendTLV->EOFposition++;
|
||||
ToSendTLV->SizePosition = ToSendTLV->EOFposition;
|
||||
|
||||
ToSendTLV->data[ToSendTLV->EOFposition] = (Size >> 8) & 0x00FF; /* Size*/
|
||||
ToSendTLV->data[ToSendTLV->EOFposition+1] = (Size ) & 0x00FF;
|
||||
ToSendTLV->EOFposition += 2;
|
||||
|
||||
for(uint32_t index = 0; index < Size; index++) /* Value*/
|
||||
{
|
||||
ToSendTLV->data[ToSendTLV->EOFposition] = Value[index];
|
||||
ToSendTLV->EOFposition++;
|
||||
}
|
||||
|
||||
ToSendTLV->data[ToSendTLV->EOFposition]
|
||||
= ToSendTLV->data[ToSendTLV->EOFposition+1]
|
||||
= ToSendTLV->data[ToSendTLV->EOFposition+2]
|
||||
= ToSendTLV->data[ToSendTLV->EOFposition+3] = TLV_EOF; /* EOF*/
|
||||
|
||||
uint16_t total_lgth = (ToSendTLV->data[5] << 8) + ToSendTLV->data[6] + 3 + Size; /* Update of the top level Size marker*/
|
||||
ToSendTLV->data[5] = total_lgth >> 8;
|
||||
ToSendTLV->data[6] = total_lgth;
|
||||
|
||||
return 3 + Size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inserts value inside the TLV packet
|
||||
* @param ToSendTLV The TLV_ToSend_Data structure in which we add data.
|
||||
* @param Size The Size of the data, in bytes.
|
||||
* @param Value A pointer to the Value to add.
|
||||
* @return The number of bytes written if everything went fine, 0xFFFF otherwise.
|
||||
*
|
||||
*/
|
||||
uint16_t TLV_addValue(TLV_ToSend_Data *ToSendTLV, const uint8_t *Value, uint16_t Size)
|
||||
{
|
||||
if(ToSendTLV->data[ToSendTLV->EOFposition] != TLV_EOF) return 0xFFFF; /* EOF has been lost. Has any TLV operation failed, or went interrupted ?*/
|
||||
if((ToSendTLV->EOFposition + 4 + 3 + Size) > ToSendTLV->maxSize) return 0xFFFF; /* Can't add this TLV, because it will overflow the provided buffer.*/
|
||||
if(ToSendTLV->data == NULL) return 0xFFFF; /* Data points to NULL. Has the encoding been initialized with TLV_init_encode ?*/
|
||||
if(ToSendTLV->EOFposition == 0xFFFF) return 0xFFFF; /* EOF at -1. Has the decoding been initialized with TLV_init_decode ?*/
|
||||
|
||||
for(uint32_t index = 0; index < Size; index++) /* Value*/
|
||||
{
|
||||
ToSendTLV->data[ToSendTLV->EOFposition] = Value[index];
|
||||
ToSendTLV->EOFposition++;
|
||||
}
|
||||
|
||||
ToSendTLV->data[ToSendTLV->EOFposition]
|
||||
= ToSendTLV->data[ToSendTLV->EOFposition+1]
|
||||
= ToSendTLV->data[ToSendTLV->EOFposition+2]
|
||||
= ToSendTLV->data[ToSendTLV->EOFposition+3] = TLV_EOF; /* EOF*/
|
||||
|
||||
uint16_t total_lgth = (ToSendTLV->data[5] << 8) + ToSendTLV->data[6] + Size; /* Update of the top level Size marker*/
|
||||
ToSendTLV->data[5] = total_lgth >> 8;
|
||||
ToSendTLV->data[6] = total_lgth;
|
||||
|
||||
return 3 + Size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update size of previous inserted TAG inside the TLV packet
|
||||
* @param ToSendTLV The TLV_ToSend_Data structure in which we add data.
|
||||
* @param Size The Size of the data, in bytes.
|
||||
* @return None
|
||||
*
|
||||
*/
|
||||
void TLV_UpdateSizeTag(TLV_ToSend_Data *ToSendTLV, uint16_t Size)
|
||||
{
|
||||
ToSendTLV->data[ToSendTLV->SizePosition] = (Size >> 8) & 0x00FF; /* Size*/
|
||||
ToSendTLV->data[ToSendTLV->SizePosition + 1] = (Size ) & 0x00FF;
|
||||
}
|
||||
/**
|
||||
* @brief TLV_deinit_encode deinitialize a TLV_ToSend_Data structure.
|
||||
* @note After this, TLV_add can no longer be used with this structure (unless if it is reinitialized with TLV_init_encode).
|
||||
* If a TLV_ToSend_Data structure is used without deinitialization, the associated string can be altered.
|
||||
* Once deinitialization is done, the string used can directly be send.
|
||||
* @param ToSendTLV The TLV_ToSend_Data structure to deinitialize.
|
||||
* @return None
|
||||
*/
|
||||
void TLV_deinit_encode(TLV_ToSend_Data *ToSendTLV)
|
||||
{
|
||||
ToSendTLV->data = NULL;
|
||||
ToSendTLV->EOFposition = 0xFFFF;
|
||||
ToSendTLV->maxSize = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TLV_init_decode initializes a TLV_Received_Data structure, to have it ready to be used with TLV_get.
|
||||
* TLV_get and TLV_deinit_decode must not be called without calling this function first.
|
||||
* @note This function places a cursor on the first parameter.
|
||||
* @param ToProcessTLV The TLV_Received_Data that will be used.
|
||||
* @param pReceivedString The string which will be decoded.
|
||||
* @return The position of the cursor if everything went fine, 0xFF otherwise.
|
||||
*/
|
||||
uint8_t TLV_init_decode(TLV_Received_Data *ToProcessTLV, uint8_t *pReceivedString)
|
||||
{
|
||||
if(pReceivedString == NULL) return 0xFF; /* Received string is NULL*/
|
||||
if( (pReceivedString[0] != TLV_SOF)
|
||||
||(pReceivedString[1] != TLV_SOF)
|
||||
||(pReceivedString[2] != TLV_SOF)
|
||||
||(pReceivedString[3] != TLV_SOF)) return 0xFF; /* Incorrect SOF*/
|
||||
|
||||
ToProcessTLV->data = pReceivedString;
|
||||
ToProcessTLV->cursor = 7; /* Cursor at start of value*/
|
||||
|
||||
return ToProcessTLV->cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TLV_get gets data in TLV format from inside the value of a host TLV instruction.
|
||||
* @note Refer to the USB-PD GUI INTERFACE SPECIFICATION DOCUMENT for more info about this practice (part 5.3.1)
|
||||
* TLV_init_decode must be called with the same TLV_Received_Data structure before calling this function.
|
||||
* Once this function has read its parameter, it places the cursor at the beginning of the next one.
|
||||
* Refer to the returned value to see if there is one or not.
|
||||
* @param ToProcessTLV The TLV_Received_Data structure which is associated to the string we want to get a parameter from.
|
||||
* @param Tag A pointer to where the decoded Tag should be stocked.
|
||||
* @param Length A pointer to where the decoded size should be stocked.
|
||||
* @param Value A double pointer, which will contain a pointer directly to the data in the reception buffer.
|
||||
* @return 0 if the reading was fine and there is another parameter after, 1 if the reading was fine and it was the last parameter, 0xFF otherwise.
|
||||
*/
|
||||
uint8_t TLV_get(TLV_Received_Data *ToProcessTLV, uint8_t *Tag, uint16_t *Length, uint8_t **Value)
|
||||
{
|
||||
if(ToProcessTLV->data == NULL) return 0xFF; /* Data points to NULL. Has the decoding been initialized with TLV_init_decode ?*/
|
||||
if(ToProcessTLV->cursor == 0) return 0xFF; /* The cursor is not positioned. Has the decoding been initialized with TLV_init_decode ?*/
|
||||
if(ToProcessTLV->data[ToProcessTLV->cursor] == TLV_EOF) return 0xFF; /* EOF reached. There is not any parameter left to read.*/
|
||||
|
||||
*Tag = ToProcessTLV->data[ToProcessTLV->cursor]; /* Tag*/
|
||||
ToProcessTLV->cursor++;
|
||||
*Length = (ToProcessTLV->data[ToProcessTLV->cursor] << 8) + ToProcessTLV->data[ToProcessTLV->cursor+1]; /* Length*/
|
||||
ToProcessTLV->cursor += 2;
|
||||
*Value = &ToProcessTLV->data[ToProcessTLV->cursor]; /* Value*/
|
||||
ToProcessTLV->cursor += *Length;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TLV_deinit_decode deinitialize a TLV_Received_Data structure.
|
||||
* @note After this, TLV_get can no longer be used with this structure (unless if it is reinitialized with TLV_init_decode).
|
||||
* Once the cursor reach the EOF, there isn't anything to do except deinitializing the TLV_Received_Data structure with this function (eventually to reinitialize it after, to restart decoding from the beginning).
|
||||
* This function do not handle any deallocation.
|
||||
* @param ToProcessTLV The TLV_Received_Data structure to deinitialize.
|
||||
* @return None
|
||||
*/
|
||||
void TLV_deinit_decode(TLV_Received_Data *ToProcessTLV)
|
||||
{
|
||||
ToProcessTLV->data = NULL;
|
||||
ToProcessTLV->cursor = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TLV_getStringLength returns the length of a 8 bit TLV string, in bytes.
|
||||
* @note This function relies on the length marker in the string. Whether there is or not the SOF and/or the EOF, it will return the size of the string without them.
|
||||
* @param pString A uint8_t pString, under TLV format, with or without SOF or EOF.
|
||||
* @return The size of the pString in bytes; including tag, length, and value; excluding SOF and EOF, if applicable.
|
||||
*/
|
||||
uint16_t TLV_get_string_length(const uint8_t* pString)
|
||||
{
|
||||
uint16_t length; /* Variable to be return.*/
|
||||
uint8_t start = 0; /* To indicate the start of the real pString, in case there is a EOF. */
|
||||
|
||||
while(pString[start] == TLV_SOF)
|
||||
{
|
||||
start++;
|
||||
} /* start variable is now after the SOF if there is one.*/
|
||||
|
||||
length = (uint16_t)pString[start+1] << 8
|
||||
|(uint16_t)pString[start+2];
|
||||
length += 3;
|
||||
|
||||
return length;
|
||||
}
|
||||
#endif /* _GUI_INTERFACE */
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file data_struct_tlv.h
|
||||
* @author MCD Application Team
|
||||
* @brief Include file used in TLV structures and/or strings handling.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef DATA_STRUCT_TLV_H_
|
||||
#define DATA_STRUCT_TLV_H_
|
||||
|
||||
#define TLV_SOF 0xFDu
|
||||
#define TLV_EOF 0xA5u
|
||||
#define TLV_SIZE_MAX 256u
|
||||
|
||||
#define TLV_TAG_POSITION 4u /* Byte position of TAG */
|
||||
#define TLV_LENGTH_HIGH_POSITION 5u /* Byte position of LENGTH HIGH */
|
||||
#define TLV_LENGTH_LOW_POSITION 6u /* Byte position of LENGTH LOW */
|
||||
#define TLV_VALUE_POSITION 7u /* Byte position of VALUE */
|
||||
#define TLV_HEADER_SIZE 3u /* Size of TLV header (TAG(1) + LENGTH(2) */
|
||||
#define TLV_SOF_SIZE 4u /* TLV_SOF * 4 */
|
||||
#define TLV_EOF_SIZE 4u /* TLV_EOF * 4 */
|
||||
|
||||
/**
|
||||
* @struct TLV_ToSend_DATA
|
||||
* @brief Structure used when forming a TLV which is about to be send
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t* data; /*!< The TLV instruction */
|
||||
uint16_t maxSize; /*!< Max size of the instruction */
|
||||
uint16_t EOFposition; /*!< Position of the EOF in data */
|
||||
uint16_t SizePosition; /*!< Position of the Size tag */
|
||||
} TLV_ToSend_Data;
|
||||
|
||||
/**
|
||||
* @struct TLV_Received_DATA
|
||||
* @brief Structure used when interpreting a received TLV
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t* data; /*!< The TLV instruction */
|
||||
uint16_t cursor; /*!< Read position */
|
||||
} TLV_Received_Data;
|
||||
|
||||
|
||||
uint16_t TLV_get_string_length(const uint8_t* string);
|
||||
|
||||
uint8_t TLV_init_encode(TLV_ToSend_Data *ToSendTLV, uint8_t tag, uint16_t sizeMax, uint8_t *ptr);
|
||||
uint16_t TLV_add(TLV_ToSend_Data *ToSendTLV, uint8_t tag, uint16_t size, const uint8_t *value);
|
||||
uint16_t TLV_addValue(TLV_ToSend_Data *ToSendTLV, const uint8_t *Value, uint16_t Size);
|
||||
void TLV_UpdateSizeTag(TLV_ToSend_Data *ToSendTLV, uint16_t Size);
|
||||
void TLV_deinit_encode(TLV_ToSend_Data *ToSendTLV);
|
||||
uint8_t TLV_init_decode(TLV_Received_Data *ToProcessTLV, uint8_t *receivedString);
|
||||
uint8_t TLV_get(TLV_Received_Data *ToProcessTLV, uint8_t *tag, uint16_t *length, uint8_t **value);
|
||||
void TLV_deinit_decode(TLV_Received_Data *ToProcessTLV);
|
||||
|
||||
#endif /* DATA_STRUCT_TLV_H_ */
|
||||
|
3376
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/gui_api.c
Normal file
3376
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/gui_api.c
Normal file
File diff suppressed because it is too large
Load diff
256
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/gui_api.h
Normal file
256
USB-PD_Provider_1port/Utilities/GUI_INTERFACE/gui_api.h
Normal file
|
@ -0,0 +1,256 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file gui_api.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for GUI
|
||||
* interface.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef _GUI_API_H
|
||||
#define _GUI_API_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "usbpd_def.h"
|
||||
|
||||
/** @addtogroup STM32_USBPD_LIBRARY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup USBPD_GUI_API
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup USBPD_GUI_API_Exported_Defines USBPD GUI API exported Defines
|
||||
* @{
|
||||
*/
|
||||
#define GUI_PE_PORT_NUM_Pos (24u)
|
||||
#define GUI_PE_PORT_NUM_Msk (0x3u << GUI_PE_PORT_NUM_Pos)
|
||||
#define GUI_PE_PORT_NUM_0 (0x0u << GUI_PE_PORT_NUM_Pos)
|
||||
#define GUI_PE_PORT_NUM_1 (0x1u << GUI_PE_PORT_NUM_Pos)
|
||||
#define GUI_PE_NOTIF_Pos (4u)
|
||||
#define GUI_PE_NOTIF_Msk (0xFFu << GUI_PE_NOTIF_Pos)
|
||||
|
||||
#define GUI_NOTIF_MEASUREMENT (USBPD_NOTIFY_ALL + 1)
|
||||
#define GUI_NOTIF_MEASUREMENT_STEP 40u
|
||||
|
||||
/**
|
||||
* @brief USB PD GUI STATE MACHINE STATE
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GUI_STATE_INIT, /*!< GUI init state */
|
||||
GUI_STATE_RUNNING, /*!< GUI running state */
|
||||
GUI_STATE_RESET, /*!< GUI reset state */
|
||||
} USBPD_GUI_State;
|
||||
|
||||
/**
|
||||
* @brief USB PD GUI TAG TYPE
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DPM_RESET_REQ = 0x01,
|
||||
DPM_INIT_REQ = 0x02,
|
||||
DPM_INIT_CNF = 0x03,
|
||||
DPM_CONFIG_GET_REQ = 0x04,
|
||||
DPM_CONFIG_GET_CNF = 0x05,
|
||||
DPM_CONFIG_SET_REQ = 0x06,
|
||||
DPM_CONFIG_SET_CNF = 0x07,
|
||||
DPM_CONFIG_REJ = 0x08,
|
||||
DPM_MESSAGE_REQ = 0x09,
|
||||
DPM_MESSAGE_CNF = 0x0A,
|
||||
DPM_MESSAGE_REJ = 0x0B,
|
||||
DPM_MESSAGE_IND = 0x0C,
|
||||
DPM_MESSAGE_RSP = 0x0D,
|
||||
DPM_REGISTER_READ_REQ = 0x0E,
|
||||
DPM_REGISTER_READ_CNF = 0x0F,
|
||||
DPM_REGISTER_WRITE_REQ = 0x10,
|
||||
DPM_REGISTER_WRITE_CNF = 0x11,
|
||||
DEBUG_STACK_MESSAGE = 0x12,
|
||||
} USBPD_GUI_Tag_TypeDef;
|
||||
|
||||
/** @defgroup USBPD_CORE_GUI_TYPE_NOTIFICATION USBPD CORE TRACE TYPE NOTIFICATION
|
||||
* @{
|
||||
*/
|
||||
#define GUI_NOTIF_NUMBEROFRCVSNKPDO (1 << 0)
|
||||
#define GUI_NOTIF_RDOPOSITION (1 << 1)
|
||||
#define GUI_NOTIF_LISTOFRCVSRCPDO (1 << 2)
|
||||
#define GUI_NOTIF_NUMBEROFRCVSRCPDO (1 << 3)
|
||||
#define GUI_NOTIF_LISTOFRCVSNKPDO (1 << 4)
|
||||
#define GUI_NOTIF_ISCONNECTED (1 << 5)
|
||||
#define GUI_NOTIF_DATAROLE (1 << 6)
|
||||
#define GUI_NOTIF_POWERROLE (1 << 7)
|
||||
#define GUI_NOTIF_CCDEFAULTCURRENTADVERTISED (1 << 8)
|
||||
#define GUI_NOTIF_VCONNON (1 << 9)
|
||||
#define GUI_NOTIF_VCONNSWAPED (1 << 10)
|
||||
#define GUI_NOTIF_MEASUREREPORTING (1 << 11)
|
||||
#define GUI_NOTIF_CC (1 << 12)
|
||||
#define GUI_NOTIF_PE_EVENT (1 << 13)
|
||||
#define GUI_NOTIF_TIMESTAMP (1 << 14)
|
||||
#define GUI_NOTIF_POWER_EVENT (1 << 15)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup USBPD_GUI_API_Exported_TypeDef USBPD GUI API exported TypeDef
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t VBUS_Level :16; /*!< VBUS Level */
|
||||
uint16_t IBUS_Level :16; /*!< IBUS Level */
|
||||
/* Measurement Reporting */
|
||||
union {
|
||||
uint8_t MeasurementReporting;
|
||||
struct {
|
||||
uint8_t MeasReportValue :7; /*!< Enable Measure reporting every tr x 40 ms */
|
||||
uint8_t MeasReportActivation :1; /*!< Enable or Disable Measure reporting */
|
||||
}d;
|
||||
}u;
|
||||
uint8_t Reserved :8; /*!< Reserved bits */
|
||||
} GUI_USER_ParamsTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t PE_DataSwap : 1; /*!< support data swap */
|
||||
uint32_t PE_VconnSwap : 1; /*!< support VCONN swap */
|
||||
uint32_t PE_DR_Swap_To_DFP : 1U; /*!< If supported, DR Swap to DFP can be accepted or not by the user else directly rejected */
|
||||
uint32_t PE_DR_Swap_To_UFP : 1U; /*!< If supported, DR Swap to UFP can be accepted or not by the user else directly rejected */
|
||||
uint32_t Reserved1 : 28U; /*!< Reserved bits */
|
||||
#if defined(_SNK) || defined(_DRP)
|
||||
USBPD_SNKPowerRequest_TypeDef DPM_SNKRequestedPower; /*!< Requested Power by the sink board */
|
||||
#else
|
||||
uint32_t Reserved_ReqPower[6]; /*!< Reserved bits to match with Resquested power information */
|
||||
#endif /* _SNK || _DRP */
|
||||
#if defined(USBPD_REV30_SUPPORT)
|
||||
#if _MANU_INFO
|
||||
USBPD_MIDB_TypeDef DPM_ManuInfoPort; /*!< Manufacturer information used for the port */
|
||||
uint16_t ReservedManu; /*!< Reserved bits to match with Manufacturer information */
|
||||
#else
|
||||
uint32_t ReservedManu[7]; /*!< Reserved bits to match with Manufacturer information */
|
||||
#endif /* _MANU_INFO */
|
||||
#if _SRC_CAPA_EXT && (defined(_SRC)||defined(_DRP))
|
||||
USBPD_SCEDB_TypeDef DPM_SRCExtendedCapa; /*!< SRC Extended Capability */
|
||||
#else
|
||||
uint32_t ReservedSrcCapa[6]; /*!< Reserved bits to match with SrcCapa information */
|
||||
#endif /* _SRC_CAPA_EXT && (_SRC || _DRP) */
|
||||
#if defined(_SNK)||defined(_DRP)
|
||||
USBPD_SKEDB_TypeDef DPM_SNKExtendedCapa; /*!< SNK Extended Capability */
|
||||
uint8_t ReservedSnkCapa[3]; /*!< Reserved bits to match with SnkCapaExt information */
|
||||
#else
|
||||
uint32_t ReservedSnkCapa[6]; /*!< Reserved bits to match with SnkCapaExt information */
|
||||
#endif /* _SNK || _DRP */
|
||||
#else
|
||||
uint32_t ReservedRev3[13]; /*!< Reserved bits to match with PD3.0 information */
|
||||
#endif /* USBPD_REV30_SUPPORT */
|
||||
uint32_t PWR_AccessoryDetection : 1; /*!< It enables or disables powered accessory detection */
|
||||
uint32_t PWR_AccessoryTransition : 1; /*!< It enables or disables transition from Powered.accessory to Try.SNK */
|
||||
USBPD_CORE_PDO_ExtPowered_TypeDef PWR_UnconstrainedPower: 1; /*!< UUT has an external power source available that is sufficient to adequately power the system while charging external devices or the UUT primary function is to charge external devices. */
|
||||
CAD_SNK_Source_Current_Adv_Typedef PWR_RpResistorValue : 2; /*!< RP resitor value based on @ref CAD_SNK_Source_Current_Adv_Typedef */
|
||||
USBPD_CORE_PDO_USBCommCapable_TypeDef USB_Support : 1; /*!< USB_Comms_Capable, is the UUT capable of enumerating as a USB host or device? */
|
||||
uint32_t USB_Device : 1; /*!< Type_C_Can_Act_As_Device, Indicates whether the UUT can communicate with USB 2.0 or USB 3.1 as a device or as the Upstream Facing Port of a hub. */
|
||||
uint32_t USB_Host : 1; /*!< Type_C_Can_Act_As_Host, Indicates whether the UUT can communicate with USB 2.0 or USB 3.1 as a host or as the Downstream Facing Port of a hub */
|
||||
USBPD_CORE_PDO_USBSuspendSupport_TypeDef USB_SuspendSupport: 1; /*!< USB Suspend support values in PDO definition (Source) */
|
||||
uint32_t CAD_tDRP :7; /*!< The period that DRP shall complete a Source to Sink and back advertisement */
|
||||
uint32_t CAD_dcSRC_DRP :7; /*!< The percent of time that a DRP shall advertise Source during tDRP (in %) */
|
||||
uint32_t Reserved2 :31; /*!< reserved bits */
|
||||
} USBPD_USER_SettingsTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t XID; /*!< Value provided by the USB-IF assigned to the product */
|
||||
uint16_t VID; /*!< Vendor ID (assigned by the USB-IF) */
|
||||
uint16_t PID; /*!< Product ID (assigned by the manufacturer) */
|
||||
} USBPD_IdSettingsTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t VDM_XID_SOP :32; /*!< A decimal number assigned by USB-IF before certification */
|
||||
uint32_t VDM_USB_VID_SOP :16; /*!< A unique 16-bit number, assigned to the Vendor by USB-IF. */
|
||||
uint32_t VDM_PID_SOP :16; /*!< A unique number assigned by the Vendor ID holder identifying the product. */
|
||||
uint32_t VDM_bcdDevice_SOP :16; /*!< A unique number assigned by the Vendor ID holder containing identity information relevant to the release version of the product. */
|
||||
USBPD_ModalOp_TypeDef VDM_ModalOperation : 1; /*!< Product support Modes based on @ref USBPD_ModalOp_TypeDef */
|
||||
USBPD_USBCapa_TypeDef VDM_USBHostSupport : 1; /*!< Indicates whether the UUT is capable of enumerating USB Host */
|
||||
USBPD_USBCapa_TypeDef VDM_USBDeviceSupport: 1; /*!< Indicates whether the UUT is capable of enumerating USB Devices */
|
||||
USBPD_ProductType_TypeDef VDM_ProductTypeUFPorCP : 3; /*!< Product type UFP or CablePlug of the UUT based on @ref USBPD_ProductType_TypeDef */
|
||||
#if defined(USBPD_REV30_SUPPORT)
|
||||
USBPD_ProductType_TypeDef VDM_ProductTypeDFP : 3; /*!< Product type DFP of the UUT based on @ref USBPD_ProductType_TypeDef */
|
||||
uint32_t Reserved3 : 7; /*!< Reserved bits */
|
||||
#else
|
||||
uint32_t Reserved3 :10; /*!< Reserved bits */
|
||||
#endif /* USBPD_REV30_SUPPORT */
|
||||
} USBPD_VDM_SettingsTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported variable ---------------------------------------------------------*/
|
||||
/** @defgroup USBPD_GUI_API_Exported_Variable USBPD GUI API exported Variable
|
||||
* @{
|
||||
*/
|
||||
extern GUI_USER_ParamsTypeDef GUI_USER_Params[USBPD_PORT_COUNT];
|
||||
#if !defined(_RTOS)
|
||||
extern volatile uint32_t GUI_Flag;
|
||||
#endif /* !_RTOS */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
/** @defgroup USBPD_GUI_API_Exported_Functions USBPD GUI API exported functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
USBPD_FunctionalState GUI_Init(const uint8_t* (*CB_HWBoardVersion)(void), const uint8_t* (*CB_HWPDType)(void), uint16_t (*CB_GetVoltage)(uint8_t), int16_t (*CB_GetCurrent)(uint8_t));
|
||||
void GUI_Start(void);
|
||||
void GUI_TimerCounter(void);
|
||||
uint32_t GUI_RXProcess(uint32_t Event);
|
||||
uint32_t GUI_FormatAndSendNotification(uint32_t PortNum, uint32_t TypeNotification, uint32_t Value);
|
||||
uint32_t GUI_GetMessage(uint8_t Character, uint8_t Error);
|
||||
USBPD_GUI_State GUI_SendAnswer(uint8_t **pMsgToSend, uint8_t *pSizeMsg);
|
||||
USBPD_GUI_State GUI_SendNotification(uint8_t PortNum, uint8_t **pMsgToSend, uint8_t *pSizeMsg, uint32_t TypeNotifcation, uint32_t Value);
|
||||
void GUI_PostNotificationMessage(uint8_t PortNum, uint16_t EventVal);
|
||||
void GUI_SaveInfo(uint8_t PortNum, uint8_t DataId, uint8_t *Ptr, uint32_t Size);
|
||||
USBPD_FunctionalState GUI_IsRunning(void);
|
||||
#if !defined(USE_STM32_UTILITY_OS)
|
||||
void GUI_Execute(void);
|
||||
#endif /* !USE_STM32_UTILITY_OS */
|
||||
void GUI_RegisterCallback_FreeText(USBPD_StatusTypeDef (*CB_FreeText)(uint8_t, uint8_t*, uint16_t));
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* _GUI_API_H */
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_gui_memmap.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains memory mapping configuration to be able to run
|
||||
* Cube-Monitor-UCPD on embedded side.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __USBPD_GUI_MEMMAP_H_
|
||||
#define __USBPD_GUI_MEMMAP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32xxxx.h"
|
||||
#include "usbpd_def.h"
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION_GUI
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
|
||||
/* Exported define -----------------------------------------------------------*/
|
||||
|
||||
/* Following definitions should be adapted to used Flash configuration :
|
||||
INDEX_PAGE : represents the number of the page used for storing USBPD settings (usually the last page)
|
||||
ADDR_FLASH_LAST_PAGE : Flash address value of beginning of USBPD settings page
|
||||
ADDR_FLASH_PAGE_END : Flash address value of end of USBPD settings page
|
||||
*/
|
||||
#define INDEX_PAGE (FLASH_PAGE_NB - 1u) /* Index of latest page */
|
||||
#define ADDR_FLASH_LAST_PAGE (FLASH_BASE + (INDEX_PAGE * FLASH_PAGE_SIZE)) /* Base @ of latest page */
|
||||
#define ADDR_FLASH_PAGE_END (ADDR_FLASH_LAST_PAGE + FLASH_PAGE_SIZE - 1u)
|
||||
|
||||
#define GUI_FLASH_MAGIC_NUMBER ADDR_FLASH_LAST_PAGE
|
||||
/* should be aligned on double word */
|
||||
#define GUI_FLASH_ADDR_NB_PDO_SNK_P0 (GUI_FLASH_MAGIC_NUMBER + 8u)
|
||||
#define GUI_FLASH_ADDR_NB_PDO_SRC_P0 (GUI_FLASH_ADDR_NB_PDO_SNK_P0 + 1u)
|
||||
#define GUI_FLASH_ADDR_NB_PDO_SNK_P1 (GUI_FLASH_ADDR_NB_PDO_SRC_P0 + 1u)
|
||||
#define GUI_FLASH_ADDR_NB_PDO_SRC_P1 (GUI_FLASH_ADDR_NB_PDO_SNK_P1 + 1u)
|
||||
|
||||
/* should be aligned on double word */
|
||||
#define GUI_FLASH_ADDR_PDO_SRC_P0 (GUI_FLASH_MAGIC_NUMBER + 16u)
|
||||
/* New Address should be modulo 8 */
|
||||
/* New Address = (Previous Address + (size / 8 * 8) + ((size % 8) + 7) / 8 * 8) */
|
||||
#define GUI_FLASH_ADDR_PDO_SNK_P0 (GUI_FLASH_ADDR_PDO_SRC_P0 + ((USBPD_MAX_NB_PDO * 4) / 8 * 8) + ((((USBPD_MAX_NB_PDO * 4) & 0x07) + 7) / 8 * 8 ))
|
||||
#define GUI_FLASH_ADDR_PDO_SRC_P1 (GUI_FLASH_ADDR_PDO_SNK_P0 + ((USBPD_MAX_NB_PDO * 4) / 8 * 8) + ((((USBPD_MAX_NB_PDO * 4) & 0x07) + 7) / 8 * 8 ))
|
||||
#define GUI_FLASH_ADDR_PDO_SNK_P1 (GUI_FLASH_ADDR_PDO_SRC_P1 + ((USBPD_MAX_NB_PDO * 4) / 8 * 8) + ((((USBPD_MAX_NB_PDO * 4) & 0x07) + 7) / 8 * 8 ))
|
||||
|
||||
#define GUI_FLASH_ADDR_DPM_SETTINGS (GUI_FLASH_ADDR_PDO_SNK_P1 + ((USBPD_MAX_NB_PDO * 4) / 8 * 8) + ((((USBPD_MAX_NB_PDO * 4) & 0x07) + 7) / 8 * 8 ))
|
||||
|
||||
/* Define by default USBPD_PORT_COUNT to 2 */
|
||||
#define GUI_FLASH_ADDR_DPM_USER_SETTINGS (GUI_FLASH_ADDR_DPM_SETTINGS + (sizeof(USBPD_SettingsTypeDef) * 2 /*USBPD_PORT_COUNT*/))
|
||||
|
||||
#define GUI_FLASH_ADDR_DPM_VDM_SETTINGS (GUI_FLASH_ADDR_DPM_USER_SETTINGS + (sizeof(USBPD_USER_SettingsTypeDef) * 2 /*USBPD_PORT_COUNT*/))
|
||||
|
||||
#define GUI_FLASH_ADDR_DPM_ID_SETTINGS (GUI_FLASH_ADDR_DPM_VDM_SETTINGS + (sizeof(USBPD_VDM_SettingsTypeDef) * 2 /*USBPD_PORT_COUNT*/))
|
||||
|
||||
#define GUI_FLASH_ADDR_RESERVED (GUI_FLASH_ADDR_DPM_ID_SETTINGS + (sizeof(USBPD_IdSettingsTypeDef) * 2 /*USBPD_PORT_COUNT*/))
|
||||
|
||||
#define GUI_FLASH_SIZE_RESERVED (ADDR_FLASH_PAGE_END - GUI_FLASH_ADDR_RESERVED)
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported variables --------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_GUI_MEMMAP_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
316
USB-PD_Provider_1port/Utilities/TRACER_EMB/Release_Notes.html
Normal file
316
USB-PD_Provider_1port/Utilities/TRACER_EMB/Release_Notes.html
Normal file
|
@ -0,0 +1,316 @@
|
|||
<!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>STM32 USB-C Power Delivery embedded Tracer</title>
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="_htmresc/mini-st.css" />
|
||||
<!--[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">
|
||||
<div class="card fluid">
|
||||
<div class="sectione dark">
|
||||
<center>
|
||||
<h1 id="release-notes-for-stm32-usb-c-power-delivery-embedded-tracer"><small>Release Notes for</small> STM32 USB-C Power Delivery embedded Tracer</h1>
|
||||
<p>Copyright © 2018 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<h1 id="license">License</h1>
|
||||
<p>This software component is licensed by ST under BSD 3-Clause license, the “License”; You may not use this component except in compliance with the License. You may obtain a copy of the License at:</p>
|
||||
<p><a href="http://www.opensource.org/licenses/BSD-3-Clause">http://www.opensource.org/licenses/BSD-3-Clause</a></p>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This driver is used for the embedded USB-PD tracer used to debug USB-PD 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-section8" checked aria-hidden="true"> <label for="collapse-section8" aria-hidden="true">V1.5.0 / 2-Jul.-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<h3 id="maintenance-release">Maintenance release</h3>
|
||||
<h2 id="contents">Contents</h2>
|
||||
<table>
|
||||
<caption>Fixed bugs list</caption>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Code aligned to support U5</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>update for GPDMA link with LL update</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Ticket 84212 - Trace non functional with STM32F4</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Remove TRACER_EMB_TX_Process prototype in tracer_emb.h</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>remove the TX processing</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.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.27</li>
|
||||
<li>STM32CubeIDE v1.2.0</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-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true">V1.4.1 / 16-Apr.-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<h3 id="maintenance-release-1">Maintenance release</h3>
|
||||
<h2 id="contents-1">Contents</h2>
|
||||
<table>
|
||||
<caption>Fixed bugs list</caption>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Remove reference to USBPD</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.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.27</li>
|
||||
<li>STM32CubeIDE v1.2.0</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-section6" aria-hidden="true"> <label for="collapse-section6" aria-hidden="true">V1.4.0 / 14-Apr.-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">Main Changes</h2>
|
||||
<h3 id="maintenance-release-2">Maintenance release</h3>
|
||||
<h2 id="contents-2">Contents</h2>
|
||||
<table>
|
||||
<caption>Fixed bugs list</caption>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>* Ticket 84461 Indicate when trace is lost</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.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.27</li>
|
||||
<li>STM32CubeIDE v1.2.0</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-section5" aria-hidden="true"> <label for="collapse-section5" aria-hidden="true">V1.3.0 / 26-March-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<h3 id="maintenance-release-3">Maintenance release</h3>
|
||||
<h2 id="contents-3">Contents</h2>
|
||||
<table>
|
||||
<caption>Fixed bugs list</caption>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Improve Usart IRQ Handler execution time in tracer_emb_hw.c</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Remove commented code sections</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Update the hardware layer to handle GPDMA</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Ticket 77333 - DMA usage in tracer_emb_hw needs to be under switch</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Add 2 macros TRACER_EMB_ENABLECHANNEL and TRACER_EMB_DISABLECHANNEL to be compliant with STM32H7</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.32.3</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.27</li>
|
||||
<li>STM32CubeIDE v1.2.0</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-section3" aria-hidden="true"> <label for="collapse-section3" aria-hidden="true">V1.2.0 / 17-June-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-4">Main Changes</h2>
|
||||
<h3 id="maintenance-release-4">Maintenance release</h3>
|
||||
<h2 id="contents-4">Contents</h2>
|
||||
<table>
|
||||
<caption>Fixed bugs list</caption>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Ticket 66638 - [FOSS-Audit] SLA0044 headers in Utilities files</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-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.1.0 / 10-April-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-5">Main Changes</h2>
|
||||
<h3 id="maintenance-release-5">Maintenance release</h3>
|
||||
<h2 id="contents-5">Contents</h2>
|
||||
<table>
|
||||
<caption>Fixed bugs list</caption>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Add new defines in tracer_emb_conf_template.h (as done in projects tracer_emb_conf.h files)</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Update tracer file</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>remove dependence with USBPD Application</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Update for low power management</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>call DPM_TraceWakeUp after added message</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Move macro definition about USART/LPUART inside tracer_em_hw.c</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Change emb_conf to be able to have trace independent of USART or LPUART</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Add LPUART files</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Add management of LPUART1</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-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.0.0 / 18-Dec.-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-6">Main Changes</h2>
|
||||
<h3 id="maintenance-release-6">Maintenance release</h3>
|
||||
<p>Maintenance release</p>
|
||||
<h2 id="contents-6">Contents</h2>
|
||||
<table>
|
||||
<caption>Fixed bugs list</caption>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>tracer embedded creation</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>
|
||||
</section>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
<p>For complete documentation on STM32,visit: [<a href="http://www.st.com">www.st.com/stm32</a>]</p>
|
||||
This release note uses up to date web standards and, for this reason, should not be opened with Internet Explorer but preferably with popular browsers such as Google Chrome, Mozilla Firefox, Opera or Microsoft Edge.
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
1700
USB-PD_Provider_1port/Utilities/TRACER_EMB/_htmresc/mini-st.css
Normal file
1700
USB-PD_Provider_1port/Utilities/TRACER_EMB/_htmresc/mini-st.css
Normal file
File diff suppressed because it is too large
Load diff
BIN
USB-PD_Provider_1port/Utilities/TRACER_EMB/_htmresc/st_logo.png
Normal file
BIN
USB-PD_Provider_1port/Utilities/TRACER_EMB/_htmresc/st_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
393
USB-PD_Provider_1port/Utilities/TRACER_EMB/tracer_emb.c
Normal file
393
USB-PD_Provider_1port/Utilities/TRACER_EMB/tracer_emb.c
Normal file
|
@ -0,0 +1,393 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file tracer_emb.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains embeded tracer control functions.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "tracer_emb.h"
|
||||
#include "tracer_emb_hw.h"
|
||||
#include "string.h"
|
||||
|
||||
/** @addtogroup TRACER_EMB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TRACER_EMB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TRACER_EMB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private enums -------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/** @defgroup TRACER_EMB_Private_TypeDef EMB TRACER Private typedef
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
TRACER_OVERFLOW_NONE,
|
||||
TRACER_OVERFLOW_DETECTED,
|
||||
TRACER_OVERFLOW_SENT
|
||||
} TRACER_OverFlowTypedef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup TRACER_EMB_Private_TypeDef EMB TRACER Private typedef
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
TRACER_OK,
|
||||
TRACER_KO
|
||||
} TRACER_StatusTypedef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TRACER_EMB_Private_TypeDef EMB TRACER Private typedef
|
||||
* @{
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t PtrTx_Read;
|
||||
uint32_t PtrTx_Write;
|
||||
uint32_t SizeSent;
|
||||
uint32_t LowPower_Counter;
|
||||
volatile uint8_t Counter;
|
||||
const uint8_t *OverFlow_Data;
|
||||
uint8_t OverFlow_Size;
|
||||
uint8_t discontinue;
|
||||
TRACER_OverFlowTypedef OverFlow_Status;
|
||||
uint8_t PtrDataTx[TRACER_EMB_BUFFER_SIZE];
|
||||
} TRACER_ContextTypedef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/** @defgroup TRACER_EMB_Private_Macros TRACE Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define TRACER_WRITE_DATA(_POSITION_,_DATA_) TracerContext.PtrDataTx[(_POSITION_)% TRACER_EMB_BUFFER_SIZE] = (_DATA_); \
|
||||
(_POSITION_) = ((_POSITION_) + 1u) % TRACER_EMB_BUFFER_SIZE;
|
||||
|
||||
#define TRACER_ENTER_CRITICAL_SECTION() uint32_t primask= __get_PRIMASK();\
|
||||
__disable_irq();
|
||||
|
||||
#define TRACER_LEAVE_CRITICAL_SECTION() __set_PRIMASK(primask)
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/** @defgroup TRACER_EMB_Private_Functions TRACE Private Functions
|
||||
* @{
|
||||
*/
|
||||
uint32_t TRACER_CallbackRX(uint8_t character, uint8_t error);
|
||||
|
||||
/* Function prototypes -----------------------------------------------*/
|
||||
uint8_t TRACER_EMB_ReadData(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/** @defgroup TRACER_EMB_Private_Variables TRACE Private Variables
|
||||
* @{
|
||||
*/
|
||||
static TRACER_ContextTypedef TracerContext;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions ---------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup TRACER_EMB_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
void TRACER_EMB_Init(void)
|
||||
{
|
||||
/* initialize the Ptr for Read/Write */
|
||||
memset(&TracerContext, 0, sizeof(TRACER_ContextTypedef));
|
||||
|
||||
/* Initialize trace BUS */
|
||||
HW_TRACER_EMB_Init();
|
||||
|
||||
/* Initialize the lowpower aspect */
|
||||
TRACER_EMB_LowPowerInit();
|
||||
}
|
||||
|
||||
void TRACER_EMB_Add(uint8_t *Ptr, uint32_t Size)
|
||||
{
|
||||
int32_t _writepos;
|
||||
uint8_t *data_to_write = Ptr;
|
||||
uint32_t index;
|
||||
|
||||
/* Data processing */
|
||||
TRACER_EMB_Lock();
|
||||
_writepos = TRACER_EMB_AllocateBufer(Size);
|
||||
|
||||
/* if allocation is ok, write data into the bufffer */
|
||||
if (_writepos != -1)
|
||||
{
|
||||
/* initialize the Ptr for Read/Write */
|
||||
for (index = 0u; index < Size; index++)
|
||||
{
|
||||
TRACER_WRITE_DATA(_writepos, data_to_write[index]);
|
||||
}
|
||||
}
|
||||
TRACER_EMB_UnLock();
|
||||
|
||||
/* Tx processing */
|
||||
TRACER_EMB_SendData();
|
||||
}
|
||||
|
||||
#if TRACER_EMB_DMA_MODE == 1UL
|
||||
void TRACER_EMB_IRQHandlerDMA(void)
|
||||
{
|
||||
HW_TRACER_EMB_IRQHandlerDMA();
|
||||
}
|
||||
#endif
|
||||
|
||||
void TRACER_EMB_IRQHandlerUSART(void)
|
||||
{
|
||||
HW_TRACER_EMB_IRQHandlerUSART();
|
||||
}
|
||||
|
||||
void TRACER_EMB_WriteData(uint16_t pos, uint8_t data)
|
||||
{
|
||||
TracerContext.PtrDataTx[pos % TRACER_EMB_BUFFER_SIZE] = data;
|
||||
}
|
||||
|
||||
void TRACER_EMB_StartRX(void (*callbackRX)(uint8_t, uint8_t))
|
||||
{
|
||||
HW_TRACER_EMB_RegisterRxCallback(callbackRX);
|
||||
HW_TRACER_EMB_StartRX();
|
||||
}
|
||||
|
||||
int32_t TRACER_EMB_EnableOverFlow(const uint8_t *Data, uint8_t Size)
|
||||
{
|
||||
if(Size != 0)
|
||||
{
|
||||
TracerContext.OverFlow_Data = Data;
|
||||
TracerContext.OverFlow_Size = Size;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t TRACER_EMB_ReadData()
|
||||
{
|
||||
return HW_TRACER_EMB_ReadData();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TRACER_EMB_Private_Functions TRACE Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief callback called to end a transfert.
|
||||
* @param None.
|
||||
* @retval None.
|
||||
*/
|
||||
void TRACER_EMB_CALLBACK_TX(void)
|
||||
{
|
||||
TRACER_ENTER_CRITICAL_SECTION();
|
||||
TracerContext.PtrTx_Read = (TracerContext.PtrTx_Read + TracerContext.SizeSent) % TRACER_EMB_BUFFER_SIZE;
|
||||
|
||||
if((TracerContext.OverFlow_Data != NULL) && (TracerContext.OverFlow_Status == TRACER_OVERFLOW_DETECTED)
|
||||
&& (TracerContext.discontinue == 0))
|
||||
{
|
||||
TracerContext.OverFlow_Status = TRACER_OVERFLOW_SENT;
|
||||
HW_TRACER_EMB_SendData((uint8_t *)TracerContext.OverFlow_Data, TracerContext.OverFlow_Size);
|
||||
TRACER_LEAVE_CRITICAL_SECTION();
|
||||
}
|
||||
else
|
||||
{
|
||||
TracerContext.LowPower_Counter--;
|
||||
TRACER_LEAVE_CRITICAL_SECTION();
|
||||
TRACER_EMB_UnLock();
|
||||
TRACER_EMB_SendData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lock the trace buffer.
|
||||
* @param None.
|
||||
* @retval None.
|
||||
*/
|
||||
void TRACER_EMB_Lock(void)
|
||||
{
|
||||
TRACER_ENTER_CRITICAL_SECTION();
|
||||
TracerContext.Counter++;
|
||||
TRACER_LEAVE_CRITICAL_SECTION();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UnLock the trace buffer.
|
||||
* @param None.
|
||||
* @retval None.
|
||||
*/
|
||||
void TRACER_EMB_UnLock(void)
|
||||
{
|
||||
TRACER_ENTER_CRITICAL_SECTION();
|
||||
TracerContext.Counter--;
|
||||
TRACER_LEAVE_CRITICAL_SECTION();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief if buffer is not locked return a Begin / end @ to transfert over the media.
|
||||
* @param address begin of the data
|
||||
* @param address end of the data
|
||||
* @retval None.
|
||||
*/
|
||||
void TRACER_EMB_SendData(void)
|
||||
{
|
||||
uint32_t _begin;
|
||||
uint32_t _end;
|
||||
|
||||
TRACER_ENTER_CRITICAL_SECTION();
|
||||
|
||||
if (0u == TracerContext.Counter)
|
||||
{
|
||||
_begin = TracerContext.PtrTx_Read;
|
||||
_end = TracerContext.PtrTx_Write;
|
||||
|
||||
if (_begin != _end)
|
||||
{
|
||||
TRACER_EMB_Lock();
|
||||
/* */
|
||||
if (_end > _begin)
|
||||
{
|
||||
TracerContext.SizeSent = _end - _begin;
|
||||
TracerContext.discontinue = 0;
|
||||
}
|
||||
else /* _begin > _end */
|
||||
{
|
||||
TracerContext.SizeSent = TRACER_EMB_BUFFER_SIZE - _begin;
|
||||
TracerContext.discontinue = 1;
|
||||
}
|
||||
TRACER_EMB_LowPowerSendData();
|
||||
TracerContext.LowPower_Counter++;
|
||||
HW_TRACER_EMB_SendData(&(TracerContext.PtrDataTx[_begin]), TracerContext.SizeSent);
|
||||
}
|
||||
}
|
||||
|
||||
/* Low power processing */
|
||||
switch(TracerContext.LowPower_Counter)
|
||||
{
|
||||
case 1:
|
||||
TRACER_EMB_LowPowerSendData();
|
||||
break;
|
||||
case 0 :
|
||||
TRACER_EMB_LowPowerSendDataComplete();
|
||||
break;
|
||||
}
|
||||
|
||||
TRACER_LEAVE_CRITICAL_SECTION();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief allocate space inside the buffer to push data
|
||||
* @param data size
|
||||
* @retval write position inside the buffer is -1 no space available.
|
||||
*/
|
||||
int32_t TRACER_EMB_AllocateBufer(uint32_t Size)
|
||||
{
|
||||
uint32_t _freesize;
|
||||
int32_t _pos = -1;
|
||||
|
||||
TRACER_ENTER_CRITICAL_SECTION();
|
||||
|
||||
if (TracerContext.PtrTx_Write == TracerContext.PtrTx_Read)
|
||||
{
|
||||
// need to add buffer full managment
|
||||
_freesize = TRACER_EMB_BUFFER_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TracerContext.PtrTx_Write > TracerContext.PtrTx_Read)
|
||||
{
|
||||
_freesize = TRACER_EMB_BUFFER_SIZE - TracerContext.PtrTx_Write + TracerContext.PtrTx_Read;
|
||||
}
|
||||
else
|
||||
{
|
||||
_freesize = TracerContext.PtrTx_Read - TracerContext.PtrTx_Write;
|
||||
}
|
||||
}
|
||||
|
||||
if (_freesize > Size)
|
||||
{
|
||||
_pos = (int32_t)TracerContext.PtrTx_Write;
|
||||
TracerContext.PtrTx_Write = (TracerContext.PtrTx_Write + Size) % TRACER_EMB_BUFFER_SIZE;
|
||||
if(TRACER_OVERFLOW_SENT == TracerContext.OverFlow_Status)
|
||||
TracerContext.OverFlow_Status = TRACER_OVERFLOW_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(TRACER_OVERFLOW_NONE == TracerContext.OverFlow_Status)
|
||||
TracerContext.OverFlow_Status = TRACER_OVERFLOW_DETECTED;
|
||||
}
|
||||
|
||||
TRACER_LEAVE_CRITICAL_SECTION();
|
||||
return _pos;
|
||||
}
|
||||
|
||||
__weak void TRACER_EMB_LowPowerInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
__weak void TRACER_EMB_LowPowerSendData(void)
|
||||
{
|
||||
}
|
||||
|
||||
__weak void TRACER_EMB_LowPowerSendDataComplete(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
147
USB-PD_Provider_1port/Utilities/TRACER_EMB/tracer_emb.h
Normal file
147
USB-PD_Provider_1port/Utilities/TRACER_EMB/tracer_emb.h
Normal file
|
@ -0,0 +1,147 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file trace_emb.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the headers of tracer_emb.h for Cable Attach-Detach
|
||||
* controls.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef __TRACER_EMB_H_
|
||||
#define __TRACER_EMB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stdint.h"
|
||||
#include "tracer_emb_conf.h"
|
||||
|
||||
/** @addtogroup TRACER_EMB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported define -----------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported variables --------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup TRACER_EMB_Exported_Functions TRACE Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Initialize the TRACE module
|
||||
* @retval None
|
||||
*/
|
||||
void TRACER_EMB_Init(void);
|
||||
|
||||
/**
|
||||
* @brief Add information in debug trace buffer
|
||||
* @param Type Trace Type based on @ref TRACER_EMB_EVENT
|
||||
* @param PortNum Port number value
|
||||
* @param Sop SOP type
|
||||
* @param Ptr Pointer on the data to send
|
||||
* @param Size Size of the data to send
|
||||
* @retval None.
|
||||
*/
|
||||
void TRACER_EMB_Add(uint8_t *Ptr, uint32_t Size);
|
||||
|
||||
/**
|
||||
* @brief Add one data into the trace buffer
|
||||
* @param pos position
|
||||
* @param data data value
|
||||
*/
|
||||
void TRACER_EMB_WriteData(uint16_t pos, uint8_t data);
|
||||
|
||||
/**
|
||||
* @brief Lock the trace buffer.
|
||||
* @param None.
|
||||
* @retval None.
|
||||
*/
|
||||
void TRACER_EMB_Lock(void);
|
||||
|
||||
/**
|
||||
* @brief UnLock the trace buffer.
|
||||
* @param None.
|
||||
* @retval None.
|
||||
*/
|
||||
void TRACER_EMB_UnLock(void);
|
||||
|
||||
|
||||
void TRACER_EMB_SendData(void);
|
||||
|
||||
/**
|
||||
* @brief allocate space inside the buffer to push data
|
||||
* @param data size
|
||||
* @retval write position inside the buffer is -1 no space available.
|
||||
*/
|
||||
int32_t TRACER_EMB_AllocateBufer(uint32_t Size);
|
||||
|
||||
/**
|
||||
* @brief enable the overflow detection
|
||||
* @param Data pointer on the overflow string
|
||||
* @param Size of the overflow string
|
||||
* @retval 0 if success other value indicate an error.
|
||||
*/
|
||||
int32_t TRACER_EMB_EnableOverFlow(const uint8_t *Data, uint8_t Size);
|
||||
|
||||
|
||||
void TRACER_EMB_CALLBACK_TX(void);
|
||||
|
||||
#if TRACER_EMB_DMA_MODE == 1UL
|
||||
void TRACER_EMB_IRQHandlerDMA(void);
|
||||
#endif
|
||||
|
||||
void TRACER_EMB_IRQHandlerUSART(void);
|
||||
|
||||
|
||||
void TRACER_EMB_StartRX(void (*callbackRX)(uint8_t, uint8_t));
|
||||
|
||||
|
||||
/**
|
||||
* @brief function to initialize LPM for emb tracer.
|
||||
* @retval Timing
|
||||
*/
|
||||
void TRACER_EMB_LowPowerInit(void);
|
||||
|
||||
/**
|
||||
* @brief function to manage LPM when sending data.
|
||||
* @retval Timing
|
||||
*/
|
||||
void TRACER_EMB_LowPowerSendData(void);
|
||||
|
||||
/**
|
||||
* @brief function to manage LPM when data send complete.
|
||||
* @retval Timing
|
||||
*/
|
||||
void TRACER_EMB_LowPowerSendDataComplete(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TRACER_EMB_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,109 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file tracer_emb_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the Trace HW related defines.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef TRACER_EMB_CONF_H
|
||||
#define TRACER_EMB_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32g0xx_ll_bus.h"
|
||||
#include "stm32g0xx_ll_dma.h"
|
||||
#include "stm32g0xx_ll_gpio.h"
|
||||
#include "stm32g0xx_ll_rcc.h"
|
||||
#include "stm32g0xx_ll_usart.h"
|
||||
#if defined(LPUART1)
|
||||
#include "stm32g0xx_ll_lpuart.h"
|
||||
#endif /* LPUART1 */
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Definitions for TRACE feature
|
||||
-------------------------------------------------------------------------------*/
|
||||
#define TRACER_EMB_BAUDRATE 921600UL
|
||||
|
||||
#define TRACER_EMB_DMA_MODE 1UL
|
||||
#define TRACER_EMB_IT_MODE 0UL
|
||||
|
||||
#define TRACER_EMB_BUFFER_SIZE 1024UL
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Definitions for TRACE Hw information
|
||||
-------------------------------------------------------------------------------*/
|
||||
|
||||
/* USART instance is used.*/
|
||||
#define TRACER_EMB_IS_INSTANCE_LPUART_TYPE 0UL /* set to 1UL if LPUART is used instead of USART */
|
||||
#define TRACER_EMB_USART_INSTANCE USART3
|
||||
|
||||
#define TRACER_EMB_TX_GPIO GPIOC
|
||||
#define TRACER_EMB_TX_PIN LL_GPIO_PIN_10
|
||||
#define TRACER_EMB_TX_AF LL_GPIO_AF_0
|
||||
#define TRACER_EMB_TX_GPIO_ENABLE_CLOCK() LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC)
|
||||
#define TRACER_EMB_TX_GPIO_DISABLE_CLOCK() LL_IOP_GRP1_DisableClock(LL_IOP_GRP1_PERIPH_GPIOC)
|
||||
#define TRACER_EMB_RX_GPIO GPIOC
|
||||
#define TRACER_EMB_RX_PIN LL_GPIO_PIN_11
|
||||
#define TRACER_EMB_RX_AF LL_GPIO_AF_0
|
||||
#define TRACER_EMB_RX_GPIO_ENABLE_CLOCK() LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC)
|
||||
#define TRACER_EMB_RX_GPIO_DISABLE_CLOCK() LL_IOP_GRP1_DisableClock(LL_IOP_GRP1_PERIPH_GPIOC)
|
||||
|
||||
#define TRACER_EMB_ENABLE_CLK_USART() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART3)
|
||||
#define TRACER_EMB_DISABLE_CLK_USART() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART3)
|
||||
#define TRACER_EMB_SET_CLK_SOURCE_USART() /* No need for clock source selection in case of USART3 // LL_RCC_SetUSARTClockSource(LL_RCC_USART3_CLKSOURCE_PCLK2) */
|
||||
#define TRACER_EMB_USART_IRQ USART3_4_LPUART1_IRQn
|
||||
#define TRACER_EMB_USART_IRQHANDLER USART3_4_LPUART1_IRQHandler
|
||||
#define TRACER_EMB_TX_AF_FUNCTION LL_GPIO_SetAFPin_8_15
|
||||
#define TRACER_EMB_RX_AF_FUNCTION LL_GPIO_SetAFPin_8_15
|
||||
#define TRACER_EMB_TX_IRQ_PRIORITY 3
|
||||
#if TRACER_EMB_DMA_MODE == 1UL
|
||||
#define TRACER_EMB_DMA_INSTANCE DMA1
|
||||
#define TRACER_EMB_ENABLE_CLK_DMA() LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1)
|
||||
#if defined (DMAMUX_CxCR_DMAREQ_ID)
|
||||
#define TRACER_EMB_TX_DMA_REQUEST LL_DMAMUX_REQ_USART3_TX /* This define is needed only in case of DMAMUX management */
|
||||
#endif /* DMAMUX_CxCR_DMAREQ_ID */
|
||||
#if defined(DMA_SxCR_CHSEL)
|
||||
#define TRACER_EMB_TX_DMA_STREAM LL_DMA_STREAM_7 /* This define is needed only in case of use of a DMA IP supporting Streams */
|
||||
#endif /* DMA_SxCR_CHSEL */
|
||||
#define TRACER_EMB_TX_DMA_CHANNEL LL_DMA_CHANNEL_7
|
||||
#if defined(DMA_SxCR_CHSEL)
|
||||
/* Those defines are needed only in case of use of a DMA IP supporting Streams */
|
||||
#define TRACER_EMB_ENABLESTREAM LL_DMA_EnableStream
|
||||
#define TRACER_EMB_DISABLESTREAM LL_DMA_DisableStream
|
||||
#else
|
||||
/* Those defines are needed only in case of use of a DMA IP not supporting Streams */
|
||||
#define TRACER_EMB_ENABLECHANNEL LL_DMA_EnableChannel
|
||||
#define TRACER_EMB_DISABLECHANNEL LL_DMA_DisableChannel
|
||||
#endif /* DMA_SxCR_CHSEL */
|
||||
#define TRACER_EMB_TX_DMA_IRQ DMA1_Ch4_7_DMAMUX1_OVR_IRQn
|
||||
#define TRACER_EMB_TX_DMA_IRQHANDLER DMA1_Ch4_7_DMAMUX1_OVR_IRQHandler
|
||||
#define TRACER_EMB_TX_DMA_ACTIVE_FLAG LL_DMA_IsActiveFlag_TC7
|
||||
#define TRACER_EMB_TX_DMA_CLEAR_FLAG LL_DMA_ClearFlag_GI7
|
||||
#define TRACER_EMB_TX_DMA_PRIORITY 0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRACER_EMB_CONF_H */
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
623
USB-PD_Provider_1port/Utilities/TRACER_EMB/tracer_emb_hw.c
Normal file
623
USB-PD_Provider_1port/Utilities/TRACER_EMB/tracer_emb_hw.c
Normal file
|
@ -0,0 +1,623 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file tracer_emb_hw.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the low level interface to control trace system.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "tracer_emb.h"
|
||||
#include "tracer_emb_hw.h"
|
||||
|
||||
#if TRACER_EMB_DMA_MODE == 1UL && TRACER_EMB_IT_MODE == 1UL
|
||||
#error "tracer emb hw please select DMA or IT mode"
|
||||
#endif
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private Defines -----------------------------------------------------------*/
|
||||
#if (TRACER_EMB_IS_INSTANCE_LPUART_TYPE == 1UL)
|
||||
|
||||
/* LPUART entry point */
|
||||
#define TRACER_EMB_ENABLEDIRECTIONRX LL_LPUART_EnableDirectionRx
|
||||
#define TRACER_EMB_RECEIVE_DATA8 LL_LPUART_ReceiveData8
|
||||
#define TRACER_EMB_TRANSMIT_DATA8 LL_LPUART_TransmitData8
|
||||
#define TRACER_EMB_DMA_GETREGADDR LL_LPUART_DMA_GetRegAddr
|
||||
#define TRACER_EMB_ENABLEDMAREQ_TX LL_LPUART_EnableDMAReq_TX
|
||||
|
||||
#define TRACER_EMB_ENABLE_IT_RXNE LL_LPUART_EnableIT_RXNE
|
||||
#define TRACER_EMB_ENABLE_IT_ERROR LL_LPUART_EnableIT_ERROR
|
||||
#define TRACER_EMB_ENABLE_IT_TXE LL_LPUART_EnableIT_TXE
|
||||
#define TRACER_EMB_ENABLE_IT_TC LL_LPUART_EnableIT_TC
|
||||
|
||||
#define TRACER_EMB_DISABLEIT_TXE LL_LPUART_DisableIT_TXE
|
||||
#define TRACER_EMB_DISABLEIT_TC LL_LPUART_DisableIT_TC
|
||||
|
||||
#define TRACER_EMB_ISACTIVEFLAG_TXE LL_LPUART_IsActiveFlag_TXE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_PE LL_LPUART_IsActiveFlag_PE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_RXNE LL_LPUART_IsActiveFlag_RXNE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_FE LL_LPUART_IsActiveFlag_FE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_ORE LL_LPUART_IsActiveFlag_ORE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_NE LL_LPUART_IsActiveFlag_NE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_TC LL_LPUART_IsActiveFlag_TC
|
||||
|
||||
#define TRACER_EMB_ISENABLEDIT_TXE LL_LPUART_IsEnabledIT_TXE
|
||||
#define TRACER_EMB_ISENABLEDIT_RXNE LL_LPUART_IsEnabledIT_RXNE
|
||||
#define TRACER_EMB_ISENABLEDIT_PE LL_LPUART_IsEnabledIT_PE
|
||||
#define TRACER_EMB_ISENABLEDIT_ERROR LL_LPUART_IsEnabledIT_ERROR
|
||||
#define TRACER_EMB_ISENABLEDIT_TC LL_LPUART_IsEnabledIT_TC
|
||||
|
||||
#define TRACER_EMB_CLEARFLAG_PE LL_LPUART_ClearFlag_PE
|
||||
#define TRACER_EMB_CLEARFLAG_FE LL_LPUART_ClearFlag_FE
|
||||
#define TRACER_EMB_CLEARFLAG_ORE LL_LPUART_ClearFlag_ORE
|
||||
#define TRACER_EMB_CLEARFLAG_NE LL_LPUART_ClearFlag_NE
|
||||
#define TRACER_EMB_CLEARFLAG_TC LL_LPUART_ClearFlag_TC
|
||||
|
||||
#define TRACER_EMB_READREG LL_LPUART_ReadReg
|
||||
|
||||
#else
|
||||
|
||||
/* UART entry point */
|
||||
#define TRACER_EMB_ENABLEDIRECTIONRX LL_USART_EnableDirectionRx
|
||||
#define TRACER_EMB_RECEIVE_DATA8 LL_USART_ReceiveData8
|
||||
#define TRACER_EMB_TRANSMIT_DATA8 LL_USART_TransmitData8
|
||||
#define TRACER_EMB_DMA_GETREGADDR LL_USART_DMA_GetRegAddr
|
||||
#define TRACER_EMB_ENABLEDMAREQ_TX LL_USART_EnableDMAReq_TX
|
||||
|
||||
#define TRACER_EMB_ENABLE_IT_RXNE LL_USART_EnableIT_RXNE
|
||||
#define TRACER_EMB_ENABLE_IT_ERROR LL_USART_EnableIT_ERROR
|
||||
#define TRACER_EMB_ENABLE_IT_TXE LL_USART_EnableIT_TXE
|
||||
#define TRACER_EMB_ENABLE_IT_TC LL_USART_EnableIT_TC
|
||||
|
||||
#define TRACER_EMB_DISABLEIT_TXE LL_USART_DisableIT_TXE
|
||||
#define TRACER_EMB_DISABLEIT_TC LL_USART_DisableIT_TC
|
||||
|
||||
#define TRACER_EMB_ISACTIVEFLAG_TXE LL_USART_IsActiveFlag_TXE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_PE LL_USART_IsActiveFlag_PE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_RXNE LL_USART_IsActiveFlag_RXNE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_FE LL_USART_IsActiveFlag_FE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_ORE LL_USART_IsActiveFlag_ORE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_NE LL_USART_IsActiveFlag_NE
|
||||
#define TRACER_EMB_ISACTIVEFLAG_TC LL_USART_IsActiveFlag_TC
|
||||
#define TRACER_EMB_ISACTIVEFLAG_RTO LL_USART_IsActiveFlag_RTO
|
||||
|
||||
#define TRACER_EMB_ISENABLEDIT_TXE LL_USART_IsEnabledIT_TXE
|
||||
#define TRACER_EMB_ISENABLEDIT_RXNE LL_USART_IsEnabledIT_RXNE
|
||||
#define TRACER_EMB_ISENABLEDIT_PE LL_USART_IsEnabledIT_PE
|
||||
#define TRACER_EMB_ISENABLEDIT_ERROR LL_USART_IsEnabledIT_ERROR
|
||||
#define TRACER_EMB_ISENABLEDIT_TC LL_USART_IsEnabledIT_TC
|
||||
#define TRACER_EMB_ISENABLEDIT_RTO LL_USART_IsEnabledIT_RTO
|
||||
|
||||
#define TRACER_EMB_CLEARFLAG_PE LL_USART_ClearFlag_PE
|
||||
#define TRACER_EMB_CLEARFLAG_FE LL_USART_ClearFlag_FE
|
||||
#define TRACER_EMB_CLEARFLAG_ORE LL_USART_ClearFlag_ORE
|
||||
#define TRACER_EMB_CLEARFLAG_NE LL_USART_ClearFlag_NE
|
||||
#define TRACER_EMB_CLEARFLAG_TC LL_USART_ClearFlag_TC
|
||||
#define TRACER_EMB_CLEARFLAG_RTO LL_USART_ClearFlag_RTO
|
||||
|
||||
#define TRACER_EMB_READREG LL_USART_ReadReg
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(USART_ISR_RXNE_RXFNE)
|
||||
#define TRACER_EMB_FLAG_RXNE USART_ISR_RXNE_RXFNE
|
||||
#elif defined(USART_ISR_RXNE)
|
||||
#define TRACER_EMB_FLAG_RXNE USART_ISR_RXNE
|
||||
#else
|
||||
#define TRACER_EMB_FLAG_RXNE USART_SR_RXNE
|
||||
#endif /* USART_ISR_RXNE_RXFNE */
|
||||
#if defined(USART_CR1_TXEIE_TXFNFIE)
|
||||
#define TRACER_EMB_FLAG_TXE USART_CR1_TXEIE_TXFNFIE
|
||||
#elif defined(USART_ISR_TXE)
|
||||
#define TRACER_EMB_FLAG_TXE USART_ISR_TXE
|
||||
#else
|
||||
#define TRACER_EMB_FLAG_TXE USART_SR_TXE
|
||||
#endif /* USART_CR1_TXEIE_TXFNFIE */
|
||||
#if defined(USART_ISR_PE)
|
||||
#define TRACER_EMB_FLAG_PE USART_ISR_PE
|
||||
#define TRACER_EMB_FLAG_FE USART_ISR_FE
|
||||
#define TRACER_EMB_FLAG_ORE USART_ISR_ORE
|
||||
#define TRACER_EMB_FLAG_NE USART_ISR_NE
|
||||
#define TRACER_EMB_FLAG_TC USART_ISR_TC
|
||||
#else
|
||||
#define TRACER_EMB_FLAG_PE USART_SR_PE
|
||||
#define TRACER_EMB_FLAG_FE USART_SR_FE
|
||||
#define TRACER_EMB_FLAG_ORE USART_SR_ORE
|
||||
#define TRACER_EMB_FLAG_NE USART_SR_NE
|
||||
#define TRACER_EMB_FLAG_TC USART_SR_TC
|
||||
#endif /* USART_ISR_RXNE_RXFNE */
|
||||
|
||||
/* Private Variables ---------------------------------------------------------*/
|
||||
static void (*fptr_rx)(uint8_t, uint8_t) = NULL;
|
||||
#if TRACER_EMB_IT_MODE == 1UL
|
||||
uint8_t *txData = NULL;
|
||||
uint32_t txSize = 0;
|
||||
#endif
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Trace init
|
||||
* @param callbackTX
|
||||
* @param callbackRX
|
||||
* @retval none
|
||||
*/
|
||||
void HW_TRACER_EMB_Init(void)
|
||||
{
|
||||
/* Enable the peripheral clock of GPIO Port */
|
||||
TRACER_EMB_TX_GPIO_ENABLE_CLOCK();
|
||||
TRACER_EMB_RX_GPIO_ENABLE_CLOCK();
|
||||
|
||||
/* Configure Tx Pin as : Alternate function, High Speed, Push pull, Pull up */
|
||||
TRACER_EMB_TX_AF_FUNCTION(TRACER_EMB_TX_GPIO, TRACER_EMB_TX_PIN, TRACER_EMB_TX_AF);
|
||||
LL_GPIO_SetPinMode(TRACER_EMB_TX_GPIO, TRACER_EMB_TX_PIN, LL_GPIO_MODE_ALTERNATE);
|
||||
LL_GPIO_SetPinSpeed(TRACER_EMB_TX_GPIO, TRACER_EMB_TX_PIN, LL_GPIO_SPEED_FREQ_HIGH);
|
||||
LL_GPIO_SetPinOutputType(TRACER_EMB_TX_GPIO, TRACER_EMB_TX_PIN, LL_GPIO_OUTPUT_PUSHPULL);
|
||||
LL_GPIO_SetPinPull(TRACER_EMB_TX_GPIO, TRACER_EMB_TX_PIN, LL_GPIO_PULL_UP);
|
||||
|
||||
/* Configure Rx Pin as : Alternate function, High Speed, Push pull, Pull up */
|
||||
TRACER_EMB_RX_AF_FUNCTION(TRACER_EMB_RX_GPIO, TRACER_EMB_RX_PIN, TRACER_EMB_RX_AF);
|
||||
LL_GPIO_SetPinMode(TRACER_EMB_RX_GPIO, TRACER_EMB_RX_PIN, LL_GPIO_MODE_ALTERNATE);
|
||||
LL_GPIO_SetPinSpeed(TRACER_EMB_RX_GPIO, TRACER_EMB_RX_PIN, LL_GPIO_SPEED_FREQ_HIGH);
|
||||
LL_GPIO_SetPinOutputType(TRACER_EMB_RX_GPIO, TRACER_EMB_RX_PIN, LL_GPIO_OUTPUT_PUSHPULL);
|
||||
LL_GPIO_SetPinPull(TRACER_EMB_RX_GPIO, TRACER_EMB_RX_PIN, LL_GPIO_PULL_UP);
|
||||
|
||||
/* Enable the peripheral clock for USART */
|
||||
TRACER_EMB_ENABLE_CLK_USART();
|
||||
|
||||
/* Set clock source */
|
||||
TRACER_EMB_SET_CLK_SOURCE_USART();
|
||||
|
||||
|
||||
if(IS_USART_INSTANCE(TRACER_EMB_USART_INSTANCE))
|
||||
{
|
||||
/* Configure USART */
|
||||
|
||||
LL_USART_InitTypeDef usart_initstruct;
|
||||
|
||||
/* Disable USART prior modifying configuration registers */
|
||||
LL_USART_Disable(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
|
||||
/* Set fields of initialization structure */
|
||||
/* - Prescaler : LL_USART_PRESCALER_DIV1 */
|
||||
/* - BaudRate : TRACE_BAUDRATE */
|
||||
/* - DataWidth : LL_USART_DATAWIDTH_8B */
|
||||
/* - StopBits : LL_USART_STOPBITS_1 */
|
||||
/* - Parity : LL_USART_PARITY_NONE */
|
||||
/* - TransferDirection : LL_USART_DIRECTION_TX */
|
||||
/* - HardwareFlowControl : LL_USART_HWCONTROL_NONE */
|
||||
/* - OverSampling : LL_USART_OVERSAMPLING_16 */
|
||||
#if defined(USART_PRESC_PRESCALER)
|
||||
usart_initstruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||
#endif
|
||||
usart_initstruct.BaudRate = TRACER_EMB_BAUDRATE;
|
||||
usart_initstruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||
usart_initstruct.StopBits = LL_USART_STOPBITS_1;
|
||||
usart_initstruct.Parity = LL_USART_PARITY_NONE;
|
||||
usart_initstruct.TransferDirection = LL_USART_DIRECTION_TX;
|
||||
usart_initstruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||
usart_initstruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||
|
||||
/* Initialize USART instance according to parameters defined in initialization structure */
|
||||
LL_USART_Init(TRACER_EMB_USART_INSTANCE, &usart_initstruct);
|
||||
|
||||
LL_USART_Enable(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
#if defined(USART_ISR_TEACK)
|
||||
uint32_t _temp1 = LL_USART_IsActiveFlag_TEACK(TRACER_EMB_USART_INSTANCE);
|
||||
/* Polling USART initialisation */
|
||||
while(0u == _temp1)
|
||||
{
|
||||
_temp1 = LL_USART_IsActiveFlag_TEACK(TRACER_EMB_USART_INSTANCE);
|
||||
}
|
||||
#endif /* USART_ISR_TEACK */
|
||||
}
|
||||
#if (TRACER_EMB_IS_INSTANCE_LPUART_TYPE == 1UL)
|
||||
else
|
||||
{
|
||||
/* Configure USART */
|
||||
LL_LPUART_InitTypeDef lpuart_initstruct;
|
||||
|
||||
/* Disable USART prior modifying configuration registers */
|
||||
LL_LPUART_Disable(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
|
||||
/* Set fields of initialization structure */
|
||||
/* - Prescaler : LL_USART_PRESCALER_DIV1 */
|
||||
/* - BaudRate : TRACE_BAUDRATE */
|
||||
/* - DataWidth : LL_USART_DATAWIDTH_8B */
|
||||
/* - StopBits : LL_USART_STOPBITS_1 */
|
||||
/* - Parity : LL_USART_PARITY_NONE */
|
||||
/* - TransferDirection : LL_USART_DIRECTION_TX */
|
||||
/* - HardwareFlowControl : LL_USART_HWCONTROL_NONE */
|
||||
/* - OverSampling : LL_USART_OVERSAMPLING_16 */
|
||||
#if defined(USART_PRESC_PRESCALER)
|
||||
lpuart_initstruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||
#endif
|
||||
lpuart_initstruct.BaudRate = TRACER_EMB_BAUDRATE;
|
||||
lpuart_initstruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||
lpuart_initstruct.StopBits = LL_USART_STOPBITS_1;
|
||||
lpuart_initstruct.Parity = LL_USART_PARITY_NONE;
|
||||
lpuart_initstruct.TransferDirection = LL_USART_DIRECTION_TX;
|
||||
lpuart_initstruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||
|
||||
/* Initialize USART instance according to parameters defined in initialization structure */
|
||||
LL_LPUART_Init(TRACER_EMB_USART_INSTANCE, &lpuart_initstruct);
|
||||
|
||||
LL_LPUART_Enable(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
uint32_t _temp1 = LL_LPUART_IsActiveFlag_TEACK(TRACER_EMB_USART_INSTANCE);
|
||||
/* Polling USART initialisation */
|
||||
while(0u == _temp1)
|
||||
{
|
||||
_temp1 = LL_LPUART_IsActiveFlag_TEACK(TRACER_EMB_USART_INSTANCE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TRACER_EMB_DMA_MODE == 1UL
|
||||
/* Configure TX DMA */
|
||||
TRACER_EMB_ENABLE_CLK_DMA();
|
||||
|
||||
/* (3) Configure the DMA functional parameters for transmission */
|
||||
#if defined(GPDMA1)
|
||||
LL_DMA_ConfigDataTransfer(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL,
|
||||
LL_DMA_SINC_INCREMENT |
|
||||
LL_DMA_DINC_NOINCREMENT |
|
||||
LL_DMA_SRC_DATAWIDTH_BYTE |
|
||||
LL_DMA_DEST_DATAWIDTH_BYTE);
|
||||
|
||||
LL_DMA_SetHardwareRequest(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL, TRACER_EMB_TX_DMA_REQUEST);
|
||||
|
||||
#elif defined(DMA_SxCR_CHSEL)
|
||||
LL_DMA_SetChannelSelection(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_STREAM, TRACER_EMB_TX_DMA_CHANNEL);
|
||||
LL_DMA_ConfigTransfer(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_STREAM,
|
||||
LL_DMA_DIRECTION_MEMORY_TO_PERIPH |
|
||||
LL_DMA_PRIORITY_HIGH |
|
||||
LL_DMA_MODE_NORMAL |
|
||||
LL_DMA_PERIPH_NOINCREMENT |
|
||||
LL_DMA_MEMORY_INCREMENT |
|
||||
LL_DMA_PDATAALIGN_BYTE |
|
||||
LL_DMA_MDATAALIGN_BYTE);
|
||||
#else
|
||||
LL_DMA_ConfigTransfer(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL,
|
||||
LL_DMA_DIRECTION_MEMORY_TO_PERIPH |
|
||||
LL_DMA_PRIORITY_HIGH |
|
||||
LL_DMA_MODE_NORMAL |
|
||||
LL_DMA_PERIPH_NOINCREMENT |
|
||||
LL_DMA_MEMORY_INCREMENT |
|
||||
LL_DMA_PDATAALIGN_BYTE |
|
||||
LL_DMA_MDATAALIGN_BYTE);
|
||||
|
||||
#if defined(DMAMUX_CxCR_DMAREQ_ID)
|
||||
LL_DMA_SetPeriphRequest(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL, TRACER_EMB_TX_DMA_REQUEST);
|
||||
#endif
|
||||
|
||||
#endif /* GPDMA1 */
|
||||
|
||||
#if defined(DMA_SxCR_CHSEL)
|
||||
LL_DMA_EnableIT_TC(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_STREAM);
|
||||
#else
|
||||
LL_DMA_EnableIT_TC(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL);
|
||||
#endif /* DMA_SxCR_CHSEL */
|
||||
|
||||
#endif
|
||||
|
||||
/* Configure the interrupt for TX */
|
||||
#if TRACER_EMB_DMA_MODE == 1UL
|
||||
#ifdef TRACER_EMB_TX_DMA_PRIORITY
|
||||
NVIC_SetPriority(TRACER_EMB_TX_DMA_IRQ, TRACER_EMB_TX_DMA_PRIORITY);
|
||||
NVIC_EnableIRQ(TRACER_EMB_TX_DMA_IRQ);
|
||||
#else
|
||||
NVIC_SetPriority(TRACER_EMB_TX_DMA_IRQ, 0);
|
||||
NVIC_EnableIRQ(TRACER_EMB_TX_DMA_IRQ);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef TRACER_EMB_TX_IRQ_PRIORITY
|
||||
NVIC_SetPriority(TRACER_EMB_USART_IRQ, TRACER_EMB_TX_IRQ_PRIORITY);
|
||||
NVIC_EnableIRQ(TRACER_EMB_USART_IRQ);
|
||||
#else
|
||||
NVIC_SetPriority(TRACER_EMB_USART_IRQ, 3);
|
||||
NVIC_EnableIRQ(TRACER_EMB_USART_IRQ);
|
||||
#endif
|
||||
|
||||
/* Disable the UART */
|
||||
if(NULL == fptr_rx)
|
||||
{
|
||||
TRACER_EMB_DISABLE_CLK_USART();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Trace Deinit
|
||||
* @retval none
|
||||
*/
|
||||
void HW_TRACER_EMB_DeInit(void)
|
||||
{
|
||||
TRACER_EMB_DISABLE_CLK_USART();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Allow to update the RX callback
|
||||
* @param callbackRX
|
||||
* @retval none
|
||||
*/
|
||||
void HW_TRACER_EMB_RegisterRxCallback(void (*callbackRX)(uint8_t, uint8_t))
|
||||
{
|
||||
fptr_rx = callbackRX;
|
||||
TRACER_EMB_ENABLE_CLK_USART();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start RX reception only when OSKernel have been started
|
||||
* @retval none
|
||||
*/
|
||||
void HW_TRACER_EMB_StartRX(void)
|
||||
{
|
||||
/* Enable USART IT for RX */
|
||||
TRACER_EMB_ENABLE_IT_RXNE(TRACER_EMB_USART_INSTANCE);
|
||||
TRACER_EMB_ENABLE_IT_ERROR(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
/* Enable RX/TX */
|
||||
TRACER_EMB_ENABLEDIRECTIONRX(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
/* Configure the interrupt for RX */
|
||||
NVIC_SetPriority(TRACER_EMB_USART_IRQ, 3);
|
||||
NVIC_EnableIRQ(TRACER_EMB_USART_IRQ);
|
||||
}
|
||||
|
||||
#if TRACER_EMB_DMA_MODE == 1UL
|
||||
/**
|
||||
* @brief Function to handle reception in DMA mode
|
||||
* @retval none
|
||||
*/
|
||||
void HW_TRACER_EMB_IRQHandlerDMA(void)
|
||||
{
|
||||
if (1UL == TRACER_EMB_TX_DMA_ACTIVE_FLAG(TRACER_EMB_DMA_INSTANCE))
|
||||
{
|
||||
TRACER_EMB_ENABLE_IT_TC(TRACER_EMB_USART_INSTANCE);
|
||||
TRACER_EMB_TX_DMA_CLEAR_FLAG(TRACER_EMB_DMA_INSTANCE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART/LPUART IRQ Handler
|
||||
* @retval none
|
||||
*/
|
||||
void HW_TRACER_EMB_IRQHandlerUSART(void)
|
||||
{
|
||||
uint32_t _temp1, _temp2;
|
||||
uint32_t _isrflags;
|
||||
uint32_t _errorflags;
|
||||
uint8_t _error = 0U;
|
||||
|
||||
/* Load ISR in local variable */
|
||||
#if defined(USART_ISR_TC)
|
||||
_isrflags = TRACER_EMB_READREG(TRACER_EMB_USART_INSTANCE, ISR);
|
||||
#else
|
||||
_isrflags = TRACER_EMB_READREG(TRACER_EMB_USART_INSTANCE, SR);
|
||||
#endif /* USART_ISR_TC */
|
||||
|
||||
/* Ready to read received char if any */
|
||||
_temp1 = TRACER_EMB_ISENABLEDIT_RXNE(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
/* If Reception is ongoing */
|
||||
if (1UL == _temp1)
|
||||
{
|
||||
/* Reception is active : check if new byte is received */
|
||||
__IO uint32_t received_char;
|
||||
|
||||
_errorflags = ((_isrflags) & (TRACER_EMB_FLAG_PE | TRACER_EMB_FLAG_FE | TRACER_EMB_FLAG_NE | TRACER_EMB_FLAG_ORE));
|
||||
|
||||
/* Check if RXNE flag is set : new byte is stored in DR */
|
||||
if ( ((TRACER_EMB_FLAG_RXNE) == ((_isrflags) & (TRACER_EMB_FLAG_RXNE)))
|
||||
&&(0UL == _errorflags) )
|
||||
{
|
||||
/* Read Received character. RXNE flag is cleared by reading of RDR register */
|
||||
received_char = TRACER_EMB_RECEIVE_DATA8(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
if (fptr_rx != NULL)
|
||||
{
|
||||
fptr_rx(received_char, 0U);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (0UL != _errorflags)
|
||||
{
|
||||
/* Error has been detected */
|
||||
|
||||
/* Check if RXNE flag is set : new byte is stored in DR */
|
||||
if ((TRACER_EMB_FLAG_RXNE) == ((_isrflags) & (TRACER_EMB_FLAG_RXNE)))
|
||||
{
|
||||
/* Read Received character. RXNE flag is cleared by reading of RDR register */
|
||||
received_char = TRACER_EMB_RECEIVE_DATA8(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
if (fptr_rx != NULL)
|
||||
{
|
||||
fptr_rx(received_char, 0U);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parity error */
|
||||
_temp2 = TRACER_EMB_ISENABLEDIT_PE(TRACER_EMB_USART_INSTANCE);
|
||||
if ( (1U == _temp2)
|
||||
&&(TRACER_EMB_FLAG_PE == ((_errorflags) & (TRACER_EMB_FLAG_PE))) )
|
||||
{
|
||||
/* Flags clearing */
|
||||
TRACER_EMB_CLEARFLAG_PE(TRACER_EMB_USART_INSTANCE);
|
||||
_error = 1U;
|
||||
}
|
||||
|
||||
/* Generic Errors*/
|
||||
_temp2 = TRACER_EMB_ISENABLEDIT_ERROR(TRACER_EMB_USART_INSTANCE);
|
||||
if (1U == _temp2)
|
||||
{
|
||||
/* Framing error */
|
||||
if (TRACER_EMB_FLAG_FE == ((_errorflags) & (TRACER_EMB_FLAG_FE)))
|
||||
{
|
||||
/* Flags clearing */
|
||||
TRACER_EMB_CLEARFLAG_FE(TRACER_EMB_USART_INSTANCE);
|
||||
_error = 1U;
|
||||
}
|
||||
|
||||
/* Overrun error */
|
||||
if (TRACER_EMB_FLAG_ORE == ((_errorflags) & (TRACER_EMB_FLAG_ORE)))
|
||||
{
|
||||
/* Flags clearing */
|
||||
TRACER_EMB_CLEARFLAG_ORE(TRACER_EMB_USART_INSTANCE);
|
||||
_error = 1U;
|
||||
}
|
||||
|
||||
/* Noise detection */
|
||||
if (TRACER_EMB_FLAG_NE == ((_errorflags) & (TRACER_EMB_FLAG_NE)))
|
||||
{
|
||||
/* Flags clearing */
|
||||
TRACER_EMB_CLEARFLAG_NE(TRACER_EMB_USART_INSTANCE);
|
||||
_error = 1U;
|
||||
}
|
||||
}
|
||||
|
||||
if ((1U == _error) && (fptr_rx != NULL))
|
||||
{
|
||||
fptr_rx(1U, 1U); /* 1 indicate a reception error */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no error, no reception */
|
||||
}
|
||||
}
|
||||
|
||||
#if TRACER_EMB_IT_MODE == 1UL
|
||||
/* Ready to handle TXE interrupt */
|
||||
_temp2 = TRACER_EMB_ISENABLEDIT_TXE(TRACER_EMB_USART_INSTANCE);
|
||||
if (((TRACER_EMB_FLAG_TXE) == ((_isrflags) & (TRACER_EMB_FLAG_TXE))) && (1UL == _temp2))
|
||||
{
|
||||
/* Write data inside the data register */
|
||||
TRACER_EMB_TRANSMIT_DATA8(TRACER_EMB_USART_INSTANCE, *txData);
|
||||
txData++;
|
||||
txSize--;
|
||||
if (txSize == 0)
|
||||
{
|
||||
TRACER_EMB_DISABLEIT_TXE(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
if(NULL == fptr_rx)
|
||||
{
|
||||
TRACER_EMB_DISABLE_CLK_USART();
|
||||
}
|
||||
|
||||
TRACER_EMB_CALLBACK_TX();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (TRACER_EMB_DMA_MODE == 1UL)
|
||||
/* Ready to handle TC interrupt */
|
||||
_temp2 = TRACER_EMB_ISENABLEDIT_TC(TRACER_EMB_USART_INSTANCE);
|
||||
if (((TRACER_EMB_FLAG_TC) == ((_isrflags) & (TRACER_EMB_FLAG_TC))) && (1UL == _temp2))
|
||||
{
|
||||
TRACER_EMB_DISABLEIT_TC(TRACER_EMB_USART_INSTANCE);
|
||||
TRACER_EMB_CLEARFLAG_TC(TRACER_EMB_USART_INSTANCE);
|
||||
#if defined(DMA_SxCR_CHSEL)
|
||||
TRACER_EMB_DISABLESTREAM(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_STREAM);
|
||||
#else
|
||||
TRACER_EMB_DISABLECHANNEL(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL);
|
||||
#endif /* DMA_SxCR_CHSEL */
|
||||
if(NULL == fptr_rx)
|
||||
{
|
||||
TRACER_EMB_DISABLE_CLK_USART();
|
||||
}
|
||||
/* call the callback */
|
||||
TRACER_EMB_CALLBACK_TX();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief USART/LPUART send data
|
||||
* @param data pointer
|
||||
* @param data size
|
||||
* @retval none
|
||||
*/
|
||||
void HW_TRACER_EMB_SendData(uint8_t *pData, uint32_t Size)
|
||||
{
|
||||
/* enable the USART */
|
||||
TRACER_EMB_ENABLE_CLK_USART();
|
||||
|
||||
#if TRACER_EMB_DMA_MODE == 1UL
|
||||
#if defined(GPDMA1)
|
||||
LL_DMA_ConfigAddrs(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL,
|
||||
(uint32_t)pData,
|
||||
TRACER_EMB_DMA_GETREGADDR(TRACER_EMB_USART_INSTANCE, LL_USART_DMA_REG_DATA_TRANSMIT));
|
||||
LL_DMA_SetBlkDataLength(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL, Size);
|
||||
|
||||
/* Enable DMA TX Interrupt */
|
||||
TRACER_EMB_ENABLEDMAREQ_TX(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
/* Enable DMA Channel Tx */
|
||||
LL_DMA_EnableChannel(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL);
|
||||
TRACER_EMB_ENABLECHANNEL(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL);
|
||||
#elif defined(DMA_SxCR_CHSEL)
|
||||
LL_DMA_ConfigAddresses(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_STREAM,
|
||||
(uint32_t)pData,
|
||||
TRACER_EMB_DMA_GETREGADDR(TRACER_EMB_USART_INSTANCE),
|
||||
LL_DMA_GetDataTransferDirection(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_STREAM));
|
||||
LL_DMA_SetDataLength(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_STREAM, Size);
|
||||
|
||||
/* Enable DMA TX Interrupt */
|
||||
TRACER_EMB_ENABLEDMAREQ_TX(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
/* Enable DMA Channel Tx */
|
||||
TRACER_EMB_ENABLESTREAM(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_STREAM);
|
||||
#else
|
||||
LL_DMA_ConfigAddresses(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL,
|
||||
(uint32_t)pData,
|
||||
TRACER_EMB_DMA_GETREGADDR(TRACER_EMB_USART_INSTANCE, LL_USART_DMA_REG_DATA_TRANSMIT),
|
||||
LL_DMA_GetDataTransferDirection(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL));
|
||||
LL_DMA_SetDataLength(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL, Size);
|
||||
|
||||
/* Enable DMA TX Interrupt */
|
||||
TRACER_EMB_ENABLEDMAREQ_TX(TRACER_EMB_USART_INSTANCE);
|
||||
|
||||
/* Enable DMA Channel Tx */
|
||||
TRACER_EMB_ENABLECHANNEL(TRACER_EMB_DMA_INSTANCE, TRACER_EMB_TX_DMA_CHANNEL);
|
||||
#endif /* GPDMA1 */
|
||||
#endif
|
||||
|
||||
#if TRACER_EMB_IT_MODE == 1UL
|
||||
/* keep information about the data to transfert */
|
||||
txData = pData;
|
||||
txSize = Size;
|
||||
|
||||
/* Enable the TXEIE */
|
||||
TRACER_EMB_ENABLE_IT_TXE(TRACER_EMB_USART_INSTANCE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief USART/LPUART read data
|
||||
* @retval return a data
|
||||
*/
|
||||
uint8_t HW_TRACER_EMB_ReadData(void)
|
||||
{
|
||||
return TRACER_EMB_RECEIVE_DATA8(TRACER_EMB_USART_INSTANCE);
|
||||
}
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
47
USB-PD_Provider_1port/Utilities/TRACER_EMB/tracer_emb_hw.h
Normal file
47
USB-PD_Provider_1port/Utilities/TRACER_EMB/tracer_emb_hw.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_bsp_trace.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains bsp interface control functions.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef HW_TRACE_H
|
||||
#define HW_TRACE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions ---------------------------------------------------------*/
|
||||
|
||||
void HW_TRACER_EMB_Init(void);
|
||||
void HW_TRACER_EMB_DeInit(void);
|
||||
void HW_TRACER_EMB_RegisterRxCallback(void (*callbackRX)(uint8_t, uint8_t));
|
||||
#if TRACER_EMB_DMA_MODE == 1UL
|
||||
void HW_TRACER_EMB_IRQHandlerDMA(void);
|
||||
#endif
|
||||
void HW_TRACER_EMB_IRQHandlerUSART(void);
|
||||
void HW_TRACER_EMB_StartRX(void);
|
||||
void HW_TRACER_EMB_SendData(uint8_t *data, uint32_t size);
|
||||
uint8_t HW_TRACER_EMB_ReadData(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HW_TRACE_H */
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Loading…
Add table
Add a link
Reference in a new issue