1 /* 2 * Copyright 2016-2023, Cypress Semiconductor Corporation or 3 * an affiliate of Cypress Semiconductor Corporation. All rights reserved. 4 * 5 * This software, including source code, documentation and related 6 * materials ("Software") is owned by Cypress Semiconductor Corporation 7 * or one of its affiliates ("Cypress") and is protected by and subject to 8 * worldwide patent protection (United States and foreign), 9 * United States copyright laws and international treaty provisions. 10 * Therefore, you may use this Software only as provided in the license 11 * agreement accompanying the software package from which you 12 * obtained this Software ("EULA"). 13 * If no EULA applies, Cypress hereby grants you a personal, non-exclusive, 14 * non-transferable license to copy, modify, and compile the Software 15 * source code solely for use in connection with Cypress's 16 * integrated circuit products. Any reproduction, modification, translation, 17 * compilation, or representation of this Software except as specified 18 * above is prohibited without the express written permission of Cypress. 19 * 20 * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND, 21 * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress 23 * reserves the right to make changes to the Software without notice. Cypress 24 * does not assume any liability arising out of the application or use of the 25 * Software or any product or circuit described in the Software. Cypress does 26 * not authorize its products for use in any products where a malfunction or 27 * failure of the Cypress product may reasonably be expected to result in 28 * significant property damage, injury or death ("High Risk Product"). By 29 * including Cypress's product in a High Risk Product, the manufacturer 30 * of such system or application assumes all risk of such use and in doing 31 * so agrees to indemnify Cypress against all liability. 32 */ 33 /**************************************************************************** 34 ** 35 ** Name: wiced_data_types.h 36 ** 37 ** Description: wiced data types header file for VS2010 projects 38 ** 39 ** Copyright (c) Cypress Semiconductor 40 ** 41 ******************************************************************************/ 42 43 #ifndef WICED_DATA_TYPES_H 44 #define WICED_DATA_TYPES_H 45 46 #include <stdint.h> 47 #include <string.h> 48 49 /** 50 * @ingroup gentypes 51 * 52 * @{ 53 */ 54 55 #ifndef WICED_FALSE 56 #define WICED_FALSE 0 /**< Wiced false */ 57 #endif // !WICED_FALSE 58 #ifndef WICED_TRUE 59 #define WICED_TRUE 1 /**< Wiced true */ 60 #endif // !WICED_TRUE 61 62 #ifndef FALSE 63 #define FALSE 0 /**< false */ 64 #endif 65 66 #ifndef TRUE 67 #define TRUE 1 /**< true */ 68 #endif 69 70 #ifdef __ARM__ 71 #define WICED_BT_STRUCT_PACKED __packed() struct /**< packed structure */ 72 #define WICED_BT_UNION_PACKED __packed() union /**< packed union */ 73 #elif defined(TOOLCHAIN_gnu) || defined(COMPILER_GNU) 74 #define WICED_BT_STRUCT_PACKED struct __attribute__((packed)) /**< packed structure */ 75 #define WICED_BT_UNION_PACKED union __attribute__((packed)) /**< packed union */ 76 #else 77 #define WICED_BT_STRUCT_PACKED struct /**< packed structure */ 78 #define WICED_BT_UNION_PACKED union /**< packed union */ 79 #endif 80 81 /** Surpress Warnings */ 82 #define WICED_SUPPRESS_WARNINGS(m) if((m)){;} 83 84 /* Suppress unused variable warning */ 85 #ifndef UNUSED_VARIABLE 86 /** Unused Variable */ 87 #define UNUSED_VARIABLE(x) /*@-noeffect@*/ ( (void)(x) ) /*@+noeffect@*/ 88 #endif 89 90 /* To prevent complier to optimize with LDM and STM instructions */ 91 #define WICED_MEMCPY(a, b, c) memcpy((void*)(a), (const void*)(b), c) /**< Wiced Memory copy*/ 92 #define WICED_MEMSET(a, b, c) memset((void*)(a), b, c) /**< Wiced Memory set */ 93 #define WICED_MEMMOVE(a, b, c) memmove((void*)(a), (const void*)(b), c) /**< Wiced Memory move*/ 94 #define WICED_MEMCMP(a, b, c) memcmp((void*)(a), (const void*)(b), c) /**< Wiced Memory compare*/ 95 96 /** Wiced Boolean */ 97 typedef unsigned int wiced_bool_t; 98 99 /** Function prototypes to lock and unlock (typically using a mutex). The context 100 ** pointer may be NULL, depending on implementation. 101 */ 102 typedef struct { 103 void* p_lock_context; /**< lock context pointer */ 104 void (*pf_lock_func)(void * p_lock_context); /**< Lock function pointer */ 105 void (*pf_unlock_func)(void * p_lock_context); /**< Unlock function pointer */ 106 }wiced_bt_lock_t; 107 108 /** 109 * Exception callback : 110 * 111 * Called by stack in case of unhandled exceptions and critical errors. 112 * 113 * @param[in] code : Exception code 114 * @param[in] msg : Exception string 115 * @param[in] p_tr : Pointer to the data (based on the exception) 116 * 117 * @return void 118 */ 119 typedef void (*pf_wiced_exception)(uint16_t code, char* msg, void* ptr); 120 /**@} gentypes */ 121 #endif 122