1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

logfs: use uintptr_t to hold opaque pointers

When storing an opaque pointer value in a uint, the
appropriate type is uintptr_t which is guaranteed to
be wide enough to hold a pointer.

This is particularly important when the code can be
compiled in a sim or unit test environment which is
intended to run on a 64-bit machine.

Conflicts:
	flight/targets/DiscoveryF4/System/pios_board.c
	flight/targets/FlyingF4/System/pios_board.c
	flight/targets/Freedom/System/pios_board.c
	flight/targets/Quanton/System/pios_board.c
This commit is contained in:
Stacey Sheldon 2012-12-14 21:53:26 -05:00 committed by Alessio Morale
parent 60c06b8c4b
commit dd5f4b949c
6 changed files with 7 additions and 7 deletions

View File

@ -461,7 +461,7 @@ static int32_t logfs_mount_log(uint8_t arena_id)
* @brief Initialize the flash object setting FS
* @return 0 if success, -1 if failure
*/
int32_t PIOS_FLASHFS_Logfs_Init(uint32_t * fs_id, const struct flashfs_logfs_cfg * cfg, const struct pios_flash_driver * driver, uint32_t flash_id)
int32_t PIOS_FLASHFS_Logfs_Init(uintptr_t * fs_id, const struct flashfs_logfs_cfg * cfg, const struct pios_flash_driver * driver, uint32_t flash_id)
{
PIOS_Assert(cfg);
PIOS_Assert(fs_id);
@ -524,7 +524,7 @@ int32_t PIOS_FLASHFS_Logfs_Init(uint32_t * fs_id, const struct flashfs_logfs_cfg
/* Log has been mounted */
rc = 0;
*fs_id = (uint32_t) &logfs;
*fs_id = (uintptr_t) &logfs;
out_end_trans:
logfs.driver->end_transaction(logfs.flash_id);

View File

@ -41,6 +41,6 @@ struct flashfs_logfs_cfg {
uint32_t page_size; /* Maximum flash burst write size */
};
int32_t PIOS_FLASHFS_Logfs_Init(uint32_t * fs_id, const struct flashfs_logfs_cfg * cfg, const struct pios_flash_driver * driver, uint32_t flash_id);
int32_t PIOS_FLASHFS_Logfs_Init(uintptr_t * fs_id, const struct flashfs_logfs_cfg * cfg, const struct pios_flash_driver * driver, uint32_t flash_id);
#endif /* PIOS_FLASHFS_LOGFS_PRIV_H_ */

View File

@ -163,7 +163,7 @@ void PIOS_Board_Init(void) {
#endif
uint32_t flash_id;
uint32_t fs_id;
uintptr_t fs_id;
switch(bdinfo->board_rev) {
case BOARD_REVISION_CC:
PIOS_Flash_Jedec_Init(&flash_id, pios_spi_flash_accel_id, 1, &flash_w25x_cfg);

View File

@ -303,7 +303,7 @@ void PIOS_Board_Init(void) {
/* Connect flash to the approrpiate interface and configure it */
uint32_t flash_id;
PIOS_Flash_Jedec_Init(&flash_id, pios_spi_telem_flash_id, 1, &flash_m25p_cfg);
uint32_t fs_id;
uintptr_t fs_id;
PIOS_FLASHFS_Logfs_Init(&fs_id, &flashfs_m25p_cfg, &pios_jedec_flash_driver, flash_id);
#endif

View File

@ -389,7 +389,7 @@ void PIOS_Board_Init(void) {
uint32_t flash_id;
PIOS_Flash_Jedec_Init(&flash_id, pios_spi_accel_id, 1, &flash_m25p_cfg);
#endif
uint32_t fs_id;
uintptr_t fs_id;
PIOS_FLASHFS_Logfs_Init(&fs_id, &flashfs_m25p_cfg, &pios_jedec_flash_driver, flash_id);
/* Initialize UAVObject libraries */

View File

@ -38,7 +38,7 @@ int main (int argc, char * argv[])
abort();
}
uint32_t fs_id;
uintptr_t fs_id;
rc = PIOS_FLASHFS_Logfs_Init(&fs_id, &flashfs_config, &pios_ut_flash_driver, flash_id);
if (rc != 0) {
printf ("flash filesystem init failed (%d)\n", rc);