|
|
@@ -1,9 +1,9 @@
|
|
|
/*********************************************************************
|
|
|
-* SEGGER MICROCONTROLLER GmbH & Co. KG *
|
|
|
-* Solutions for real time microcontroller applications *
|
|
|
+* SEGGER Microcontroller GmbH & Co. KG *
|
|
|
+* The Embedded Experts *
|
|
|
**********************************************************************
|
|
|
* *
|
|
|
-* (c) 2015 - 2016 SEGGER Microcontroller GmbH & Co. KG *
|
|
|
+* (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG *
|
|
|
* *
|
|
|
* www.segger.com Support: support@segger.com *
|
|
|
* *
|
|
|
@@ -15,37 +15,51 @@
|
|
|
* *
|
|
|
* All rights reserved. *
|
|
|
* *
|
|
|
-* * This software may in its unmodified form be freely redistributed *
|
|
|
-* in source form. *
|
|
|
-* * The source code may be modified, provided the source code *
|
|
|
-* retains the above copyright notice, this list of conditions and *
|
|
|
-* the following disclaimer. *
|
|
|
-* * Modified versions of this software in source or linkable form *
|
|
|
-* may not be distributed without prior consent of SEGGER. *
|
|
|
+* SEGGER strongly recommends to not make any changes *
|
|
|
+* to or modify the source code of this software in order to stay *
|
|
|
+* compatible with the RTT protocol and J-Link. *
|
|
|
* *
|
|
|
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND *
|
|
|
-* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, *
|
|
|
-* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
|
|
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
|
|
|
-* SEGGER Microcontroller BE LIABLE FOR ANY DIRECT, INDIRECT, *
|
|
|
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
|
|
|
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
|
|
|
-* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
|
|
|
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, *
|
|
|
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
|
|
|
-* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
|
|
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
|
|
+* Redistribution and use in source and binary forms, with or *
|
|
|
+* without modification, are permitted provided that the following *
|
|
|
+* conditions are met: *
|
|
|
+* *
|
|
|
+* o Redistributions of source code must retain the above copyright *
|
|
|
+* notice, this list of conditions and the following disclaimer. *
|
|
|
+* *
|
|
|
+* o Redistributions in binary form must reproduce the above *
|
|
|
+* copyright notice, this list of conditions and the following *
|
|
|
+* disclaimer in the documentation and/or other materials provided *
|
|
|
+* with the distribution. *
|
|
|
+* *
|
|
|
+* o Neither the name of SEGGER Microcontroller GmbH & Co. KG *
|
|
|
+* nor the names of its contributors may be used to endorse or *
|
|
|
+* promote products derived from this software without specific *
|
|
|
+* prior written permission. *
|
|
|
+* *
|
|
|
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
|
|
|
+* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
|
|
|
+* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
|
|
|
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
|
|
|
+* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
|
|
|
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
|
|
|
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
|
|
|
+* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
|
|
|
+* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
|
|
+* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
|
|
|
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
|
|
|
+* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
|
|
|
+* DAMAGE. *
|
|
|
* *
|
|
|
**********************************************************************
|
|
|
* *
|
|
|
-* SystemView version: V2.40 *
|
|
|
+* SystemView version: V2.52a *
|
|
|
* *
|
|
|
**********************************************************************
|
|
|
-------------------------- END-OF-HEADER -----------------------------
|
|
|
|
|
|
File : SEGGER_SYSVIEW.c
|
|
|
Purpose : System visualization API implementation.
|
|
|
-Revision: $Rev: 4039 $
|
|
|
+Revision: $Rev: 6414 $
|
|
|
|
|
|
Additional information:
|
|
|
Packet format:
|
|
|
@@ -232,7 +246,7 @@ typedef struct {
|
|
|
*
|
|
|
**********************************************************************
|
|
|
*/
|
|
|
-static void _SendPacket(U8* pStartPacket, U8* pEndPacket, unsigned EventId);
|
|
|
+static void _SendPacket(U8* pStartPacket, U8* pEndPacket, unsigned int EventId);
|
|
|
|
|
|
/*********************************************************************
|
|
|
*
|
|
|
@@ -253,7 +267,7 @@ static const U8 _abSync[10] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE];
|
|
|
#pragma location=SEGGER_SYSVIEW_SECTION
|
|
|
static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms
|
|
|
- #elif (defined __CC_ARM__)
|
|
|
+ #elif (defined __CC_ARM)
|
|
|
__attribute__ ((section (SEGGER_SYSVIEW_SECTION), zero_init)) static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE];
|
|
|
#if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1)
|
|
|
__attribute__ ((section (SEGGER_SYSVIEW_SECTION), zero_init)) static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms
|
|
|
@@ -337,8 +351,8 @@ static U8 _aPacket[SEGGER_SYSVIEW_MAX_PACKET_SIZE];
|
|
|
* of the data buffer.
|
|
|
* Make sure NumBytes + 1 bytes are free for the payload.
|
|
|
*/
|
|
|
-static U8* _EncodeData(U8* pPayload, const char* pSrc, unsigned NumBytes) {
|
|
|
- unsigned n;
|
|
|
+static U8* _EncodeData(U8* pPayload, const char* pSrc, unsigned int NumBytes) {
|
|
|
+ unsigned int n;
|
|
|
//
|
|
|
n = 0;
|
|
|
*pPayload++ = NumBytes;
|
|
|
@@ -371,9 +385,9 @@ static U8* _EncodeData(U8* pPayload, const char* pSrc, unsigned NumBytes) {
|
|
|
* of the string.
|
|
|
* No more than 1 + Limit bytes will be encoded to the payload.
|
|
|
*/
|
|
|
-static U8 *_EncodeStr(U8 *pPayload, const char *pText, unsigned Limit) {
|
|
|
- unsigned n;
|
|
|
- unsigned Len;
|
|
|
+static U8 *_EncodeStr(U8 *pPayload, const char *pText, unsigned int Limit) {
|
|
|
+ unsigned int n;
|
|
|
+ unsigned int Len;
|
|
|
//
|
|
|
// Compute string len
|
|
|
//
|
|
|
@@ -607,12 +621,12 @@ static void _SendSyncInfo(void) {
|
|
|
* EventId - Id of the event to send.
|
|
|
*
|
|
|
*/
|
|
|
-static void _SendPacket(U8* pStartPacket, U8* pEndPacket, unsigned EventId) {
|
|
|
- unsigned NumBytes;
|
|
|
- U32 TimeStamp;
|
|
|
- U32 Delta;
|
|
|
+static void _SendPacket(U8* pStartPacket, U8* pEndPacket, unsigned int EventId) {
|
|
|
+ unsigned int NumBytes;
|
|
|
+ U32 TimeStamp;
|
|
|
+ U32 Delta;
|
|
|
#if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1)
|
|
|
- int Status;
|
|
|
+ int Status;
|
|
|
#endif
|
|
|
|
|
|
#if (SEGGER_SYSVIEW_USE_STATIC_BUFFER == 0)
|
|
|
@@ -734,63 +748,85 @@ SendDone:
|
|
|
}
|
|
|
|
|
|
#ifndef SEGGER_SYSVIEW_EXCLUDE_PRINTF // Define in project to avoid warnings about variable parameter list
|
|
|
-/*********************************************************************
|
|
|
-*
|
|
|
-* _APrintHost()
|
|
|
-*
|
|
|
-* Function description
|
|
|
-* Prepares a string and its parameters to be formatted on the host.
|
|
|
-*
|
|
|
-* Parameters
|
|
|
-* s Pointer to format string.
|
|
|
-* Options Options to be sent to the host.
|
|
|
-* pArguments Pointer to array of arguments for the format string.
|
|
|
-* NumArguments Number of arguments in the array.
|
|
|
-*/
|
|
|
-static void _APrintHost(const char* s, U32 Options, U32* pArguments, U32 NumArguments) {
|
|
|
- U8* pPayload;
|
|
|
- U8* pPayloadStart;
|
|
|
-
|
|
|
- RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_ARGUMENTS * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
- pPayload = _EncodeStr(pPayloadStart, s, SEGGER_SYSVIEW_MAX_STRING_LEN);
|
|
|
- ENCODE_U32(pPayload, Options);
|
|
|
- ENCODE_U32(pPayload, NumArguments);
|
|
|
- while (NumArguments--) {
|
|
|
- ENCODE_U32(pPayload, (*pArguments++));
|
|
|
- }
|
|
|
- _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_PRINT_FORMATTED);
|
|
|
- RECORD_END();
|
|
|
-}
|
|
|
-
|
|
|
/*********************************************************************
|
|
|
*
|
|
|
* _VPrintHost()
|
|
|
*
|
|
|
* Function description
|
|
|
-* Prepares a string and its parameters to be formatted on the host.
|
|
|
+* Send a format string and its parameters to the host.
|
|
|
*
|
|
|
* Parameters
|
|
|
* s Pointer to format string.
|
|
|
* Options Options to be sent to the host.
|
|
|
* pParamList Pointer to the list of arguments for the format string.
|
|
|
*/
|
|
|
-static void _VPrintHost(const char* s, U32 Options, va_list* pParamList) {
|
|
|
- U32 aParas[SEGGER_SYSVIEW_MAX_ARGUMENTS];
|
|
|
- U32 NumArguments;
|
|
|
+static int _VPrintHost(const char* s, U32 Options, va_list* pParamList) {
|
|
|
+ U32 aParas[SEGGER_SYSVIEW_MAX_ARGUMENTS];
|
|
|
+ U32* pParas;
|
|
|
+ U32 NumArguments;
|
|
|
const char* p;
|
|
|
+ char c;
|
|
|
+ U8* pPayload;
|
|
|
+ U8* pPayloadStart;
|
|
|
+#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
|
|
+ U8 HasNonScalar;
|
|
|
|
|
|
+ HasNonScalar = 0;
|
|
|
+#endif
|
|
|
+ //
|
|
|
+ // Count number of arguments by counting '%' characters in string.
|
|
|
+ // If enabled, check for non-scalar modifier flags to format string on the target.
|
|
|
+ //
|
|
|
p = s;
|
|
|
NumArguments = 0;
|
|
|
- while (*p) {
|
|
|
- if (*p == '%') {
|
|
|
+ for (;;) {
|
|
|
+ c = *p++;
|
|
|
+ if (c == 0) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (c == '%') {
|
|
|
+ c = *p;
|
|
|
+#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT == 0
|
|
|
aParas[NumArguments++] = va_arg(*pParamList, int);
|
|
|
if (NumArguments == SEGGER_SYSVIEW_MAX_ARGUMENTS) {
|
|
|
break;
|
|
|
}
|
|
|
+#else
|
|
|
+ if (c == 's') {
|
|
|
+ HasNonScalar = 1;
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ aParas[NumArguments++] = va_arg(*pParamList, int);
|
|
|
+ if (NumArguments == SEGGER_SYSVIEW_MAX_ARGUMENTS) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
}
|
|
|
- p++;
|
|
|
}
|
|
|
- _APrintHost(s, Options, aParas, NumArguments);
|
|
|
+
|
|
|
+#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
|
|
+ if (HasNonScalar) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ //
|
|
|
+ // Send string and parameters to host
|
|
|
+ //
|
|
|
+ {
|
|
|
+ RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_ARGUMENTS * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
+ pPayload = _EncodeStr(pPayloadStart, s, SEGGER_SYSVIEW_MAX_STRING_LEN);
|
|
|
+ ENCODE_U32(pPayload, Options);
|
|
|
+ ENCODE_U32(pPayload, NumArguments);
|
|
|
+ pParas = aParas;
|
|
|
+ while (NumArguments--) {
|
|
|
+ ENCODE_U32(pPayload, (*pParas));
|
|
|
+ pParas++;
|
|
|
+ }
|
|
|
+ _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_PRINT_FORMATTED);
|
|
|
+ RECORD_END();
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
/*********************************************************************
|
|
|
@@ -806,9 +842,9 @@ static void _VPrintHost(const char* s, U32 Options, va_list* pParamList) {
|
|
|
* c Character to be printed.
|
|
|
*/
|
|
|
static void _StoreChar(SEGGER_SYSVIEW_PRINTF_DESC * p, char c) {
|
|
|
- unsigned Cnt;
|
|
|
- U8* pPayload;
|
|
|
- U32 Options;
|
|
|
+ unsigned int Cnt;
|
|
|
+ U8* pPayload;
|
|
|
+ U32 Options;
|
|
|
|
|
|
Cnt = p->Cnt;
|
|
|
if ((Cnt + 1u) <= SEGGER_SYSVIEW_MAX_STRING_LEN) {
|
|
|
@@ -847,13 +883,13 @@ static void _StoreChar(SEGGER_SYSVIEW_PRINTF_DESC * p, char c) {
|
|
|
* FieldWidth Width of the printed field.
|
|
|
* FormatFlags Flags for formatting the value.
|
|
|
*/
|
|
|
-static void _PrintUnsigned(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, unsigned v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {
|
|
|
+static void _PrintUnsigned(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, unsigned int v, unsigned int Base, unsigned int NumDigits, unsigned int FieldWidth, unsigned int FormatFlags) {
|
|
|
static const char _aV2C[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
|
|
- unsigned Div;
|
|
|
- unsigned Digit;
|
|
|
- unsigned Number;
|
|
|
- unsigned Width;
|
|
|
- char c;
|
|
|
+ unsigned int Div;
|
|
|
+ unsigned int Digit;
|
|
|
+ unsigned int Number;
|
|
|
+ unsigned int Width;
|
|
|
+ char c;
|
|
|
|
|
|
Number = v;
|
|
|
Digit = 1u;
|
|
|
@@ -938,9 +974,9 @@ static void _PrintUnsigned(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, unsigned v,
|
|
|
* FieldWidth Width of the printed field.
|
|
|
* FormatFlags Flags for formatting the value.
|
|
|
*/
|
|
|
-static void _PrintInt(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, int v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {
|
|
|
- unsigned Width;
|
|
|
- int Number;
|
|
|
+static void _PrintInt(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, int v, unsigned int Base, unsigned int NumDigits, unsigned int FieldWidth, unsigned int FormatFlags) {
|
|
|
+ unsigned int Width;
|
|
|
+ int Number;
|
|
|
|
|
|
Number = (v < 0) ? -v : v;
|
|
|
|
|
|
@@ -995,7 +1031,7 @@ static void _PrintInt(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, int v, unsigned
|
|
|
//
|
|
|
// Print number without sign
|
|
|
//
|
|
|
- _PrintUnsigned(pBufferDesc, (unsigned)v, Base, NumDigits, FieldWidth, FormatFlags);
|
|
|
+ _PrintUnsigned(pBufferDesc, (unsigned int)v, Base, NumDigits, FieldWidth, FormatFlags);
|
|
|
}
|
|
|
|
|
|
/*********************************************************************
|
|
|
@@ -1013,12 +1049,12 @@ static void _PrintInt(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, int v, unsigned
|
|
|
*/
|
|
|
static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList) {
|
|
|
SEGGER_SYSVIEW_PRINTF_DESC BufferDesc;
|
|
|
- char c;
|
|
|
- int v;
|
|
|
- unsigned NumDigits;
|
|
|
- unsigned FormatFlags;
|
|
|
- unsigned FieldWidth;
|
|
|
- U8* pPayloadStart;
|
|
|
+ char c;
|
|
|
+ int v;
|
|
|
+ unsigned int NumDigits;
|
|
|
+ unsigned int FormatFlags;
|
|
|
+ unsigned int FieldWidth;
|
|
|
+ U8* pPayloadStart;
|
|
|
#if SEGGER_SYSVIEW_USE_STATIC_BUFFER == 0
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 1 + 2 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
SEGGER_SYSVIEW_LOCK();
|
|
|
@@ -1068,7 +1104,7 @@ static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList)
|
|
|
break;
|
|
|
}
|
|
|
sFormat++;
|
|
|
- FieldWidth = (FieldWidth * 10u) + ((unsigned)c - '0');
|
|
|
+ FieldWidth = (FieldWidth * 10u) + ((unsigned int)c - '0');
|
|
|
} while (1);
|
|
|
|
|
|
//
|
|
|
@@ -1084,7 +1120,7 @@ static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList)
|
|
|
break;
|
|
|
}
|
|
|
sFormat++;
|
|
|
- NumDigits = NumDigits * 10u + ((unsigned)c - '0');
|
|
|
+ NumDigits = NumDigits * 10u + ((unsigned int)c - '0');
|
|
|
} while (1);
|
|
|
}
|
|
|
//
|
|
|
@@ -1116,16 +1152,16 @@ static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList)
|
|
|
break;
|
|
|
case 'u':
|
|
|
v = va_arg(*pParamList, int);
|
|
|
- _PrintUnsigned(&BufferDesc, (unsigned)v, 10u, NumDigits, FieldWidth, FormatFlags);
|
|
|
+ _PrintUnsigned(&BufferDesc, (unsigned int)v, 10u, NumDigits, FieldWidth, FormatFlags);
|
|
|
break;
|
|
|
case 'x':
|
|
|
case 'X':
|
|
|
v = va_arg(*pParamList, int);
|
|
|
- _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, NumDigits, FieldWidth, FormatFlags);
|
|
|
+ _PrintUnsigned(&BufferDesc, (unsigned int)v, 16u, NumDigits, FieldWidth, FormatFlags);
|
|
|
break;
|
|
|
case 'p':
|
|
|
v = va_arg(*pParamList, int);
|
|
|
- _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, 8u, 8u, 0u);
|
|
|
+ _PrintUnsigned(&BufferDesc, (unsigned int)v, 16u, 8u, 8u, 0u);
|
|
|
break;
|
|
|
case '%':
|
|
|
_StoreChar(&BufferDesc, '%');
|
|
|
@@ -1255,7 +1291,7 @@ void SEGGER_SYSVIEW_SetRAMBase(U32 RAMBaseAddress) {
|
|
|
* Parameters
|
|
|
* EventID - SystemView event ID.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordVoid(unsigned EventID) {
|
|
|
+void SEGGER_SYSVIEW_RecordVoid(unsigned int EventID) {
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE);
|
|
|
//
|
|
|
@@ -1275,7 +1311,7 @@ void SEGGER_SYSVIEW_RecordVoid(unsigned EventID) {
|
|
|
* EventID - SystemView event ID.
|
|
|
* Value - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32(unsigned EventID, U32 Value) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32(unsigned int EventID, U32 Value) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1298,7 +1334,7 @@ void SEGGER_SYSVIEW_RecordU32(unsigned EventID, U32 Value) {
|
|
|
* Para0 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para1 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x2(unsigned EventID, U32 Para0, U32 Para1) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x2(unsigned int EventID, U32 Para0, U32 Para1) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1323,7 +1359,7 @@ void SEGGER_SYSVIEW_RecordU32x2(unsigned EventID, U32 Para0, U32 Para1) {
|
|
|
* Para1 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para2 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x3(unsigned EventID, U32 Para0, U32 Para1, U32 Para2) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x3(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 3 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1350,7 +1386,7 @@ void SEGGER_SYSVIEW_RecordU32x3(unsigned EventID, U32 Para0, U32 Para1, U32 Para
|
|
|
* Para2 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para3 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x4(unsigned EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x4(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1379,7 +1415,7 @@ void SEGGER_SYSVIEW_RecordU32x4(unsigned EventID, U32 Para0, U32 Para1, U32 Para
|
|
|
* Para3 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para4 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x5(unsigned EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x5(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1410,7 +1446,7 @@ void SEGGER_SYSVIEW_RecordU32x5(unsigned EventID, U32 Para0, U32 Para1, U32 Para
|
|
|
* Para4 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para5 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x6(unsigned EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x6(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 6 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1443,7 +1479,7 @@ void SEGGER_SYSVIEW_RecordU32x6(unsigned EventID, U32 Para0, U32 Para1, U32 Para
|
|
|
* Para5 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para6 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x7(unsigned EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x7(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 7 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1478,7 +1514,7 @@ void SEGGER_SYSVIEW_RecordU32x7(unsigned EventID, U32 Para0, U32 Para1, U32 Para
|
|
|
* Para6 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para7 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x8(unsigned EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x8(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 8 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1515,7 +1551,7 @@ void SEGGER_SYSVIEW_RecordU32x8(unsigned EventID, U32 Para0, U32 Para1, U32 Para
|
|
|
* Para7 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para8 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x9(unsigned EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7, U32 Para8) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x9(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7, U32 Para8) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 9 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1554,7 +1590,7 @@ void SEGGER_SYSVIEW_RecordU32x9(unsigned EventID, U32 Para0, U32 Para1, U32 Para
|
|
|
* Para8 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
* Para9 - The 32-bit parameter encoded to SystemView packet payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordU32x10(unsigned EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7, U32 Para8, U32 Para9) {
|
|
|
+void SEGGER_SYSVIEW_RecordU32x10(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7, U32 Para8, U32 Para9) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 10 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1589,7 +1625,7 @@ void SEGGER_SYSVIEW_RecordU32x10(unsigned EventID, U32 Para0, U32 Para1, U32 Par
|
|
|
* of the string.
|
|
|
* No more than SEGGER_SYSVIEW_MAX_STRING_LEN bytes will be encoded to the payload.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordString(unsigned EventID, const char* pString) {
|
|
|
+void SEGGER_SYSVIEW_RecordString(unsigned int EventID, const char* pString) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN);
|
|
|
@@ -1908,7 +1944,7 @@ void SEGGER_SYSVIEW_RecordExitTimer(void) {
|
|
|
* Parameters
|
|
|
* EventID - Id of API function which ends.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordEndCall(unsigned EventID) {
|
|
|
+void SEGGER_SYSVIEW_RecordEndCall(unsigned int EventID) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1930,7 +1966,7 @@ void SEGGER_SYSVIEW_RecordEndCall(unsigned EventID) {
|
|
|
* EventID - Id of API function which ends.
|
|
|
* Para0 - Return value which will be returned by the API function.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_RecordEndCallU32(unsigned EventID, U32 Para0) {
|
|
|
+void SEGGER_SYSVIEW_RecordEndCallU32(unsigned int EventID, U32 Para0) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1968,7 +2004,7 @@ void SEGGER_SYSVIEW_OnIdle(void) {
|
|
|
* Parameters
|
|
|
* TaskId - Task ID of created task.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_OnTaskCreate(unsigned TaskId) {
|
|
|
+void SEGGER_SYSVIEW_OnTaskCreate(U32 TaskId) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -1993,7 +2029,7 @@ void SEGGER_SYSVIEW_OnTaskCreate(unsigned TaskId) {
|
|
|
* Parameters
|
|
|
* TaskId - Task ID of terminated task.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_OnTaskTerminate(unsigned TaskId) {
|
|
|
+void SEGGER_SYSVIEW_OnTaskTerminate(U32 TaskId) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -2017,7 +2053,7 @@ void SEGGER_SYSVIEW_OnTaskTerminate(unsigned TaskId) {
|
|
|
* Parameters
|
|
|
* TaskId - Task ID of task that started to execute.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_OnTaskStartExec(unsigned TaskId) {
|
|
|
+void SEGGER_SYSVIEW_OnTaskStartExec(U32 TaskId) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -2055,7 +2091,7 @@ void SEGGER_SYSVIEW_OnTaskStopExec(void) {
|
|
|
* Parameters
|
|
|
* TaskId - Task ID of task that started to execute.
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_OnTaskStartReady(unsigned TaskId) {
|
|
|
+void SEGGER_SYSVIEW_OnTaskStartReady(U32 TaskId) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -2078,7 +2114,7 @@ void SEGGER_SYSVIEW_OnTaskStartReady(unsigned TaskId) {
|
|
|
* TaskId - Task ID of task that completed execution.
|
|
|
* Cause - Reason for task to stop (i.e. Idle/Sleep)
|
|
|
*/
|
|
|
-void SEGGER_SYSVIEW_OnTaskStopReady(unsigned TaskId, unsigned Cause) {
|
|
|
+void SEGGER_SYSVIEW_OnTaskStopReady(U32 TaskId, unsigned int Cause) {
|
|
|
U8* pPayload;
|
|
|
U8* pPayloadStart;
|
|
|
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32);
|
|
|
@@ -2173,7 +2209,7 @@ void SEGGER_SYSVIEW_NameResource(U32 ResourceId, const char* sName) {
|
|
|
* !=0: Success, Message sent.
|
|
|
* ==0: Buffer full, Message *NOT* sent.
|
|
|
*/
|
|
|
-int SEGGER_SYSVIEW_SendPacket(U8* pPacket, U8* pPayloadEnd, unsigned EventId) {
|
|
|
+int SEGGER_SYSVIEW_SendPacket(U8* pPacket, U8* pPayloadEnd, unsigned int EventId) {
|
|
|
#if (SEGGER_SYSVIEW_USE_STATIC_BUFFER == 1)
|
|
|
SEGGER_SYSVIEW_LOCK();
|
|
|
#endif
|
|
|
@@ -2200,7 +2236,7 @@ int SEGGER_SYSVIEW_SendPacket(U8* pPacket, U8* pPayloadEnd, unsigned EventId) {
|
|
|
* byte in the payload and the next position to store payload
|
|
|
* content.
|
|
|
*/
|
|
|
-U8* SEGGER_SYSVIEW_EncodeU32(U8* pPayload, unsigned Value) {
|
|
|
+U8* SEGGER_SYSVIEW_EncodeU32(U8* pPayload, U32 Value) {
|
|
|
ENCODE_U32(pPayload, Value);
|
|
|
return pPayload;
|
|
|
}
|
|
|
@@ -2227,7 +2263,7 @@ U8* SEGGER_SYSVIEW_EncodeU32(U8* pPayload, unsigned Value) {
|
|
|
* of the string.
|
|
|
* No more than 1 + MaxLen bytes will be encoded to the payload.
|
|
|
*/
|
|
|
-U8* SEGGER_SYSVIEW_EncodeString(U8* pPayload, const char* s, unsigned MaxLen) {
|
|
|
+U8* SEGGER_SYSVIEW_EncodeString(U8* pPayload, const char* s, unsigned int MaxLen) {
|
|
|
return _EncodeStr(pPayload, s, MaxLen);
|
|
|
}
|
|
|
|
|
|
@@ -2253,7 +2289,7 @@ U8* SEGGER_SYSVIEW_EncodeString(U8* pPayload, const char* s, unsigned MaxLen) {
|
|
|
* of the data buffer.
|
|
|
* Make sure NumBytes + 1 bytes are free for the payload.
|
|
|
*/
|
|
|
-U8* SEGGER_SYSVIEW_EncodeData(U8 *pPayload, const char* pSrc, unsigned NumBytes) {
|
|
|
+U8* SEGGER_SYSVIEW_EncodeData(U8 *pPayload, const char* pSrc, unsigned int NumBytes) {
|
|
|
return _EncodeData(pPayload, pSrc, NumBytes);
|
|
|
}
|
|
|
|
|
|
@@ -2281,7 +2317,7 @@ U8* SEGGER_SYSVIEW_EncodeData(U8 *pPayload, const char* pSrc, unsigned NumBytes)
|
|
|
* SEGGER_SYSVIEW_ID_SHIFT: Number of bits to shift the Id to
|
|
|
* save bandwidth. (i.e. 2 when Ids are 4 byte aligned)
|
|
|
*/
|
|
|
-U8* SEGGER_SYSVIEW_EncodeId(U8* pPayload, unsigned Id) {
|
|
|
+U8* SEGGER_SYSVIEW_EncodeId(U8* pPayload, U32 Id) {
|
|
|
Id = SHRINK_ID(Id);
|
|
|
ENCODE_U32(pPayload, Id);
|
|
|
return pPayload;
|
|
|
@@ -2502,10 +2538,23 @@ void SEGGER_SYSVIEW_SendNumModules(void) {
|
|
|
*/
|
|
|
void SEGGER_SYSVIEW_PrintfHostEx(const char* s, U32 Options, ...) {
|
|
|
va_list ParamList;
|
|
|
+#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
|
|
+ int r;
|
|
|
|
|
|
+ va_start(ParamList, Options);
|
|
|
+ r = _VPrintHost(s, Options, &ParamList);
|
|
|
+ va_end(ParamList);
|
|
|
+
|
|
|
+ if (r == -1) {
|
|
|
+ va_start(ParamList, Options);
|
|
|
+ _VPrintTarget(s, Options, &ParamList);
|
|
|
+ va_end(ParamList);
|
|
|
+ }
|
|
|
+#else
|
|
|
va_start(ParamList, Options);
|
|
|
_VPrintHost(s, Options, &ParamList);
|
|
|
va_end(ParamList);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/*********************************************************************
|
|
|
@@ -2523,10 +2572,23 @@ void SEGGER_SYSVIEW_PrintfHostEx(const char* s, U32 Options, ...) {
|
|
|
*/
|
|
|
void SEGGER_SYSVIEW_PrintfHost(const char* s, ...) {
|
|
|
va_list ParamList;
|
|
|
+#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
|
|
+ int r;
|
|
|
|
|
|
+ va_start(ParamList, s);
|
|
|
+ r = _VPrintHost(s, SEGGER_SYSVIEW_LOG, &ParamList);
|
|
|
+ va_end(ParamList);
|
|
|
+
|
|
|
+ if (r == -1) {
|
|
|
+ va_start(ParamList, s);
|
|
|
+ _VPrintTarget(s, SEGGER_SYSVIEW_LOG, &ParamList);
|
|
|
+ va_end(ParamList);
|
|
|
+ }
|
|
|
+#else
|
|
|
va_start(ParamList, s);
|
|
|
_VPrintHost(s, SEGGER_SYSVIEW_LOG, &ParamList);
|
|
|
va_end(ParamList);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/*********************************************************************
|
|
|
@@ -2545,10 +2607,23 @@ void SEGGER_SYSVIEW_PrintfHost(const char* s, ...) {
|
|
|
*/
|
|
|
void SEGGER_SYSVIEW_WarnfHost(const char* s, ...) {
|
|
|
va_list ParamList;
|
|
|
+#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
|
|
+ int r;
|
|
|
+
|
|
|
+ va_start(ParamList, s);
|
|
|
+ r = _VPrintHost(s, SEGGER_SYSVIEW_WARNING, &ParamList);
|
|
|
+ va_end(ParamList);
|
|
|
|
|
|
+ if (r == -1) {
|
|
|
+ va_start(ParamList, s);
|
|
|
+ _VPrintTarget(s, SEGGER_SYSVIEW_WARNING, &ParamList);
|
|
|
+ va_end(ParamList);
|
|
|
+ }
|
|
|
+#else
|
|
|
va_start(ParamList, s);
|
|
|
_VPrintHost(s, SEGGER_SYSVIEW_WARNING, &ParamList);
|
|
|
va_end(ParamList);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/*********************************************************************
|
|
|
@@ -2567,10 +2642,23 @@ void SEGGER_SYSVIEW_WarnfHost(const char* s, ...) {
|
|
|
*/
|
|
|
void SEGGER_SYSVIEW_ErrorfHost(const char* s, ...) {
|
|
|
va_list ParamList;
|
|
|
+#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
|
|
+ int r;
|
|
|
|
|
|
+ va_start(ParamList, s);
|
|
|
+ r = _VPrintHost(s, SEGGER_SYSVIEW_ERROR, &ParamList);
|
|
|
+ va_end(ParamList);
|
|
|
+
|
|
|
+ if (r == -1) {
|
|
|
+ va_start(ParamList, s);
|
|
|
+ _VPrintTarget(s, SEGGER_SYSVIEW_ERROR, &ParamList);
|
|
|
+ va_end(ParamList);
|
|
|
+ }
|
|
|
+#else
|
|
|
va_start(ParamList, s);
|
|
|
_VPrintHost(s, SEGGER_SYSVIEW_ERROR, &ParamList);
|
|
|
va_end(ParamList);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/*********************************************************************
|