当前位置: 首页>>代码示例>>C++>>正文


C++ WL_TRACE函数代码示例

本文整理汇总了C++中WL_TRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ WL_TRACE函数的具体用法?C++ WL_TRACE怎么用?C++ WL_TRACE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了WL_TRACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dhd_customer_gpio_wlan_ctrl

/* Customer function to control hw specific wlan gpios */
void
dhd_customer_gpio_wlan_ctrl(int onoff)
{
#if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL
    unsigned int mod_sel = mmc_pm_get_mod_type();
#endif

	switch (onoff) {
		case WLAN_RESET_OFF:
			WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n",
				__FUNCTION__));
/* winner's power control */
#if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL
            switch (mod_sel)
            {
                case 2: /* usi bm01a */
                    mmc_pm_gpio_ctrl("usi_bm01a_wl_rst", 0);
                    mmc_pm_gpio_ctrl("usi_bm01a_wl_regon", 0);
                    break;
                case 5: /* swb b23 */
                    mmc_pm_gpio_ctrl("swbb23_wl_shdn", 0);
                    break;
                default:
                    printk("[bcm4329]: no wifi module matched !!\n");
            }
#endif

#ifdef CUSTOMER_HW
			bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
			wifi_set_power(0, 0);
#endif
			WL_ERROR(("=========== WLAN placed in RESET ========\n"));
		break;

		case WLAN_RESET_ON:
			WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n",
				__FUNCTION__));
/* winner's power control */
#if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL
            switch (mod_sel)
            {
                case 2: /* usi bm01a */
                    mmc_pm_gpio_ctrl("usi_bm01a_wl_regon", 1);
                    mmc_pm_gpio_ctrl("usi_bm01a_wl_rst", 1);
                    break;
                case 5: /* swb b23 */
                    mmc_pm_gpio_ctrl("swbb23_wl_shdn", 1);
                    break;
                default:
                    printk("[bcm4329]: no wifi module matched !!\n");
            }
#endif

#ifdef CUSTOMER_HW
			bcm_wlan_power_on(2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
			wifi_set_power(1, 0);
#endif
			WL_ERROR(("=========== WLAN going back to live  ========\n"));
			
			OSL_DELAY(10000);
		break;

		case WLAN_POWER_OFF:
			WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",
				__FUNCTION__));
/* winner's power control */
#if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL
            switch (mod_sel)
            {
                case 2: /* usi bm01a */
                    mmc_pm_gpio_ctrl("usi_bm01a_wl_rst", 0);
                    mmc_pm_gpio_ctrl("usi_bm01a_wl_regon", 0);
                    break;
                case 5: /* swb b23 */
                    mmc_pm_gpio_ctrl("swbb23_wl_shdn", 0);
                    break;
                default:
                    printk("[bcm4329]: no wifi module matched !!\n");
            }
            sw_mmc_rescan_card(3, 0);
#endif
#ifdef CUSTOMER_HW
			bcm_wlan_power_off(1);
#endif /* CUSTOMER_HW */
		break;

		case WLAN_POWER_ON:
			WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",
				__FUNCTION__));
/* winner's power control */
#if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL
            switch (mod_sel)
            {
                case 2: /* usi bm01a */
                    mmc_pm_gpio_ctrl("usi_bm01a_wl_regon", 1);
//.........这里部分代码省略.........
开发者ID:murphy666,项目名称:sun4i-kernel,代码行数:101,代码来源:dhd_custom_gpio.c

示例2: wl_cfgvendor_gscan_get_batch_results

static int wl_cfgvendor_gscan_get_batch_results(struct wiphy *wiphy,
	struct wireless_dev *wdev, const void  *data, int len)
{
	int err = 0;
	struct wl_priv *cfg = wiphy_priv(wiphy);
	gscan_results_cache_t *results, *iter;
	uint32 reply_len, complete = 1;
	int32 mem_needed, num_results_iter;
	wifi_gscan_result_t *ptr;
	uint16 num_scan_ids, num_results;
	struct sk_buff *skb;
	struct nlattr *scan_hdr, *complete_flag;

	err = dhd_dev_wait_batch_results_complete(wl_to_prmry_ndev(cfg));
	if (err != BCME_OK)
		return -EBUSY;

	err = dhd_dev_pno_lock_access_batch_results(wl_to_prmry_ndev(cfg));
	if (err != BCME_OK) {
		WL_ERR(("Can't obtain lock to access batch results %d\n", err));
		return -EBUSY;
	}
	results = dhd_dev_pno_get_gscan(wl_to_prmry_ndev(cfg),
	             DHD_PNO_GET_BATCH_RESULTS, NULL, &reply_len);

	if (!results) {
		WL_ERR(("No results to send %d\n", err));
		err =  wl_cfgvendor_send_cmd_reply(wiphy, wl_to_prmry_ndev(cfg),
		        results, 0);

		if (unlikely(err))
			WL_ERR(("Vendor Command reply failed ret:%d \n", err));
		dhd_dev_pno_unlock_access_batch_results(wl_to_prmry_ndev(cfg));
		return err;
	}
	num_scan_ids = reply_len & 0xFFFF;
	num_results = (reply_len & 0xFFFF0000) >> 16;
	mem_needed = (num_results * sizeof(wifi_gscan_result_t)) +
	             (num_scan_ids * GSCAN_BATCH_RESULT_HDR_LEN) +
	             VENDOR_REPLY_OVERHEAD + SCAN_RESULTS_COMPLETE_FLAG_LEN;

	if (mem_needed > (int32)NLMSG_DEFAULT_SIZE) {
		mem_needed = (int32)NLMSG_DEFAULT_SIZE;
		complete = 0;
	}

	WL_TRACE(("complete %d mem_needed %d max_mem %d\n", complete, mem_needed,
		(int)NLMSG_DEFAULT_SIZE));
	/* Alloc the SKB for vendor_event */
	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed);
	if (unlikely(!skb)) {
		WL_ERR(("skb alloc failed"));
		dhd_dev_pno_unlock_access_batch_results(wl_to_prmry_ndev(cfg));
		return -ENOMEM;
	}
	iter = results;
	complete_flag = nla_reserve(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE,
	                    sizeof(complete));
	mem_needed = mem_needed - (SCAN_RESULTS_COMPLETE_FLAG_LEN + VENDOR_REPLY_OVERHEAD);

	while (iter) {
		num_results_iter =
		    (mem_needed - GSCAN_BATCH_RESULT_HDR_LEN)/sizeof(wifi_gscan_result_t);
		if (num_results_iter <= 0 ||
		    ((iter->tot_count - iter->tot_consumed) > num_results_iter))
			break;
		scan_hdr = nla_nest_start(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS);
		/* no more room? we are done then (for now) */
		if (scan_hdr == NULL) {
			complete = 0;
			break;
		}
		nla_put_u32(skb, GSCAN_ATTRIBUTE_SCAN_ID, iter->scan_id);
		nla_put_u8(skb, GSCAN_ATTRIBUTE_SCAN_FLAGS, iter->flag);
		num_results_iter = iter->tot_count - iter->tot_consumed;

		nla_put_u32(skb, GSCAN_ATTRIBUTE_NUM_OF_RESULTS, num_results_iter);
		if (num_results_iter) {
			ptr = &iter->results[iter->tot_consumed];
			iter->tot_consumed += num_results_iter;
			nla_put(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS,
			 num_results_iter * sizeof(wifi_gscan_result_t), ptr);
		}
		nla_nest_end(skb, scan_hdr);
		mem_needed -= GSCAN_BATCH_RESULT_HDR_LEN +
		    (num_results_iter * sizeof(wifi_gscan_result_t));
		iter = iter->next;
	}
	memcpy(nla_data(complete_flag), &complete, sizeof(complete));
	dhd_dev_gscan_batch_cache_cleanup(wl_to_prmry_ndev(cfg));
	dhd_dev_pno_unlock_access_batch_results(wl_to_prmry_ndev(cfg));
	return cfg80211_vendor_cmd_reply(skb);
}
开发者ID:MrJwiz,项目名称:UBER-M,代码行数:93,代码来源:wl_cfgvendor.c

