/* SPDX-License-Identifier: GPL-2.0-or-later */ /* Copyright (C) 2004 - 2009 Ivo van Doorn <[email protected]> <http://rt2x00.serialmonkey.com> */ /* Module: rt2x00 Abstract: rt2x00 generic register information. */ #ifndef RT2X00REG_H #define RT2X00REG_H /* * RX crypto status */ enum rx_crypto { … }; /* * Antenna values */ enum antenna { … }; /* * Led mode values. */ enum led_mode { … }; /* * TSF sync values */ enum tsf_sync { … }; /* * Device states */ enum dev_state { … }; /* * IFS backoff values */ enum ifs { … }; /* * IFS backoff values for HT devices */ enum txop { … }; /* * Cipher types for hardware encryption */ enum cipher { … }; /* * Rate modulations */ enum rate_modulation { … }; /* * Firmware validation error codes */ enum firmware_errors { … }; /* * Register handlers. * We store the position of a register field inside a field structure, * This will simplify the process of setting and reading a certain field * inside the register while making sure the process remains byte order safe. */ struct rt2x00_field8 { … }; struct rt2x00_field16 { … }; struct rt2x00_field32 { … }; /* * Power of two check, this will check * if the mask that has been given contains and contiguous set of bits. * Note that we cannot use the is_power_of_2() function since this * check must be done at compile-time. */ #define is_power_of_two(x) … #define low_bit_mask(x) … #define is_valid_mask(x) … /* * Macros to find first set bit in a variable. * These macros behave the same as the __ffs() functions but * the most important difference that this is done during * compile-time rather then run-time. */ #define compile_ffs2(__x) … #define compile_ffs4(__x) … #define compile_ffs8(__x) … #define compile_ffs16(__x) … #define compile_ffs32(__x) … /* * This macro will check the requirements for the FIELD{8,16,32} macros * The mask should be a constant non-zero contiguous set of bits which * does not exceed the given typelimit. */ #define FIELD_CHECK(__mask, __type) … \ #define FIELD8(__mask) … #define FIELD16(__mask) … #define FIELD32(__mask) … #define SET_FIELD(__reg, __type, __field, __value) … #define GET_FIELD(__reg, __type, __field) … #define rt2x00_set_field32(__reg, __field, __value) … #define rt2x00_get_field32(__reg, __field) … #define rt2x00_set_field16(__reg, __field, __value) … #define rt2x00_get_field16(__reg, __field) … #define rt2x00_set_field8(__reg, __field, __value) … #define rt2x00_get_field8(__reg, __field) … #endif /* RT2X00REG_H */