diff --git a/src/include/esp/esp_mem.h b/src/include/esp/esp_mem.h index 0f80c8ff..c1ca1ad9 100644 --- a/src/include/esp/esp_mem.h +++ b/src/include/esp/esp_mem.h @@ -1,77 +1,77 @@ -/** - * \file esp_mem.h - * \brief Memory manager - */ - -/* - * Copyright (c) 2018 Tilen Majerle - * - * 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. - * - * This file is part of ESP-AT library. - * - * Author: Tilen MAJERLE - */ -#ifndef __ESP_MEM_H -#define __ESP_MEM_H - -/* C++ detection */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include "esp/esp.h" - -/** - * \ingroup ESP - * \defgroup ESP_MEM Memory manager - * \brief Dynamic memory manager - * \{ - */ - -/** - * \brief Single memory region descriptor - */ -typedef struct esp_mem_region { - void* start_addr; /*!< Start address of region */ - size_t size; /*!< Size in units of bytes of region */ -} esp_mem_region_t; - -void* esp_mem_alloc(uint32_t size); -void* esp_mem_realloc(void* ptr, size_t size); -void* esp_mem_calloc(size_t num, size_t size); -void esp_mem_free(void* ptr); -size_t esp_mem_getfree(void); -size_t esp_mem_getfull(void); -size_t esp_mem_getminfree(void); - -uint8_t esp_mem_assignmemory(const esp_mem_region_t* regions, size_t size); - -/** - * \} - */ - -/* C++ detection */ -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __ESP_MEM_H */ +/** + * \file esp_mem.h + * \brief Memory manager + */ + +/* + * Copyright (c) 2018 Tilen Majerle + * + * 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. + * + * This file is part of ESP-AT library. + * + * Author: Tilen MAJERLE + */ +#ifndef __ESP_MEM_H +#define __ESP_MEM_H + +/* C++ detection */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "esp/esp.h" + +/** + * \ingroup ESP + * \defgroup ESP_MEM Memory manager + * \brief Dynamic memory manager + * \{ + */ + +/** + * \brief Single memory region descriptor + */ +typedef struct { + void* start_addr; /*!< Start address of region */ + size_t size; /*!< Size in units of bytes of region */ +} esp_mem_region_t; + +void* esp_mem_alloc(uint32_t size); +void* esp_mem_realloc(void* ptr, size_t size); +void* esp_mem_calloc(size_t num, size_t size); +void esp_mem_free(void* ptr); +size_t esp_mem_getfree(void); +size_t esp_mem_getfull(void); +size_t esp_mem_getminfree(void); + +uint8_t esp_mem_assignmemory(const esp_mem_region_t* regions, size_t size); + +/** + * \} + */ + +/* C++ detection */ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ESP_MEM_H */ diff --git a/src/include/esp/esp_private.h b/src/include/esp/esp_private.h index b76aaf19..b409e077 100644 --- a/src/include/esp/esp_private.h +++ b/src/include/esp/esp_private.h @@ -464,9 +464,10 @@ typedef struct { } esp_t; /** + * \ingroup ESP_UNICODE * \brief Unicode support structure */ -typedef struct esp_unicode_t { +typedef struct { uint8_t ch[4]; /*!< UTF-8 max characters */ uint8_t t; /*!< Total expected length in UTF-8 sequence */ uint8_t r; /*!< Remaining bytes in UTF-8 sequence */ diff --git a/src/include/esp/esp_typedefs.h b/src/include/esp/esp_typedefs.h index fe26ae1e..cf7bc3e9 100644 --- a/src/include/esp/esp_typedefs.h +++ b/src/include/esp/esp_typedefs.h @@ -419,7 +419,7 @@ typedef struct esp_timeout { * \ingroup ESP_BUFF * \brief Buffer structure */ -typedef struct esp_buff { +typedef struct { size_t size; /*!< Size of buffer in units of bytes */ size_t in; /*!< Input pointer to save next value */ size_t out; /*!< Output pointer to read next value */ diff --git a/src/include/esp/esp_unicode.h b/src/include/esp/esp_unicode.h index 89150edc..89112bda 100644 --- a/src/include/esp/esp_unicode.h +++ b/src/include/esp/esp_unicode.h @@ -1,61 +1,61 @@ -/** - * \file esp_unicode.h - * \brief Unicode support - */ - -/* - * Copyright (c) 2018 Tilen Majerle - * - * 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. - * - * This file is part of ESP-AT library. - * - * Author: Tilen MAJERLE - */ -#ifndef __ESP_UNICODE_H -#define __ESP_UNICODE_H - -/* C++ detection */ -#ifdef __cplusplus -extern "C" { -#endif - -#include "esp/esp.h" - -/** - * \ingroup ESP - * \defgroup ESP_UNICODE Unicode support - * \brief Unicode manager - * \{ - */ - -espr_t espi_unicode_decode(esp_unicode_t* uni, uint8_t ch); - -/** - * \} - */ - -/* C++ detection */ -#ifdef __cplusplus -} -#endif - -#endif /* __ESP_UNICODE_H */ +/** + * \file esp_unicode.h + * \brief Unicode support + */ + +/* + * Copyright (c) 2018 Tilen Majerle + * + * 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. + * + * This file is part of ESP-AT library. + * + * Author: Tilen MAJERLE + */ +#ifndef __ESP_UNICODE_H +#define __ESP_UNICODE_H + +/* C++ detection */ +#ifdef __cplusplus +extern "C" { +#endif + +#include "esp/esp.h" + +/** + * \ingroup ESP + * \defgroup ESP_UNICODE Unicode manager + * \brief Unicode support manager + * \{ + */ + +espr_t espi_unicode_decode(esp_unicode_t* uni, uint8_t ch); + +/** + * \} + */ + +/* C++ detection */ +#ifdef __cplusplus +} +#endif + +#endif /* __ESP_UNICODE_H */