From 020cb2200b13ac33dfeafc0f9992e8b0a5379344 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sat, 14 May 2016 20:09:37 +0000 Subject: [PATCH] [bwn] add Q52 macros. The PHY-N code uses a different format for gain values, so these macros are used for converting to/from and print out values. --- sys/dev/bwn/if_bwn_util.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/dev/bwn/if_bwn_util.h b/sys/dev/bwn/if_bwn_util.h index 07d23fe5c7d..b1da256b346 100644 --- a/sys/dev/bwn/if_bwn_util.h +++ b/sys/dev/bwn/if_bwn_util.h @@ -55,6 +55,12 @@ bwn_clamp_val(int val, int lo, int hi) return val; } +/* Q52 format - used in PHY routines */ +#define INT_TO_Q52(i) ((i) << 2) +#define Q52_TO_INT(q52) ((q52) >> 2) +#define Q52_FMT "%u.%u" +#define Q52_ARG(q52) Q52_TO_INT(q52), ((((q52) & 0x3) * 100) / 4) + extern unsigned int bwn_sqrt(struct bwn_mac *mac, unsigned int x); #endif /* __IF_BWN_UTIL_H__ */ -- 2.45.2