# arch/avr32/include/arch/bitops.h File Reference

AVR32-specific implementation of bit operations. More...

`#include <compiler.h>`

Include dependency graph for bitops.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions
static void | atomic_set_bit (unsigned int nr, unsigned long *bitmap)
| Atomically set bit nr in bitmap.
static void | atomic_clear_bit (unsigned int nr, unsigned long *bitmap)
| Atomically clear bit nr in bitmap.
static void | atomic_toggle_bit (unsigned int nr, unsigned long *bitmap)
| Atomically toggle bit nr in bitmap.
static bool | atomic_test_and_set_bit (unsigned int nr, unsigned long *bitmap)
| Atomically set bit nr in bitmap and return its previous state.
static bool | atomic_test_and_clear_bit (unsigned int nr, unsigned long *bitmap)
| Atomically clear bit nr in bitmap and return its previous state.
static unsigned long | __ffs (unsigned long word)
| Find First bit Set in word.
static unsigned long | ffz (unsigned long word)
| Find First Zero bit in word.
static int | __fls (unsigned long word)
| Find Last bit Set in word.
static int | fls (unsigned long word)
| Find Last bit Set in word (counting from 1).
static int | ffs (unsigned long word)
| Find First bit Set in word (standard semantics).

## Detailed Description

AVR32-specific implementation of bit operations.

- Compiler: IAR EWAVR32 and GNU GCC v4.2+ for AVR32
- Supported devices: All AVR32 devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file bitops.h.

## Function Documentation

static unsigned long __ffs | ( | unsigned long | word | ) | `[inline, static]`

Find First bit Set in word.

Note:
  If word is 0, the result is undefined.

Returns:
  The lowest number x such that (word & (1UL << x)) is nonzero.

Definition at line 106 of file bitops.h.

References bit_reverse(), and count_leading_zeroes.

Referenced by ffs(), ffz(), and softirq_priv_do_pending().

Here is the call graph for this function:

static int __fls | ( | unsigned long | word | ) | `[inline, static]`

Find Last bit Set in word.

Note:
  If word is zero, the result is undefined.

Returns:
  The highest number x such that (word & (1UL << x)) is nonzero.

Definition at line 132 of file bitops.h.

References count_leading_zeroes.

Referenced by fls().

static void atomic_clear_bit | ( | unsigned int | nr,
|  | unsigned long * | bitmap |
| ) |  |  | `[inline, static]`

Atomically clear bit nr in bitmap.

Definition at line 57 of file bitops.h.

References bit_mask, and bit_word.

static void atomic_set_bit | ( | unsigned int | nr,
|  | unsigned long * | bitmap |
| ) |  |  | `[inline, static]`

Atomically set bit nr in bitmap.

Definition at line 49 of file bitops.h.

References bit_mask, and bit_word.

Referenced by softirq_raise().

static bool atomic_test_and_clear_bit | ( | unsigned int | nr,
|  | unsigned long * | bitmap |
| ) |  |  | `[inline, static]`

Atomically clear bit nr in bitmap and return its previous state.

Definition at line 88 of file bitops.h.

References bit_mask, bit_word, and BITS_PER_LONG.

static bool atomic_test_and_set_bit | ( | unsigned int | nr,
|  | unsigned long * | bitmap |
| ) |  |  | `[inline, static]`

Atomically set bit nr in bitmap and return its previous state.

Definition at line 74 of file bitops.h.

References bit_mask, bit_word, and BITS_PER_LONG.

static void atomic_toggle_bit | ( | unsigned int | nr,
|  | unsigned long * | bitmap |
| ) |  |  | `[inline, static]`

Atomically toggle bit nr in bitmap.

Definition at line 65 of file bitops.h.

References bit_mask, and bit_word.

static int ffs | ( | unsigned long | word | ) | `[inline, static]`

Find First bit Set in word (standard semantics).

This function differs from __ffs() in that the least significant bit is position 1, and it returns a well-defined result when word is 0.

Returns:
  The lowest number x such that (word & (1UL << (x - 1))) is nonzero, or 0 if word is zero.

Definition at line 165 of file bitops.h.

References __ffs().

Referenced by sdmmc_slot_set_voltage().

Here is the call graph for this function:

static unsigned long ffz | ( | unsigned long | word | ) | `[inline, static]`

Find First Zero bit in word.

Note:
  If word has all bits set, the result is undefined.

Returns:
  The lowest number x such that (word & (1UL << x)) is zero.

Definition at line 119 of file bitops.h.

References __ffs().

Here is the call graph for this function:

static int fls | ( | unsigned long | word | ) | `[inline, static]`

Find Last bit Set in word (counting from 1).

This function differs from __fls() in that the least significant bit is position 1, and it returns a well-defined result when word is 0.

Returns:
  The highest number x such that (word & (1UL << (x - 1))) is nonzero, or 0 if word is zero.

Definition at line 147 of file bitops.h.

References __fls().

Here is the call graph for this function: