| |
| #include <osl.h> |
| #include <dhd_linux.h> |
| |
| struct wifi_platform_data dhd_wlan_control = {0}; |
| |
| int bcm_wlan_get_mac_address(unsigned char *buf) |
| { |
| int err = 0; |
| |
| printf("======== %s ========\n", __FUNCTION__); |
| #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 err; |
| } |
| |
| #ifdef CONFIG_DHD_USE_STATIC_BUF |
| extern void *bcmdhd_mem_prealloc(int section, unsigned long size); |
| void* bcm_wlan_prealloc(int section, unsigned long size) |
| { |
| void *alloc_ptr = NULL; |
| alloc_ptr = bcmdhd_mem_prealloc(section, size); |
| if (alloc_ptr) { |
| printf("success alloc section %d, size %ld\n", section, size); |
| if (size != 0L) |
| bzero(alloc_ptr, size); |
| return alloc_ptr; |
| } |
| printf("can't alloc section %d\n", section); |
| return NULL; |
| } |
| #endif |
| |
| #if !defined(WL_WIRELESS_EXT) |
| struct cntry_locales_custom { |
| char iso_abbrev[WLC_CNTRY_BUF_SZ]; /* ISO 3166-1 country abbreviation */ |
| char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */ |
| int32 custom_locale_rev; /* Custom local revisin default -1 */ |
| }; |
| #endif |
| |
| static struct cntry_locales_custom brcm_wlan_translate_custom_table[] = { |
| /* Table should be filled out based on custom platform regulatory requirement */ |
| {"", "XT", 49}, /* Universal if Country code is unknown or empty */ |
| {"US", "US", 0}, |
| }; |
| |
| static void *bcm_wlan_get_country_code(char *ccode) |
| { |
| struct cntry_locales_custom *locales; |
| int size; |
| int i; |
| |
| if (!ccode) |
| return NULL; |
| |
| locales = brcm_wlan_translate_custom_table; |
| size = ARRAY_SIZE(brcm_wlan_translate_custom_table); |
| |
| for (i = 0; i < size; i++) |
| if (strcmp(ccode, locales[i].iso_abbrev) == 0) |
| return &locales[i]; |
| return NULL; |
| } |
| |
| int bcm_wlan_set_plat_data(void) |
| { |
| |
| printf("======== %s ========\n", __FUNCTION__); |
| |
| dhd_wlan_control.get_mac_addr = bcm_wlan_get_mac_address; |
| #ifdef CONFIG_DHD_USE_STATIC_BUF |
| dhd_wlan_control.mem_prealloc = bcm_wlan_prealloc; |
| #endif |
| dhd_wlan_control.get_country_code = bcm_wlan_get_country_code; |
| return 0; |
| } |
| |