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>
127 lines
4.0 KiB
C
127 lines
4.0 KiB
C
/**
|
|
******************************************************************************
|
|
* @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 */
|