Initial commit

This commit is contained in:
Jochen Friedrich 2021-01-01 14:06:20 +01:00
commit 66c5a26d69
1145 changed files with 938088 additions and 0 deletions

View 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 &amp; 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 &amp; PE_VconnSwap in the USBPD_USER_SettingsTypeDef for integration in cubeMX [USBPD][GUI] Ticket 67078 - Use common defines for XID, VID &amp; 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

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

View file

@ -0,0 +1,398 @@
/**
******************************************************************************
* @file bsp_gui.c
* @author MCD Application Team
* @brief This file contains phy interface control functions.
******************************************************************************
* @attention
*
* <h2><center>&copy; 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****/

View file

@ -0,0 +1,56 @@
/**
******************************************************************************
* @file bsp_gui.h
* @author MCD Application Team
* @brief This file contains bsp interface control functions.
******************************************************************************
* @attention
*
* <h2><center>&copy; 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****/

View 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>&copy; 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 */

View file

@ -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>&copy; 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_ */

File diff suppressed because it is too large Load diff

View 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>&copy; 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 */

View file

@ -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>&copy; 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****/