iPXE
Functions
ath5k_gpio.c File Reference
#include "ath5k.h"
#include "reg.h"
#include "base.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (MIT)
int ath5k_hw_set_gpio_input (struct ath5k_hw *ah, u32 gpio)
int ath5k_hw_set_gpio_output (struct ath5k_hw *ah, u32 gpio)
u32 ath5k_hw_get_gpio (struct ath5k_hw *ah, u32 gpio)
int ath5k_hw_set_gpio (struct ath5k_hw *ah, u32 gpio, u32 val)
void ath5k_hw_set_gpio_intr (struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level)

Function Documentation

FILE_LICENCE ( MIT  )
int ath5k_hw_set_gpio_input ( struct ath5k_hw ah,
u32  gpio 
)
int ath5k_hw_set_gpio_output ( struct ath5k_hw ah,
u32  gpio 
)
u32 ath5k_hw_get_gpio ( struct ath5k_hw ah,
u32  gpio 
)

Definition at line 64 of file ath5k_gpio.c.

References AR5K_GPIODI, AR5K_GPIODI_M, AR5K_NUM_GPIO, and ath5k_hw_reg_read().

Referenced by ath5k_hw_reset(), ath5k_is_rfkill_set(), and ath5k_rfkill_set_intr().

{
        if (gpio >= AR5K_NUM_GPIO)
                return 0xffffffff;

        /* GPIO input magic */
        return ((ath5k_hw_reg_read(ah, AR5K_GPIODI) & AR5K_GPIODI_M) >> gpio) &
                0x1;
}
int ath5k_hw_set_gpio ( struct ath5k_hw ah,
u32  gpio,
u32  val 
)

Definition at line 77 of file ath5k_gpio.c.

References AR5K_GPIODO, AR5K_NUM_GPIO, ath5k_hw_reg_read(), ath5k_hw_reg_write(), data, EINVAL, and gpio.

Referenced by ath5k_rfkill_disable(), and ath5k_rfkill_enable().

{
        u32 data;

        if (gpio >= AR5K_NUM_GPIO)
                return -EINVAL;

        /* GPIO output magic */
        data = ath5k_hw_reg_read(ah, AR5K_GPIODO);

        data &= ~(1 << gpio);
        data |= (val & 1) << gpio;

        ath5k_hw_reg_write(ah, data, AR5K_GPIODO);

        return 0;
}
void ath5k_hw_set_gpio_intr ( struct ath5k_hw ah,
unsigned int  gpio,
u32  interrupt_level 
)