1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 5 #ifndef AMP_SYSTEM_H 6 #define AMP_SYSTEM_H 7 8 #if defined(__cplusplus) 9 extern "C" { 10 #endif 11 12 #include "stdarg.h" 13 #include "ulog/ulog.h" 14 #include "aos/kernel.h" 15 16 /* log system operation wrapper */ 17 #define amp_debug(mod, fmt, ...) LOGD(mod, fmt, ##__VA_ARGS__) 18 #define amp_info(mod, fmt, ...) LOGI(mod, fmt, ##__VA_ARGS__) 19 #define amp_warn(mod, fmt, ...) LOGW(mod, fmt, ##__VA_ARGS__) 20 #define amp_error(mod, fmt, ...) LOGE(mod, fmt, ##__VA_ARGS__) 21 #define amp_fatal(mod, fmt, ...) LOGF(mod, fmt, ##__VA_ARGS__) 22 23 typedef struct amp_heap_info { 24 unsigned long heap_total; /* total heap memory */ 25 unsigned long heap_used; /* used heap memory */ 26 unsigned long heap_free; /* free heap memory */ 27 } amp_heap_info_t; 28 29 typedef struct _amp_wireless_info_t { 30 int rssi; /* Received Signal Strength Indication */ 31 int snr; /* Signal to Noise Ratio */ 32 int per; /* Packet Error Rate (Unit: PPM, Part Per Million) */ 33 } aos_wireless_info_t; 34 35 void aos_printf(const char *fmt, ...); 36 37 /** 38 * @brief get RTOS default priority 39 * 40 * @return default priority 41 */ 42 int aos_snprintf(char *str, const int len, const char *fmt, ...); 43 44 /** 45 * @brief get RTOS default priority 46 * 47 * @return default priority 48 */ 49 int aos_vsnprintf(char *str, const int len, const char *format, va_list ap); 50 51 /** 52 * Get system version. 53 * 54 * @return sysinfo_version. 55 */ 56 const char *aos_get_system_version(void); 57 58 /** 59 * Get system platform type. 60 * 61 * @return platform_type. 62 */ 63 const char *aos_get_platform_type(void); 64 65 /** 66 * Get device name. 67 * 68 * @return device_name. 69 */ 70 const char *aos_get_device_name(void); 71 72 /** 73 * @brief get RTOS default priority 74 * 75 * @return default priority 76 */ 77 int aos_system_sleep(void); 78 79 /** 80 * @brief get RTOS default priority 81 * 82 * @return default priority 83 */ 84 int aos_get_wireless_info(struct _amp_wireless_info_t *info); 85 86 /** 87 * @brief get RTOS default priority 88 * 89 * @return default priority 90 */ 91 int aos_get_network_status(void); 92 93 /** 94 * @brief get RTOS default priority 95 * 96 * @return default priority 97 */ 98 int aos_get_ip(char *ip); 99 100 /** 101 * @brief get RTOS default priority 102 * 103 * @return default priority 104 */ 105 int aos_get_mac_addr(unsigned char mac[6]); 106 107 /** 108 * @brief get RTOS default priority 109 * 110 * @return default priority 111 */ 112 int amp_heap_memory_info(amp_heap_info_t *heap_info); 113 114 /** 115 * Initialize system 116 */ 117 int aos_system_init(void); 118 119 /** 120 * @brief get RTOS default priority 121 * 122 * @return default priority 123 */ 124 const char *aos_get_module_hardware_version(void); 125 126 /** 127 * @brief get RTOS default priority 128 * 129 * @return default priority 130 */ 131 const char *aos_get_module_software_version(void); 132 133 #if defined(__cplusplus) 134 } 135 #endif 136 137 #endif /* AMP_SYSTEM_H */ 138