CubeMX: SPI4 + SDMMC1/FatFs + I2S6, audio BSP et debug VS Code (Linux)

Regeneration CubeMX (Appli) preparant le driver ST67W611M1 et la carte SD :
- SPI4 (PE12/13/14, CS PF8) + DMA GPDMA1 canaux 4/5, SPI_RDY (PD12/EXTI12),
  CHIP_EN (PD13) et BOOT (PD15) pour la X-NUCLEO-67W61M1 sur l'Arduino
- SDMMC1 + FatFs (appels d'init non generes dans main, IRQ SDMMC1 prio 14),
  PM14 en open-drain ; I2S6_CK sur PA5 pour liberer PC12 (SDMMC1_CK)
- HAL UART retire ; USE_BSP_COM_FEATURE=0
- Audio preserve : ADF 4/16/24, prio IRQ 2, DMA canal 0 en priorite haute,
  GPDMA1_Channel2_IRQHandler deplace dans audio_irq.c (hors fichiers generes),
  BSP_MX_I2S6_Init (renommage dans le BSP pour eviter le conflit avec CubeMX)
- Middlewares/ST/ST67W6X_Network_Driver, FatFs et sources HAL SPI/SD ajoutes
  (driver ST67 pas encore integre au build)

Build et debug sous Linux :
- gcc/toolchain-env.sh, gdbserver.sh, arm-gdb.sh : outils de STM32CubeIDE par
  glob ; flash.sh les retrouve ; ruby_compat.rb pour Ruby >= 3.2 (TouchGFX)
- makefile_appli : sources SD/SPI/FatFs/audio_irq ; chmod +x des .out TouchGFX
- Objets de build (*.o, *.d, *.su) retires de l'index (deja dans .gitignore)
- AGENTS.md : toolchain Linux, configs VS Code (cppdbg et ST stlinkgdbtarget),
  pieges de l'extension ST (.settings/ide.store.json, preRunCommands reset)

Verifie sur carte : audio OK, debug Appli/Boot OK.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
thomasandClaude Sonnet 5.5 committed 2026-10-23 22:49:06 +02:00
1 parent b119a6abd7
commit 66bb319423
1092 files changed
+172728 -133236

No files matched your search

@@ -0,0 +1,126 @@
/**
******************************************************************************
* @file common_parser.h
* @author ST67 Application Team
* @brief This file provides the W6x common parser definitions
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef COMMON_PARSER_H
#define COMMON_PARSER_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Includes ------------------------------------------------------------------*/
#include <inttypes.h>
#include <stdlib.h>
#include <stdint.h>
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/** @defgroup ST67W6X_Utilities_Common_Macros ST67W6X Utility Common Macros
* @ingroup ST67W6X_Utilities_Common
* @{
*/
#ifndef MAC2STR
/** MAC buffer to string macros */
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
/** MAC string format */
#define MACSTR "%02" PRIx16 ":%02" PRIx16 ":%02" PRIx16 ":%02" PRIx16 ":%02" PRIx16 ":%02" PRIx16
#endif /* MAC2STR */
#ifndef IP2STR
/** IP buffer to string macros */
#define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
/** IP string format */
#define IPSTR "%" PRIu16 ".%" PRIu16 ".%" PRIu16 ".%" PRIu16
#endif /* IP2STR */
#ifndef NIP2STR
/** Macro to convert a uint32_t IP address to a string */
#define NIP2STR(ip) \
(uint8_t)(((ip) >> 24U) & 0xFFU), \
(uint8_t)(((ip) >> 16U) & 0xFFU), \
(uint8_t)(((ip) >> 8U) & 0xFFU), \
(uint8_t)((ip) & 0xFFU)
/** Macro to format the IP address as a string, same as IPSTR */
#define NIP2STR_FMT "%" PRIu16 ".%" PRIu16 ".%" PRIu16 ".%" PRIu16
#endif /* NIP2STR */
/** @} */
/* Exported functions ------------------------------------------------------- */
/** @defgroup ST67W6X_Utilities_Common_Functions ST67W6X Utility Common Functions
* @ingroup ST67W6X_Utilities_Common
* @{
*/
/**
* @brief Extract a hex number from a string
* @param ptr: pointer to string
* @param cnt: pointer to the number of parsed digit
* @retval Hex value or -1 on error
*/
int32_t Parser_StrToHex(char *ptr, uint8_t *cnt);
/**
* @brief Parses and returns number from string
* @param ptr: pointer to string
* @param cnt: pointer to the number of parsed digit
* @param value: pointer to the parsed value
* @retval integer value
*/
int32_t Parser_StrToInt(char *ptr, uint8_t *cnt, int32_t *value);
/**
* @brief Parses and returns IP address
* @param ptr: pointer to string
* @param ip: IP buffer
*/
void Parser_StrToIP(char *ptr, uint8_t ip[4]);
/**
* @brief Parses and returns MAC address
* @param ptr: pointer to string
* @param mac: MAC buffer
*/
void Parser_StrToMAC(char *ptr, uint8_t mac[6]);
/**
* @brief Convert char in Hex format to integer
* @param a: character to convert
* @retval integer value
*/
uint8_t Parser_Hex2Num(char a);
/**
* @brief Checks if the given IP or MAC address is valid
* @param buff: pointer to the address buffer (4 bytes for IP, 6 bytes for MAC)
* @param len: length of the address buffer (4 for IP, 6 for MAC)
* @return Operation status
*/
int32_t Parser_CheckValidAddress(uint8_t *buff, uint32_t len);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* COMMON_PARSER_H */
@@ -0,0 +1,224 @@
/**
******************************************************************************
* @file logging.h
* @author ST67 Application Team
* @brief This file is part of the FreeRTOS logging interface
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/**
* Portions of this file are based on FreeRTOS, which is licensed under the MIT license as indicated below.
* See https://www.FreeRTOS.org/logging.html for more information.
*
* Reference source:
* https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Source/Utilities/logging/logging.h
*/
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef LOGGING_H
#define LOGGING_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include "logging_config.h"
#include "logging_levels.h"
/* Exported macros -----------------------------------------------------------*/
/** @defgroup ST67W6X_Utilities_Logging_Macros ST67W6X Utility Logging Macros
* @ingroup ST67W6X_Utilities_Logging
* @{
*/
/**
* \def LogError( ... )
* Send a message to the log with level ::LOG_ERROR.
*/
/**
* \def LogErrorEx( line, file, ... )
* Send a message with line number and file name to the log with level ::LOG_ERROR.
*/
/**
* \def LogInfo( ... )
* Send a message to the log with level ::LOG_INFO.
*/
/**
* \def LogWarn( ... )
* Send a message to the log with level ::LOG_WARN.
*/
/**
* \def LogDebug( ... )
* Send a message to the log with level ::LOG_DEBUG.
*/
#ifndef LOG_LEVEL
/** Global verbosity level (LOG_NONE, LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG) */
#define LOG_LEVEL LOG_INFO
#endif /* LOG_LEVEL */
/* Get rid of extra C89 style parentheses generated by core FreeRTOS libraries */
/** Macro to remove the extra parentheses. */
#define REMOVE
/** Convert a macro parameter to a string. */
#define STR_( ... ) REM ## __VA_ARGS__
/** Convert a macro parameter to a string. */
#define STR( ... ) STR_( __VA_ARGS__ )
/** Removes at most one outer set of parentheses from its arguments. */
#define OVE( ... ) OVE __VA_ARGS__
/** Removes at most one outer set of parentheses from its arguments. */
#define REMOVE_PARENS( ... ) STR( OVE __VA_ARGS__ )
#if defined(__ICCARM__) || defined(__ICCRX__) /* For IAR Compiler */
#ifndef __FILE_NAME__
/* coverity[misra_c_2012_rule_21_1_violation : FALSE] */
/* coverity[misra_c_2012_rule_21_2_violation : FALSE] */
#define __FILE_NAME__ __FILE__
#endif /* ! __FILE_NAME__ */
#endif /* __ICCARM__ */
/**
* Disable definition of logging interface macros when generating doxygen output,
* to avoid conflict with documentation of macros at the end of the file.
*/
/* Check that LOG_LEVEL is defined and has a valid value. */
#if !defined( LOG_LEVEL ) || \
( ( LOG_LEVEL != LOG_NONE ) && \
( LOG_LEVEL != LOG_ERROR ) && \
( LOG_LEVEL != LOG_WARN ) && \
( LOG_LEVEL != LOG_INFO ) && \
( LOG_LEVEL != LOG_DEBUG ) )
#error "Please define LOG_LEVEL as either LOG_NONE, LOG_ERROR, LOG_WARN, LOG_INFO, or LOG_DEBUG."
#else
#if ( LOG_LEVEL >= LOG_ERROR )
#define LogError( ... ) vLoggingPrintf( LOG_ERROR, 1U, __LINE__, __FILE_NAME__, REMOVE_PARENS( __VA_ARGS__ ) )
#define LogErrorEx(line, file, ... ) vLoggingPrintf( LOG_ERROR, 1U, line, file, REMOVE_PARENS( __VA_ARGS__ ) )
#else
#define LogError( ... )
#define LogErrorEx(line, file, ... )
#endif /* ( LOG_LEVEL >= LOG_ERROR ) */
#if ( LOG_LEVEL >= LOG_WARN )
#define LogWarn( ... ) vLoggingPrintf( LOG_WARN, 1U, __LINE__, __FILE_NAME__, REMOVE_PARENS( __VA_ARGS__ ) )
#else
#define LogWarn( ... )
#endif /* ( LOG_LEVEL >= LOG_WARN ) */
#if ( LOG_LEVEL >= LOG_INFO )
#define LogInfo( ... ) vLoggingPrintf( LOG_INFO, 0U, 0U, (void *)0, REMOVE_PARENS( __VA_ARGS__ ) )
#else
#define LogInfo( ... )
#endif /* ( LOG_LEVEL >= LOG_INFO ) */
#if ( LOG_LEVEL >= LOG_DEBUG )
#define LogDebug( ... ) vLoggingPrintf( LOG_DEBUG, 0U, 0U, (void *)0, REMOVE_PARENS( __VA_ARGS__ ) )
#else
#define LogDebug( ... )
#endif /* ( LOG_LEVEL >= LOG_DEBUG ) */
#endif /* LOG_LEVEL */
/** @} */
/* Exported functions ------------------------------------------------------- */
/** @defgroup ST67W6X_Utilities_Logging_Functions ST67W6X Utility Logging Functions
* @ingroup ST67W6X_Utilities_Logging
* @{
*/
/**
* @brief Printf like function to print a message in the log. The application should not use it directly,
* but it must uses the log macros:
* - LogError
* - LogWarn
* - LogInfo
* - LogDebug
* @param log_level specifies the type of log entry
* @param metadata_print specifies if the metadata should be printed
* @param line_number specifies the line number in the compilation unit generating the log message. \
* is automatically generated by the log macros.
* @param p_file_name specifies the name of the file generating the log message. \
* is automatically generated by the log macros.
* @param p_format printf like format string
*/
void vLoggingPrintf(uint32_t log_level,
const uint8_t metadata_print,
const uint32_t line_number,
const char *const p_file_name,
const char *const p_format,
...);
/**
* @brief Initialize the logging service
* @param LogOutput_cb [IN] specifies the callback to output the message. \
* The callback shall not return until it is completed
* @return NULL in case of error, a pointer to the logging service otherwise
*/
void *vLoggingInit(void (*LogOutput_cb)(const char *message));
/**
* @brief Reset the logging service
*/
void vLoggingDeInit(void);
/**
* @brief Set the verbose level
* @param level [IN] the maximum log level to be printed
*/
void vLoggingSetVerbosity(uint32_t level);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LOGGING_H */
@@ -0,0 +1,136 @@
/**
******************************************************************************
* @file logging_levels.h
* @author ST67 Application Team
* @brief Defines the configuration constants for all logging verbosity levels
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/**
* Portions of this file are based on FreeRTOS, which is licensed under the MIT license as indicated below.
* See https://www.FreeRTOS.org/logging.html for more information.
*
* Reference source:
* https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Source/Utilities/logging/logging_levels.h
*/
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef LOGGING_LEVELS_H
#define LOGGING_LEVELS_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Exported macros -----------------------------------------------------------*/
/** @addtogroup ST67W6X_Utilities_Logging_Macros
* @{
*/
/**
* Each part using the logging should specify a log level by setting LOG_LEVEL.
* If a LOG_LEVEL is not defined locally by the part, then it is used the global LOG_LEVEL.
* All log messages with a level at or below the specified level will be printed
* for that part.
* Currently, there are 4 log levels. In the order of lowest to highest, they are:
* - #LOG_NONE <br>
* @copybrief LOG_NONE
* - #LOG_ERROR <br>
* @copybrief LOG_ERROR
* - #LOG_WARN <br>
* @copybrief LOG_WARN
* - #LOG_INFO <br>
* @copybrief LOG_INFO
* - #LOG_DEBUG <br>
* @copybrief LOG_DEBUG
*/
/**
* @brief No log messages
* When LOG_LEVEL is #LOG_NONE, logging is disabled and no
* logging messages are printed.
*/
#define LOG_NONE 0
/**
* @brief Represents erroneous application state or event
* These messages describe the situations when a library encounters an error from
* which it cannot recover.
* @note These messages are printed when LOG_LEVEL is defined as either
* of #LOG_ERROR, #LOG_WARN, #LOG_INFO or #LOG_DEBUG.
*/
#define LOG_ERROR 1
/**
* @brief Message about an abnormal event
* These messages describe the situations when a library encounters
* abnormal event that may be indicative of an error. Libraries continue
* execution after logging a warning.
* @note These messages are printed when LOG_LEVEL is defined as either
* of #LOG_WARN, #LOG_INFO or #LOG_DEBUG.
*/
#define LOG_WARN 2
/**
* @brief A helpful, informational message
* These messages describe normal execution of a library. They provide
* the progress of the program at a coarse-grained level.
* @note These messages are printed when LOG_LEVEL is defined as either
* of #LOG_INFO or #LOG_DEBUG.
*/
#define LOG_INFO 3
/**
* @brief Detailed and excessive debug information
* Debug log messages are used to provide the
* progress of the program at a fine-grained level. These are mostly used
* for debugging and may contain excessive information such as internal
* variables, buffers, or other specific information.
* @note These messages are only printed when LOG_LEVEL is defined as
* #LOG_DEBUG.
*/
#define LOG_DEBUG 4
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LOGGING_LEVELS_H */
@@ -0,0 +1,322 @@
/**
******************************************************************************
* @file shell.h
* @author ST67 Application Team
* @brief This file provides the definition of the Shell API
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/**
* Portions of this file are based on RT-Thread Development Team,
* which is licensed under the Apache-2.0 license as indicated below.
* See https://github.com/RT-Thread/rt-thread for more information.
*
* Reference source:
* https://github.com/RT-Thread/rt-thread/blob/master/components/finsh/shell.h
*/
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2011-06-02 Bernard Add finsh_get_prompt function declaration
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef SHELL_H
#define SHELL_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Includes ------------------------------------------------------------------*/
#include <stdio.h>
#include <stdbool.h>
#include "shell_default_config.h"
/* Exported constants --------------------------------------------------------*/
/** @defgroup ST67W6X_Utilities_Shell_Constants ST67W6X Utility Shell Constants
* @ingroup ST67W6X_Utilities_Shell
* @{
*/
/** @brief Shell no command found */
#define SHELL_STATUS_NO_COMMAND -255
/** @brief Shell unknown arguments */
#define SHELL_STATUS_UNKNOWN_ARGS -254
/** @brief Shell error code */
#define SHELL_STATUS_ERROR -1
/** @brief Shell success code */
#define SHELL_STATUS_OK 0
/** @brief Interrupt signal */
#define SHELL_SIGINT 1
/** @brief Default action */
#define SHELL_SIG_DFL ((shell_sig_func_ptr)0)
/** @brief Ignore action */
#define SHELL_SIG_IGN ((shell_sig_func_ptr)1)
/** @} */
/* Exported types ------------------------------------------------------------*/
/** @defgroup ST67W6X_Utilities_Shell_Types ST67W6X Utility Shell Types
* @ingroup ST67W6X_Utilities_Shell
* @{
*/
/** shell input status */
enum input_stat
{
WAIT_NORMAL, /*!< normal status */
WAIT_SPEC_KEY, /*!< wait special key */
WAIT_FUNC_KEY, /*!< wait function key */
WAIT_EXT_KEY, /*!< wait extended key */
};
/** shell command function typedef */
typedef int32_t (*cmd_function_t)(int32_t argc, char **argv);
/**
* @brief System call table
*/
typedef struct shell_syscall
{
const char *name; /*!< the name of system call */
#if (SHELL_USING_DESCRIPTION == 1)
const char *desc; /*!< description of system call */
#endif /* SHELL_USING_DESCRIPTION */
cmd_function_t func; /*!< the function address of system call */
} shell_syscall_t;
/**
* @brief Shell structure
*/
struct shell
{
/** shell status */
enum input_stat stat;
/** shell overwrite mode flag */
uint8_t overwrite_mode;
/** shell control mode flag */
uint8_t control_mode;
/** shell history command position */
uint16_t current_history;
/** shell history command count */
uint16_t history_count;
/** shell history command buffer */
char cmd_history[SHELL_HISTORY_LINES][SHELL_CMD_SIZE];
/** shell command buffer */
char line[SHELL_CMD_SIZE + 1];
/** shell cursor position on the line */
uint16_t line_position;
/** shell current position on the line */
uint16_t line_curpos;
/** shell prompt */
char *prompt_custom;
/** shell printf function */
void (*shell_printf_fn)(char *fmt, ...);
/** shell start of system call table */
shell_syscall_t *syscall_table_begin;
/** shell end of system call table */
shell_syscall_t *syscall_table_end;
};
/**
* @brief Shell queue internal typedef
*/
typedef struct QueueDefinition shell_queue_def_t;
/**
* @brief Shell queue handle typedef
*/
typedef shell_queue_def_t *shell_queue_handle_t;
/** @} */
/* Exported variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/** @defgroup ST67W6X_Utilities_Shell_Macros ST67W6X Utility Shell Macros
* @ingroup ST67W6X_Utilities_Shell
* @{
*/
/**
* \def SHELL_PRINTF( ... )
* Print standard output without color.
*/
/**
* \def SHELL_PROMPT( ... )
* Print prompt message with cyan color or without color according to the SHELL_USING_COLOR configuration.
*/
/**
* \def SHELL_DBG( ... )
* Print debug message with green color or without color according to the SHELL_USING_COLOR configuration.
*/
/**
* \def SHELL_CMD( ... )
* Print command with yellow color or without color according to the SHELL_USING_COLOR configuration.
*/
/**
* \def SHELL_E( ... )
* Print error message with red color or without color according to the SHELL_USING_COLOR configuration.
*/
/** Print output without color */
#define SHELL_PRINT_NOCOLOR(fmt, ...) \
do { \
struct shell *shell_hdl = shell_get_instance(); \
(void)shell_hdl->shell_printf_fn(fmt, ##__VA_ARGS__); \
SHELL_FLUSH_OUT; \
} while(false)
#ifndef SHELL_PRINTF
#define SHELL_PRINTF(fmt, ...) SHELL_PRINT_NOCOLOR(fmt, ##__VA_ARGS__)
#endif /* SHELL_PRINTF */
#if (SHELL_USING_COLOR == 1)
/*
* The color for terminal (foreground)
* BLACK 30
* RED 31
* GREEN 32
* YELLOW 33
* BLUE 34
* PURPLE 35
* CYAN 36
* WHITE 37
*/
/** Start colorized output */
#define SHELL_COLOR_HDR(n) shell_hdl->shell_printf_fn("\033[" #n "m")
/** End colorized output */
#define SHELL_COLOR_END shell_hdl->shell_printf_fn("\033[0m")
/** Print output with color */
#define SHELL_PRINT(color_n, fmt, ...) \
do { \
struct shell *shell_hdl = shell_get_instance(); \
SHELL_COLOR_HDR(color_n); \
(void)shell_hdl->shell_printf_fn(fmt, ##__VA_ARGS__); \
SHELL_FLUSH_OUT; \
SHELL_COLOR_END; \
} while(false)
#define SHELL_PROMPT(fmt, ...) SHELL_PRINT(36, fmt, ##__VA_ARGS__)
#define SHELL_DBG(fmt, ...) SHELL_PRINT(32, fmt, ##__VA_ARGS__)
#define SHELL_CMD(fmt, ...) SHELL_PRINT(33, fmt, ##__VA_ARGS__)
#define SHELL_E(fmt, ...) SHELL_PRINT(31, fmt, ##__VA_ARGS__)
#else /* SHELL_USING_COLOR */
#define SHELL_PROMPT(fmt, ...) SHELL_PRINT_NOCOLOR(fmt, ##__VA_ARGS__)
#define SHELL_DBG(fmt, ...) SHELL_PRINT_NOCOLOR(fmt, ##__VA_ARGS__)
#define SHELL_CMD(fmt, ...) SHELL_PRINT_NOCOLOR(fmt, ##__VA_ARGS__)
#define SHELL_E(fmt, ...) SHELL_PRINT_NOCOLOR(fmt, ##__VA_ARGS__)
#endif /* SHELL_USING_COLOR */
/**
* \def SHELL_CMD_EXPORT_ALIAS( ... )
* @brief This macro exports a command to module shell
* @param name the name of command
* @param cmd the alias of command
* @param desc the description of command, which will show in help
*/
#if (SHELL_ENABLE == 1)
/**
* \def SHELL_CMD_EXPORT_ALIAS_WITH_DESC( ... )
* @brief This macro exports a command to module shell with description
* @param name the name of command
* @param cmd the alias of command
* @param desc_str the description of command, which will show in help
*/
#if (SHELL_USING_DESCRIPTION == 1)
#define SHELL_CMD_EXPORT_ALIAS_WITH_DESC(name, cmd, desc_str) \
const char fsym_##cmd##_name[] __attribute__((section(".rodata.name"))) = #cmd; \
const char fsym_##cmd##_desc[] __attribute__((section(".rodata.name"))) = desc_str; \
__attribute__((used)) const struct shell_syscall fsym_##cmd __attribute__((section("FSymTab"))) = \
{ \
(fsym_##cmd##_name), \
fsym_##cmd##_desc, \
(cmd_function_t)&(name) \
};
#define SHELL_CMD_EXPORT_ALIAS(name, cmd, desc) SHELL_CMD_EXPORT_ALIAS_WITH_DESC(name, cmd, #desc)
#else
#define SHELL_CMD_EXPORT_ALIAS_WITH_DESC(name, cmd, desc_str) \
const char fsym_##cmd##_name[] __attribute__((section(".rodata.name"))) = #cmd; \
__attribute__((used)) const struct shell_syscall fsym_##cmd __attribute__((section("FSymTab"))) = \
{ \
(fsym_##cmd##_name), \
(cmd_function_t)&(name) \
};
#define SHELL_CMD_EXPORT_ALIAS(name, cmd, desc) SHELL_CMD_EXPORT_ALIAS_WITH_DESC(name, cmd, "")
#endif /* SHELL_USING_DESCRIPTION */
#else /* SHELL_ENABLE */
#define SHELL_CMD_EXPORT_ALIAS(name, cmd, desc)
#endif /* SHELL_ENABLE */
/** @} */
/* Exported functions ------------------------------------------------------- */
/** @addtogroup ST67W6X_Utilities_Shell_Functions
* @{
*/
/**
* @brief Initialize the shell based on FreeRTOS. It creates a task that read the input chars from the uart and parse
* the input using the upper layer shell API. The output of the shell is sent to the stream buffer ::tx_stream.
* @param shell_queue [IN] specifies the queue where to send all the output produced by the shell
*/
void shell_freertos_init(shell_queue_handle_t shell_queue);
/**
* @brief Deinitialize the shell. It stops the shell task and release all the resources used by the shell
*/
void shell_freertos_deinit(void);
/**
* @brief Callback called by the uart ISR when a new byte is received
* @param uart_rxbyte [IN] specifies the byte received.
*/
void shell_freertos_on_new_data(uint8_t uart_rxbyte);
/**
* @brief Get the shell instance
* @return shell instance
*/
struct shell *shell_get_instance(void);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SHELL_H */
@@ -0,0 +1,152 @@
/**
******************************************************************************
* @file shell_default_config.h
* @author ST67 Application Team
* @brief This file provides default configuration for the Shell component
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef SHELL_DEFAULT_CONFIG_H
#define SHELL_DEFAULT_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Includes ------------------------------------------------------------------*/
#include "shell_config.h"
/* Exported constants --------------------------------------------------------*/
/** @addtogroup ST67W6X_Utilities_Shell_Constants
* @{
*/
#ifndef SHELL_ENABLE
/** Enable the shell component */
#define SHELL_ENABLE 1
#endif /* SHELL_ENABLE */
#ifndef SHELL_CMD_LEVEL
/** Default shell commands list level (0: Minimal, 1: Full) */
#define SHELL_CMD_LEVEL 0
#endif /* SHELL_CMD_LEVEL */
#ifndef SHELL_DEFAULT_NAME
/** Default shell prompt string */
#define SHELL_DEFAULT_NAME "w61"
#endif /* SHELL_DEFAULT_NAME */
#ifndef SHELL_CONSOLEBUF_SIZE
/** Console buffer size */
#define SHELL_CONSOLEBUF_SIZE 128U
#endif /* SHELL_CONSOLEBUF_SIZE */
#ifndef SHELL_HISTORY_LINES
/** Shell history maximum lines */
#define SHELL_HISTORY_LINES 5U
#endif /* SHELL_HISTORY_LINES */
#ifndef SHELL_CMD_SIZE
/** Shell command maximum size */
#define SHELL_CMD_SIZE 120U
#endif /* SHELL_CMD_SIZE */
#ifndef SHELL_ARG_NUM
/** Shell argument maximum number */
#define SHELL_ARG_NUM 24U
#endif /* SHELL_ARG_NUM */
#ifndef SHELL_USING_WORD_OPERATION
/** Enable word operation support */
#define SHELL_USING_WORD_OPERATION 1
#endif /* SHELL_USING_WORD_OPERATION */
#ifndef SHELL_USING_FUNC_EXT
/** Enable function extension support */
#define SHELL_USING_FUNC_EXT 1
#endif /* SHELL_USING_FUNC_EXT */
#ifndef SHELL_USING_COLOR
/** Shell using color */
#define SHELL_USING_COLOR 1
#endif /* SHELL_USING_COLOR */
#ifndef SHELL_PRINT_STATUS
/** Print an additional status message at the end of the command execution */
#define SHELL_PRINT_STATUS 0
#endif /* SHELL_PRINT_STATUS */
#ifndef SHELL_FREERTOS_MAX_PRINT_STRING_LENGTH
/** Maximum length of the string to be printed */
#define SHELL_FREERTOS_MAX_PRINT_STRING_LENGTH 2000U
#endif /* SHELL_FREERTOS_MAX_PRINT_STRING_LENGTH */
#ifndef SHELL_FREERTOS_RX_BUFF_SIZE
/** Shell receive buffer size */
#define SHELL_FREERTOS_RX_BUFF_SIZE 128U
#endif /* SHELL_FREERTOS_RX_BUFF_SIZE */
#ifndef SHELL_FREERTOS_RX_THREAD_STACK_SIZE
/** Shell receive thread stack size */
#define SHELL_FREERTOS_RX_THREAD_STACK_SIZE 2048U
#endif /* SHELL_FREERTOS_RX_THREAD_STACK_SIZE */
#ifndef SHELL_FREERTOS_RX_THREAD_PRIO
/** Shell receive thread priority */
#define SHELL_FREERTOS_RX_THREAD_PRIO 5
#endif /* SHELL_FREERTOS_RX_THREAD_PRIO */
#ifndef SHELL_FLUSH_OUT
/** Flush the output */
#define SHELL_FLUSH_OUT do { (void)fflush(stdout); } while(false)
#endif /* SHELL_FLUSH_OUT */
#ifndef SHELL_USING_DESCRIPTION
/** Enable the shell command description */
#define SHELL_USING_DESCRIPTION 1
#endif /* SHELL_USING_DESCRIPTION */
#ifndef SHELL_HELP_MAX_COMPARED_NB_CHAR
/** Maximum number of characters to compare in the help command */
#define SHELL_HELP_MAX_COMPARED_NB_CHAR 10U
#endif /* SHELL_HELP_MAX_COMPARED_NB_CHAR */
#ifndef SHELL_HELP_DESC_SIZE
/** Shell help command description size */
#define SHELL_HELP_DESC_SIZE 110U
#endif /* SHELL_HELP_DESC_SIZE */
#ifndef SHELL_LOG
/** Print log message */
#define SHELL_LOG SHELL_DBG
#endif /* SHELL_LOG */
/* Memory allocator */
#ifndef SHELL_MALLOC
/** Shell memory allocator */
#define SHELL_MALLOC pvPortMalloc
#endif /* SHELL_MALLOC */
#ifndef SHELL_FREE
/** Shell memory deallocator */
#define SHELL_FREE vPortFree
#endif /* SHELL_FREE */
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SHELL_DEFAULT_CONFIG_H */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,489 @@
/**
******************************************************************************
* @file w6x_legacy.h
* @author ST67 Application Team
* @brief This file provides the legacy W6x core resources definitions
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef W6X_LEGACY_H
#define W6X_LEGACY_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Includes ------------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/**
* @brief Write a file from the Host file system to the NCP file system
* @param filename: File name
* @return Operation status
*/
static inline W6X_Status_t W6X_FS_WriteFile(char *filename)
{
return W6X_FS_WriteFileByName(filename);
}
/**
* @brief Restore module default configuration
* @note If the ::W6X_WIFI_AUTOCONNECT is enabled, the Wi-Fi station credentials must be reconfigured
* through the ::W6X_WiFi_Connect function
* @return Operation status
*/
static inline W6X_Status_t W6X_RestoreDefaultConfig(void)
{
return W6X_Reset(1);
}
/**
* @brief Starts the NCP FWU process
* @param enable: 0 Terminate the FWU transmission. 1 Start the FWU transmission
* @return Operation status
*/
static inline W6X_Status_t W6X_OTA_Starts(uint32_t enable)
{
return W6X_FWU_Starts(enable);
}
/**
* @brief Finish the NCP FWU process which reboot the module to apply the new firmware
* @return Operation status
*/
static inline W6X_Status_t W6X_OTA_Finish(void)
{
return W6X_FWU_Finish();
}
/**
* @brief Send the firmware binary to the module
* @param buff: Buffer containing the firmware binary chunk
* @param len: Length of the firmware binary chunk
* @return Operation status
*/
static inline W6X_Status_t W6X_OTA_Send(uint8_t *buff, uint32_t len)
{
return W6X_FWU_Send(buff, len);
}
/**
* @brief Set the module in station mode
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_StartSta(void)
{
return W6X_WiFi_Station_Start();
}
#if (ST67_ARCH == W6X_ARCH_T01)
/**
* @brief This function set the Wi-Fi STA host name
* @param Hostname: Hostname to set
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_SetHostname(uint8_t Hostname[33])
{
return W6X_Net_SetHostname(Hostname);
}
/**
* @brief This function retrieves the Wi-Fi STA host name
* @param Hostname: Hostname to get
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetHostname(uint8_t Hostname[33])
{
return W6X_Net_GetHostname(Hostname);
}
/**
* @brief This function retrieves the Wi-Fi interface's IP address
* @param Ip_addr: IP address of the interface
* @param Gateway_addr: Gateway address of the interface
* @param Netmask_addr: Netmask address of the interface
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetStaIpAddress(uint8_t Ip_addr[4], uint8_t Gateway_addr[4],
uint8_t Netmask_addr[4])
{
return W6X_Net_Station_GetIPAddress(Ip_addr, Gateway_addr, Netmask_addr);
}
#endif /* (ST67_ARCH == W6X_ARCH_T01) */
/**
* @brief This function retrieves the Wi-Fi station MAC address
* @param mac: MAC address of the interface
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetStaMacAddress(uint8_t mac[6])
{
return W6X_WiFi_Station_GetMACAddress(mac);
}
#if (ST67_ARCH == W6X_ARCH_T01)
/**
* @brief This function set the Wi-Fi interface's IP address
* @param Ipaddr: IP address to set
* @param Gateway_addr: Gateway address to set
* @param Netmask_addr: Netmask address to set
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_SetStaIpAddress(uint8_t Ipaddr[4], uint8_t Gateway_addr[4],
uint8_t Netmask_addr[4])
{
return W6X_Net_Station_SetIPAddress(Ipaddr, Gateway_addr, Netmask_addr);
}
/**
* @brief This function retrieves the Wi-Fi DNS addresses
* @param Dns_enable: DNS enable status. Unused
* @param Dns1_addr: DNS1 address
* @param Dns2_addr: DNS2 address
* @param Dns3_addr: DNS3 address
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetDnsAddress(uint32_t *Dns_enable, uint8_t Dns1_addr[4], uint8_t Dns2_addr[4],
uint8_t Dns3_addr[4])
{
(void)Dns_enable; /* unused */
return W6X_Net_GetDnsAddress(Dns1_addr, Dns2_addr, Dns3_addr);
}
/**
* @brief This function set the Wi-Fi DNS addresses
* @param Dns_enable: DNS enable manually. Unused
* @param Dns1_addr: DNS1 address
* @param Dns2_addr: DNS2 address
* @param Dns3_addr: DNS3 address
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_SetDnsAddress(uint32_t *Dns_enable, uint8_t Dns1_addr[4], uint8_t Dns2_addr[4],
uint8_t Dns3_addr[4])
{
(void)Dns_enable; /* unused */
return W6X_Net_SetDnsAddress(Dns1_addr, Dns2_addr, Dns3_addr);
}
#endif /* (ST67_ARCH == W6X_ARCH_T01) */
/**
* @brief This function retrieves the Wi-Fi station state
* @param state: Station state
* @param connect_data: Connection data
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetStaState(W6X_WiFi_StaStateType_e *state, W6X_WiFi_Connect_t *connect_data)
{
return W6X_WiFi_Station_GetState(state, connect_data);
}
/**
* @brief Configure a Soft-AP
* @param ap_config: Soft-AP configuration
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_StartAp(W6X_WiFi_ApConfig_t *ap_config)
{
return W6X_WiFi_AP_Start(ap_config);
}
/**
* @brief Stop the Soft-AP
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_StopAp(void)
{
return W6X_WiFi_AP_Stop();
}
/**
* @brief Get the Soft-AP configuration
* @param ap_config: Soft-AP configuration
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetApConfig(W6X_WiFi_ApConfig_t *ap_config)
{
return W6X_WiFi_AP_GetConfig(ap_config);
}
/**
* @brief List the connected stations
* @param connected_sta: Connected stations structure
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_ListConnectedSta(W6X_WiFi_Connected_Sta_t *connected_sta)
{
return W6X_WiFi_AP_ListConnectedStations(connected_sta);
}
/**
* @brief Disconnect station from the Soft-AP
* @param mac: MAC address of the station to disconnect
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_DisconnectSta(uint8_t mac[6])
{
return W6X_WiFi_AP_DisconnectStation(mac);
}
/**
* @brief This function retrieves the Wi-Fi Soft-AP MAC address
* @param mac: MAC address of the interface
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetApMacAddress(uint8_t mac[6])
{
return W6X_WiFi_AP_GetMACAddress(mac);
}
#if (ST67_ARCH == W6X_ARCH_T01)
/**
* @brief Get the Soft-AP IP addresses
* @param Ipaddr: IP address of the Soft-AP
* @param Netmask_addr: Netmask address of the Soft-AP
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetApIpAddress(uint8_t Ipaddr[4], uint8_t Netmask_addr[4])
{
return W6X_Net_AP_GetIPAddress(Ipaddr, Netmask_addr);
}
/**
* @brief DHCP Client type enumeration
*/
typedef W6X_Net_DhcpType_e W6X_WiFi_DhcpType_e;
/**
* @brief Get the DHCP configuration
* @param State: pointer to the DHCP state
* @param lease_time: lease time
* @param start_ip: pointer to the start IP address
* @param end_ip: pointer to the end IP address
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetDhcp(W6X_WiFi_DhcpType_e *State, uint32_t *lease_time,
uint8_t start_ip[4], uint8_t end_ip[4])
{
return W6X_Net_GetDhcp(State, lease_time, start_ip, end_ip);
}
/**
* @brief Set the DHCP configuration
* @param State: DHCP state
* @param Operate: pointer to enable / disable DHCP
* @param lease_time: lease time
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_SetDhcp(W6X_WiFi_DhcpType_e *State, uint32_t *Operate, uint32_t lease_time)
{
return W6X_Net_SetDhcp(State, Operate, lease_time);
}
#endif /* (ST67_ARCH == W6X_ARCH_T01) */
/**
* @brief Setup Target Wake Time (TWT) for the Wi-Fi station
* @param twt_params: TWT parameters
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_SetupTWT(W6X_WiFi_TWT_Setup_Params_t *twt_params)
{
return W6X_WiFi_TWT_Setup(twt_params);
}
/**
* @brief Get Target Wake Time (TWT) status for the Wi-Fi station
* @param twt_status: Pointer to TWT flow status
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_GetTWTStatus(W6X_WiFi_TWT_Status_t *twt_status)
{
return W6X_WiFi_TWT_GetStatus(twt_status);
}
/**
* @brief Teardown Target Wake Time (TWT) for the Wi-Fi station
* @param twt_params: TWT parameters
* @return Operation status
*/
static inline W6X_Status_t W6X_WiFi_TeardownTWT(W6X_WiFi_TWT_Teardown_Params_t *twt_params)
{
return W6X_WiFi_TWT_Teardown(twt_params);
}
#if (ST67_ARCH == W6X_ARCH_T01)
/**
* @brief Get IP address from URL using DNS
* @param location: Host URL
* @param ipaddr: array of the IP address
* @return Operation status
*/
static inline W6X_Status_t W6X_Net_GetHostAddress(const char *location, uint8_t *ipaddr)
{
return W6X_Net_ResolveHostAddress(location, ipaddr);
}
/**
* @brief Query date string from SNTP, the used format is asctime style time
* @param Time: Buffer to store time
* @return Operation status
*/
static inline W6X_Status_t W6X_Net_GetTime(uint8_t *Time)
{
W6X_Status_t ret;
W6X_Net_Time_t time_s;
ret = W6X_Net_SNTP_GetTime(&time_s);
if (ret != W6X_STATUS_OK)
{
return ret;
}
for (uint32_t i = 0; i < sizeof(time_s.raw); i++)
{
Time[i] = time_s.raw[i];
}
return W6X_STATUS_OK;
}
/**
* @brief Get current SNTP status, timezone and servers
* @param Enable: SNTP usage status
* @param Timezone: Configured Timezone
* @param SntpServer1: Configured Primary SNTP Server URL
* @param SntpServer2: Configured Secondary SNTP Server URL
* @param SntpServer3: Configured Third SNTP Server URL
* @return Operation status
*/
static inline W6X_Status_t W6X_Net_GetSNTPConfiguration(uint8_t *Enable, int16_t *Timezone, uint8_t *SntpServer1,
uint8_t *SntpServer2, uint8_t *SntpServer3)
{
return W6X_Net_SNTP_GetConfiguration(Enable, Timezone, SntpServer1, SntpServer2, SntpServer3);
}
/**
* @brief Set SNTP status, timezone and servers
* @param Enable: Enable/Disable SNTP usage
* @param Timezone: Timezone to set in one of the 2 following formats:
* - range [-12,14]: marks most of the time zones by offset from UTC in whole hours
* - HHmm with HH in range[-12,+14] and mm in range [00,59]
* @param SntpServer1: Primary SNTP Server URL to use
* @param SntpServer2: Secondary SNTP Server URL to use
* @param SntpServer3: Third SNTP Server URL to use
* @return Operation status
*/
static inline W6X_Status_t W6X_Net_SetSNTPConfiguration(uint8_t Enable, int16_t Timezone, uint8_t *SntpServer1,
uint8_t *SntpServer2, uint8_t *SntpServer3)
{
return W6X_Net_SNTP_SetConfiguration(Enable, Timezone, SntpServer1, SntpServer2, SntpServer3);
}
/**
* @brief Get SNTP Synchronization interval
* @param Interval: Configured SNTP time synchronization interval, in seconds
* @return Operation status
*/
static inline W6X_Status_t W6X_Net_GetSNTPInterval(uint16_t *Interval)
{
return W6X_Net_SNTP_GetInterval(Interval);
}
/**
* @brief Set SNTP Synchronization interval
* @param Interval: SNTP time synchronization interval, in seconds (range:[15,4294967])
* @return Operation status
*/
static inline W6X_Status_t W6X_Net_SetSNTPInterval(uint16_t Interval)
{
return W6X_Net_SNTP_SetInterval(Interval);
}
/**
* @brief Add the credential to the TLS context
* @param tag: Tag of the TLS context (must be unique by credential file)
* @param type: Type of the credential
* @param cred: Credential to add
* @param credlen: Length of the credential
* @return Operation status
*/
static inline int32_t W6X_Net_Tls_Credential_Add(uint32_t tag, W6X_Net_Tls_Credential_e type,
const void *cred, size_t credlen)
{
return W6X_Net_TLS_Credential_AddByName(tag, type, (const char *)cred);
}
/**
* @brief Delete the credential from the TLS context
* @param tag: Tag of the TLS context
* @param type: Type of the credential
* @return Operation status
*/
static inline int32_t W6X_Net_Tls_Credential_Delete(uint32_t tag, W6X_Net_Tls_Credential_e type)
{
return W6X_Net_TLS_Credential_Delete(tag, type);
}
#endif /* (ST67_ARCH == W6X_ARCH_T01) */
/**
* @brief Indicate the Characteristic Value from the Server to a Client
* @param service_index: index of the service containing characteristic to indicate
* @param char_index: index of the characteristic to indicate
* @param data: pointer to the data to indicate
* @param req_len: length of the data to indicate
* @param sent_data_len: length of the data sent
* @param timeout: timeout in ms
* @return Operation status
*/
static inline W6X_Status_t W6X_Ble_ServerSendIndication(uint8_t service_index, uint8_t char_index,
void *data, uint32_t req_len, uint32_t *sent_data_len,
uint32_t timeout)
{
uint8_t conn_handle = 0;
return W6X_Ble_ServerIndicate(conn_handle, service_index, char_index,
data, req_len, sent_data_len, timeout);
}
/**
* @brief Notify the Characteristic Value from the Server to a Client
* @param service_index: index of the service containing characteristic to notify
* @param char_index: index of the characteristic to notify
* @param data: pointer to the data to notify
* @param req_len: length of the data to notify
* @param sent_data_len: length of the data sent
* @param timeout: timeout in ms
* @return Operation status
*/
static inline W6X_Status_t W6X_Ble_ServerSendNotification(uint8_t service_index, uint8_t char_index,
void *data, uint32_t req_len, uint32_t *sent_data_len,
uint32_t timeout)
{
uint8_t conn_handle = 0;
return W6X_Ble_ServerNotify(conn_handle, service_index, char_index,
data, req_len, sent_data_len, timeout);
}
/**
* @brief BLE enter remote passkey
* @param conn_handle: BLE connection handle
* @param passkey: BLE security passkey
* @return Operation status
*/
static inline W6X_Status_t W6X_Ble_SecuritySetPassKey(uint8_t conn_handle, uint32_t passkey)
{
return W6X_Ble_SecurityEnterRemotePassKey(conn_handle, passkey);
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* W6X_LEGACY_H */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,67 @@
/**
******************************************************************************
* @file w6x_version.h
* @author ST67 Application Team
* @brief This file provides the version of W6x_Network_Driver
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef W6X_VERSION_H
#define W6X_VERSION_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Exported constants --------------------------------------------------------*/
/** @addtogroup ST67W6X_API_System_Public_Constants
* @{
*/
#define W6X_VERSION_MAIN 1 /*!< [31:24] main version */
#define W6X_VERSION_SUB1 3 /*!< [23:16] sub1 version */
#define W6X_VERSION_SUB2 0 /*!< [15:8] sub2 version */
#define W6X_MAIN_SHIFT 24 /*!< main version shift */
#define W6X_SUB1_SHIFT 16 /*!< sub1 version shift */
#define W6X_SUB2_SHIFT 8 /*!< sub2 version shift */
/** ST67W61_Network_Driver version */
#define W6X_VERSION ((W6X_VERSION_MAIN << W6X_MAIN_SHIFT)\
|(W6X_VERSION_SUB1 << W6X_SUB1_SHIFT)\
|(W6X_VERSION_SUB2 << W6X_SUB2_SHIFT))
/** @} */
/* Exported macros -----------------------------------------------------------*/
/** @defgroup ST67W6X_API_System_Public_Macros ST67W6X System Macros
* @ingroup ST67W6X_API_System
* @{
*/
/** ST67W61_Network_Driver version preprocessor macro */
#define XSTR(x) #x
/** ST67W61_Network_Driver version preprocessor macro */
#define MSTR(x) XSTR(x)
/** ST67W61_Network_Driver version string */
#define W6X_VERSION_STR MSTR(W6X_VERSION_MAIN) "." MSTR(W6X_VERSION_SUB1) "." MSTR(W6X_VERSION_SUB2)
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* W6X_VERSION_H */