/* Customized Locale convertor * input : ISO 3166-1 country abbreviation * output: customized cspec */ void get_customized_country_code(void *adapter, char *country_iso_code, wl_country_t *cspec, u32 flags) { #if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) struct cntry_locales_custom *cloc_ptr; if (!cspec) return; cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code, flags); if (cloc_ptr) { strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = cloc_ptr->custom_locale_rev; } return; #else int size, i; size = ARRAYSIZE(translate_custom_table); if (cspec == 0) return; if (size == 0) return; for (i = 0; i < size; i++) { if (strcmp(country_iso_code, translate_custom_table[i].iso_abbrev) == 0) { memcpy(cspec->ccode, translate_custom_table[i].custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = translate_custom_table[i].custom_locale_rev; return; } } #ifdef EXAMPLE_TABLE /* if no country code matched return first universal code from translate_custom_table */ memcpy(cspec->ccode, translate_custom_table[0].custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = translate_custom_table[0].custom_locale_rev; #endif /* EXMAPLE_TABLE */ return; #endif /* defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) */ }
/* Customized Locale convertor * input : ISO 3166-1 country abbreviation * output: customized cspec */ void get_customized_country_code(void *adapter, char *country_iso_code, wl_country_t *cspec) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) struct cntry_locales_custom *cloc_ptr; if (!cspec) return; cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code); if (cloc_ptr) { strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = cloc_ptr->custom_locale_rev; } return; #else int size, i; size = ARRAYSIZE(translate_custom_table); if (cspec == 0) return; if (size == 0) return; for (i = 0; i < size; i++) { if (strcmp(country_iso_code, translate_custom_table[i].iso_abbrev) == 0) { memcpy(cspec->ccode, translate_custom_table[i].custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = translate_custom_table[i].custom_locale_rev; return; } } return; #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) */ }
void get_customized_country_code(void *adapter, char *country_iso_code, wl_country_t *cspec) #endif { #if 0 && defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) struct cntry_locales_custom *cloc_ptr; if (!cspec) return; cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code); if (cloc_ptr) { strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = cloc_ptr->custom_locale_rev; } return; #else int size, i; const struct cntry_locales_custom* translate_table; translate_table = translate_custom_table; //Cannot get array size from sizeof() for pointor!!! size = ARRAYSIZE(translate_custom_table); #ifdef CHIPNUM //BCM4343s use it's own table if(chipnum == 43430){ //printk("############get_customized_country_code: use translate_custom_table_bcm43430"); translate_table = translate_custom_table_bcm43430; //Cannot get array size from sizeof() for pointor!!! size = ARRAYSIZE(translate_custom_table_bcm43430); }else if (chipnum == 43362){ //printk("############get_customized_country_code: use translate_custom_table_bcm43362"); translate_table = translate_custom_table_bcm43362; //Cannot get array size from sizeof() for pointor!!! size = ARRAYSIZE(translate_custom_table_bcm43362); } #endif if (cspec == 0) return; if (size == 0) return; for (i = 0; i < size; i++) { if (strcmp(country_iso_code, translate_table[i].iso_abbrev) == 0) { memcpy(cspec->ccode, translate_table[i].custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = translate_table[i].custom_locale_rev; return; } } //CY+ always use translate_custom_table //#ifdef EXAMPLE_TABLE /* if no country code matched return first universal code from translate_custom_table */ memcpy(cspec->ccode, translate_table[0].custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = translate_table[0].custom_locale_rev; //#endif /* EXMAPLE_TABLE */ //CY- return; #endif /* defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) */ }