mirror of https://github.com/ARMmbed/mbed-os.git
Apply new astyle config style
parent
7c05a83afa
commit
fd7e46b799
|
@ -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.");
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
#include "Watchdog.h"
|
||||
|
||||
namespace mbed
|
||||
{
|
||||
namespace mbed {
|
||||
|
||||
watchdog_status_t Watchdog::start(const uint32_t timeout)
|
||||
{
|
||||
|
|
|
@ -44,8 +44,7 @@ namespace mbed {
|
|||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class Watchdog
|
||||
{
|
||||
class Watchdog {
|
||||
public:
|
||||
Watchdog() {}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue