drivers/net/wireless/ath/ath5k/pcu.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath5k/pcu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath5k/pcu.c- Extension
.c- Size
- 28671 bytes
- Lines
- 1012
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hath5k.hreg.hdebug.h
Detected Declarations
function ath5k_hw_get_frame_durationfunction ath5k_hw_get_default_slottimefunction ath5k_hw_get_default_sifsfunction ath5k_hw_update_mib_countersfunction ath5k_hw_write_rate_durationfunction ath5k_hw_set_ack_timeoutfunction ath5k_hw_set_cts_timeoutfunction ath5k_hw_set_lladdrfunction ath5k_hw_set_bssidfunction ath5k_hw_set_bssid_maskfunction ath5k_hw_set_mcast_filterfunction ath5k_hw_get_rx_filterfunction ath5k_hw_set_rx_filterfunction ath5k_hw_get_tsf64function ath5k_hw_set_tsf64function ath5k_hw_reset_tsffunction ath5k_hw_init_beacon_timersfunction ath5k_check_timer_winfunction ath5k_hw_check_beacon_timersfunction ath5k_hw_set_coverage_classfunction ath5k_hw_start_rx_pcufunction ath5k_hw_stop_rx_pcufunction ath5k_hw_set_opmodefunction ath5k_hw_pcu_init
Annotated Snippet
if (ah->ah_version == AR5K_AR5210) {
timer1 = 0xffffffff;
timer2 = 0xffffffff;
} else {
timer1 = 0x0000ffff;
timer2 = 0x0007ffff;
}
/* Mark associated AP as PCF incapable for now */
AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, AR5K_STA_ID1_PCF);
break;
case NL80211_IFTYPE_ADHOC:
AR5K_REG_ENABLE_BITS(ah, AR5K_TXCFG, AR5K_TXCFG_ADHOC_BCN_ATIM);
fallthrough;
default:
/* On non-STA modes timer1 is used as next DMA
* beacon alert (DBA) timer and timer2 as next
* software beacon alert. Both in 1/8TUs. */
timer1 = (next_beacon - AR5K_TUNE_DMA_BEACON_RESP) << 3;
timer2 = (next_beacon - AR5K_TUNE_SW_BEACON_RESP) << 3;
break;
}
/* Timer3 marks the end of our ATIM window
* a zero length window is not allowed because
* we 'll get no beacons */
timer3 = next_beacon + 1;
/*
* Set the beacon register and enable all timers.
*/
/* When in AP or Mesh Point mode zero timer0 to start TSF */
if (ah->opmode == NL80211_IFTYPE_AP ||
ah->opmode == NL80211_IFTYPE_MESH_POINT)
ath5k_hw_reg_write(ah, 0, AR5K_TIMER0);
ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0);
ath5k_hw_reg_write(ah, timer1, AR5K_TIMER1);
ath5k_hw_reg_write(ah, timer2, AR5K_TIMER2);
ath5k_hw_reg_write(ah, timer3, AR5K_TIMER3);
/* Force a TSF reset if requested and enable beacons */
if (interval & AR5K_BEACON_RESET_TSF)
ath5k_hw_reset_tsf(ah);
ath5k_hw_reg_write(ah, interval & (AR5K_BEACON_PERIOD |
AR5K_BEACON_ENABLE),
AR5K_BEACON);
/* Flush any pending BMISS interrupts on ISR by
* performing a clear-on-write operation on PISR
* register for the BMISS bit (writing a bit on
* ISR toggles a reset for that bit and leaves
* the remaining bits intact) */
if (ah->ah_version == AR5K_AR5210)
ath5k_hw_reg_write(ah, AR5K_ISR_BMISS, AR5K_ISR);
else
ath5k_hw_reg_write(ah, AR5K_ISR_BMISS, AR5K_PISR);
/* TODO: Set enhanced sleep registers on AR5212
* based on vif->bss_conf params, until then
* disable power save reporting.*/
AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, AR5K_STA_ID1_PWR_SV);
}
/**
* ath5k_check_timer_win() - Check if timer B is timer A + window
* @a: timer a (before b)
* @b: timer b (after a)
* @window: difference between a and b
* @intval: timers are increased by this interval
*
* This helper function checks if timer B is timer A + window and covers
* cases where timer A or B might have already been updated or wrapped
* around (Timers are 16 bit).
*
* Returns true if O.K.
*/
static inline bool
ath5k_check_timer_win(int a, int b, int window, int intval)
{
/*
* 1.) usually B should be A + window
* 2.) A already updated, B not updated yet
* 3.) A already updated and has wrapped around
* 4.) B has wrapped around
*/
if ((b - a == window) || /* 1.) */
(a - b == intval - window) || /* 2.) */
((a | 0x10000) - b == intval - window) || /* 3.) */
Annotation
- Immediate include surface: `linux/unaligned.h`, `ath5k.h`, `reg.h`, `debug.h`.
- Detected declarations: `function ath5k_hw_get_frame_duration`, `function ath5k_hw_get_default_slottime`, `function ath5k_hw_get_default_sifs`, `function ath5k_hw_update_mib_counters`, `function ath5k_hw_write_rate_duration`, `function ath5k_hw_set_ack_timeout`, `function ath5k_hw_set_cts_timeout`, `function ath5k_hw_set_lladdr`, `function ath5k_hw_set_bssid`, `function ath5k_hw_set_bssid_mask`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.