diff --git a/driver/sdr.c b/driver/sdr.c index 8722a01..3c60522 100644 --- a/driver/sdr.c +++ b/driver/sdr.c @@ -1330,6 +1330,7 @@ static void openwifi_tx(struct ieee80211_hw *dev, status = dma_async_is_tx_complete(priv->tx_chan, priv->tx_cookie, NULL, NULL); delay_count++; udelay(4); + // udelay(priv->stat.dbg_ch1); } if (status!=DMA_COMPLETE) { printk("%s openwifi_tx: WARNING status!=DMA_COMPLETE\n", sdr_compatible_str); @@ -2550,6 +2551,9 @@ static int openwifi_dev_probe(struct platform_device *pdev) priv->stat.csma_cfg0 = 0; priv->stat.cw_max_min_cfg = 0; + priv->stat.dbg_ch0 = 0; + priv->stat.dbg_ch1 = 0; + priv->stat.dbg_ch2 = 0; // // //--------------------hook leds (not complete yet)-------------------------------- // tmp_dev = bus_find_device( &platform_bus_type, NULL, "leds", custom_match_platform_dev ); //leds is the name in devicetree, not "compatible" field diff --git a/driver/sdr.h b/driver/sdr.h index bd70964..60211b5 100644 --- a/driver/sdr.h +++ b/driver/sdr.h @@ -438,6 +438,9 @@ struct openwifi_stat { u32 csma_cfg0; u32 cw_max_min_cfg; + u32 dbg_ch0; + u32 dbg_ch1; + u32 dbg_ch2; }; #define RX_DMA_CYCLIC_MODE diff --git a/driver/sysfs_intf.c b/driver/sysfs_intf.c index 06bb2da..fe4dab0 100644 --- a/driver/sysfs_intf.c +++ b/driver/sysfs_intf.c @@ -1081,6 +1081,76 @@ static ssize_t cw_max_min_cfg_store(struct device *input_dev, struct device_attr return ret ? ret : len; } +static ssize_t dbg_ch0_show(struct device *input_dev, struct device_attribute *attr, char *buf) +{ + struct platform_device *pdev = to_platform_device(input_dev); + struct ieee80211_hw *dev = platform_get_drvdata(pdev); + struct openwifi_priv *priv = dev->priv; + + return sprintf(buf, "%u\n", priv->stat.dbg_ch0); +} +static ssize_t dbg_ch0_store(struct device *input_dev, struct device_attribute *attr, const char *buf, size_t len) +{ + struct platform_device *pdev = to_platform_device(input_dev); + struct ieee80211_hw *dev = platform_get_drvdata(pdev); + struct openwifi_priv *priv = dev->priv; + + long readin; + u32 ret = kstrtol(buf, 10, &readin); + + priv->stat.dbg_ch0 = readin; + + // xpu_api->XPU_REG_DIFS_ADVANCE_write((readin<<16)|2); //us. bit31~16 max pkt length threshold + // rx_intf_api->RX_INTF_REG_START_TRANS_TO_PS_write(readin<<16); //bit31~16 max pkt length threshold + // openofdm_rx_api->OPENOFDM_RX_REG_SOFT_DECODING_write((readin<<16)|1); //bit1 enable soft decoding; bit31~16 max pkt length threshold + + return ret ? ret : len; +} + +static ssize_t dbg_ch1_show(struct device *input_dev, struct device_attribute *attr, char *buf) +{ + struct platform_device *pdev = to_platform_device(input_dev); + struct ieee80211_hw *dev = platform_get_drvdata(pdev); + struct openwifi_priv *priv = dev->priv; + + return sprintf(buf, "%u\n", priv->stat.dbg_ch1); +} +static ssize_t dbg_ch1_store(struct device *input_dev, struct device_attribute *attr, const char *buf, size_t len) +{ + struct platform_device *pdev = to_platform_device(input_dev); + struct ieee80211_hw *dev = platform_get_drvdata(pdev); + struct openwifi_priv *priv = dev->priv; + + long readin; + u32 ret = kstrtol(buf, 10, &readin); + + priv->stat.dbg_ch1 = readin; + + return ret ? ret : len; +} + +static ssize_t dbg_ch2_show(struct device *input_dev, struct device_attribute *attr, char *buf) +{ + struct platform_device *pdev = to_platform_device(input_dev); + struct ieee80211_hw *dev = platform_get_drvdata(pdev); + struct openwifi_priv *priv = dev->priv; + + return sprintf(buf, "%u\n", priv->stat.dbg_ch2); +} +static ssize_t dbg_ch2_store(struct device *input_dev, struct device_attribute *attr, const char *buf, size_t len) +{ + struct platform_device *pdev = to_platform_device(input_dev); + struct ieee80211_hw *dev = platform_get_drvdata(pdev); + struct openwifi_priv *priv = dev->priv; + + long readin; + u32 ret = kstrtol(buf, 10, &readin); + + priv->stat.dbg_ch2 = readin; + + return ret ? ret : len; +} + static DEVICE_ATTR(stat_enable, S_IRUGO | S_IWUSR, stat_enable_show, stat_enable_store); static DEVICE_ATTR(tx_prio_queue, S_IRUGO | S_IWUSR, tx_prio_queue_show, tx_prio_queue_store); static DEVICE_ATTR(tx_data_pkt_need_ack_num_total, S_IRUGO | S_IWUSR, tx_data_pkt_need_ack_num_total_show, tx_data_pkt_need_ack_num_total_store); @@ -1125,6 +1195,10 @@ static DEVICE_ATTR(restrict_freq_mhz, S_IRUGO | S_IWUSR, restrict_freq_mhz_show, static DEVICE_ATTR(csma_cfg0, S_IRUGO | S_IWUSR, csma_cfg0_show, csma_cfg0_store); static DEVICE_ATTR(cw_max_min_cfg, S_IRUGO | S_IWUSR, cw_max_min_cfg_show, cw_max_min_cfg_store); +static DEVICE_ATTR(dbg_ch0, S_IRUGO | S_IWUSR, dbg_ch0_show, dbg_ch0_store); +static DEVICE_ATTR(dbg_ch1, S_IRUGO | S_IWUSR, dbg_ch1_show, dbg_ch1_store); +static DEVICE_ATTR(dbg_ch2, S_IRUGO | S_IWUSR, dbg_ch2_show, dbg_ch2_store); + static struct attribute *stat_attributes[] = { &dev_attr_stat_enable.attr, @@ -1174,6 +1248,10 @@ static struct attribute *stat_attributes[] = { &dev_attr_csma_cfg0.attr, &dev_attr_cw_max_min_cfg.attr, + &dev_attr_dbg_ch0.attr, + &dev_attr_dbg_ch1.attr, + &dev_attr_dbg_ch2.attr, + NULL, }; static const struct attribute_group stat_attribute_group = { diff --git a/user_space/set_dbg_ch0.sh b/user_space/set_dbg_ch0.sh new file mode 100755 index 0000000..28d3fb2 --- /dev/null +++ b/user_space/set_dbg_ch0.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +home_dir=$(pwd) + +if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then + cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr +else + cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr +fi + +# set +if [[ -n $1 ]]; then + echo $1 > dbg_ch0 +fi + +# show +cat dbg_ch0 + +cd $home_dir + diff --git a/user_space/set_dbg_ch1.sh b/user_space/set_dbg_ch1.sh new file mode 100755 index 0000000..d17b7e5 --- /dev/null +++ b/user_space/set_dbg_ch1.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +home_dir=$(pwd) + +if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then + cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr +else + cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr +fi + +# set +if [[ -n $1 ]]; then + echo $1 > dbg_ch1 +fi + +# show +cat dbg_ch1 + +cd $home_dir + diff --git a/user_space/set_dbg_ch2.sh b/user_space/set_dbg_ch2.sh new file mode 100755 index 0000000..bc3af76 --- /dev/null +++ b/user_space/set_dbg_ch2.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +home_dir=$(pwd) + +if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then + cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr +else + cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr +fi + +# set +if [[ -n $1 ]]; then + echo $1 > dbg_ch2 +fi + +# show +cat dbg_ch2 + +cd $home_dir +