Revision 916f8d28
core/inc/aos_types.h | ||
---|---|---|
46 | 46 |
/******************************************************************************/ |
47 | 47 |
|
48 | 48 |
/** |
49 |
* @brief Error codes used in AMiRo-OS.
|
|
49 |
* @brief Error and status type generally used in AMiRo-OS.
|
|
50 | 50 |
*/ |
51 |
typedef enum { |
|
52 |
AOS_OK = 0, /**< No error, success. */ |
|
53 |
AOS_SUCCESS = 0, /**< No error, success */ |
|
54 |
AOS_WARNING = 1, /**< No error, but a warning occurred */ |
|
55 |
AOS_INVALID_ARGUMENTS = 2, /**< No error, but given arguments are invalid */ |
|
56 |
AOS_ERROR = 0x80, /**< An error occurred */ |
|
57 |
AOS_FAILURE = 0x80, /**< An error occurred */ |
|
58 |
} aos_status_t; |
|
51 |
typedef uint8_t aos_status_t; |
|
59 | 52 |
|
53 |
/** |
|
54 |
* @brief Success: no error or warning occurred. |
|
55 |
*/ |
|
56 |
#define AOS_OK ((aos_status_t)0x00u) |
|
57 |
|
|
58 |
/** |
|
59 |
* @brief Success: no error or warning occurred. |
|
60 |
*/ |
|
61 |
#define AOS_SUCCESS ((aos_status_t)0x00u) |
|
62 |
|
|
63 |
/** |
|
64 |
* @brief Some unspecified waring occurred. |
|
65 |
*/ |
|
66 |
#define AOS_WARNING ((aos_status_t)0x01u) |
|
67 |
|
|
68 |
/** |
|
69 |
* @brief Invalid arguments detected. |
|
70 |
*/ |
|
71 |
#define AOS_INVALIDARGUMENTS ((aos_status_t)0x02u) |
|
72 |
|
|
73 |
/** |
|
74 |
* @brief An error occurred. |
|
75 |
*/ |
|
76 |
#define AOS_ERROR ((aos_status_t)0x80u) |
|
77 |
|
|
78 |
/** |
|
79 |
* @brief An error occurred. |
|
80 |
*/ |
|
81 |
#define AOS_FAILURE ((aos_status_t)0x80u) |
|
60 | 82 |
|
61 | 83 |
/******************************************************************************/ |
62 | 84 |
/* MACROS */ |
core/src/aos_system.c | ||
---|---|---|
357 | 357 |
* |
358 | 358 |
* @return An exit status. |
359 | 359 |
* @retval AOS_OK The command was executed successfuly. |
360 |
* @retval AOS_INVALID_ARGUMENTS There was an issue with the arguemnts.
|
|
360 |
* @retval AOS_INVALIDARGUMENTS There was an issue with the arguemnts.
|
|
361 | 361 |
*/ |
362 | 362 |
static int _shellcmd_configcb(BaseSequentialStream* stream, int argc, char* argv[]) |
363 | 363 |
{ |
364 | 364 |
aosDbgCheck(stream != NULL); |
365 | 365 |
|
366 | 366 |
// local variables |
367 |
int retval = AOS_INVALID_ARGUMENTS;
|
|
367 |
int retval = AOS_INVALIDARGUMENTS; |
|
368 | 368 |
|
369 | 369 |
// if there are additional arguments |
370 | 370 |
if (argc > 1) { |
... | ... | |
401 | 401 |
} |
402 | 402 |
else { |
403 | 403 |
chprintf(stream, "unknown option '%s'\n", argv[3]); |
404 |
return AOS_INVALID_ARGUMENTS;
|
|
404 |
return AOS_INVALIDARGUMENTS; |
|
405 | 405 |
} |
406 | 406 |
} |
407 | 407 |
} |
... | ... | |
470 | 470 |
} |
471 | 471 |
else { |
472 | 472 |
chprintf(stream, "unknown option '%s' or invalid value '%s'\n", argv[2], argv[3]); |
473 |
return AOS_INVALID_ARGUMENTS;
|
|
473 |
return AOS_INVALIDARGUMENTS; |
|
474 | 474 |
} |
475 | 475 |
dt.tm_wday = aosTimeDayOfWeekFromDate(dt.tm_mday, dt.tm_mon+1, dt.tm_year+1900) % 7; |
476 | 476 |
aosSysSetDateTime(&dt); |
... | ... | |
487 | 487 |
} |
488 | 488 |
|
489 | 489 |
// print help, if required |
490 |
if (retval == AOS_INVALID_ARGUMENTS) {
|
|
490 |
if (retval == AOS_INVALIDARGUMENTS) { |
|
491 | 491 |
chprintf(stream, "Usage: %s OPTION\n", argv[0]); |
492 | 492 |
chprintf(stream, "Options:\n"); |
493 | 493 |
chprintf(stream, " --help\n"); |
... | ... | |
578 | 578 |
* |
579 | 579 |
* @return An exit status. |
580 | 580 |
* @retval AOS_OK The command was executed successfully. |
581 |
* @retval AOS_INVALID_ARGUMENTS There was an issue with the arguments.
|
|
581 |
* @retval AOS_INVALIDARGUMENTS There was an issue with the arguments. |
|
582 | 582 |
*/ |
583 | 583 |
static int _shellcmd_shutdowncb(BaseSequentialStream* stream, int argc, char* argv[]) |
584 | 584 |
{ |
... | ... | |
603 | 603 |
chprintf(stream, " --restart, -r\n"); |
604 | 604 |
chprintf(stream, " Shutdown and restart system.\n"); |
605 | 605 |
|
606 |
return (argc != 2) ? AOS_INVALID_ARGUMENTS : AOS_OK;
|
|
606 |
return (argc != 2) ? AOS_INVALIDARGUMENTS : AOS_OK; |
|
607 | 607 |
} |
608 | 608 |
// handle argument |
609 | 609 |
else { |
... | ... | |
629 | 629 |
} |
630 | 630 |
else { |
631 | 631 |
chprintf(stream, "unknown argument %s\n", argv[1]); |
632 |
return AOS_INVALID_ARGUMENTS;
|
|
632 |
return AOS_INVALIDARGUMENTS; |
|
633 | 633 |
} |
634 | 634 |
} |
635 | 635 |
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
modules/DiWheelDrive_1-1/module.c | ||
---|---|---|
786 | 786 |
chprintf(stream, " Test left wheel proximity sensor.\n"); |
787 | 787 |
chprintf(stream, " --wheelright, -wr\n"); |
788 | 788 |
chprintf(stream, " Test right wheel proximity sensor.\n"); |
789 |
return AOS_INVALID_ARGUMENTS;
|
|
789 |
return AOS_INVALIDARGUMENTS; |
|
790 | 790 |
} |
791 | 791 |
static ut_vcnl4020data_t _utVcnl4020Data = { |
792 | 792 |
/* driver */ &moduleLldProximity, |
modules/DiWheelDrive_1-2/module.c | ||
---|---|---|
684 | 684 |
chprintf(stream, " Test left wheel proximity sensor.\n"); |
685 | 685 |
chprintf(stream, " --wheelright, -wr\n"); |
686 | 686 |
chprintf(stream, " Test right wheel proximity sensor.\n"); |
687 |
return AOS_INVALID_ARGUMENTS;
|
|
687 |
return AOS_INVALIDARGUMENTS; |
|
688 | 688 |
} |
689 | 689 |
static ut_vcnl4020data_t _utVcnl4020Data = { |
690 | 690 |
/* driver */ &moduleLldProximity, |
modules/LightRing_1-2/module.c | ||
---|---|---|
624 | 624 |
chprintf(stream, " Test power switch for 5.0V supply.\n"); |
625 | 625 |
chprintf(stream, " VSYS\n"); |
626 | 626 |
chprintf(stream, " Test power switch for VSYS supply.\n"); |
627 |
return AOS_INVALID_ARGUMENTS;
|
|
627 |
return AOS_INVALIDARGUMENTS; |
|
628 | 628 |
} |
629 | 629 |
aos_unittest_t moduleUtAlldMic9404x = { |
630 | 630 |
/* info */ "MIC9404x", |
modules/PowerManagement_1-1/module.c | ||
---|---|---|
800 | 800 |
chprintf(stream, " Test the front battery charger.\n"); |
801 | 801 |
chprintf(stream, " --rear, -r\n"); |
802 | 802 |
chprintf(stream, " Test the rear battery charger.\n"); |
803 |
return AOS_INVALID_ARGUMENTS;
|
|
803 |
return AOS_INVALIDARGUMENTS; |
|
804 | 804 |
} else { |
805 | 805 |
return AOS_OK; |
806 | 806 |
} |
... | ... | |
844 | 844 |
chprintf(stream, " Test the front battery fuel gauge.\n"); |
845 | 845 |
chprintf(stream, " --rear, -r\n"); |
846 | 846 |
chprintf(stream, " Test the rear battery fuel gauge.\n"); |
847 |
return AOS_INVALID_ARGUMENTS;
|
|
847 |
return AOS_INVALIDARGUMENTS; |
|
848 | 848 |
} |
849 | 849 |
static ut_bq27500data_t _utAlldBq27500Data = { |
850 | 850 |
/* driver */ NULL, |
... | ... | |
893 | 893 |
chprintf(stream, " Test the front battery fuel gauge and charger.\n"); |
894 | 894 |
chprintf(stream, " --rear, -r\n"); |
895 | 895 |
chprintf(stream, " Test the rear battery fuel gauge and charger.\n"); |
896 |
return AOS_INVALID_ARGUMENTS;
|
|
896 |
return AOS_INVALIDARGUMENTS; |
|
897 | 897 |
} |
898 | 898 |
static ut_bq27500bq241xxdata_t _utAlldBq27500Bq24103aData= { |
899 | 899 |
/* bq27500 driver */ NULL, |
... | ... | |
973 | 973 |
chprintf(stream, " Test VSYS 4.2V power monitor.\n"); |
974 | 974 |
chprintf(stream, " VIO5.0\n"); |
975 | 975 |
chprintf(stream, " Test VIO 5.0V power monitor.\n"); |
976 |
return AOS_INVALID_ARGUMENTS;
|
|
976 |
return AOS_INVALIDARGUMENTS; |
|
977 | 977 |
} |
978 | 978 |
static ut_ina219data_t _utAlldIna219Data = { |
979 | 979 |
/* driver */ NULL, |
... | ... | |
1149 | 1149 |
chprintf(stream, " Test the multiplexer on the I2C bus #1.\n"); |
1150 | 1150 |
chprintf(stream, " #2\n"); |
1151 | 1151 |
chprintf(stream, " Test the multiplexer on the I2C bus #2.\n"); |
1152 |
return AOS_INVALID_ARGUMENTS;
|
|
1152 |
return AOS_INVALIDARGUMENTS; |
|
1153 | 1153 |
} |
1154 | 1154 |
static ut_pca9544adata_t _utAlldPca9544aData = { |
1155 | 1155 |
/* driver */ NULL, |
... | ... | |
1295 | 1295 |
chprintf(stream, " Test west-northwest sensor.\n"); |
1296 | 1296 |
chprintf(stream, " -nnw\n"); |
1297 | 1297 |
chprintf(stream, " Test north-northwest sensor.\n"); |
1298 |
return AOS_INVALID_ARGUMENTS;
|
|
1298 |
return AOS_INVALIDARGUMENTS; |
|
1299 | 1299 |
} |
1300 | 1300 |
static ut_vcnl4020data_t _utAlldVcnl4020Data = { |
1301 | 1301 |
/* driver */ NULL, |
... | ... | |
1346 | 1346 |
chprintf(stream, " Test the GPIO extender on the I2C bus #1.\n"); |
1347 | 1347 |
chprintf(stream, " #2\n"); |
1348 | 1348 |
chprintf(stream, " Test the GPIO extender on the I2C bus #2.\n"); |
1349 |
return AOS_INVALID_ARGUMENTS;
|
|
1349 |
return AOS_INVALIDARGUMENTS; |
|
1350 | 1350 |
} |
1351 | 1351 |
static ut_pcal6524data_t _utAlldPcal6524Data = { |
1352 | 1352 |
/* driver */ NULL, |
... | ... | |
1423 | 1423 |
chprintf(stream, " Test the GPIO extender on the I2C bus #1.\n"); |
1424 | 1424 |
chprintf(stream, " #2\n"); |
1425 | 1425 |
chprintf(stream, " Test the GPIO extender on the I2C bus #2.\n"); |
1426 |
return AOS_INVALID_ARGUMENTS;
|
|
1426 |
return AOS_INVALIDARGUMENTS; |
|
1427 | 1427 |
} |
1428 | 1428 |
static ut_pcal6524data_t _utAlldPcal6524Data = { |
1429 | 1429 |
/* driver */ NULL, |
modules/PowerManagement_1-2/module.c | ||
---|---|---|
816 | 816 |
chprintf(stream, " Test the front battery charger.\n"); |
817 | 817 |
chprintf(stream, " --rear, -r\n"); |
818 | 818 |
chprintf(stream, " Test the rear battery charger.\n"); |
819 |
return AOS_INVALID_ARGUMENTS;
|
|
819 |
return AOS_INVALIDARGUMENTS; |
|
820 | 820 |
} else { |
821 | 821 |
return AOS_OK; |
822 | 822 |
} |
... | ... | |
860 | 860 |
chprintf(stream, " Test the front battery fuel gauge.\n"); |
861 | 861 |
chprintf(stream, " --rear, -r\n"); |
862 | 862 |
chprintf(stream, " Test the rear battery fuel gauge.\n"); |
863 |
return AOS_INVALID_ARGUMENTS;
|
|
863 |
return AOS_INVALIDARGUMENTS; |
|
864 | 864 |
} |
865 | 865 |
static ut_bq27500data_t _utAlldBq27500Data = { |
866 | 866 |
/* driver */ NULL, |
... | ... | |
909 | 909 |
chprintf(stream, " Test the front battery fuel gauge and charger.\n"); |
910 | 910 |
chprintf(stream, " --rear, -r\n"); |
911 | 911 |
chprintf(stream, " Test the rear battery fuel gauge and charger.\n"); |
912 |
return AOS_INVALID_ARGUMENTS;
|
|
912 |
return AOS_INVALIDARGUMENTS; |
|
913 | 913 |
} |
914 | 914 |
static ut_bq27500bq241xxdata_t _utAlldBq27500Bq24103aData= { |
915 | 915 |
/* bq27500 driver */ NULL, |
... | ... | |
989 | 989 |
chprintf(stream, " Test VSYS 4.2V power monitor.\n"); |
990 | 990 |
chprintf(stream, " VIO5.0\n"); |
991 | 991 |
chprintf(stream, " Test VIO 5.0V power monitor.\n"); |
992 |
return AOS_INVALID_ARGUMENTS;
|
|
992 |
return AOS_INVALIDARGUMENTS; |
|
993 | 993 |
} |
994 | 994 |
static ut_ina219data_t _utAlldIna219Data = { |
995 | 995 |
/* driver */ NULL, |
... | ... | |
1165 | 1165 |
chprintf(stream, " Test the multiplexer on the I2C bus #1.\n"); |
1166 | 1166 |
chprintf(stream, " #2\n"); |
1167 | 1167 |
chprintf(stream, " Test the multiplexer on the I2C bus #2.\n"); |
1168 |
return AOS_INVALID_ARGUMENTS;
|
|
1168 |
return AOS_INVALIDARGUMENTS; |
|
1169 | 1169 |
} |
1170 | 1170 |
static ut_pca9544adata_t _utAlldPca9544aData = { |
1171 | 1171 |
/* driver */ NULL, |
... | ... | |
1311 | 1311 |
chprintf(stream, " Test west-northwest sensor.\n"); |
1312 | 1312 |
chprintf(stream, " -nnw\n"); |
1313 | 1313 |
chprintf(stream, " Test north-northwest sensor.\n"); |
1314 |
return AOS_INVALID_ARGUMENTS;
|
|
1314 |
return AOS_INVALIDARGUMENTS; |
|
1315 | 1315 |
} |
1316 | 1316 |
static ut_vcnl4020data_t _utAlldVcnl4020Data = { |
1317 | 1317 |
/* driver */ NULL, |
... | ... | |
1362 | 1362 |
chprintf(stream, " Test the GPIO extender on the I2C bus #1.\n"); |
1363 | 1363 |
chprintf(stream, " #2\n"); |
1364 | 1364 |
chprintf(stream, " Test the GPIO extender on the I2C bus #2.\n"); |
1365 |
return AOS_INVALID_ARGUMENTS;
|
|
1365 |
return AOS_INVALIDARGUMENTS; |
|
1366 | 1366 |
} |
1367 | 1367 |
static ut_pcal6524data_t _utAlldPcal6524Data = { |
1368 | 1368 |
/* driver */ NULL, |
... | ... | |
1439 | 1439 |
chprintf(stream, " Test the GPIO extender on the I2C bus #1.\n"); |
1440 | 1440 |
chprintf(stream, " #2\n"); |
1441 | 1441 |
chprintf(stream, " Test the GPIO extender on the I2C bus #2.\n"); |
1442 |
return AOS_INVALID_ARGUMENTS;
|
|
1442 |
return AOS_INVALIDARGUMENTS; |
|
1443 | 1443 |
} |
1444 | 1444 |
static ut_pcal6524data_t _utAlldPcal6524Data = { |
1445 | 1445 |
/* driver */ NULL, |
Also available in: Unified diff