diff --git a/TESTS/mbed_drivers/reset_reason/main.cpp b/TESTS/mbed_drivers/reset_reason/main.cpp index 2f32b75d7c..4b1eaa8e3a 100644 --- a/TESTS/mbed_drivers/reset_reason/main.cpp +++ b/TESTS/mbed_drivers/reset_reason/main.cpp @@ -61,7 +61,7 @@ static cmd_status_t handle_command(const char *key, const char *value) uint32_t raw_reason = ResetReason::get_raw(); char raw_reason_hex_str[9] = { }; int raw_reason_hex_str_len = snprintf(raw_reason_hex_str, - sizeof raw_reason_hex_str, "%08lx", raw_reason); + sizeof raw_reason_hex_str, "%08lx", raw_reason); if (raw_reason_hex_str_len != (sizeof raw_reason_hex_str) - 1) { TEST_ASSERT_MESSAGE(0, "Failed to compose raw reset reason hex string."); diff --git a/TESTS/mbed_drivers/watchdog/main.cpp b/TESTS/mbed_drivers/watchdog/main.cpp index dd8ee4bdc9..cc813f9beb 100644 --- a/TESTS/mbed_drivers/watchdog/main.cpp +++ b/TESTS/mbed_drivers/watchdog/main.cpp @@ -204,15 +204,15 @@ Case cases[] = { Case("max_timeout is valid", test_max_timeout_is_valid), Case("Stop", test_stop), Case("Restart multiple times", (utest::v1::case_setup_handler_t) case_setup_sync_on_reset, - test_restart, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), + test_restart, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), // Do not set watchdog timeout shorter than 500 ms as it may cause the // host-test-runner return 'TIMEOUT' instead of 'FAIL' / 'PASS' if watchdog // performs reset during test suite teardown. Case("Start, 500 ms", (utest::v1::case_setup_handler_t) case_setup_sync_on_reset, - test_start<500UL>, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), + test_start<500UL>, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), Case("Start, max_timeout", (utest::v1::case_setup_handler_t) case_setup_sync_on_reset, - test_start_max_timeout, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), + test_start_max_timeout, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), Case("Start, 0 ms", test_start_zero), Case("Start, max_timeout exceeded", test_start_max_timeout_exceeded), diff --git a/TESTS/mbed_drivers/watchdog_reset/main.cpp b/TESTS/mbed_drivers/watchdog_reset/main.cpp index 983e068711..1011d78087 100644 --- a/TESTS/mbed_drivers/watchdog_reset/main.cpp +++ b/TESTS/mbed_drivers/watchdog_reset/main.cpp @@ -261,7 +261,7 @@ int testsuite_setup(const size_t number_of_cases) } utest_printf("This test suite is composed of %i test cases. Starting at index %i.\n", number_of_cases, - current_case.start_index); + current_case.start_index); return current_case.start_index; } diff --git a/TESTS/mbed_hal/reset_reason/main.cpp b/TESTS/mbed_hal/reset_reason/main.cpp index 891e0398ca..4a10c9b02a 100644 --- a/TESTS/mbed_hal/reset_reason/main.cpp +++ b/TESTS/mbed_hal/reset_reason/main.cpp @@ -77,7 +77,7 @@ static cmd_status_t handle_command(const char *key, const char *value) uint32_t raw_reason = hal_reset_reason_get_raw(); char raw_reason_hex_str[9] = { }; int raw_reason_hex_str_len = snprintf(raw_reason_hex_str, - sizeof raw_reason_hex_str, "%08lx", raw_reason); + sizeof raw_reason_hex_str, "%08lx", raw_reason); if (raw_reason_hex_str_len != (sizeof raw_reason_hex_str) - 1) { TEST_ASSERT_MESSAGE(0, "Failed to compose raw reset reason hex string."); diff --git a/TESTS/mbed_hal/watchdog/main.cpp b/TESTS/mbed_hal/watchdog/main.cpp index 24a262ff2f..e8365ed811 100644 --- a/TESTS/mbed_hal/watchdog/main.cpp +++ b/TESTS/mbed_hal/watchdog/main.cpp @@ -217,17 +217,17 @@ Case cases[] = { Case("Watchdog can be stopped", test_stop), Case("Update config with multiple init calls", - (utest::v1::case_setup_handler_t) case_setup_sync_on_reset, - test_update_config, - (utest::v1::case_teardown_handler_t) case_teardown_wdg_stop_or_reset), + (utest::v1::case_setup_handler_t) case_setup_sync_on_reset, + test_update_config, + (utest::v1::case_teardown_handler_t) case_teardown_wdg_stop_or_reset), // Do not set watchdog timeout shorter than 500 ms as it may cause the // host-test-runner return 'TIMEOUT' instead of 'FAIL' / 'PASS' if watchdog // performs reset during test suite teardown. Case("Init, 500 ms", (utest::v1::case_setup_handler_t) case_setup_sync_on_reset, - test_init<500UL>, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), + test_init<500UL>, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), Case("Init, max_timeout", (utest::v1::case_setup_handler_t) case_setup_sync_on_reset, - test_init_max_timeout, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), + test_init_max_timeout, (utest::v1::case_teardown_handler_t) case_teardown_sync_on_reset), }; Specification specification((utest::v1::test_setup_handler_t) testsuite_setup_sync_on_reset, cases); diff --git a/TESTS/mbed_hal/watchdog_reset/main.cpp b/TESTS/mbed_hal/watchdog_reset/main.cpp index 1cc772c4f2..9b121c4bc5 100644 --- a/TESTS/mbed_hal/watchdog_reset/main.cpp +++ b/TESTS/mbed_hal/watchdog_reset/main.cpp @@ -284,7 +284,7 @@ int testsuite_setup(const size_t number_of_cases) } utest_printf("This test suite is composed of %i test cases. Starting at index %i.\n", number_of_cases, - current_case.start_index); + current_case.start_index); return current_case.start_index; } diff --git a/TESTS/mbed_hal/watchdog_timing/main.cpp b/TESTS/mbed_hal/watchdog_timing/main.cpp index 513d39d031..ba7412807c 100644 --- a/TESTS/mbed_hal/watchdog_timing/main.cpp +++ b/TESTS/mbed_hal/watchdog_timing/main.cpp @@ -77,7 +77,7 @@ void test_timing() } int str_len = snprintf(msg_value, sizeof msg_value, "%02x,%08lx", current_case.start_index + current_case.index, - (uint32_t) current_ts); + (uint32_t) current_ts); if (str_len != (sizeof msg_value) - 1) { utest_printf("Failed to compose a value string to be sent to host."); return; @@ -130,7 +130,7 @@ int testsuite_setup(const size_t number_of_cases) } utest_printf("This test suite is composed of %i test cases. Starting at index %i.\n", number_of_cases, - current_case.start_index); + current_case.start_index); return current_case.start_index; } diff --git a/drivers/ResetReason.h b/drivers/ResetReason.h index fa8736a268..7bc74255b3 100644 --- a/drivers/ResetReason.h +++ b/drivers/ResetReason.h @@ -21,8 +21,7 @@ #include "reset_reason_api.h" -namespace mbed -{ +namespace mbed { /** \addtogroup drivers */ /** ResetReason API. When the system is restarted, the reason for the restart is * contained in the system registers at boot time in a platform specific manner, @@ -30,8 +29,7 @@ namespace mbed * * @ingroup drivers */ -class ResetReason -{ +class ResetReason { public: /** Get the platform-independent reason code for the last system reset. * diff --git a/drivers/Watchdog.cpp b/drivers/Watchdog.cpp index 0d655b0a21..0214173e45 100644 --- a/drivers/Watchdog.cpp +++ b/drivers/Watchdog.cpp @@ -18,8 +18,7 @@ #include "Watchdog.h" -namespace mbed -{ +namespace mbed { watchdog_status_t Watchdog::start(const uint32_t timeout) { diff --git a/drivers/Watchdog.h b/drivers/Watchdog.h index f09503372f..a154f9abf5 100644 --- a/drivers/Watchdog.h +++ b/drivers/Watchdog.h @@ -44,8 +44,7 @@ namespace mbed { * @endcode * @ingroup drivers */ -class Watchdog -{ +class Watchdog { public: Watchdog() {} diff --git a/hal/reset_reason_api.h b/hal/reset_reason_api.h index e9d0d79398..b43b2fbcab 100644 --- a/hal/reset_reason_api.h +++ b/hal/reset_reason_api.h @@ -34,18 +34,18 @@ extern "C" { /** Definitions of different reset reasons */ typedef enum { - RESET_REASON_POWER_ON, /**< Set when power is initially applied to the board. The power-on-reset circuit causes a POWER_ON reset when this occurs */ - RESET_REASON_PIN_RESET, /**< Set when a reset is triggered by the hardware pin on the board */ - RESET_REASON_BROWN_OUT, /**< Triggered when the voltage drops below the low voltage detect (LVD) threshold the system will be held in a reset until the voltage rises above the threshold */ - RESET_REASON_SOFTWARE, /**< Set during software reset, typically triggered by writing the SYSRESETREQ bit in the Application Interrupt and Reset Control register */ - RESET_REASON_WATCHDOG, /**< Set when a running watchdog timer fails to be refreshed */ - RESET_REASON_LOCKUP, /**< Set when the core is locked because of an unrecoverable exception */ - RESET_REASON_WAKE_LOW_POWER, /**< Set when waking from deep sleep mode */ - RESET_REASON_ACCESS_ERROR, /**< Umbrella value that encompasses any access related reset */ - RESET_REASON_BOOT_ERROR, /**< Umbrella value that encompasses any boot related reset */ - RESET_REASON_MULTIPLE, /**< Set if multiple reset reasons are set within the board. Occurs when the reset reason registers aren't cleared between resets */ - RESET_REASON_PLATFORM, /**< Platform specific reset reason not captured in this enum */ - RESET_REASON_UNKNOWN /**< Unknown or unreadable reset reason **/ + RESET_REASON_POWER_ON, /**< Set when power is initially applied to the board. The power-on-reset circuit causes a POWER_ON reset when this occurs */ + RESET_REASON_PIN_RESET, /**< Set when a reset is triggered by the hardware pin on the board */ + RESET_REASON_BROWN_OUT, /**< Triggered when the voltage drops below the low voltage detect (LVD) threshold the system will be held in a reset until the voltage rises above the threshold */ + RESET_REASON_SOFTWARE, /**< Set during software reset, typically triggered by writing the SYSRESETREQ bit in the Application Interrupt and Reset Control register */ + RESET_REASON_WATCHDOG, /**< Set when a running watchdog timer fails to be refreshed */ + RESET_REASON_LOCKUP, /**< Set when the core is locked because of an unrecoverable exception */ + RESET_REASON_WAKE_LOW_POWER, /**< Set when waking from deep sleep mode */ + RESET_REASON_ACCESS_ERROR, /**< Umbrella value that encompasses any access related reset */ + RESET_REASON_BOOT_ERROR, /**< Umbrella value that encompasses any boot related reset */ + RESET_REASON_MULTIPLE, /**< Set if multiple reset reasons are set within the board. Occurs when the reset reason registers aren't cleared between resets */ + RESET_REASON_PLATFORM, /**< Platform specific reset reason not captured in this enum */ + RESET_REASON_UNKNOWN /**< Unknown or unreadable reset reason **/ } reset_reason_t; /** Fetch the reset reason for the last system reset diff --git a/hal/watchdog_api.h b/hal/watchdog_api.h index 1cf4e8f858..e7fe9da6d7 100644 --- a/hal/watchdog_api.h +++ b/hal/watchdog_api.h @@ -46,45 +46,43 @@ * modes unless the chip is woken to refresh the timer. */ -typedef struct -{ - /** - * Refresh value for the watchdog in milliseconds. The maximum value of this - * setting is platform dependent, to find the maximum value for the current - * platform call hal_watchdog_get_features() and check the timeout value - * member. The minimum valid value for this setting is 1, attempting to - * initialise the watchdog with a timeout of 0ms will return - * WATCHDOG_STATUS_INVALID_ARGUMENT. - */ - uint32_t timeout_ms; +typedef struct { + /** + * Refresh value for the watchdog in milliseconds. The maximum value of this + * setting is platform dependent, to find the maximum value for the current + * platform call hal_watchdog_get_features() and check the timeout value + * member. The minimum valid value for this setting is 1, attempting to + * initialise the watchdog with a timeout of 0ms will return + * WATCHDOG_STATUS_INVALID_ARGUMENT. + */ + uint32_t timeout_ms; } watchdog_config_t; -typedef struct -{ - /** - * Maximum timeout value for the watchdog in milliseconds. - */ - uint32_t max_timeout; - /** - * Watchdog configuration can be updated after the watchdog has been started - */ - bool update_config; - /** - * Watchdog can be stopped after it is started without a reset - */ - bool disable_watchdog; +typedef struct { + /** + * Maximum timeout value for the watchdog in milliseconds. + */ + uint32_t max_timeout; + /** + * Watchdog configuration can be updated after the watchdog has been started + */ + bool update_config; + /** + * Watchdog can be stopped after it is started without a reset + */ + bool disable_watchdog; } watchdog_features_t; typedef enum { - WATCHDOG_STATUS_OK, - WATCHDOG_STATUS_NOT_SUPPORTED, - WATCHDOG_STATUS_INVALID_ARGUMENT + WATCHDOG_STATUS_OK, + WATCHDOG_STATUS_NOT_SUPPORTED, + WATCHDOG_STATUS_INVALID_ARGUMENT } watchdog_status_t; #ifdef __cplusplus - extern "C" { +extern "C" { #endif /** Initialise and start a watchdog timer with the given configuration.