@@ -36,7 +36,7 @@ void test_error_count_and_reset()
36
36
TEST_ASSERT_EQUAL_INT (count, get_error_count ());
37
37
38
38
// clear the errors and error count to 0
39
- clear_all_errors ();
39
+ mbed_clear_all_errors ();
40
40
41
41
// Now the error count should be 0
42
42
TEST_ASSERT_EQUAL_INT (0 , get_error_count ());
@@ -56,15 +56,15 @@ void test_error_capturing()
56
56
MBED_WARNING (MBED_ERROR_OUT_OF_RESOURCES, " System type error" , 0x1100 );
57
57
mbed_error_status_t lastError = get_last_error ();
58
58
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_TYPE_SYSTEM, MBED_GET_ERROR_TYPE (lastError));
59
- TEST_ASSERT_EQUAL_UINT (MODULE_UNKNOWN , MBED_GET_ERROR_MODULE (lastError));
59
+ TEST_ASSERT_EQUAL_UINT (MBED_MODULE_UNKNOWN , MBED_GET_ERROR_MODULE (lastError));
60
60
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_CODE_OUT_OF_RESOURCES, MBED_GET_ERROR_CODE (lastError));
61
61
62
- mbed_error_status_t error = MAKE_ERROR (MODULE_DRIVER_SERIAL , MBED_ERROR_CODE_OUT_OF_RESOURCES);
62
+ mbed_error_status_t error = MBED_MAKE_ERROR (MBED_MODULE_DRIVER_SERIAL , MBED_ERROR_CODE_OUT_OF_RESOURCES);
63
63
MBED_WARNING (error, " Error Serial" , 0xAA );
64
64
lastError = get_last_error ();
65
65
TEST_ASSERT_EQUAL_UINT (error, lastError);
66
66
67
- error = MAKE_CUSTOM_ERROR (MODULE_APPLICATION , MBED_ERROR_CODE_UNKNOWN);
67
+ error = MBED_MAKE_CUSTOM_ERROR (MBED_MODULE_APPLICATION , MBED_ERROR_CODE_UNKNOWN);
68
68
MBED_WARNING (error, " Custom Error Unknown" , 0x1234 );
69
69
lastError = get_last_error ();
70
70
TEST_ASSERT_EQUAL_UINT (error, lastError);
@@ -73,34 +73,34 @@ void test_error_capturing()
73
73
lastError = get_last_error ();
74
74
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_EPERM, lastError);
75
75
76
- error = MAKE_CUSTOM_ERROR (MODULE_PLATFORM , MBED_ERROR_CODE_CREATE_FAILED);
76
+ error = MBED_MAKE_CUSTOM_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_CREATE_FAILED);
77
77
MBED_WARNING (error, " Custom Error Type" , error_value);
78
78
lastError = get_last_error ();
79
79
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_TYPE_CUSTOM, MBED_GET_ERROR_TYPE (lastError));
80
- TEST_ASSERT_EQUAL_UINT (MODULE_PLATFORM , MBED_GET_ERROR_MODULE (lastError));
80
+ TEST_ASSERT_EQUAL_UINT (MBED_MODULE_PLATFORM , MBED_GET_ERROR_MODULE (lastError));
81
81
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_CODE_CREATE_FAILED, MBED_GET_ERROR_CODE (lastError));
82
- mbed_error_status_t status = get_last_error_log_info ( &error_ctx );
82
+ mbed_error_status_t status = mbed_get_last_error_log_info ( &error_ctx );
83
83
TEST_ASSERT (status == MBED_SUCCESS);
84
84
TEST_ASSERT_EQUAL_UINT (error_value, error_ctx.error_value );
85
85
86
86
error_value = 0xAABBCC ;
87
87
MBED_WARNING (MBED_ERROR_EACCES, " Posix Error" , error_value );
88
88
lastError = get_last_error ();
89
89
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_TYPE_POSIX, MBED_GET_ERROR_TYPE (lastError));
90
- TEST_ASSERT_EQUAL_UINT (MODULE_UNKNOWN , MBED_GET_ERROR_MODULE (lastError));
90
+ TEST_ASSERT_EQUAL_UINT (MBED_MODULE_UNKNOWN , MBED_GET_ERROR_MODULE (lastError));
91
91
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_CODE_EACCES, MBED_GET_ERROR_CODE (lastError));
92
- status = get_last_error_log_info ( &error_ctx );
92
+ status = mbed_get_last_error_log_info ( &error_ctx );
93
93
TEST_ASSERT (status == MBED_SUCCESS);
94
94
TEST_ASSERT_EQUAL_UINT (error_value, error_ctx.error_value );
95
95
96
96
error_value = 0 ;
97
- error = MAKE_ERROR (MODULE_HAL , MBED_ERROR_CODE_UNKNOWN);
97
+ error = MBED_MAKE_ERROR (MBED_MODULE_HAL , MBED_ERROR_CODE_UNKNOWN);
98
98
MBED_WARNING (error, " HAL Entity error" , error_value );
99
99
lastError = get_last_error ();
100
100
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_TYPE_SYSTEM, MBED_GET_ERROR_TYPE (lastError));
101
- TEST_ASSERT_EQUAL_UINT (MODULE_HAL , MBED_GET_ERROR_MODULE (lastError));
101
+ TEST_ASSERT_EQUAL_UINT (MBED_MODULE_HAL , MBED_GET_ERROR_MODULE (lastError));
102
102
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_CODE_UNKNOWN, MBED_GET_ERROR_CODE (lastError));
103
- status = get_last_error_log_info ( &error_ctx );
103
+ status = mbed_get_last_error_log_info ( &error_ctx );
104
104
TEST_ASSERT (status == MBED_SUCCESS);
105
105
TEST_ASSERT_EQUAL_UINT (error_value, error_ctx.error_value );
106
106
@@ -121,7 +121,7 @@ void test_error_context_capture()
121
121
mbed_error_ctx error_ctx = {0 };
122
122
123
123
MBED_WARNING (MBED_ERROR_INVALID_ARGUMENT, " System type error" , error_value );
124
- mbed_error_status_t status = get_last_error_log_info ( &error_ctx );
124
+ mbed_error_status_t status = mbed_get_last_error_log_info ( &error_ctx );
125
125
TEST_ASSERT (status == MBED_SUCCESS);
126
126
TEST_ASSERT_EQUAL_UINT (error_value, error_ctx.error_value );
127
127
TEST_ASSERT_EQUAL_UINT (osThreadGetId (), error_ctx.thread_id );
@@ -144,22 +144,22 @@ void test_error_logging()
144
144
mbed_error_ctx error_ctx = {0 };
145
145
146
146
// clear the current errors first
147
- clear_all_errors ();
147
+ mbed_clear_all_errors ();
148
148
149
149
// log 3 errors and retrieve them to ensure they are correct
150
150
MBED_WARNING (MBED_ERROR_INVALID_ARGUMENT, " Invalid argument" , 1 );
151
151
MBED_WARNING (MBED_ERROR_INVALID_SIZE, " Invalid size" , 2 );
152
152
MBED_WARNING (MBED_ERROR_INVALID_FORMAT, " Invalid format" , 3 );
153
153
154
- mbed_error_status_t status = get_error_log_info ( 0 , &error_ctx );
154
+ mbed_error_status_t status = mbed_get_error_log_info ( 0 , &error_ctx );
155
155
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_INVALID_ARGUMENT, error_ctx.error_status );
156
156
TEST_ASSERT_EQUAL_UINT (1 , error_ctx.error_value );
157
157
158
- status = get_error_log_info ( 1 , &error_ctx );
158
+ status = mbed_get_error_log_info ( 1 , &error_ctx );
159
159
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_INVALID_SIZE, error_ctx.error_status );
160
160
TEST_ASSERT_EQUAL_UINT (2 , error_ctx.error_value );
161
161
162
- status = get_error_log_info ( 2 , &error_ctx );
162
+ status = mbed_get_error_log_info ( 2 , &error_ctx );
163
163
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_INVALID_FORMAT, error_ctx.error_status );
164
164
TEST_ASSERT_EQUAL_UINT (3 , error_ctx.error_value );
165
165
@@ -175,24 +175,24 @@ void test_error_logging()
175
175
MBED_WARNING (MBED_ERROR_UNSUPPORTED, " Not supported" , 12 );
176
176
MBED_WARNING (MBED_ERROR_ACCESS_DENIED, " Access denied" , 13 );
177
177
178
- status = get_error_log_info ( 0 , &error_ctx );
178
+ status = mbed_get_error_log_info ( 0 , &error_ctx );
179
179
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_TIME_OUT, error_ctx.error_status );
180
180
TEST_ASSERT_EQUAL_UINT (10 , error_ctx.error_value );
181
181
182
- status = get_error_log_info ( 1 , &error_ctx );
182
+ status = mbed_get_error_log_info ( 1 , &error_ctx );
183
183
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_ALREADY_IN_USE, error_ctx.error_status );
184
184
TEST_ASSERT_EQUAL_UINT (11 , error_ctx.error_value );
185
185
186
- status = get_error_log_info ( 2 , &error_ctx );
186
+ status = mbed_get_error_log_info ( 2 , &error_ctx );
187
187
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_UNSUPPORTED, error_ctx.error_status );
188
188
TEST_ASSERT_EQUAL_UINT (12 , error_ctx.error_value );
189
189
190
- status = get_error_log_info ( 3 , &error_ctx );
190
+ status = mbed_get_error_log_info ( 3 , &error_ctx );
191
191
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_ACCESS_DENIED, error_ctx.error_status );
192
192
TEST_ASSERT_EQUAL_UINT (13 , error_ctx.error_value );
193
193
194
194
// Try an index which is invalid, we should get ERROR_INVALID_ARGUMENT back
195
- status = get_error_log_info ( 99 , &error_ctx );
195
+ status = mbed_get_error_log_info ( 99 , &error_ctx );
196
196
TEST_ASSERT_EQUAL_UINT (MBED_ERROR_INVALID_ARGUMENT, status);
197
197
198
198
}
@@ -228,10 +228,10 @@ void test_error_logging_multithread()
228
228
errThread[i]->join ();
229
229
}
230
230
231
- i = get_error_log_count ()-1 ;
231
+ i = mbed_get_error_log_count ()-1 ;
232
232
// printf("\nError log count = %d\n", i+1);
233
233
for (;i>=0 ;--i) {
234
- mbed_error_status_t status = get_error_log_info ( i, &error_ctx );
234
+ mbed_error_status_t status = mbed_get_error_log_info ( i, &error_ctx );
235
235
if (status != MBED_SUCCESS) {
236
236
TEST_FAIL ();
237
237
}
@@ -252,7 +252,7 @@ void MyErrorHook(const mbed_error_ctx *error_ctx)
252
252
*/
253
253
void test_error_hook ()
254
254
{
255
- if ( MBED_SUCCESS != set_error_hook (MyErrorHook)) {
255
+ if ( MBED_SUCCESS != mbed_set_error_hook (MyErrorHook)) {
256
256
TEST_FAIL ();
257
257
}
258
258
@@ -317,7 +317,7 @@ void test_save_error_log()
317
317
TEST_FAIL ();
318
318
}
319
319
320
- if (MBED_SUCCESS != save_error_log (" /fs/errors.log" )) {
320
+ if (MBED_SUCCESS != mbed_save_error_log (" /fs/errors.log" )) {
321
321
printf (" Failed saving error log" );
322
322
TEST_FAIL ();
323
323
}
0 commit comments