// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * * Purpose: Provide functions to setup NIC operation mode * Functions: * vnt_set_rspinf - Set RSPINF * vnt_update_ifs - Update slotTime,SIFS,DIFS, and EIFS * vnt_update_top_rates - Update BasicTopRate * vnt_add_basic_rate - Add to BasicRateSet * vnt_ofdm_min_rate - Check if any OFDM rate is in BasicRateSet * vnt_get_tsf_offset - Calculate TSFOffset * vnt_get_next_tbtt - Calculate Next Beacon TSF counter * vnt_reset_next_tbtt - Set NIC Beacon time * vnt_update_next_tbtt - Sync. NIC Beacon time * vnt_radio_power_off - Turn Off NIC Radio Power * vnt_radio_power_on - Turn On NIC Radio Power * * Revision History: * 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec. * 08-26-2003 Kyle Hsu: Modify the definition type of dwIoBase. * 09-01-2003 Bryan YC Fan: Add vnt_update_ifs(). * */ #include <linux/bitops.h> #include <linux/errno.h> #include "device.h" #include "card.h" #include "baseband.h" #include "mac.h" #include "desc.h" #include "rf.h" #include "power.h" #include "key.h" #include "usbpipe.h" /* const u16 cw_rxbcntsf_off[MAX_RATE] = * {17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3}; */ static const u16 cw_rxbcntsf_off[MAX_RATE] = …; int vnt_set_channel(struct vnt_private *priv, u32 connection_channel) { … } static const u8 vnt_rspinf_b_short_table[] = …; static const u8 vnt_rspinf_b_long_table[] = …; static const u8 vnt_rspinf_a_table[] = …; static const u8 vnt_rspinf_gb_table[] = …; int vnt_set_rspinf(struct vnt_private *priv, u8 bb_type) { … } int vnt_update_ifs(struct vnt_private *priv) { … } void vnt_update_top_rates(struct vnt_private *priv) { … } bool vnt_ofdm_min_rate(struct vnt_private *priv) { … } u8 vnt_get_pkt_type(struct vnt_private *priv) { … } /* * Description: Calculate TSF offset of two TSF input * Get TSF Offset from RxBCN's TSF and local TSF * * Parameters: * In: * rx_rate - rx rate. * tsf1 - Rx BCN's TSF * tsf2 - Local TSF * Out: * none * * Return Value: TSF Offset value * */ u64 vnt_get_tsf_offset(u8 rx_rate, u64 tsf1, u64 tsf2) { … } int vnt_adjust_tsf(struct vnt_private *priv, u8 rx_rate, u64 time_stamp, u64 local_tsf) { … } /* * Description: Clear NIC TSF counter * Clear local TSF counter * * Parameters: * In: * priv - The adapter to be read * * Return Value: true if success; otherwise false * */ bool vnt_clear_current_tsf(struct vnt_private *priv) { … } /* * Description: Read NIC TSF counter * Get NEXTTBTT from adjusted TSF and Beacon Interval * * Parameters: * In: * tsf - Current TSF counter * beacon_interval - Beacon Interval * Out: * tsf - Current TSF counter * * Return Value: TSF value of next Beacon * */ u64 vnt_get_next_tbtt(u64 tsf, u16 beacon_interval) { … } int vnt_reset_next_tbtt(struct vnt_private *priv, u16 beacon_interval) { … } int vnt_update_next_tbtt(struct vnt_private *priv, u64 tsf, u16 beacon_interval) { … } /* * Description: Turn off Radio power * * Parameters: * In: * priv - The adapter to be turned off * Out: * none * * Return Value: true if success; otherwise false * */ int vnt_radio_power_off(struct vnt_private *priv) { … } /* * Description: Turn on Radio power * * Parameters: * In: * priv - The adapter to be turned on * Out: * none * * Return Value: true if success; otherwise false * */ int vnt_radio_power_on(struct vnt_private *priv) { … } int vnt_set_bss_mode(struct vnt_private *priv) { … }