obj-$(CONFIG_WILC1000) += wilc1000.o
-obj-$(CONFIG_WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT) += wilc_exported_buf.o
-
ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO
-Wno-unused-function -DUSE_WIRELESS -DWILC_DEBUGFS
#ccflags-y += -DTCP_ACK_FILTER
-ccflags-$(CONFIG_WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT) += -DMEMORY_STATIC \
- -DWILC_PREALLOC_AT_BOOT
-
ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \
-DWILC_PREALLOC_AT_INSMOD
+++ /dev/null
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-
-#define LINUX_RX_SIZE (96 * 1024)
-#define LINUX_TX_SIZE (64 * 1024)
-#define WILC1000_FW_SIZE (4 * 1024)
-
-/*
- * Add necessary buffer pointers
- */
-void *exported_g_tx_buf;
-void *exported_g_rx_buf;
-void *exported_g_fw_buf;
-
-void *get_tx_buffer(void)
-{
- return exported_g_tx_buf;
-}
-EXPORT_SYMBOL(get_tx_buffer);
-
-void *get_rx_buffer(void)
-{
- return exported_g_rx_buf;
-}
-EXPORT_SYMBOL(get_rx_buffer);
-
-void *get_fw_buffer(void)
-{
- return exported_g_fw_buf;
-}
-EXPORT_SYMBOL(get_fw_buffer);
-
-static int __init wilc_module_init(void)
-{
- printk("wilc_module_init\n");
- /*
- * alloc necessary memory
- */
- exported_g_tx_buf = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
- if (!exported_g_tx_buf)
- return -ENOMEM;
-
- exported_g_rx_buf = kmalloc(LINUX_RX_SIZE, GFP_KERNEL);
- if (!exported_g_rx_buf)
- goto free_g_tx_buf;
-
- exported_g_fw_buf = kmalloc(WILC1000_FW_SIZE, GFP_KERNEL);
- if (!exported_g_fw_buf)
- goto free_g_rx_buf;
-
- return 0;
-
-free_g_rx_buf:
- kfree(exported_g_rx_buf);
- exported_g_rx_buf = NULL;
-
-free_g_tx_buf:
- kfree(exported_g_tx_buf);
- exported_g_tx_buf = NULL;
-
- return -ENOMEM;
-}
-
-static void __exit wilc_module_deinit(void)
-{
- printk("wilc_module_deinit\n");
- kfree(exported_g_tx_buf);
- kfree(exported_g_rx_buf);
- kfree(exported_g_fw_buf);
-}
-
-MODULE_LICENSE("Dual BSD/GPL");
-MODULE_AUTHOR("Tony Cho");
-MODULE_DESCRIPTION("WILC1xxx Memory Manager");
-pure_initcall(wilc_module_init);
-module_exit(wilc_module_deinit);
blksz = (1ul << 12); /* Bug 4703: 4KB Good enough size for most platforms = PAGE_SIZE. */
/* Allocate a DMA coherent buffer. */
-#if (defined WILC_PREALLOC_AT_BOOT)
- {
- extern void *get_fw_buffer(void);
- dma_buffer = (uint8_t *)get_fw_buffer();
- PRINT_D(TX_DBG, "fw_buffer = 0x%x\n", dma_buffer);
- }
-#else
dma_buffer = (uint8_t *)g_wlan.os_func.os_malloc(blksz);
-#endif
if (dma_buffer == NULL) {
/*EIO 5*/
ret = -5;
_fail_:
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
if (dma_buffer)
g_wlan.os_func.os_free(dma_buffer);
-#endif
_fail_1:
* clean up buffer
**/
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
#ifdef MEMORY_STATIC
if (p->rx_buffer) {
p->os_func.os_free(p->rx_buffer);
p->os_func.os_free(p->tx_buffer);
p->tx_buffer = NULL;
}
-#endif
acquire_bus(ACQUIRE_AND_WAKEUP);
/**
* alloc tx, rx buffer
**/
-#if (defined WILC_PREALLOC_AT_BOOT)
- extern void *get_tx_buffer(void);
- extern void *get_rx_buffer(void);
-
- PRINT_D(TX_DBG, "malloc before, g_wlan.tx_buffer = 0x%x, g_wlan.rx_buffer = 0x%x\n", g_wlan.tx_buffer, g_wlan.rx_buffer);
-#endif
-
-
-
if (g_wlan.tx_buffer == NULL)
-#if (defined WILC_PREALLOC_AT_BOOT)
- g_wlan.tx_buffer = (uint8_t *)get_tx_buffer();
-#else
g_wlan.tx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.tx_buffer_size);
-#endif
PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer);
if (g_wlan.tx_buffer == NULL) {
/* rx_buffer is not used unless we activate USE_MEM STATIC which is not applicable, allocating such memory is useless*/
#if defined (MEMORY_STATIC)
if (g_wlan.rx_buffer == NULL)
- #if (defined WILC_PREALLOC_AT_BOOT)
- g_wlan.rx_buffer = (uint8_t *)get_rx_buffer();
- #else
g_wlan.rx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.rx_buffer_size);
- #endif
PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer);
if (g_wlan.rx_buffer == NULL) {
/* ENOBUFS 105 */
_fail_:
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
#ifdef MEMORY_STATIC
if (g_wlan.rx_buffer) {
g_wlan.os_func.os_free(g_wlan.rx_buffer);
g_wlan.os_func.os_free(g_wlan.tx_buffer);
g_wlan.tx_buffer = NULL;
}
-#endif
#if defined(PLAT_RK3026_TCHIP) /* AMR : 0422 RK3026 Crash issue */
if (!g_wilc_initialized)