Initial commit: MT firmware project
- BLE peripheral applications - dr_piezo and bladder_patch projects Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
74
external/infineon/optiga/include/optiga/pal/pal.h
vendored
Normal file
74
external/infineon/optiga/include/optiga/pal/pal.h
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief This file implements the prototype declarations of platform abstraction layer
|
||||
*
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _PAL_H_
|
||||
#define _PAL_H_
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* HEADER FILES
|
||||
*********************************************************************************************************************/
|
||||
#include "optiga/common/Datatypes.h"
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* pal.h
|
||||
*********************************************************************************************************************/
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* MACROS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
/// PAL API execution is successful
|
||||
#define PAL_STATUS_SUCCESS (0x0000)
|
||||
/// PAL API execution failed
|
||||
#define PAL_STATUS_FAILURE (0x0001)
|
||||
/// PAL I2C is busy
|
||||
#define PAL_STATUS_I2C_BUSY (0x0002)
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* ENUMS
|
||||
*********************************************************************************************************************/
|
||||
/**
|
||||
* \brief PAL return status.
|
||||
*/
|
||||
typedef uint16_t pal_status_t;
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* API Prototypes
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#endif /* _PAL_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
93
external/infineon/optiga/include/optiga/pal/pal_gpio.h
vendored
Normal file
93
external/infineon/optiga/include/optiga/pal/pal_gpio.h
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief This file implements the prototype declarations of pal gpio
|
||||
*
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _PAL_GPIO_H_
|
||||
#define _PAL_GPIO_H_
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* HEADER FILES
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#include "optiga/pal/pal.h"
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* MACROS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* ENUMS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* DATA STRUCTURES
|
||||
*********************************************************************************************************************/
|
||||
|
||||
/**
|
||||
* \brief Structure defines the PAL GPIO configuration.
|
||||
*/
|
||||
typedef struct pal_gpio
|
||||
{
|
||||
/// Pointer to gpio platform specific context/structure
|
||||
void* p_gpio_hw;
|
||||
|
||||
} pal_gpio_t;
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* API Prototypes
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Sets the gpio pin to high state.
|
||||
*/
|
||||
void pal_gpio_set_high(const pal_gpio_t* p_gpio_context);
|
||||
|
||||
/**
|
||||
* \brief Sets the gpio pin to Low state.
|
||||
*/
|
||||
void pal_gpio_set_low(const pal_gpio_t* p_gpio_context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PAL_GPIO_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
107
external/infineon/optiga/include/optiga/pal/pal_i2c.h
vendored
Normal file
107
external/infineon/optiga/include/optiga/pal/pal_i2c.h
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief This file implements the prototype declarations of pal i2c
|
||||
*
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _PAL_I2C_H_
|
||||
#define _PAL_I2C_H_
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* HEADER FILES
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#include "optiga/pal/pal.h"
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* MACROS
|
||||
*********************************************************************************************************************/
|
||||
/// Event returned when I2C master completes execution
|
||||
#define PAL_I2C_EVENT_SUCCESS (0x0000)
|
||||
/// Event returned when I2C master operation fails
|
||||
#define PAL_I2C_EVENT_ERROR (0x0001)
|
||||
/// Event returned when lower level I2C bus is busy
|
||||
#define PAL_I2C_EVENT_BUSY (0x0002)
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* ENUMS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* DATA STRUCTURES
|
||||
*********************************************************************************************************************/
|
||||
/** @brief PAL I2C context structure */
|
||||
typedef struct pal_i2c
|
||||
{
|
||||
/// Pointer to I2C master platform specific context
|
||||
void* p_i2c_hw_config;
|
||||
/// I2C slave address
|
||||
uint8_t slave_address;
|
||||
/// Pointer to store the callers context information
|
||||
void* upper_layer_ctx;
|
||||
/// Pointer to store the callers handler
|
||||
void* upper_layer_event_handler;
|
||||
|
||||
} pal_i2c_t;
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* API Prototypes
|
||||
*********************************************************************************************************************/
|
||||
/**
|
||||
* @brief Initializes the I2C master.
|
||||
*/
|
||||
pal_status_t pal_i2c_init(const pal_i2c_t* p_i2c_context);
|
||||
|
||||
/**
|
||||
* @brief Sets the I2C Master bitrate
|
||||
*/
|
||||
pal_status_t pal_i2c_set_bitrate(const pal_i2c_t* p_i2c_context, uint16_t bitrate);
|
||||
|
||||
//Dileep: "write on I2C bus" --> "write to I2C bus"
|
||||
/**
|
||||
* @brief Writes on I2C bus.
|
||||
*/
|
||||
pal_status_t pal_i2c_write(pal_i2c_t* p_i2c_context, uint8_t* p_data , uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief Reads from I2C bus.
|
||||
*/
|
||||
pal_status_t pal_i2c_read(pal_i2c_t* p_i2c_context, uint8_t* p_data , uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief De-initializes the I2C master.
|
||||
*/
|
||||
pal_status_t pal_i2c_deinit(const pal_i2c_t* p_i2c_context);
|
||||
|
||||
#endif /* _PAL_I2C_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
64
external/infineon/optiga/include/optiga/pal/pal_ifx_i2c_config.h
vendored
Normal file
64
external/infineon/optiga/include/optiga/pal/pal_ifx_i2c_config.h
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief This file implements the platform abstraction layer extern declarations for ifx i2c.
|
||||
*
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _PAL_IFX_I2C_CONFIG_H_
|
||||
#define _PAL_IFX_I2C_CONFIG_H_
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* HEADER FILES
|
||||
*********************************************************************************************************************/
|
||||
#include "optiga/pal/pal.h"
|
||||
#include "optiga/pal/pal_i2c.h"
|
||||
#include "optiga/pal/pal_gpio.h"
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* MACROS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* ENUMS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* PAL extern definitions for IFX I2C
|
||||
*********************************************************************************************************************/
|
||||
extern pal_i2c_t optiga_pal_i2c_context_0;
|
||||
extern pal_gpio_t optiga_vdd_0;
|
||||
extern pal_gpio_t optiga_reset_0;
|
||||
|
||||
|
||||
#endif /* _PAL_IFX_I2C_CONFIG_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
79
external/infineon/optiga/include/optiga/pal/pal_os_event.h
vendored
Normal file
79
external/infineon/optiga/include/optiga/pal/pal_os_event.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief This file implements the prototype declarations of pal os event
|
||||
*
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _PAL_OS_EVENT_H_
|
||||
#define _PAL_OS_EVENT_H_
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* HEADER FILES
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#include "optiga/common/Datatypes.h"
|
||||
#include "optiga/pal/pal.h"
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* MACROS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* ENUMS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* PAL extern definitions
|
||||
*********************************************************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief typedef for Callback function when timer elapses.
|
||||
*/
|
||||
typedef void (*register_callback)(void*);
|
||||
|
||||
#ifdef PAL_OS_HAS_EVENT_INIT
|
||||
/**
|
||||
* @brief Platform specific event init function.
|
||||
*/
|
||||
pal_status_t pal_os_event_init(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Callback registration function to trigger once when timer expires.
|
||||
*/
|
||||
void pal_os_event_register_callback_oneshot(register_callback callback, void* callback_args, uint32_t time_us);
|
||||
|
||||
|
||||
|
||||
#endif //_PAL_OS_EVENT_H_
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
78
external/infineon/optiga/include/optiga/pal/pal_os_lock.h
vendored
Normal file
78
external/infineon/optiga/include/optiga/pal/pal_os_lock.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* \file pal_os_lock.h
|
||||
*
|
||||
* \brief This file provides the prototype declarations of PAL OS lock functionalities
|
||||
*
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _PAL_OS_LOCK_H_
|
||||
#define _PAL_OS_LOCK_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "pal.h"
|
||||
|
||||
/**
|
||||
* @brief Acquires a lock.
|
||||
*
|
||||
*<b>Pre-conditions:</b>
|
||||
* None.<br>
|
||||
*
|
||||
*<b>API Details:</b>
|
||||
* - Acquires the lock.<br>
|
||||
*<br>
|
||||
*
|
||||
*
|
||||
*/
|
||||
pal_status_t pal_os_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Releases the lock.
|
||||
*
|
||||
*<b>Pre-conditions:</b>
|
||||
* None.<br>
|
||||
*
|
||||
*<b>API Details:</b>
|
||||
* - Releases the lock.<br>
|
||||
*<br>
|
||||
*
|
||||
*
|
||||
*/
|
||||
void pal_os_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_PAL_OS_LOCK_H_
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
77
external/infineon/optiga/include/optiga/pal/pal_os_random.h
vendored
Normal file
77
external/infineon/optiga/include/optiga/pal/pal_os_random.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief This file implements the prototype declarations of pal os random functionalities
|
||||
*
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _PAL_OS_RANDOM_H_
|
||||
#define _PAL_OS_RANDOM_H_
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* HEADER FILES
|
||||
*********************************************************************************************************************/
|
||||
#include "pal.h"
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* MACROS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* ENUMS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* DATA STRUCTURES
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* API Prototypes
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Gets the random counter value.
|
||||
*/
|
||||
uint32_t pal_os_random_get_counter(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PAL_OS_RANDOM_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
90
external/infineon/optiga/include/optiga/pal/pal_os_timer.h
vendored
Normal file
90
external/infineon/optiga/include/optiga/pal/pal_os_timer.h
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief This file implements the prototype declarations of pal os timer functionalities.
|
||||
*
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
#ifndef _PAL_OS_TIMER_H_
|
||||
#define _PAL_OS_TIMER_H_
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* HEADER FILES
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#include "optiga/pal/pal.h"
|
||||
|
||||
/*********************************************************************************************************************
|
||||
* pal_os_timer.h
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* MACROS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* ENUMS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* DATA STRUCTURES
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* API Prototypes
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gets tick count value in milliseconds
|
||||
*/
|
||||
uint32_t pal_os_timer_get_time_in_milliseconds(void);
|
||||
|
||||
/**
|
||||
* @brief Waits or delay until the supplied milliseconds
|
||||
*/
|
||||
void pal_os_timer_delay_in_milliseconds(uint16_t milliseconds);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PAL_OS_TIMER_H_ */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
198
external/infineon/optiga/include/optiga/pal/pal_socket.h
vendored
Normal file
198
external/infineon/optiga/include/optiga/pal/pal_socket.h
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Infineon Technologies AG
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief This file implements the prototype declarations of pal socket functionalities
|
||||
* \addtogroup grPAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _PAL_SOCKET_H_
|
||||
#define _PAL_SOCKET_H_
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* HEADER FILES
|
||||
*********************************************************************************************************************/
|
||||
#ifdef MODULE_ENABLE_DTLS_MUTUAL_AUTH
|
||||
|
||||
#ifndef WIN32
|
||||
#include "optiga/common/Datatypes.h"
|
||||
#include "udp.h"
|
||||
#include "inet.h"
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#include "optiga/common/Datatypes.h"
|
||||
#endif
|
||||
|
||||
#include "optiga/common/ErrorCodes.h"
|
||||
#include "optiga/dtls/UDPErrorCodes.h"
|
||||
|
||||
/// @cond hidden
|
||||
/**********************************************************************************************************************
|
||||
* MACROS
|
||||
*********************************************************************************************************************/
|
||||
#ifndef WIN32
|
||||
#define IPAddressParse(pzIpAddress, psIPAddress) (inet_aton(pzIpAddress, psIPAddress))
|
||||
#else
|
||||
#define IPAddressParse(pzIpAddress, psIPAddress) (1)
|
||||
#endif
|
||||
/// @endcond
|
||||
/**********************************************************************************************************************
|
||||
* ENUMS
|
||||
*********************************************************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* DATA STRUCTURES
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#ifndef WIN32
|
||||
/**
|
||||
* \brief Pointer type definition of pal socket receive event callback
|
||||
*/
|
||||
typedef void (*pal_socket_event_listener)(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *addr, u16_t port);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief This structure contains socket communication data
|
||||
*/
|
||||
typedef enum eRecvMode_d
|
||||
{
|
||||
eBlock = 0x10,
|
||||
|
||||
eNonBlock = 0x20
|
||||
}eRecvMode_d;
|
||||
|
||||
/**
|
||||
* \brief This structure contains socket communication data
|
||||
*/
|
||||
#ifndef WIN32
|
||||
|
||||
typedef struct pal_socket
|
||||
{
|
||||
|
||||
///UDP structure Tx
|
||||
struct udp_pcb *pcbTx;
|
||||
|
||||
///UDP structure Rx
|
||||
struct udp_pcb *pcbRx;
|
||||
|
||||
//Received IP address
|
||||
ip_addr_t sIPAddress;
|
||||
|
||||
///Function pointer to hold receive callback
|
||||
pal_socket_event_listener pfListen;
|
||||
|
||||
///Port for UDP communication
|
||||
uint16_t wPort;
|
||||
|
||||
///Transport Layer Timeout
|
||||
uint16_t wTimeout;
|
||||
|
||||
///Enumeration to indicate Blocking or Non blocking
|
||||
uint8_t bMode;
|
||||
|
||||
} pal_socket_t;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct pal_socket
|
||||
{
|
||||
///Received IP address
|
||||
char* sIPAddress;
|
||||
|
||||
///Port for UDP communication
|
||||
uint16_t wPort;
|
||||
|
||||
///Pointer to the socket for Receiving
|
||||
SOCKET SocketHdl;
|
||||
|
||||
///IPv4 Socket address for Receiving
|
||||
SOCKADDR_IN sSocketAddrIn;
|
||||
|
||||
///Transport Layer Timeout
|
||||
uint16_t wTimeout;
|
||||
|
||||
///Enumeration to indicate Blocking or Non blocking
|
||||
uint8_t bMode;
|
||||
|
||||
} pal_socket_t;
|
||||
#endif
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* API Prototypes
|
||||
*********************************************************************************************************************/
|
||||
|
||||
/**
|
||||
* \brief Assign IP address
|
||||
*/
|
||||
#ifndef WIN32
|
||||
int32_t pal_socket_assign_ip_address(const char* p_ip_address,void *p_input_ip_address);
|
||||
#else
|
||||
int32_t pal_socket_assign_ip_address(const char_t* p_ip_address,char** p_input_ip_address);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Initializes the socket communication structure
|
||||
*/
|
||||
int32_t pal_socket_init(pal_socket_t* p_socket);
|
||||
|
||||
/**
|
||||
* \brief Creates server port and bind
|
||||
*/
|
||||
int32_t pal_socket_open(pal_socket_t* p_socket,
|
||||
uint16_t port);
|
||||
/**
|
||||
* \brief Creates a client port and connect
|
||||
*/
|
||||
int32_t pal_socket_connect(pal_socket_t* p_socket,
|
||||
uint16_t port);
|
||||
/**
|
||||
* \brief Receive data from the client
|
||||
*/
|
||||
int32_t pal_socket_listen(pal_socket_t* p_socket, uint8_t *p_data,
|
||||
uint32_t *p_length);
|
||||
/**
|
||||
* \brief Sends the data to the the client
|
||||
*/
|
||||
int32_t pal_socket_send(const pal_socket_t* p_socket, uint8_t *p_data,
|
||||
uint32_t length);
|
||||
/**
|
||||
* \brief Closes the socket communication and release the udp port
|
||||
*/
|
||||
void pal_socket_close(pal_socket_t* p_socket);
|
||||
|
||||
#endif
|
||||
|
||||
#endif //_PAL_SOCKET_H_
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user