kopia lustrzana https://github.com/espressif/esp-idf
Structure size alligned by compiler.
rodzic
743969f333
commit
5cbb1943ac
|
@ -20,11 +20,17 @@
|
||||||
* @brief This class is used as a structure to configure wear levelling module
|
* @brief This class is used as a structure to configure wear levelling module
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef wl_config_t_size
|
|
||||||
#define wl_config_t_size (int)((48 - (2*sizeof(size_t) + 7*sizeof(uint32_t)) + sizeof(uint32_t) - 1)/sizeof(uint32_t))
|
#if defined(_MSC_VER)
|
||||||
#endif // wl_config_t_size
|
#define ALIGNED_(x) __declspec(align(x))
|
||||||
typedef struct WL_Config_s {
|
#else
|
||||||
size_t start_addr; /*!< start address in the flash*/
|
#if defined(__GNUC__)
|
||||||
|
#define ALIGNED_(x) __attribute__ ((aligned(x)))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct ALIGNED_(16) WL_Config_s { /*!< Size of wl_config_t structure should be divided by 16 for encryption*/
|
||||||
|
size_t start_addr; /*!< start address in the flash*/
|
||||||
uint32_t full_mem_size; /*!< Amount of memory used to store data in bytes*/
|
uint32_t full_mem_size; /*!< Amount of memory used to store data in bytes*/
|
||||||
uint32_t page_size; /*!< One page size in bytes. Page could be more then memory block. This parameter must be page_size >= N*block_size.*/
|
uint32_t page_size; /*!< One page size in bytes. Page could be more then memory block. This parameter must be page_size >= N*block_size.*/
|
||||||
uint32_t sector_size; /*!< size of flash memory sector that will be erased and stored at once (erase)*/
|
uint32_t sector_size; /*!< size of flash memory sector that will be erased and stored at once (erase)*/
|
||||||
|
@ -32,13 +38,7 @@ typedef struct WL_Config_s {
|
||||||
uint32_t wr_size; /*!< Minimum amount of bytes per one block at write operation: 1...*/
|
uint32_t wr_size; /*!< Minimum amount of bytes per one block at write operation: 1...*/
|
||||||
uint32_t version; /*!< A version of current implementatioon. To erase and reallocate complete memory this ID must be different from id before.*/
|
uint32_t version; /*!< A version of current implementatioon. To erase and reallocate complete memory this ID must be different from id before.*/
|
||||||
size_t temp_buff_size; /*!< Size of temporary allocated buffer to copy from one flash area to another. The best way, if this value will be equal to sector size.*/
|
size_t temp_buff_size; /*!< Size of temporary allocated buffer to copy from one flash area to another. The best way, if this value will be equal to sector size.*/
|
||||||
uint32_t reserved[wl_config_t_size]; /*!< dummy array to make wl_config_t size compatible with flash encryption (divided by 16)*/
|
|
||||||
uint32_t crc; /*!< CRC for this config*/
|
uint32_t crc; /*!< CRC for this config*/
|
||||||
public:
|
|
||||||
WL_Config_s()
|
|
||||||
{
|
|
||||||
for (int i=0 ; i< wl_config_t_size ; i++) this->reserved[i] = 0;
|
|
||||||
}
|
|
||||||
} wl_config_t;
|
} wl_config_t;
|
||||||
|
|
||||||
#ifndef _MSC_VER // MSVS has different format for this define
|
#ifndef _MSC_VER // MSVS has different format for this define
|
||||||
|
|
Ładowanie…
Reference in New Issue