#include <linux/printk.h>
  #include <linux/pci_ids.h>
  #include <linux/netdevice.h>
- #include <linux/interrupt.h>
- #include <linux/sched.h>
- #include <linux/mmc/sdio.h>
- #include <linux/mmc/sdio_func.h>
- #include <linux/semaphore.h>
- #include <linux/firmware.h>
- #include <asm/unaligned.h>
- #include <defs.h>
- #include <brcmu_wifi.h>
- #include <brcmu_utils.h>
- #include <brcm_hw_ids.h>
- #include <soc.h>
- #include "sdio_host.h"
+ #include <bcmdefs.h>
+ #include <bcmsdh.h>
  
- /* register access macros */
- #ifndef __BIG_ENDIAN
- #ifndef __mips__
- #define R_REG(r, typ) \
-       brcmf_sdcard_reg_read(NULL, (r), sizeof(typ))
- #else                         /* __mips__ */
- #define R_REG(r, typ) \
-       ({ \
-               __typeof(*(r)) __osl_v; \
-               __asm__ __volatile__("sync"); \
-               __osl_v = brcmf_sdcard_reg_read(NULL, (r),\
-                                         sizeof(typ)); \
-               __asm__ __volatile__("sync"); \
-               __osl_v; \
-       })
- #endif                                /* __mips__ */
+ #ifdef BCMEMBEDIMAGE
+ #include BCMEMBEDIMAGE
+ #endif                                /* BCMEMBEDIMAGE */
  
- #else                         /* __BIG_ENDIAN */
- #define R_REG(r, typ) \
-       brcmf_sdcard_reg_read(NULL, (r), sizeof(typ))
- #endif                                /* __BIG_ENDIAN */
+ #include <bcmutils.h>
+ #include <bcmdevs.h>
  
- #define OR_REG(r, v, typ) \
-       brcmf_sdcard_reg_write(NULL, (r), sizeof(typ), R_REG(r, typ) | (v))
+ #include <hndsoc.h>
+ #ifdef DHD_DEBUG
+ #include <hndrte_armtrap.h>
+ #include <hndrte_cons.h>
+ #endif                                /* DHD_DEBUG */
+ #include <sbchipc.h>
+ #include <sbhnddma.h>
  
- #ifdef BCMDBG
+ #include <sdio.h>
+ #include <sbsdio.h>
+ #include <sbsdpcmdev.h>
+ #include <bcmsdpcm.h>
  
- /* ARM trap handling */
+ #include <proto/802.11.h>
  
- /* Trap types defined by ARM (see arminc.h) */
- 
- #if defined(__ARM_ARCH_4T__)
- #define       MAX_TRAP_TYPE   (TR_FIQ + 1)
- #elif defined(__ARM_ARCH_7M__)
- #define       MAX_TRAP_TYPE   (TR_ISR + ARMCM3_NUMINTS)
- #endif                                /* __ARM_ARCH_7M__ */
- 
- /* The trap structure is defined here as offsets for assembly */
- #define       TR_TYPE         0x00
- #define       TR_EPC          0x04
- #define       TR_CPSR         0x08
- #define       TR_SPSR         0x0c
- #define       TR_REGS         0x10
- #define       TR_REG(n)       (TR_REGS + (n) * 4)
- #define       TR_SP           TR_REG(13)
- #define       TR_LR           TR_REG(14)
- #define       TR_PC           TR_REG(15)
- 
- #define       TRAP_T_SIZE     80
- 
- struct brcmf_trap {
-       u32 type;
-       u32 epc;
-       u32 cpsr;
-       u32 spsr;
-       u32 r0;
-       u32 r1;
-       u32 r2;
-       u32 r3;
-       u32 r4;
-       u32 r5;
-       u32 r6;
-       u32 r7;
-       u32 r8;
-       u32 r9;
-       u32 r10;
-       u32 r11;
-       u32 r12;
-       u32 r13;
-       u32 r14;
-       u32 pc;
- };
+ #include <dngl_stats.h>
+ #include <dhd.h>
+ #include <dhd_bus.h>
+ #include <dhd_proto.h>
+ #include <dhd_dbg.h>
+ #include <dhdioctl.h>
+ #include <sdiovar.h>
+ #include <bcmchip.h>
  
 -#ifndef DHDSDIO_MEM_DUMP_FNAME
 -#define DHDSDIO_MEM_DUMP_FNAME         "mem_dump"
 -#endif
 +#define CBUF_LEN      (128)
 +
 +struct rte_log {
 +      u32 buf;                /* Can't be pointer on (64-bit) hosts */
 +      uint buf_size;
 +      uint idx;
 +      char *_buf_compat;      /* Redundant pointer for backward compat. */
 +};
 +
 +struct rte_console {
 +      /* Virtual UART
 +       * When there is no UART (e.g. Quickturn),
 +       * the host should write a complete
 +       * input line directly into cbuf and then write
 +       * the length into vcons_in.
 +       * This may also be used when there is a real UART
 +       * (at risk of conflicting with
 +       * the real UART).  vcons_out is currently unused.
 +       */
 +      volatile uint vcons_in;
 +      volatile uint vcons_out;
 +
 +      /* Output (logging) buffer
 +       * Console output is written to a ring buffer log_buf at index log_idx.
 +       * The host may read the output when it sees log_idx advance.
 +       * Output will be lost if the output wraps around faster than the host
 +       * polls.
 +       */
 +      struct rte_log log;
 +
 +      /* Console input line buffer
 +       * Characters are read one at a time into cbuf
 +       * until <CR> is received, then
 +       * the buffer is processed as a command line.
 +       * Also used for virtual UART.
 +       */
 +      uint cbuf_idx;
 +      char cbuf[CBUF_LEN];
 +};
 +
 +#endif                                /* BCMDBG */
 +#include <chipcommon.h>
 +
 +#include "dhd.h"
 +#include "dhd_bus.h"
 +#include "dhd_proto.h"
 +#include "dhd_dbg.h"
 +#include <bcmchip.h>
  
  #define TXQLEN                2048    /* bulk tx queue length */
  #define TXHI          (TXQLEN - 256)  /* turn on flow control above TXHI */
 
 +/*
 + * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
 + *               2005-2007 Takahiro Hirofuchi
 + *
 + * This program is free software: you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation, either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
 + */
  
 -#ifdef HAVE_CONFIG_H
 -#include "../config.h"
 -#endif
 +#ifndef __UTILS_H
 +#define __UTILS_H
  
 -#define _GNU_SOURCE
 -#include <string.h>
 -#include <sys/un.h>
 -#include <sys/types.h>
 -#include <sys/socket.h>
 +int modify_match_busid(char *busid, int add);
  
 +#endif /* __UTILS_H */
+ #include <sysfs/libsysfs.h>
+ #include <glib.h>
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
+ #include <time.h>
+ #include <errno.h>
+ 
+ 
+ 
+ /* Be sync to kernel header */
+ #define BUS_ID_SIZE 20
+ 
+ int read_string(char *path, char *, size_t len);
+ int read_integer(char *path);
+ int getdevicename(char *busid, char *name, size_t len);
+ int getdriver(char *busid, int conf, int infnum, char *driver, size_t len);
+ int read_bNumInterfaces(char *busid);
+ int read_bConfigurationValue(char *busid);
+ int write_integer(char *path, int value);
+ int write_bConfigurationValue(char *busid, int config);
+ int read_bDeviceClass(char *busid);
+ int readline(int sockfd, char *str, int strlen);
+ int writeline(int sockfd, char *buff, int bufflen);