示例3: set_btc_esco_params

/* Enhanced BT COEX settings for eSCO compatibility during DHCP window */
static int set_btc_esco_params(struct net_device *dev, bool trump_sco)
{
	static bool saved_status = FALSE;

	char buf_reg50va_dhcp_on[8] =
		{ 50, 00, 00, 00, 0x22, 0x80, 0x00, 0x00 };
	char buf_reg51va_dhcp_on[8] =
		{ 51, 00, 00, 00, 0x00, 0x00, 0x00, 0x00 };
	char buf_reg64va_dhcp_on[8] =
		{ 64, 00, 00, 00, 0x00, 0x00, 0x00, 0x00 };
	char buf_reg65va_dhcp_on[8] =
		{ 65, 00, 00, 00, 0x00, 0x00, 0x00, 0x00 };
	char buf_reg71va_dhcp_on[8] =
		{ 71, 00, 00, 00, 0x00, 0x00, 0x00, 0x00 };
	uint32 regaddr;
	static uint32 saved_reg50;
	static uint32 saved_reg51;
	static uint32 saved_reg64;
	static uint32 saved_reg65;
	static uint32 saved_reg71;

	if (trump_sco) {
		/* this should reduce eSCO agressive retransmit
		 * w/o breaking it
		 */

		/* 1st save current */
		WL_TRACE(("Do new SCO/eSCO coex algo {save &"
			  "override}\n"));
		if ((!dev_wlc_intvar_get_reg(dev, "btc_params", 50, &saved_reg50)) &&
			(!dev_wlc_intvar_get_reg(dev, "btc_params", 51, &saved_reg51)) &&
			(!dev_wlc_intvar_get_reg(dev, "btc_params", 64, &saved_reg64)) &&
			(!dev_wlc_intvar_get_reg(dev, "btc_params", 65, &saved_reg65)) &&
			(!dev_wlc_intvar_get_reg(dev, "btc_params", 71, &saved_reg71))) {
			saved_status = TRUE;
			WL_TRACE(("%s saved bt_params[50,51,64,65,71]:"
				  "0x%x 0x%x 0x%x 0x%x 0x%x\n",
				  __FUNCTION__, saved_reg50, saved_reg51,
				  saved_reg64, saved_reg65, saved_reg71));
		} else {
			WL_ERR((":%s: save btc_params failed\n",
				__FUNCTION__));
			saved_status = FALSE;
			return -1;
		}

		WL_TRACE(("override with [50,51,64,65,71]:"
			  "0x%x 0x%x 0x%x 0x%x 0x%x\n",
			  *(u32 *)(buf_reg50va_dhcp_on+4),
			  *(u32 *)(buf_reg51va_dhcp_on+4),
			  *(u32 *)(buf_reg64va_dhcp_on+4),
			  *(u32 *)(buf_reg65va_dhcp_on+4),
			  *(u32 *)(buf_reg71va_dhcp_on+4)));

		dev_wlc_bufvar_set(dev, "btc_params",
			(char *)&buf_reg50va_dhcp_on[0], 8);
		dev_wlc_bufvar_set(dev, "btc_params",
			(char *)&buf_reg51va_dhcp_on[0], 8);
		dev_wlc_bufvar_set(dev, "btc_params",
			(char *)&buf_reg64va_dhcp_on[0], 8);
		dev_wlc_bufvar_set(dev, "btc_params",
			(char *)&buf_reg65va_dhcp_on[0], 8);
		dev_wlc_bufvar_set(dev, "btc_params",
			(char *)&buf_reg71va_dhcp_on[0], 8);

		saved_status = TRUE;
	} else if (saved_status) {
		/* restore previously saved bt params */
		WL_TRACE(("Do new SCO/eSCO coex algo {save &"
			  "override}\n"));

		regaddr = 50;
		dev_wlc_intvar_set_reg(dev, "btc_params",
			(char *)&regaddr, (char *)&saved_reg50);
		regaddr = 51;
		dev_wlc_intvar_set_reg(dev, "btc_params",
			(char *)&regaddr, (char *)&saved_reg51);
		regaddr = 64;
		dev_wlc_intvar_set_reg(dev, "btc_params",
			(char *)&regaddr, (char *)&saved_reg64);
		regaddr = 65;
		dev_wlc_intvar_set_reg(dev, "btc_params",
			(char *)&regaddr, (char *)&saved_reg65);
		regaddr = 71;
		dev_wlc_intvar_set_reg(dev, "btc_params",
			(char *)&regaddr, (char *)&saved_reg71);

		WL_TRACE(("restore bt_params[50,51,64,65,71]:"
			"0x%x 0x%x 0x%x 0x%x 0x%x\n",
			saved_reg50, saved_reg51, saved_reg64,
			saved_reg65, saved_reg71));

		saved_status = FALSE;
	} else {
		WL_ERR((":%s att to restore not saved BTCOEX params\n",
			__FUNCTION__));
		return -1;
	}
	return 0;
//.........这里部分代码省略.........
开发者ID:ARMP,项目名称:ARMP-i9300,代码行数:101,代码来源:dhd_cfg80211.c

示例4: dhd_customer_gpio_wlan_ctrl

/* Customer function to control hw specific wlan gpios */
void
dhd_customer_gpio_wlan_ctrl(int onoff)
{
    static int first = 1;
    static int sdc_id = 1;

    script_item_value_type_e type;
    script_item_u val;

    if (first == 1) {
        type = script_get_item("wifi_para", "wifi_sdc_id", &val);
        if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
            WL_ERROR(("failed to fetch sdio card's sdcid\n"));
            return -1;
        }
        sdc_id = val.val;
        first = 0;
    }

    switch (onoff) {
    case WLAN_RESET_OFF:
        WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n",
                  __FUNCTION__));
