hardware: add device ids for QCA9984, 88W8887 and 88W8964 radios
[project/iwinfo.git] / include / iwinfo / utils.h
index d58ec5f..159fd49 100644 (file)
 
 #include <sys/socket.h>
 #include <net/if.h>
+#include <uci.h>
 
 #include "iwinfo.h"
 
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
+
 #define LOG10_MAGIC    1.25892541179
 
+extern struct uci_context *uci_ctx;
+
 int iwinfo_ioctl(int cmd, void *ifr);
 
 int iwinfo_dbm2mw(int in);
 int iwinfo_mw2dbm(int in);
+static inline int iwinfo_mbm2dbm(int gain)
+{
+       return gain / 100;
+}
 
 int iwinfo_ifup(const char *ifname);
 int iwinfo_ifdown(const char *ifname);
@@ -44,4 +55,7 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id);
 void iwinfo_parse_rsn(struct iwinfo_crypto_entry *c, uint8_t *data, uint8_t len,
                                          uint8_t defcipher, uint8_t defauth);
 
+struct uci_section *iwinfo_uci_get_radio(const char *name, const char *type);
+void iwinfo_uci_free(void);
+
 #endif