#ifdef CUSTOMER_HW
        wifi_pm_power(0);
#endif /* CUSTOMER_HW */
#if defined(CUSTOMER_HW2)
        wifi_set_power(0, 0);
#endif
        mdelay(100);
        WL_ERROR(("=========== WLAN placed in RESET ========\n"));
        break;

    case WLAN_RESET_ON:
        WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n",
                  __FUNCTION__));
#ifdef CUSTOMER_HW
        wifi_pm_power(1);
#endif /* CUSTOMER_HW */
#if defined(CUSTOMER_HW2)
        wifi_set_power(1, 0);
#endif
        mdelay(100);
        WL_ERROR(("=========== WLAN going back to live  ========\n"));
        break;

    case WLAN_POWER_OFF:
        WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",
                  __FUNCTION__));
#ifdef CUSTOMER_HW
        wifi_pm_power(0);
        sw_mci_rescan_card(sdc_id, 0);
#endif /* CUSTOMER_HW */
        WL_ERROR(("=========== WLAN placed in POWER OFF ========\n"));
        break;

    case WLAN_POWER_ON:
        WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",
                  __FUNCTION__));
#ifdef CUSTOMER_HW
        wifi_pm_power(1);
        sw_mci_rescan_card(sdc_id, 1);
        /* Lets customer power to get stable */
#endif /* CUSTOMER_HW */
        mdelay(100);
        WL_ERROR(("=========== WLAN placed in POWER ON ========\n"));
        break;
    }
}
开发者ID:maikovisky,项目名称:BananaPi-Android-4.2.2-Liab,代码行数:70,代码来源:dhd_custom_gpio.c

示例5: WL_ERROR

/**
 * attach to the WL device.
 *
 * Attach to the WL device identified by vendor and device parameters.
 * regs is a host accessible memory address pointing to WL device registers.
 *
 * wl_attach is not defined as static because in the case where no bus
 * is defined, wl_attach will never be called, and thus, gcc will issue
 * a warning that this function is defined but not used if we declare
 * it as static.
 *
 *
 * is called in wl_pci_probe() context, therefore no locking required.
 */
static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs,
			    uint bustype, void *btparam, uint irq)
{
	struct wl_info *wl;
	int unit, err;

	unsigned long base_addr;
	struct ieee80211_hw *hw;
	u8 perm[ETH_ALEN];

	unit = wl_found;
	err = 0;

	if (unit < 0) {
		WL_ERROR("wl%d: unit number overflow, exiting\n", unit);
		return NULL;
	}

	/* allocate private info */
	hw = pci_get_drvdata(btparam);	/* btparam == pdev */
	wl = hw->priv;
	ASSERT(wl);

	atomic_set(&wl->callbacks, 0);

	/* setup the bottom half handler */
	tasklet_init(&wl->tasklet, wl_dpc, (unsigned long) wl);



	base_addr = regs;

	if (bustype == PCI_BUS) {
		wl->piomode = false;
	} else if (bustype == RPC_BUS) {
		/* Do nothing */
	} else {
		bustype = PCI_BUS;
		WL_TRACE("force to PCI\n");
	}
	wl->bcm_bustype = bustype;

	wl->regsva = ioremap_nocache(base_addr, PCI_BAR0_WINSZ);
	if (wl->regsva == NULL) {
		WL_ERROR("wl%d: ioremap() failed\n", unit);
		goto fail;
	}
	spin_lock_init(&wl->lock);
	spin_lock_init(&wl->isr_lock);

	/* prepare ucode */
	if (wl_request_fw(wl, (struct pci_dev *)btparam) < 0) {
		WL_ERROR("%s: Failed to find firmware usually in %s\n",
			 KBUILD_MODNAME, "/lib/firmware/brcm");
		wl_release_fw(wl);
		wl_remove((struct pci_dev *)btparam);
		goto fail1;
	}

	/* common load-time initialization */
	wl->wlc = wlc_attach((void *)wl, vendor, device, unit, wl->piomode,
			     wl->regsva, wl->bcm_bustype, btparam, &err);
	wl_release_fw(wl);
	if (!wl->wlc) {
		WL_ERROR("%s: wlc_attach() failed with code %d\n",
			 KBUILD_MODNAME, err);
		goto fail;
	}
	wl->pub = wlc_pub(wl->wlc);

	wl->pub->ieee_hw = hw;
	ASSERT(wl->pub->ieee_hw);
	ASSERT(wl->pub->ieee_hw->priv == wl);


	if (wlc_iovar_setint(wl->wlc, "mpc", 0)) {
		WL_ERROR("wl%d: Error setting MPC variable to 0\n", unit);
	}

	/* register our interrupt handler */
	if (request_irq(irq, wl_isr, IRQF_SHARED, KBUILD_MODNAME, wl)) {
		WL_ERROR("wl%d: request_irq() failed\n", unit);
		goto fail;
	}
	wl->irq = irq;

//.........这里部分代码省略.........
开发者ID:ARMP,项目名称:android_kernel_lge_x3,代码行数:101,代码来源:wl_mac80211.c

示例6: dhd_customer_gpio_wlan_ctrl

/* Customer function to control hw specific wlan gpios */
void
dhd_customer_gpio_wlan_ctrl(int onoff)
{
	int ret;
	switch (onoff) {
		case WLAN_RESET_OFF:
			WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
			//wifi_set_power(0, 0);
//			wifi_set_reset(0, 0);
#endif
			WL_ERROR(("=========== WLAN placed in RESET ========\n"));
			ret = IW8101_wlan_power_off(RESET);
			if(ret < 0){
				printk("IW8101_wlan_power_off reset failed");
			}
		break;

		case WLAN_RESET_ON:
			WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_on(2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
			//wifi_set_power(1, 0);
			//wifi_set_reset(1, 0);
#endif
			WL_ERROR(("=========== WLAN going back to live  ========\n"));
			
			ret = IW8101_wlan_power_on(RESET);
			if(ret < 0){
				printk("IW8101_wlan_power_on reset failed");
			}
		break;

		case WLAN_POWER_OFF:
			WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_off(1);
#endif /* CUSTOMER_HW */
			ret = IW8101_wlan_power_off(NORMAL);
			if(ret < 0){
				printk("IW8101_wlan_power_off failed");
			}
		break;

		case WLAN_POWER_ON:
			WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_on(1);
			/* Lets customer power to get stable */
			OSL_DELAY(200);
#endif /* CUSTOMER_HW */
			ret = IW8101_wlan_power_on(NORMAL);
			if(ret < 0){
				printk("IW8101_wlan_power_on failed");
			}
			OSL_DELAY(300);
		break;
	}
}
开发者ID:xuanhoa9985,项目名称:KERNEL-NPM801,代码行数:69,代码来源:dhd_custom_gpio.c

示例7: dhd_custom_get_mac_address

/* Function to get custom MAC address */
int
dhd_custom_get_mac_address(unsigned char *buf)
{
	int ret = 0;

	WL_TRACE(("%s Enter\n", __FUNCTION__));
	if (!buf)
		return -EINVAL;

	/* Customer access to MAC address stored outside of DHD driver */
#if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
	ret = wifi_get_mac_addr(buf);
#endif

//#ifdef EXAMPLE_GET_MAC
	/* EXAMPLE code */
	{
	    
	    char text[128];
	    int len;
	    void *image = NULL;
	    char *p_start=NULL;  
        char text_addr[12];
         
		struct ether_addr ea_example = {{0xc8, 0x56, 0x78, 0x9a, 0xbc, 0xde}};
        

		bcopy((char *)&ea_example, buf, sizeof(struct ether_addr));
         buf[4]=random32()&0xff;
         buf[5]=random32()&0xff;
        image = dhd_os_open_image("/persist/WCNSS_qcom_cfg.ini");
        if (image == NULL)
            WL_ERROR(("%s can't open wncss config file!!!\n", __FUNCTION__));  

        	/* Download image */
#if defined(NDISVER) && (NDISVER >= 0x0630)
	while ((len = dhd_os_get_image_block((char*)text, 127, image, FALSE))) {
#else
	while ((len = dhd_os_get_image_block((char*)text, 127, image))) {
#endif /* NDSIVER && (NDISVER >= 0x0680) */
		if (len < 0) {
			  WL_ERROR(("%s get address data failed (%d)\n", __FUNCTION__,len));
			    goto err;;
			
		}
        if(text[0]=='#')
            continue;
         if ((p_start=strstr(text, "Intf0MacAddress")))
            {
                if ((p_start=strstr(text, "="))){

                                        
                      scru_ascii_2_hex (p_start+1, 12,text_addr);  
 
                        memcpy(buf,text_addr,6);   
                     
                        printk("get wifi NV address=%x:%x:%x:%x:%x:%x\n",buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]); 
                        ret = 0;      
                break;
                    }
            }

         
       }
    err:
        if (image){
		dhd_os_close_image(image);
          
            }
        
	}
//#endif /* EXAMPLE_GET_MAC */

	return ret;
}
#endif /* GET_CUSTOM_MAC_ENABLE */

/* Customized Locale table : OPTIONAL feature */
const struct cntry_locales_custom translate_custom_table[] = {
/* Table should be filled out based on custom platform regulatory requirement */
#ifdef EXAMPLE_TABLE
	{"",   "XY", 4},  /* Universal if Country code is unknown or empty */
	{"US", "US", 69}, /* input ISO "US" to : US regrev 69 */
	{"CA", "US", 69}, /* input ISO "CA" to : US regrev 69 */
	{"EU", "EU", 5},  /* European union countries to : EU regrev 05 */
	{"AT", "EU", 5},
	{"BE", "EU", 5},
	{"BG", "EU", 5},
	{"CY", "EU", 5},
	{"CZ", "EU", 5},
	{"DK", "EU", 5},
	{"EE", "EU", 5},
	{"FI", "EU", 5},
	{"FR", "EU", 5},
	{"DE", "EU", 5},
	{"GR", "EU", 5},
	{"HU", "EU", 5},
	{"IE", "EU", 5},
	{"IT", "EU", 5},
//.........这里部分代码省略.........
开发者ID:gentu,项目名称:android_kernel_zte_z5s,代码行数:101,代码来源:dhd_custom_gpio.c

示例8: dhd_custom_get_mac_address

//FIH-ADD+]
int
dhd_custom_get_mac_address(unsigned char *buf)
{
	int ret = 0;

	WL_TRACE(("%s Enter\n", __FUNCTION__));
	if (!buf)
		return -EINVAL;

	/* Customer access to MAC address stored outside of DHD driver */
#if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
	ret = wifi_get_mac_addr(buf);
#endif
//FIH-ADD+[
    if (getwlanmac != 0) {
        bcopy(cached_mac, buf, ETHER_ADDR_LEN);
        printk(KERN_INFO "%s:[WIFI] cached MAC address: '%02x:%02x:%02x:%02x:%02x:%02x'\n", __func__,
                cached_mac[0], cached_mac[1], cached_mac[2], cached_mac[3], cached_mac[4], cached_mac[5]);
    } else {
        unsigned char cMacaddr[ETHER_ADDR_LEN];

	    memset(cMacaddr, 0, sizeof(cMacaddr));
        ret = rpc_nv_read_wlan_mac_addr(cMacaddr);

        if (ret == 0) {
            fih_wifi_mac_swap(cMacaddr);
            printk(KERN_INFO "%s:[WIFI] read MAC(nv 4678): '%02x:%02x:%02x:%02x:%02x:%02x\n'", __func__,
                    cMacaddr[0], cMacaddr[1], cMacaddr[2], cMacaddr[3], cMacaddr[4], cMacaddr[5]);
            if (cMacaddr[0] == 0x0 && cMacaddr[1] == 0x0 && cMacaddr[2] == 0x0
                 && cMacaddr[3] == 0x0 && cMacaddr[4] == 0x0 && cMacaddr[5] == 0x0) {
                printk("%s: zero Mac is not acceptable, return error\n", __func__);
                return -EINVAL;
            }
            else {
                bcopy(cMacaddr, buf, ETHER_ADDR_LEN);
                bcopy(cMacaddr, cached_mac, ETHER_ADDR_LEN);
            }
#if 0	/* Do not check SoMC mac */
            if ( fih_mac_is_se_mac(cMacaddr) ) {
                bcopy(cMacaddr, buf, ETHER_ADDR_LEN);
                bcopy(cMacaddr, cached_mac, ETHER_ADDR_LEN);
            } else {
                printk(KERN_INFO "%s:[WIFI]MAC from NV is not of SEMC\n", __func__);
                fih_generate_mac(cMacaddr, buf);
            }
#endif
        } else {
            printk("%s: failed to get MAC address from NV \n", __func__);
            /* fih_generate_mac(cMacaddr, buf);
            *
            * MAC is empty in NV, break from Wi-Fi init function
            */
            return -EINVAL;
        }

        getwlanmac = 1;
        //Update the new mac address based on NV item 4678
        printk("[Wlan] MAC address: '%02x:%02x:%02x:%02x:%02x:%02x'\n", cached_mac[0], cached_mac[1], cached_mac[2], cached_mac[3], cached_mac[4], cached_mac[5]);
    }
//FIH-ADD+]
#ifdef EXAMPLE_GET_MAC
	/* EXAMPLE code */
	{
		struct ether_addr ea_example = {{0x00, 0x11, 0x22, 0x33, 0x44, 0xFF}};
		bcopy((char *)&ea_example, buf, sizeof(struct ether_addr));
	}
#endif /* EXAMPLE_GET_MAC */

	return ret;
}
开发者ID:sladebot,项目名称:Vengeance-Kernel-MSM7x27,代码行数:71,代码来源:dhd_custom_gpio.c

示例9: dhd_customer_gpio_wlan_ctrl

/* Customer function to control hw specific wlan gpios */
void
dhd_customer_gpio_wlan_ctrl(int onoff)
{

	switch (onoff) {
		case WLAN_RESET_OFF:
		{
			WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n", __FUNCTION__));
			mmc_pm_gpio_ctrl("bcm40181_shdn", 0);
			mmc_pm_gpio_ctrl("bcm40181_vcc_en", 0);
			mmc_pm_gpio_ctrl("bcm40181_vdd_en", 0);
			printk("[bcm40181]: bcm40181_shdn=>0 !!\n");

#ifdef CUSTOMER_HW
			bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */

#ifdef CONFIG_MACH_MAHIMAHI
			wifi_set_power(0, 0);
#endif
			WL_ERROR(("=========== WLAN placed in RESET ========\n"));
		}
		break;

		case WLAN_RESET_ON:
		{
			WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n", __FUNCTION__));
			mmc_pm_gpio_ctrl("bcm40181_vcc_en", 1);
			udelay(100);
			mmc_pm_gpio_ctrl("bcm40181_shdn", 1);
			udelay(50);
			mmc_pm_gpio_ctrl("bcm40181_vdd_en", 1);
			printk("[bcm40181]: bcm40181_shdn=>1 !!\n");

#ifdef CUSTOMER_HW
			bcm_wlan_power_on(2);
#endif /* CUSTOMER_HW */

#ifdef CONFIG_MACH_MAHIMAHI
			wifi_set_power(1, 0);
#endif
			WL_ERROR(("=========== WLAN going back to live  ========\n"));
		}
		break;

		case WLAN_POWER_OFF:
		{
			WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n", __FUNCTION__));
			mmc_pm_gpio_ctrl("bcm40181_shdn", 0);
			mmc_pm_gpio_ctrl("bcm40181_vcc_en", 0);
			mmc_pm_gpio_ctrl("bcm40181_vdd_en", 0);
			sunximmc_rescan_card(3, 0);

#ifdef CUSTOMER_HW
			bcm_wlan_power_off(1);
#endif /* CUSTOMER_HW */
		}
		break;

		case WLAN_POWER_ON:
		{
			WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n", __FUNCTION__));
			mmc_pm_gpio_ctrl("bcm40181_vcc_en", 1);
			udelay(100);
			mmc_pm_gpio_ctrl("bcm40181_shdn", 1);
			udelay(50);
			mmc_pm_gpio_ctrl("bcm40181_vdd_en", 1);			

#ifdef CUSTOMER_HW
			bcm_wlan_power_on(1);
#endif /* CUSTOMER_HW */
			/* Lets customer power to get stable */
			OSL_DELAY(200);
            sunximmc_rescan_card(3, 1);
		}
		break;
	}
}
开发者ID:EddyKuo,项目名称:linux-sdk-kernel-source,代码行数:79,代码来源:dhd_custom_gpio.c

示例10: create_handler

static void create_handler(bcm_p2p_discovery_t *discNull,
	int reqLength, bcm_p2p_discovery_req_t *req, void *rspData)
{
	bcm_p2p_discovery_t *disc;
	create_rsp_t *rsp = (create_rsp_t *)rspData;

	(void)discNull;
	if (reqLength != sizeof(bcm_p2p_discovery_req_t) || req == 0 || rspData == 0) {
		WL_ERROR(("invalid parameter\n"));
		return;
	}
	WL_TRACE(("create_handler\n"));

#ifndef BCMDRIVER
	/* seed the random generator */
	srand((unsigned)time(NULL));
#endif /* BCMDRIVER */

	rsp->disc = 0;
	disc = &gDisc;
	memset(disc, 0, sizeof(*disc));

	disc->drv = req->create.drv;

	disc->listenChannel = req->create.listenChannel;

	/* initialize social channels */
	disc->socialChannel[0] = 1;
	disc->socialChannel[1] = 6;
	disc->socialChannel[2] = 11;

#ifdef BCM_P2P_DISCOVERY_CREATE_DISCOVERY_BSSCFG
	/* disable P2P discovery - to ensure bsscfg does not exist */
	wl_p2p_disc(disc->drv, FALSE);
	/* enable P2P discovery */
	wl_p2p_disc(disc->drv, TRUE);
#endif	/* BCM_P2P_DISCOVERY_CREATE_DISCOVERY_BSSCFG */

	if (wl_p2p_dev(disc->drv, &disc->bsscfgIndex) < 0) {
		WL_ERROR(("failed to get bsscfg index\n"));
	}
	WL_P2PO(("bsscfg index=%d\n", disc->bsscfgIndex));
#ifdef BCM_P2P_DISCOVERY_ADD_DELETE_IES
	wl_cur_etheraddr(disc->drv, disc->bsscfgIndex, &disc->addr);
	WL_PRMAC("discovery MAC address", &disc->addr);
#endif /* BCM_P2P_DISCOVERY_ADD_DELETE_IES */

#ifdef BCM_P2P_DISCOVERY_ADD_DELETE_IES
	addIes(disc);
#endif	/* BCM_P2P_DISCOVERY_ADD_DELETE_IES */

	/* create timers */
	disc->listenTimer = tmrCreate(
#ifndef BCMDRIVER
		dsp(),
#else
		disc->drv,
#endif	/* BCMDRIVER */
		listenTimeout, disc, "listenTimer");
	if (disc->listenTimer == 0) {
		WL_ERROR(("failed to create timer\n"));
		goto fail;
	}

	/* reset state machine */
	fsm(disc, EVENT_RESET);

	/* return created instance */
	rsp->disc = disc;
	return;

fail:
	memset(disc, 0, sizeof(*disc));
}
开发者ID:hajuuk,项目名称:asuswrt,代码行数:74,代码来源:bcm_p2p_discovery.c

示例11: wl_cfg80211_bt_handler

static void wl_cfg80211_bt_handler(struct work_struct *work)
{
	struct btcoex_info *btcx_inf;

	btcx_inf = container_of(work, struct btcoex_info, work);

	if (btcx_inf->timer_on) {
		btcx_inf->timer_on = 0;
		del_timer_sync(&btcx_inf->timer);
	}

	switch (btcx_inf->bt_state) {
		case BT_DHCP_START:
			WL_TRACE(("%s bt_dhcp stm: started \n",
				__FUNCTION__));
			bt_coex_retry_cnt = 0;
			btcx_inf->bt_state = BT_DHCP_OPPR_WIN;
			mod_timer(&btcx_inf->timer,
				jiffies + msecs_to_jiffies(BT_DHCP_OPPR_WIN_TIME));
			btcx_inf->timer_on = 1;
			break;

		case BT_DHCP_OPPR_WIN:
			if ((btcx_inf->dhcp_done)||(bt_coex_retry_cnt > 7)) {
				WL_TRACE(("%s DHCP Done before T1 expiration\n",
					__FUNCTION__));
				goto btc_coex_idle;
			}

			WL_TRACE(("%s DHCP T1:%d expired\n", __FUNCTION__,
				BT_DHCP_OPPR_WIN_TIME));
			if (btcx_inf->dev)
				wl_cfg80211_bt_setflag(btcx_inf->dev, TRUE);
			btcx_inf->bt_state = BT_DHCP_FLAG_FORCE_TIMEOUT;
			mod_timer(&btcx_inf->timer,
				jiffies + msecs_to_jiffies(BT_DHCP_FLAG_FORCE_TIME));
			btcx_inf->timer_on = 1;
			break;

		case BT_DHCP_FLAG_FORCE_TIMEOUT:
			if ((btcx_inf->dhcp_done)||(++bt_coex_retry_cnt > 7)) {
				WL_TRACE(("%s DHCP Done before T2 expiration\n",
					__FUNCTION__));
                
                if (btcx_inf->dev)
                    wl_cfg80211_bt_setflag(btcx_inf->dev, FALSE);
				goto btc_coex_idle;
			} else {
				
				WL_TRACE(("%s DHCP wait interval T2:%d"
					  "msec expired\n", __FUNCTION__,
					  BT_DHCP_FLAG_FORCE_TIME));
                
                if (btcx_inf->dev)
                    wl_cfg80211_bt_setflag(btcx_inf->dev, FALSE);
				btcx_inf->bt_state = BT_DHCP_OPPR_WIN;
				mod_timer(&btcx_inf->timer,
					jiffies + msecs_to_jiffies(BT_DHCP_OPPR_WIN_TIME));
				btcx_inf->timer_on = 1;
			}

			if (!(btcx_inf->dhcp_done)) {
				break;
			}

btc_coex_idle:
			btcx_inf->bt_state = BT_DHCP_IDLE;
			btcx_inf->timer_on = 0;
			bt_coex_retry_cnt = 0;
			break;

		default:
			WL_ERR(("%s error g_status=%d !!!\n", __FUNCTION__,
				btcx_inf->bt_state));
			if (btcx_inf->dev)
				wl_cfg80211_bt_setflag(btcx_inf->dev, FALSE);
			btcx_inf->bt_state = BT_DHCP_IDLE;
			btcx_inf->timer_on = 0;
			break;
	}

	net_os_wake_unlock(btcx_inf->dev);
}
开发者ID:hyuh,项目名称:m7-wls,代码行数:83,代码来源:dhd_cfg80211.c

示例12: wl_cfgvendor_gscan_get_batch_results

static int wl_cfgvendor_gscan_get_batch_results(struct wiphy *wiphy,
	struct wireless_dev *wdev, const void  *data, int len)
{
	int err = 0;
	struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
	gscan_results_cache_t *results, *iter;
	uint32 reply_len, complete = 0, num_results_iter;
	int32 mem_needed;
	wifi_gscan_result_t *ptr;
	uint16 num_scan_ids, num_results;
	struct sk_buff *skb;
	struct nlattr *scan_hdr;

	dhd_dev_wait_batch_results_complete(bcmcfg_to_prmry_ndev(cfg));
	dhd_dev_pno_lock_access_batch_results(bcmcfg_to_prmry_ndev(cfg));
	results = dhd_dev_pno_get_gscan(bcmcfg_to_prmry_ndev(cfg),
	             DHD_PNO_GET_BATCH_RESULTS, NULL, &reply_len);

	if (!results) {
		WL_ERR(("No results to send %d\n", err));
		err =  rtw_cfgvendor_send_cmd_reply(wiphy, bcmcfg_to_prmry_ndev(cfg),
		        results, 0);

		if (unlikely(err))
			WL_ERR(("Vendor Command reply failed ret:%d \n", err));
		dhd_dev_pno_unlock_access_batch_results(bcmcfg_to_prmry_ndev(cfg));
		return err;
	}
	num_scan_ids = reply_len & 0xFFFF;
	num_results = (reply_len & 0xFFFF0000) >> 16;
	mem_needed = (num_results * sizeof(wifi_gscan_result_t)) +
	             (num_scan_ids * GSCAN_BATCH_RESULT_HDR_LEN) +
	             VENDOR_REPLY_OVERHEAD + SCAN_RESULTS_COMPLETE_FLAG_LEN;

	if (mem_needed > (int32)NLMSG_DEFAULT_SIZE) {
		mem_needed = (int32)NLMSG_DEFAULT_SIZE;
		complete = 0;
	} else {
		complete = 1;
	}

	WL_TRACE(("complete %d mem_needed %d max_mem %d\n", complete, mem_needed,
		(int)NLMSG_DEFAULT_SIZE));
	/* Alloc the SKB for vendor_event */
	skb = rtw_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed);
	if (unlikely(!skb)) {
		WL_ERR(("skb alloc failed"));
		dhd_dev_pno_unlock_access_batch_results(bcmcfg_to_prmry_ndev(cfg));
		return -ENOMEM;
	}
	iter = results;

	nla_put_u32(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE, complete);

	mem_needed = mem_needed - (SCAN_RESULTS_COMPLETE_FLAG_LEN + VENDOR_REPLY_OVERHEAD);

	while (iter && ((mem_needed - GSCAN_BATCH_RESULT_HDR_LEN)  > 0)) {
		scan_hdr = nla_nest_start(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS);
		nla_put_u32(skb, GSCAN_ATTRIBUTE_SCAN_ID, iter->scan_id);
		nla_put_u8(skb, GSCAN_ATTRIBUTE_SCAN_FLAGS, iter->flag);
		num_results_iter =
		    (mem_needed - GSCAN_BATCH_RESULT_HDR_LEN)/sizeof(wifi_gscan_result_t);

		if ((iter->tot_count - iter->tot_consumed) < num_results_iter)
			num_results_iter = iter->tot_count - iter->tot_consumed;

		nla_put_u32(skb, GSCAN_ATTRIBUTE_NUM_OF_RESULTS, num_results_iter);
		if (num_results_iter) {
			ptr = &iter->results[iter->tot_consumed];
			iter->tot_consumed += num_results_iter;
			nla_put(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS,
			 num_results_iter * sizeof(wifi_gscan_result_t), ptr);
		}
		nla_nest_end(skb, scan_hdr);
		mem_needed -= GSCAN_BATCH_RESULT_HDR_LEN +
		    (num_results_iter * sizeof(wifi_gscan_result_t));
		iter = iter->next;
	}

	dhd_dev_gscan_batch_cache_cleanup(bcmcfg_to_prmry_ndev(cfg));
	dhd_dev_pno_unlock_access_batch_results(bcmcfg_to_prmry_ndev(cfg));

	return rtw_cfg80211_vendor_cmd_reply(skb);
}
开发者ID:GREYFOXRGR,项目名称:BPI-M3-bsp,代码行数:84,代码来源:rtw_cfgvendor.c

示例13: wl_cfg80211_set_btcoex_dhcp

int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command)
{

	struct wl_priv *wl = wlcfg_drv_priv;
	char powermode_val = 0;
	char buf_reg66va_dhcp_on[8] = { 66, 00, 00, 00, 0x10, 0x27, 0x00, 0x00 };
	char buf_reg41va_dhcp_on[8] = { 41, 00, 00, 00, 0x33, 0x00, 0x00, 0x00 };
	char buf_reg68va_dhcp_on[8] = { 68, 00, 00, 00, 0x90, 0x01, 0x00, 0x00 };

	uint32 regaddr;
	static uint32 saved_reg66;
	static uint32 saved_reg41;
	static uint32 saved_reg68;
	static bool saved_status = FALSE;

#ifdef COEX_DHCP
	char buf_flag7_default[8] =   { 7, 00, 00, 00, 0x0, 0x00, 0x00, 0x00};
	struct btcoex_info *btco_inf = wl->btcoex_info;
#endif 

#ifdef PKT_FILTER_SUPPORT
	dhd_pub_t *dhd =  (dhd_pub_t *)(wl->pub);
#endif

	
	strncpy((char *)&powermode_val, command + strlen("BTCOEXMODE") +1, 1);

	if (strnicmp((char *)&powermode_val, "1", strlen("1")) == 0) {
		WL_TRACE_HW4(("%s: DHCP session starts\n", __FUNCTION__));

#ifdef PKT_FILTER_SUPPORT
		dhd->dhcp_in_progress = 1;

		if (dhd->early_suspended) {
			WL_TRACE_HW4(("DHCP in progressing , disable packet filter!!!\n"));
			dhd_enable_packet_filter(0, dhd);
		}
#endif

		
		if ((saved_status == FALSE) &&
			(!dev_wlc_intvar_get_reg(dev, "btc_params", 66,  &saved_reg66)) &&
			(!dev_wlc_intvar_get_reg(dev, "btc_params", 41,  &saved_reg41)) &&
			(!dev_wlc_intvar_get_reg(dev, "btc_params", 68,  &saved_reg68)))   {
				saved_status = TRUE;
				WL_TRACE(("Saved 0x%x 0x%x 0x%x\n",
					saved_reg66, saved_reg41, saved_reg68));

				

				
#ifdef COEX_DHCP
				
				if (btcoex_is_sco_active(dev)) {
					
					dev_wlc_bufvar_set(dev, "btc_params",
						(char *)&buf_reg66va_dhcp_on[0],
						sizeof(buf_reg66va_dhcp_on));
					
					dev_wlc_bufvar_set(dev, "btc_params",
						(char *)&buf_reg41va_dhcp_on[0],
						sizeof(buf_reg41va_dhcp_on));
					
					dev_wlc_bufvar_set(dev, "btc_params",
						(char *)&buf_reg68va_dhcp_on[0],
						sizeof(buf_reg68va_dhcp_on));
					saved_status = TRUE;

					btco_inf->bt_state = BT_DHCP_START;
					btco_inf->timer_on = 1;
					btco_inf->dhcp_done = 0;
					mod_timer(&btco_inf->timer, jiffies + msecs_to_jiffies(BT_DHCP_OPPR_WIN_TIME));
					WL_TRACE(("%s enable BT DHCP Timer\n",
					__FUNCTION__));
				}
#endif 
		}
		else if (saved_status == TRUE) {
			WL_ERR(("%s was called w/o DHCP OFF. Continue\n", __FUNCTION__));
		}
	}
	else if (strnicmp((char *)&powermode_val, "2", strlen("2")) == 0) {


#ifdef PKT_FILTER_SUPPORT
		dhd->dhcp_in_progress = 0;
		WL_TRACE_HW4(("%s: DHCP is complete \n", __FUNCTION__));

		
		if (dhd->early_suspended) {
			WL_TRACE_HW4(("DHCP is complete , enable packet filter!!!\n"));
			dhd_enable_packet_filter(1, dhd);
		}
#endif

		

#ifdef COEX_DHCP
		
		WL_TRACE(("%s disable BT DHCP Timer\n", __FUNCTION__));
//.........这里部分代码省略.........
开发者ID:hyuh,项目名称:m7-wls,代码行数:101,代码来源:dhd_cfg80211.c

示例14: dhd_cfgvendor_priv_string_handler

static int dhd_cfgvendor_priv_string_handler(struct wiphy *wiphy,
	struct wireless_dev *wdev, const void  *data, int len)
{
	const struct bcm_nlmsg_hdr *nlioc = data;
	struct net_device *ndev = NULL;
	struct bcm_cfg80211 *cfg;
	struct sk_buff *reply;
	void *buf = NULL, *cur;
	dhd_pub_t *dhd;
	dhd_ioctl_t ioc = { 0 };
	int ret = 0, ret_len, payload, msglen;
	int maxmsglen = PAGE_SIZE - 0x100;
	int8 index;

	WL_TRACE(("entry: cmd = %d\n", nlioc->cmd));
	DHD_ERROR(("entry: cmd = %d\n", nlioc->cmd));

	cfg = wiphy_priv(wiphy);
	dhd = cfg->pub;

	DHD_OS_WAKE_LOCK(dhd);

	
	if (dhd->hang_was_sent) {
		WL_ERR(("HANG was sent up earlier\n"));
		DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(dhd, DHD_EVENT_TIMEOUT_MS);
		DHD_OS_WAKE_UNLOCK(dhd);
		return OSL_ERROR(BCME_DONGLE_DOWN);
	}

	len -= sizeof(struct bcm_nlmsg_hdr);
	ret_len = nlioc->len;
	if (ret_len > 0 || len > 0) {
		if (len > DHD_IOCTL_MAXLEN) {
			WL_ERR(("oversize input buffer %d\n", len));
			len = DHD_IOCTL_MAXLEN;
		}
		if (ret_len > DHD_IOCTL_MAXLEN) {
			WL_ERR(("oversize return buffer %d\n", ret_len));
			ret_len = DHD_IOCTL_MAXLEN;
		}
		payload = max(ret_len, len) + 1;
		buf = vzalloc(payload);
		if (!buf) {
			DHD_OS_WAKE_UNLOCK(dhd);
			return -ENOMEM;
		}
		memcpy(buf, (void *)nlioc + nlioc->offset, len);
		*(char *)(buf + len) = '\0';
	}

	ndev = wdev_to_wlc_ndev(wdev, cfg);
	index = dhd_net2idx(dhd->info, ndev);
	if (index == DHD_BAD_IF) {
		WL_ERR(("Bad ifidx from wdev:%p\n", wdev));
		ret = BCME_ERROR;
		goto done;
	}

	ioc.cmd = nlioc->cmd;
	ioc.len = nlioc->len;
	ioc.set = nlioc->set;
	ioc.driver = nlioc->magic;
	ret = dhd_ioctl_process(dhd, index, &ioc, buf);
	if (ret) {
		WL_TRACE(("dhd_ioctl_process return err %d\n", ret));
		ret = OSL_ERROR(ret);
		goto done;
	}

	cur = buf;
	while (ret_len > 0) {
		msglen = nlioc->len > maxmsglen ? maxmsglen : ret_len;
		ret_len -= msglen;
		payload = msglen + sizeof(msglen);
		reply = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, payload);
		if (!reply) {
			WL_ERR(("Failed to allocate reply msg\n"));
			ret = -ENOMEM;
			break;
		}

		if (nla_put(reply, BCM_NLATTR_DATA, msglen, cur) ||
			nla_put_u16(reply, BCM_NLATTR_LEN, msglen)) {
			kfree_skb(reply);
			ret = -ENOBUFS;
			break;
		}

		ret = cfg80211_vendor_cmd_reply(reply);
		if (ret) {
			WL_ERR(("testmode reply failed:%d\n", ret));
			break;
		}
		cur += msglen;
	}

done:
	vfree(buf);
	DHD_OS_WAKE_UNLOCK(dhd);
//.........这里部分代码省略.........
开发者ID:Clumsy-Kernel-Development,项目名称:M9_Kernel,代码行数:101,代码来源:dhd_cfg_vendor.c

示例15: dhd_customer_gpio_wlan_ctrl

/* Customer function to control hw specific wlan gpios */
void
dhd_customer_gpio_wlan_ctrl(int onoff)
{
	switch (onoff) {
		case WLAN_RESET_OFF:
			WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */
#ifdef CONFIG_MACH_MAHIMAHI
			wifi_set_power(0, 0);
#endif
			WL_ERROR(("=========== WLAN placed in RESET ========\n"));

/* LGE_CHANGE_S [[email protected]] 2009-05-14, support start/stop */
#if defined(CONFIG_LGE_BCM432X_PATCH) && defined(CONFIG_ARCH_MSM)
            if (gpio_get_value(CONFIG_BCM4330_GPIO_WL_RESET)) {
                disable_irq(gpio_to_irq(CONFIG_BCM4330_GPIO_WL_RESET));
                gpio_set_value(CONFIG_BCM4330_GPIO_WL_RESET, 0);
            }
#endif /* defined(CONFIG_LGE_BCM432X_PATCH) && defined(CONFIG_ARCH_MSM) */
/* LGE_CHANGE_E [[email protected]] 2009-05-14, support start/stop */

		break;

		case WLAN_RESET_ON:
			WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_on(2);
#endif /* CUSTOMER_HW */
#ifdef CONFIG_MACH_MAHIMAHI
			wifi_set_power(1, 0);
#endif
			WL_ERROR(("=========== WLAN going back to live  ========\n"));

/* LGE_CHANGE_S [[email protected]] 2009-05-14, support start/stop */
#if defined(CONFIG_LGE_BCM432X_PATCH) && defined(CONFIG_ARCH_MSM)
            if (!gpio_get_value(CONFIG_BCM4330_GPIO_WL_RESET)) {
                gpio_set_value(CONFIG_BCM4330_GPIO_WL_RESET, 1);

                mdelay(150);

                enable_irq(gpio_to_irq(CONFIG_BCM4330_GPIO_WL_RESET));
            }
#endif /* defined(CONFIG_LGE_BCM432X_PATCH) && defined(CONFIG_ARCH_MSM) */
/* LGE_CHANGE_E [[email protected]] 2009-05-14, support start/stop */

		break;

		case WLAN_POWER_OFF:
			WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_off(1);
#endif /* CUSTOMER_HW */

/* LGE_CHANGE_S [[email protected]] 2009-03-05, for gpio set in dhd_linux */
#if defined(CONFIG_LGE_BCM432X_PATCH) && defined(CONFIG_ARCH_MSM)
			//gpio_tlmm_config(GPIO_CFG(CONFIG_BCM4330_GPIO_WL_RESET, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), GPIO_ENABLE);
			if (!gpio_get_value(CONFIG_BCM4330_GPIO_WL_RESET)) {
				gpio_set_value(CONFIG_BCM4330_GPIO_WL_RESET, 1);
				enable_irq(gpio_to_irq(CONFIG_BCM4330_GPIO_WL_RESET));
			}
			gpio_set_value(CONFIG_BCM4330_GPIO_WL_RESET, 0);
			//gpio_tlmm_config(GPIO_CFG(CONFIG_BCM4330_GPIO_WL_RESET, 0, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), GPIO_ENABLE);
#endif /* defined(CONFIG_LGE_BCM432X_PATCH) && defined(CONFIG_ARCH_MSM) */
/* LGE_CHANGE_E [[email protected]] 2009-03-05, for gpio set in dhd_linux */

		break;

		case WLAN_POWER_ON:
			WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_on(1);
#endif /* CUSTOMER_HW */


/* LGE_CHANGE_S [[email protected]] 2009-03-05, for gpio set in dhd_linux */
#if defined(CONFIG_LGE_BCM432X_PATCH) && defined(CONFIG_ARCH_MSM)
	        gpio_set_value(CONFIG_BCM4330_GPIO_WL_RESET, 1);
#endif /* defined(CONFIG_LGE_BCM432X_PATCH) && defined(CONFIG_ARCH_MSM) */
/* LGE_CHANGE_E [[email protected]] 2009-03-05, for gpio set in dhd_linux */

			/* Lets customer power to get stable */
			OSL_DELAY(200);
		break;
	}
}
开发者ID:Pesach85,项目名称:lge-kernel-omap4,代码行数:92,代码来源:dhd_custom_gpio.c


注:本文中的WL_TRACE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。