* user,hence these routines should be called to manipulate
* anything inside it.
*/
-#include <adf_net.h>
#include <osapi.h>
#include "cmnos_api.h"
#include <Magpie_api.h>
* @module_desc Magpie Network Shim
*/
-#include <adf_net.h>
-//#include <asf_queue.h>
-//#include "adf_net_wcmd_pvt.h"
#include <wlan_pci.h>
/**
#ifndef __ADF_OS_ATOMIC_PVT_H
#define __ADF_OS_ATOMIC_PVT_H
-//#include <sys/types.h>
-//#include <machine/atomic.h>
-
-#include <adf_os_types.h>
-
typedef a_uint32_t __adf_os_atomic_t;
/**
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File:
- *
- * @Abstract: Buf pool implementation: Dynamic version
- *
- * @Notes:
- */
-#include <adf_os_mem.h>
-#include <adf_os_module.h>
-#include <osapi.h>
-#include <Magpie_api.h>
-//#include <os/cmnos_api.h>
-#include <buf_pool_api.h>
-
-LOCAL htc_handle_t _buf_pool_dynamic_init(adf_os_handle_t handle);
-LOCAL void _buf_pool_dynamic_create_pool(pool_handle_t handle, BUF_POOL_ID poolId, int nItems, int nSize);
-LOCAL adf_nbuf_t _buf_pool_dynamic_alloc_buf(pool_handle_t handle, BUF_POOL_ID poolId, int reserve);
-LOCAL adf_nbuf_t _buf_pool_dynamic_alloc_buf_align(pool_handle_t handle, BUF_POOL_ID poolId, int reserve, int align);
-LOCAL void _buf_pool_dynamic_free_buf(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf);
-LOCAL void _buf_pool_dynamic_shutdown(pool_handle_t handle);
-
-typedef struct _POOL_CONFIG {
- int nSize;
-} POOL_CONFIG;
-
-typedef struct _BUF_POOL_DYNAMIC_CONTEXT {
- adf_os_handle_t OSHandle;
- POOL_CONFIG poolConf[POOL_ID_MAX];
-} BUF_POOL_DYNAMIC_CONTEXT;
-
-void buf_pool_module_install(struct buf_pool_api *pAPIs)
-{
- pAPIs->_init = _buf_pool_dynamic_init;
- pAPIs->_create_pool = _buf_pool_dynamic_create_pool;
- pAPIs->_alloc_buf = _buf_pool_dynamic_alloc_buf;
- pAPIs->_alloc_buf_align = _buf_pool_dynamic_alloc_buf_align;
- pAPIs->_free_buf = _buf_pool_dynamic_free_buf;
- pAPIs->_shutdown = _buf_pool_dynamic_shutdown;
-}
-
-LOCAL pool_handle_t _buf_pool_dynamic_init(adf_os_handle_t handle)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx;
-
- ctx = (BUF_POOL_DYNAMIC_CONTEXT *)adf_os_mem_alloc(sizeof(BUF_POOL_DYNAMIC_CONTEXT));
- ctx->OSHandle = handle;
-
- return ctx;
-}
-
-LOCAL void _buf_pool_dynamic_shutdown(pool_handle_t handle)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
-
- adf_os_mem_free(ctx);
-}
-
-LOCAL void _buf_pool_dynamic_create_pool(pool_handle_t handle, BUF_POOL_ID poolId, int nItems, int nSize)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
-
- ctx->poolConf[poolId].nSize = nSize;
-}
-
-LOCAL adf_nbuf_t _buf_pool_dynamic_alloc_buf(pool_handle_t handle, BUF_POOL_ID poolId, int reserve)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
- POOL_CONFIG *poolConf = &ctx->poolConf[poolId];
-
- return adf_nbuf_alloc(poolConf->nSize,
- reserve, 0);
-
-}
-
-LOCAL adf_nbuf_t _buf_pool_dynamic_alloc_buf_align(pool_handle_t handle, BUF_POOL_ID poolId, int reserve, int align)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
- POOL_CONFIG *poolConf = &ctx->poolConf[poolId];
-
- return adf_nbuf_alloc(poolConf->nSize,
- reserve, align);
-
-}
-
-LOCAL void _buf_pool_dynamic_free_buf(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf)
-{
- //BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
-
- adf_nbuf_free(buf);
-}
-
-adf_os_export_symbol(buf_pool_module_install);
#define MSEC_TO_TICK(msec) ((msec)* TICK_MSEC_RATIO)
struct clock_api {
- void (* _clock_init)(A_UINT32 ref_clk);
- void (* _clockregs_init)(void);
- A_UINT32 (* _uart_frequency)(void);
- void (* _delay_us)(int);
- void (* _wlan_band_set)(int);
- A_UINT32 (* _refclk_speed_get)(void);
- A_UINT32 (* _milliseconds)(void);
- void (* _sysclk_change)(void);
+ void (* _clock_init)(A_UINT32 ref_clk);
+ void (* _clockregs_init)(void);
+ A_UINT32 (* _uart_frequency)(void);
+ void (* _delay_us)(int);
+ void (* _wlan_band_set)(int);
+ A_UINT32 (* _refclk_speed_get)(void);
+ A_UINT32 (* _milliseconds)(void);
+ void (* _sysclk_change)(void);
- void (* _clock_tick)(void);
+#if defined(PROJECT_K2)
+ A_UINT32 (* _sysclk_get)(void);
+#endif
+
+ void (* _clock_tick)(void);
};
#endif /* __CLOCK_API_H__ */
#if defined(PROJECT_K2)
#if SYSTEM_MODULE_SFLASH
-#include "sflash_api.h"
+#include "cmnos/sflash_api.h"
#endif
#endif
asm volatile("rsr %0,%1" : "=r" (epc3) : "n" (EPC_3)); \
asm volatile("rsr %0,%1" : "=r" (epc4) : "n" (EPC_4)); \
\
- A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n", \
+ A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n", \
epc1, epc2, epc3, epc4); \
A_PRINTF("0x%08x, 0x%08x, 0x%08x, \n\r", \
DEBUG_SYSTEM_STATE, WATCH_DOG_RESET_COUNTER, \
#if SYSTEM_MODULE_UART
/* Serial port support */
-#define A_UART_INIT() A_CMN(uart._uart_init())
+#define A_UART_INIT() A_CMN(uart._uart_init())
#define A_UART_HWINIT(freq, baud) \
A_CMN(uart._uart_hwinit((freq), (baud)))
-#define A_UART_ENABLED() (HOST_INTEREST->hi_uart_enable)
+#define A_UART_ENABLED() (HOST_INTEREST->hi_uart_enable)
-#define A_PUTS(str) A_CMN(uart._uart_str_out(str))
+#define A_PUTS(str) A_CMN(uart._uart_str_out(str))
-#define A_PUTC(ch) A_CMN(uart._uart_char_put(ch))
-#define A_GETC(pCh) A_CMN(uart._uart_char_get(pCh))
+#define A_PUTC(ch) A_CMN(uart._uart_char_put(ch))
+#define A_GETC(pCh) A_CMN(uart._uart_char_get(pCh))
-#define A_UART_TASK() A_CMN(uart._uart_task())
-#define A_UART_CONFIG(x) A_CMN(uart._uart_config(x))
+#define A_UART_TASK() A_CMN(uart._uart_task())
+#define A_UART_CONFIG(x) A_CMN(uart._uart_config(x))
#else
#define A_MISALIGNED_LOAD_HANDLER(dump) A_CMN(misc._misaligned_load_handler(dump))
/* reture the host interface type */
-#define A_IS_HOST_PRESENT() A_CMN(misc._is_host_present())
+#define A_IS_HOST_PRESENT() A_CMN(misc._is_host_present())
#define A_KBHIT(delay) A_CMN(misc._kbhit(delay))
#define A_GET_ROM_VER() A_CMN(misc._rom_version_get())
#else
#if SYSTEM_MODULE_CLOCK
-#define A_CLOCK_INIT(refclk_guess) A_CMN(clock._clock_init(refclk_guess))
-#define A_CLOCK_TICK() A_CMN(clock._clock_tick())
-#define A_CLOCK_GET_TICK() A_CMN(clock._clock_get_tick())
+#define A_CLOCK_INIT(refclk_guess) A_CMN(clock._clock_init(refclk_guess))
+#define A_CLOCK_TICK() A_CMN(clock._clock_tick())
+#define A_CLOCK_GET_TICK() A_CMN(clock._clock_get_tick())
/*
* Get the number of millisecond ticks since the system was started.
#define A_TIMER_RUN() \
A_CMN(timer._timer_run())
-#define A_PCI_BOOT_INIT() \
- A_CMN(pci.pci_boot_init())
-
#define A_GMAC_BOOT_INIT() \
A_CMN(gmac.gmac_boot_init())
A_CMN(allocram.cmnos_allocram_init((astart), (asize))); \
} while (0)
-#define A_ALLOCRAM(nbytes) A_CMN(allocram.cmnos_allocram(0, (nbytes)))
+#define A_ALLOCRAM(nbytes) A_CMN(allocram.cmnos_allocram(0, (nbytes)))
#define A_ALLOCRAM_DEBUG() A_CMN(allocram.cmnos_allocram_debug())
// struct dbg_api dbg;
//#endif
-#if SYSTEM_MODULE_PCI
- struct pci_api pci;
-#endif
#if SYSTEM_MODULE_GMAC
struct gmac_api gmac;
extern void cmnos_eep_module_install(struct eep_api *);
#endif
-#if SYSTEM_MODULE_PCI
-extern void cmnos_pci_module_install(struct pci_api *);
-#endif
-
extern void cmnos_tasklet_module_install(struct tasklet_api *);
extern void cmnos_string_module_install(struct string_api *tbl);
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "sys_cfg.h"
-
-#if SYSTEM_MODULE_CLOCK
-#include "athos_api.h"
-
-LOCAL A_UINT32 cticks = 0;
-
-#define A_BAND_DEFAULT 0 // not ust now, avoiding compile error/warning, Ryan
-
-LOCAL int curr_band = A_BAND_DEFAULT;
-LOCAL void cmnos_pll_init(void);
-
-/* We accept frequencies within this deviation from an expected frequency. */
-#define A_REFCLK_DEVIATION 800000
-
-#define A_REFCLK_UNKNOWN SYS_CFG_REFCLK_UNKNOWN
-#define A_REFCLK_10_MHZ SYS_CFG_REFCLK_10_MHZ
-#define A_REFCLK_20_MHZ SYS_CFG_REFCLK_20_MHZ
-#define A_REFCLK_40_MHZ SYS_CFG_REFCLK_40_MHZ
-
-LOCAL const struct cmnos_clock_s {
- A_refclk_speed_t refclk_speed;
- A_UINT32 ticks_per_sec;
- // below are useless so far, ryan
- A_UINT32 pll_ctrl_5ghz;
- A_UINT32 pll_ctrl_24ghz;
- A_UINT32 pll_settling_time; /* 50us */
-} cmnos_clocking_table[] = {
- {A_REFCLK_10_MHZ,
- //10485760,
- 10000000,
- 0x0,
- 0x0,
- 0x0},
-
- {A_REFCLK_20_MHZ,
- //20971520,
- 20000000,
- 0x0,
- 0x0,
- 0x0},
-
- {A_REFCLK_40_MHZ,
- //41943040,
- 40000000,
- 0x0,
- 0x0,
- 0x0},
-
- {A_REFCLK_UNKNOWN,
- 0,
- 0x0,
- 0x0,
- 0x0},
-};
-
-
-#define CMNOS_CLOCKING_TABLE_NUM_ENTRIES \
- (sizeof(cmnos_clocking_table)/sizeof(cmnos_clocking_table[0]))
-
-LOCAL struct cmnos_clock_s *clock_info;
-
-
-LOCAL void cmnos_tick(void);
-
-/*
- * In case we have PLL initialization problems, software can arrange
- * (e.g. through BMI) to skip PLL initialization, and other software
- * can handle it.
- */
-int cmnos_skip_pll_init = 0;
-A_UINT32 pll_ctrl_setting_24ghz = 0;
-A_UINT32 pll_ctrl_setting_5ghz = 0;
-
-/*
- * Use default hardware values for clock-related registers.
- * The defaults can be overridden through BMI, EJTAG, or patches.
- *
- * CPU clock frequencies depend on what mode we're in (2.4GHz or 5GHz):
- * NB: AR6001 has a "reduced power" mode, but we don't use it.
- *
- * AR6001/AR6002 FPGA CPU clock is always at 40MHz
- *
- * AR6001 Rev 2.x supports 4 CPU speed selections:
- * selector: 0 1 2 3
- * 2.4GHz: 44, 88, 141, refclk
- * 5 GHz: 40, 80, 128, refclk
- *
- * AR6002 supports 7 CPU/SoC speed selections via CORE_CLK:
- * CORE_CLK.DIV setting: 6,7 5 4 3 2 1 0
- * divisor: 16 14 12 10 8 6 4
- * 2.4GHz (pll at 352MHz): 22 25.1, 29.3, 35.2, 44, 58.7, 88
- * 5 GHz (pll at 320MHz): 20 22.9, 26.7, 32, 40, 53.3, 80
- */
-
-#if defined(DISABLE_SYNC_DURING_PLL_UPDATE_WAR)
-A_UINT32 cpu_clock_setting;
-#endif
-
-//A_COMPILE_TIME_ASSERT(verify_host_interest_small_enough,
-// (sizeof(struct host_interest_s) <= HOST_INTEREST_MAX_SIZE))
-
-//A_COMPILE_TIME_ASSERT(verify_flash_is_present_addr,
-// ((A_UINT32)&HOST_INTEREST->hi_flash_is_present) == FLASH_IS_PRESENT_TARGADDR)
-
-
-LOCAL void
-cmnos_delay_us(int us)
-{
-// A_UINT32 start_time = A_RTC_REG_READ(LF_TIMER_COUNT0_ADDRESS);
-// unsigned int num_LF_ticks = (us+29) / 30 + 1; /* ~30.5us per LF tick */
- //A_UINT32 ref_clk = (clock_info->ticks_per_sec)/1000/1000;
- A_UINT32 ref_clk = (clock_info->ticks_per_sec) >> 20;
- A_UINT32 start_time = NOW();
- unsigned int num_ticks = us*ref_clk; // system_freq == number of ticks per 1us
-
- while ( (NOW() - start_time) < num_ticks) {
- /* busy spin */;
- }
-}
-
-/*
- * Return the number of milliseconds since startup.
- * For this purpose, a "millisecond" is approximated by
- * 1/32 of a 32KHz clock.
- */
-LOCAL A_UINT32
-cmnos_milliseconds(void)
-{
- //unsigned int lowfreq_timer;
-
- //lowfreq_timer = A_RTC_REG_READ(LF_TIMER_COUNT0_ADDRESS);
- //lowfreq_timer = NOW();
-
- /* LF0 timer counts at 32KHz, so adjust to approximate Ms with >> 5. */
- //lowfreq_timer = lowfreq_timer;
-
- /*
- * NB: We do not account for wrap, which occurs every 36
- * hours when the 32768Hz low frequency timer wraps the
- * 32 bit counter.
- */
- cmnos_tick();
-
- return cticks;
-}
-
-
-/* Expect 40MHz on AR6001 and 26MHz on AR6002 */
-//LOCAL A_refclk_speed_t cmnos_refclk_speed;
-
-LOCAL A_UINT32
-cmnos_refclk_speed_get(void)
-{
- return clock_info->ticks_per_sec;
-}
-
-/* The UART is clocked at the reference clock frequency. */
-LOCAL A_UINT32
-cmnos_uart_frequency(void)
-{
-#if 0
-#if defined(FPGA)
- return clock_info->ticks_per_sec;
-#else
- return clock_info->ticks_per_sec;
-#endif
-#else
- /* TBD */
- /* do we need keep a struct to hold the data ?*/
-#endif
-}
-
-
-/*
- * Adjust any state that needs adjusting when the clock
- * speed changes.
- */
-LOCAL void
-cmnos_sysclk_change(void)
-{
- /* OS may override this function */
-}
-
-
-LOCAL void
-cmnos_clockregs_init(void)
-{
- /* TBD */
- /* we might don't need this init() */
-}
-
-/*
- * Make whatever system-level changes are needed in order to operate
- * in the specified wireless band.
- *
- * For AR6K, we just need to set the PLL appropriately.
- */
-LOCAL void
-cmnos_wlan_band_set(int which_band)
-{
- /* TBD */
- /* we don't have wlan need to config */
-}
-
-LOCAL void
-cmnos_pll_init(void)
-{
- /* TBD */
- /* we don't have pll now, */
-}
-
-LOCAL void
-cmnos_clock_init(A_UINT32 ref_clk)
-{
-#if 1
- unsigned int i;
-
- /* Look up the nearest supported frequency. */
- for (i = 0;
- i < CMNOS_CLOCKING_TABLE_NUM_ENTRIES-1;
- i++)
- {
- A_UINT32 ticks_per_sec;
-
- ticks_per_sec = cmnos_clocking_table[i].ticks_per_sec;
- if ((ref_clk > ticks_per_sec - A_REFCLK_DEVIATION) &&
- (ref_clk < ticks_per_sec + A_REFCLK_DEVIATION))
- {
- break;
- }
- }
-
- clock_info = (struct cmnos_clock_s *)&cmnos_clocking_table[i];
-// HOST_INTEREST->hi_clock_info = (A_UINT32)clock_info;
-
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////
-// software emulate ticks on millisecond based
-LOCAL void
-cmnos_tick(void)
-{
-#if 0
-
- set_ccompare0(xthal_get_ccompare(XTENSA_TIMER_0)+ONE_MSEC);
-
- cticks++;
-
-#else
- static A_UINT32 last_tick = 0;
- A_UINT32 current_tick = NOW();
- A_UINT32 delta_tick;
-
- // tick is 32 bit register, will overflow soon
- if( current_tick < last_tick )
- {
- delta_tick = (A_UINT32 )((0xffffffff-last_tick)+current_tick+1)/(1000);
- }
- else
- {
- delta_tick = (A_UINT32 ) (current_tick - last_tick)/(1000);
- }
-
- if( delta_tick > 0 )
- last_tick = current_tick;
-
- cticks += delta_tick;
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////
-
-void
-cmnos_clock_module_install(struct clock_api *tbl)
-{
- tbl->_clock_init = cmnos_clock_init;
- tbl->_clockregs_init = cmnos_clockregs_init;
- tbl->_delay_us = cmnos_delay_us;
- tbl->_wlan_band_set = cmnos_wlan_band_set;
- tbl->_refclk_speed_get = cmnos_refclk_speed_get;
- tbl->_milliseconds = cmnos_milliseconds;
- tbl->_uart_frequency = cmnos_uart_frequency;
- tbl->_sysclk_change = cmnos_sysclk_change;
-
- tbl->_clock_tick = cmnos_tick;
-}
-#endif /* SYSTEM_MODULE_CLOCK */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <adf_os_types.h>
-#include <adf_os_dma.h>
-#include <adf_os_timer.h>
-#include <adf_os_time.h>
-#include <adf_os_lock.h>
-#include <adf_os_io.h>
-#include <adf_os_mem.h>
-#include <adf_os_module.h>
-
-#include <osapi.h>
-#include <Magpie_api.h>
-
-_A_magpie_indirection_table_t _indir_tbl;
-
-int init_htc_tgt(void);
-
-int init_htc_tgt(void)
-{
- /* target-side HIF/HTC/WMI module installation */
- BUF_POOL_MODULE_INSTALL();
- HIF_MODULE_INSTALL();
- HTC_MODULE_INSTALL();
- WMI_SERVICE_MODULE_INSTALL();
-
- adf_os_print("HTC Target Version 1.xx Loaded...\n");
- return 0;
-}
-
-void exit_htc_tgt(void);
-
-void exit_htc_tgt(void)
-{
- adf_os_print("HTC Target UnLoaded...\n");
-}
-
-adf_os_export_symbol(_indir_tbl);
-
-adf_os_virt_module_init(init_htc_tgt);
-adf_os_virt_module_exit(exit_htc_tgt);
-adf_os_module_dep(htc_tgt, adf_net);
-adf_os_module_dep(htc_tgt, inproc_hif);
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __AR6K_HTC_H__
-#define __AR6K_HTC_H__
-
-/* Host/Target Communications for an AR6K Target */
-
-/* Number of mailboxes */
-#define AR6000_MBOX_COUNT 4
-
-/* ------ MBOX ID ------ */
-typedef enum
-{
- ENDPOINT_UNUSED = -1,
- ENDPOINT1 = 0,
- ENDPOINT2,
- ENDPOINT3,
- ENDPOINT4,
-} HTC_ENDPOINT_ID;
-
-
-/* An AR6000 DMA Descriptor. See HTC_descriptor(). */
-struct AR6000_DMA_desc_s {
- A_UINT32 dma_control;
- char *dma_data;
- struct AR6000_DMA_desc_s *dma_next;
-};
-
-
-/*
- * Make a Mailbox DMA descriptor available to HTC.
- *
- * Once made available, there is no way to reclaim this memory.
- * The caller must guarantee that a descriptor exists for each
- * buffer that is used to send or receive. It is expected that
- * the caller will supply a bunch of descriptors once during
- * initialization, and then forget about them. The number of
- * buffers given to HTC for send+recv must never exceed the
- * number of descriptors given to HTC.
- *
- * HTC accesses descriptors via uncached accesses. The caller
- * must guarantee not to place any other data in the same cache
- * line as a DMA descriptor! In practice, this means that the
- * caller should allocate a block of memory for descriptors,
- * and the block should include padding at the start and end
- * to guarantee there will be no other data in the same cache
- * line.
- *
- * It would be far preferable to bury descriptors in the bufinfo
- * structure; but there are practical issues that prevent this.
- * It turns out that the most efficient way to add descriptors
- * to an active DMA engine requires HTC to "own and actively
- * manage" the descriptors. HTC needs to make the association
- * between descriptors and buffers at the last possible moment.
- *
- * extern void _HTC_descriptor(struct AR6000_DMA_desc_s *descriptor);
- */
-
-/*
- * The following interfaces make it easy to allocate suitable
- * descriptors for HTC. During initialization, simply use the
- * HTC_DESCRIPTORS_INIT macro and specify the number of descriptors
- * desired. This number must be a constant, since it is used to
- * declare a static array!
- *
- * The descriptor array is padded with a cache line at the start
- * and another at the end. This avoids false sharing between adjacent
- * cached data and uncached descriptors.
- */
-#define HTC_DESCRIPTOR_SPACE_SIZE(ndescs) \
- (((ndescs) * sizeof(struct AR6000_DMA_desc_s)) + 2*A_CACHE_LINE_SIZE)
-
-#define HTC_DESCRIPTORS_INIT(ndescs) \
-{ \
- static A_UINT8 HTC_descriptor_space[HTC_DESCRIPTOR_SPACE_SIZE(ndescs)]; \
- struct AR6000_DMA_desc_s *desc; \
- int i; \
- \
- A_DATA_CACHE_FLUSH(HTC_descriptor_space, sizeof(HTC_descriptor_space)); \
- \
- desc = (struct AR6000_DMA_desc_s *) \
- A_ROUND_UP((A_UINT32)HTC_descriptor_space, A_CACHE_LINE_SIZE); \
- \
- for (i=0; i<(ndescs); i++) { \
- HTC_descriptor(desc); \
- desc++; \
- } \
-}
-
-#endif /* __AR6K_HTC_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __AR6K_MISC_H__
-#define __AR6K_MISC_H__
-
-/*
- * AR6001: CIS Tuple 0x82, "Board Hardware Configuration Information",
- * is set at chip reset according to board configuration. Bits in this
- * register indicate what type of Host connection is in use. We don't
- * have proper header files to describe tuples, so the offset and layout
- * for the one tuple that firmwware needs is defined here.
- *
- * AR6002: The RESET_TUPLE_STATUS register in the GPIO block holds
- * Board Hardware Configuration Information.
- *
- * If the interface is SDIO, then the "INFO_MASK" must be "SDIO_NORMAL".
- * For debug purposes, a Target with the KeepAlive jumper may be booted
- * before the Host. In this case, INFO_MASK is 0.
- *
- * For NON-SDIO Host interfaces, the INFO_MASK may hold board information.
- *
- * By convention, hostless boards set INTERFACE to SDIO, and INFO to
- * something OTHER than SDIO_NORMAL or 0.
- *
- * Layout of Board HW Cfg Info is below. These values are captured at
- * reset and made available to software.
- *
- * These 3 bits are available on AR6002 via RESET_TUPLE_STATUS_ADDRESS;
- * they are NOT available on AR6001.
- * bit 10: rftest ???
- * bit 9: cmode[1] Bits 9..8 indicate modes as follows:
- * bit 8: cmode[0] 0-->normal
- * 1-->rftest
- * 2-->functional test (ATE)
- * 3-->ATPG/MBIST
- *
- * These 8 bits are available on AR6002 through RESET_TUPLE_STATUS_ADDRESS
- * and on both AR6001 and AR6002 through CIS Tuple 0x82.
- * bit 7: gpio9 (aka hmode0) Bits 7..6 are the "Interface Config bits"
- * bit 6: tdo (aka hmode1)
- * bit 5: clk_req
- * bit 4: sdio_cmd
- * bit 3: sdio_dat[3]
- * bit 2: sdio_dat[2]
- * bit 1: sdio_dat[1]
- * bit 0: sdio_dat[0]
- */
-
-#if defined(RESET_TUPLE_STATUS_ADDRESS)
-#define AR6K_BOARD_HWCFG_CMODE_MASK 0x300
-#define AR6K_BOARD_HWCFG_CMODE_ATE 0x200
-#else
-/*
- * CIS Tuple 0x82 happens to be located at offset 0x13c into CIS registers.
- * This may change across tapeouts, if CIS tuple information changes.
- */
-#define AR6K_BOARD_HWCFG_TUPLE_OFFSET 0x13c
-#endif
-
-#define AR6K_BOARD_HWCFG_INTERFACE_MASK 0xc0
-#define AR6K_BOARD_HWCFG_KEEP_ALIVE_MASK 0x20
-#define AR6K_BOARD_HWCFG_INFO_MASK 0x1f
-
-/* Values for INTERFACE_MASK indicate type of interface */
-#define AR6K_BOARD_HWCFG_SPI 0x00
-#define AR6K_BOARD_HWCFG_SDIO 0x40
-#define AR6K_BOARD_HWCFG_LBCF 0x80
-#define AR6K_BOARD_HWCFG_MSIO 0xc0
-
-#define AR6K_BOARD_HWCFG_SDIO_NORMAL 0x1f
-
-#endif /* __AR6K_MISC_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**
- * @ingroup adf_os_public
- * @file adf_os_bitops.h
- * This file abstracts bit-level operations on a stream of bytes.
- */
-
-#ifndef _ADF_OS_BITOPS_H
-#define _ADF_OS_BITOPS_H
-
-#include <adf_os_types.h>
-
-/**
- * @brief Set a bit atomically
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_set_bit_a(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_set_bit_a(nr, addr);
-}
-
-/**
- * @brief Set a bit
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_set_bit(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_set_bit(nr, addr);
-}
-
-/**
- * @brief Clear a bit atomically
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_clear_bit_a(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_clear_bit_a(nr, addr);
-}
-
-/**
- * @brief Clear a bit
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_clear_bit(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_clear_bit(nr, addr);
-}
-
-/**
- * @brief Toggle a bit atomically
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_change_bit_a(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_change_bit_a(nr, addr);
-}
-
-/**
- * @brief Toggle a bit
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_change_bit(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_change_bit(nr, addr);
-}
-
-/**
- * @brief Test and Set a bit atomically
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_set_bit_a(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_set_bit_a(nr, addr);
-}
-
-/**
- * @brief Test and Set a bit
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_set_bit(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_set_bit(nr, addr);
-}
-
-/**
- * @brief Test and clear a bit atomically
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_clear_bit_a(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_clear_bit_a(nr, addr);
-}
-
-/**
- * @brief Test and clear a bit
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_clear_bit(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_clear_bit(nr, addr);
-}
-
-/**
- * @brief Test and change a bit atomically
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_change_bit_a(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_change_bit_a(nr, addr);
-}
-
-/**
- * @brief Test and clear a bit
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_change_bit(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_change_bit(nr, addr);
-}
-
-/**
- * @brief test_bit - Determine whether a bit is set
- * @param[in] nr bit number to test
- * @param[in] addr Address to start counting from
- *
- * @return 1 if set, 0 if not
- */
-static inline int adf_os_test_bit(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_test_bit(nr, addr);
-}
-
-
-#endif /**_AOD_BITOPS_H*/
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**
- * @ingroup adf_os_public
- * @file adf_os_crypto.h
- * This file defines crypto APIs
- */
-
-#ifndef __ADF_OS_CRYPTO_H
-#define __ADF_OS_CRYPTO_H
-
-#include <adf_os_crypto_pvt.h>
-
-/**
- * @brief Representation of a cipher context.
- */
-typedef __adf_os_cipher_t adf_os_cipher_t;
-
-/**
- * @brief Types of crypto algorithms
- */
-typedef enum adf_os_crypto_alg{
- ADF_OS_CRYPTO_AES = __ADF_OS_CRYPTO_AES,
- ADF_OS_CRYPTO_OTHER = __ADF_OS_CRYPTO_OTHER,
-}adf_os_crypto_alg_t;
-
-
-/**
- * @brief allocate the cipher context
- * @param[in] type crypto algorithm
- *
- * @return the new cipher context
- */
-static inline adf_os_cipher_t
-adf_os_crypto_alloc_cipher(adf_os_crypto_alg_t type)
-{
- return __adf_os_crypto_alloc_cipher(type);
-}
-
-/**
- * @brief free the cipher context
- *
- * @param[in] cipher cipher context
- */
-static inline void
-adf_os_crypto_free_cipher(adf_os_cipher_t cipher)
-{
- __adf_os_crypto_free_cipher(cipher);
-}
-
-/**
- * @brief set the key for cipher context with length keylen
- *
- * @param[in] cipher cipher context
- * @param[in] key key material
- * @param[in] keylen length of key material
- *
- * @return a_uint32_t
- */
-static inline a_uint32_t
-adf_os_crypto_cipher_setkey(adf_os_cipher_t cipher, const a_uint8_t *key, a_uint8_t keylen)
-{
- return __adf_os_crypto_cipher_setkey(cipher, key, keylen);
-}
-
-/**
- * @brief encrypt the data with AES
- *
- * @param[in] cipher cipher context
- * @param[in] src unencrypted data
- * @param[out] dst encrypted data
- */
-static inline void
-adf_os_crypto_rijndael_encrypt(adf_os_cipher_t cipher, const void *src, void *dst)
-{
- __adf_os_crypto_rijndael_encrypt(cipher, src, dst);
-}
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**
- * @ingroup adf_os_public
- * @file adf_os_pseudo.h
- * This file abstracts "pseudo module" semantics.
- */
-#ifndef __ADF_OS_PSEUDO_H
-#define __ADF_OS_PSEUDO_H
-
-#include <adf_os_pseudo_pvt.h>
-
-/**
- * @brief Specify the module's entry point.
- */
-#define adf_os_pseudo_module_init(_fn) __adf_os_pseudo_module_init(_fn)
-
-/**
- * @brief Specify the module's exit point.
- */
-#define adf_os_pseudo_module_exit(_fn) __adf_os_pseudo_module_exit(_fn)
-
-/**
- * @brief Setup the following driver information: name, pseudo IDs of devices
- * supported and some device handlers.
- */
-#define adf_os_pseudo_set_drv_info(_name, _ifname, _pseudo_ids, _attach, _detach, \
- _suspend, _resume) \
- __adf_os_pseudo_set_drv_info(_name, _ifname, _pseudo_ids, \
- _attach, _detach, \
- _suspend, _resume)
-#endif
-
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __ALLOCRAM_API_H__
+#define __ALLOCRAM_API_H__
+
+/* API for Target-side startup-time RAM allocations */
+
+struct allocram_api {
+ /*
+ * Initialize allocram, providing it with a block of RAM
+ * (an "arena") from which to allocate.
+ *
+ * If arena_start is 0, a default start -- the end of
+ * the application's text & data -- is used.
+ *
+ * If arena_sz is 0, a default size -- which uses most
+ * of physical RAM beyond arena_start -- is used.
+ *
+ * Return value is reserved for future use -- it's an arena handle.
+ */
+ void *(* cmnos_allocram_init)(void *arena_start, A_UINT32 arena_sz);
+
+ /*
+ * Allocate nbytes of memory, returning a pointer to the start
+ * of the allocated block. Allocation size is rounded up to the
+ * nearest A_CACHE_LINE_SIZE and the returned address similarly
+ * aligned.
+ *
+ * There is no need to check the return value from this function.
+ * A failure to satisfy a RAM allocation request is treated as a
+ * fatal error.
+ *
+ * Allocations are expected to occur only during startup; this
+ * API does not, for instance, guarantee atomicity with respect
+ * to allocations that might (foolishly) be attempted from
+ * interrupt handlers.
+ *
+ * The "which_arena" parameter is currently unused, and should
+ * be set to 0 -- only a single arena is currently supported.
+ */
+ void *(* cmnos_allocram)(void *which_arena, A_UINT32 nbytes);
+
+ void (* cmnos_allocram_debug)(void);
+};
+
+extern void allocram_module_install(struct allocram_api *api);
+
+
+#endif /* __ALLOCRAM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _ASF_SM_H_
-#define _ASF_SM_H_
-
-typedef void (*asf_sm_fn_t)(void *object, int event);
-
-typedef struct asf_sm_s {
- void * object;
- asf_sm_fn_t fn;
- void * event_arg;
-} asf_sm_t;
-
-static inline void
-asf_sm_init(asf_sm_t *sm, void *object)
-{
- sm->object = object;
-}
-
-static inline void
-asf_sm_set_state(asf_sm_t *sm, asf_sm_fn_t fn)
-{
- sm->fn = fn;
-}
-
-static inline void
-asf_sm_send_event(asf_sm_t *sm, int event)
-{
- sm->fn(sm->object, event);
-}
-
-static inline void
-asf_sm_set_event_arg(asf_sm_t *sm, void *arg)
-{
- sm->event_arg = arg;
-}
-
-static inline void *
-asf_sm_get_event_arg(asf_sm_t *sm)
-{
- return sm->event_arg;
-}
-
-#endif /* _ASF_SM_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __ATHOS_API_H__
+#define __ATHOS_API_H__
+
+/*
+ * This file contains wrappers to OS operating system functions
+ * that are available in the Athos version of the operating system.
+ *
+ * Target software must always use these wrappers to access OS
+ * services -- it may not access any OS services directly.
+ *
+ * These wrappers are intended to provide OS-independence for applications.
+ * Using this header file, an application should be able to compile and
+ * fully link without any other OS header files, source files, or
+ * binary files.
+ */
+
+#include <osapi.h>
+#include "dt_defs.h"
+#include "cmnos_api.h"
+#include "Magpie_api.h"
+
+/* ROM Patch API */
+
+/* save the ROM printf function point */
+extern int (* save_cmnos_printf)(const char * fmt, ...);
+
+extern unsigned int _data_start_in_rom;
+extern unsigned int _data_start;
+extern unsigned int _data_end;
+extern unsigned int _bss_start;
+extern unsigned int _bss_end;
+extern unsigned int _stack_sentry;
+extern unsigned int __stack;
+extern unsigned int _fw_image_end;
+
+#if defined(__XTENSA__)
+#define START_DATA _data_start
+#define END_DATA _data_end
+#define START_BSS _bss_start
+#define END_BSS _bss_end
+
+#define STACK_START _stack_sentry
+#define STACK_END __stack
+#endif
+
+struct _A_os_linkage_check {
+ int version;
+ int table;
+};
+
+/*
+ * A_INIT() handles any initialization needed by the OS abstraction,
+ * and it clears the application's BSS, if necessary. (Application BSS
+ * is not cleared if the application is linked into a single image that
+ * includes AthOS.)
+ *
+ * A_INIT() must be called first thing in the application (from app_start)
+ * in order to guarantee that BSS has been cleared properly.
+ */
+static INLINE int
+A_INIT(void)
+{
+ struct _A_os_linkage_check link_check;
+ unsigned int *clrptr;
+
+ if (&START_BSS != _A_MAGPIE_INDIRECTION_TABLE->cmnos.start_bss) {
+ /* Clear BSS */
+ for (clrptr = &START_BSS; clrptr < &END_BSS; clrptr++) {
+ *clrptr = 0;
+ }
+ }
+
+ /* Copy writable data from flash to RAM. */
+ unsigned int *srcptr, *destptr;
+
+ /*
+ * The _data_start symbol points to the start of data IN FLASH.
+ * It is defined by flash.ld at application link time. If flash.ld
+ * is not used, it is defined (on the link line) as 0.
+ */
+ static int *data_start_addr = &_data_start;
+
+ if (data_start_addr != 0) {
+ for (srcptr = &_data_start, destptr = &START_DATA;
+ destptr < &END_DATA;
+ srcptr++, destptr++) {
+ *destptr = *srcptr;
+ }
+ }
+
+#define OS_LINKAGE_VERSION 4
+ link_check.version = OS_LINKAGE_VERSION;
+ link_check.table = _A_MAGPIE_INDIRECTION_TABLE_SIZE;
+
+ return A_CMN(hal_linkage_check(sizeof(link_check), &link_check));
+}
+
+#endif /* __ATHOS_API_H__ */
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * @File: dma_engine_api.h
+ *
+ * @Abstract: DMA Engine api
+ *
+ * @Notes:
+ */
+
+#ifndef _DMA_ENGINE_API_H
+#define _DMA_ENGINE_API_H
+
+#include <vbuf_api.h>
+#include <vdesc_api.h>
+
+struct zsDmaDesc
+{
+#if 1 // BIG_ENDIAN
+ volatile u16_t ctrl; // Descriptor control
+ volatile u16_t status; // Descriptor status
+ volatile u16_t totalLen; // Total length
+ volatile u16_t dataSize; // Data size
+#else
+ volatile u16_t status; // Descriptor status
+ volatile u16_t ctrl; // Descriptor control
+ volatile u16_t dataSize; // Data size
+ volatile u16_t totalLen; // Total length
+#endif
+ struct zsDmaDesc* lastAddr; // Last address of this chain
+ volatile u32_t dataAddr; // Data buffer address
+ struct zsDmaDesc* nextAddr; // Next TD address
+};
+
+struct zsDmaQueue
+{
+ struct zsDmaDesc* head;
+ struct zsDmaDesc* terminator;
+};
+
+// Subclass of zsDmaQueue for TX
+struct zsTxDmaQueue
+{
+ struct zsDmaDesc* head;
+ struct zsDmaDesc* terminator;
+
+ /* Below are fields specific to TX */
+ VBUF *xmited_buf_head;
+ VBUF *xmited_buf_tail;
+};
+
+/* hardware API table structure (API descriptions below) */
+struct dma_engine_api
+{
+ void (*_init)();
+
+ void (*_init_rx_queue)(struct zsDmaQueue *q);
+
+ void (*_init_tx_queue)(struct zsTxDmaQueue *q);
+
+ void (*_config_rx_queue)(struct zsDmaQueue *q, int num_desc, int buf_size);
+
+ void (*_xmit_buf)(struct zsTxDmaQueue *q, VBUF *buf);
+
+ void (*_flush_xmit)(struct zsDmaQueue *q);
+
+ VBUF* (*_reap_recv_buf)(struct zsDmaQueue *q);
+
+ void (*_return_recv_buf)(struct zsDmaQueue *q, VBUF *buf);
+
+ VBUF* (*_reap_xmited_buf)(struct zsTxDmaQueue *q);
+
+ void (*_swap_data)(struct zsDmaDesc* desc);
+
+ int (*_has_compl_packets)(struct zsDmaQueue *q);
+
+ void (*_desc_dump)(struct zsDmaQueue *q);
+
+ /* The functions below are for patchable */
+ struct zsDmaDesc* (*_get_packet)(struct zsDmaQueue* q);
+ void (*_reclaim_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
+ void (*_put_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
+
+ /* room to expand this table by another table */
+ void *pReserved;
+};
+
+extern void dma_engine_module_install(struct dma_engine_api *apis);
+
+#endif /* #ifndef _DMA_ENGINE_API_H */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __DMA_LIB_H
+#define __DMA_LIB_H
+
+
+/***********************External***************************/
+
+/**
+ * @brief DMA engine numbers, HIF need to map them to there
+ * respective order
+ */
+typedef enum dma_engine{
+ DMA_ENGINE_RX0,
+ DMA_ENGINE_RX1,
+ DMA_ENGINE_RX2,
+ DMA_ENGINE_RX3,
+ DMA_ENGINE_TX0,
+ DMA_ENGINE_TX1,
+ DMA_ENGINE_MAX
+}dma_engine_t;
+
+/**
+ * @brief Interface type, each HIF should call with its own interface type
+ */
+typedef enum dma_iftype{
+ DMA_IF_GMAC = 0x0,/* GMAC */
+ DMA_IF_PCI = 0x1,/*PCI */
+ DMA_IF_PCIE = 0x2 /*PCI Express */
+}dma_iftype_t;
+
+
+struct dma_lib_api{
+ A_UINT16 (*tx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
+ void (*tx_start)(dma_engine_t eng_no);
+ A_UINT16 (*rx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
+ void (*rx_config)(dma_engine_t eng_no, a_uint16_t num_desc,
+ a_uint16_t gran);
+ void (*rx_start)(dma_engine_t eng_no);
+ A_UINT32 (*intr_status)(dma_iftype_t if_type);
+ A_UINT16 (*hard_xmit)(dma_engine_t eng_no, VBUF *buf);
+ void (*flush_xmit)(dma_engine_t eng_no);
+ A_UINT16 (*xmit_done)(dma_engine_t eng_no);
+ VBUF * (*reap_xmitted)(dma_engine_t eng_no);
+ VBUF * (*reap_recv)(dma_engine_t eng_no);
+ void (*return_recv)(dma_engine_t eng_no, VBUF *buf);
+ A_UINT16 (*recv_pkt)(dma_engine_t eng_no);
+};
+
+
+/**
+ * @brief Install the DMA lib api's this for ROM patching
+ * support
+ *
+ * @param apis
+ */
+void dma_lib_module_install(struct dma_lib_api *apis);
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __EEPROM_API_H__
+#define __EEPROM_API_H__
+
+typedef enum {
+ RET_SUCCESS = 0,
+ RET_NOT_INIT,
+ RET_NOT_EXIST,
+ RET_EEP_CORRUPT,
+ RET_EEP_OVERFLOW,
+
+ // add return code from here
+ RET_UNKNOWN
+} T_EEP_RET;
+
+
+/*!- interface of eeprom access
+ *
+ */
+struct eep_api {
+ void (* _eep_init)(void);
+ T_EEP_RET (* _eep_read)(uint16_t, uint16_t, uint16_t *);
+ T_EEP_RET (* _eep_write)(uint16_t, uint16_t, uint16_t *);
+ T_EEP_RET (*_eep_is_exist)(void);
+};
+
+#endif /* __EEPROM_API_H__ */
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * @File: HIF_api.h
+ *
+ * @Abstract: Host Interface api
+ *
+ * @Notes:
+ */
+
+#ifndef _HIF_API_H
+#define _HIF_API_H
+
+#include <adf_nbuf.h>
+
+/* mailbox hw module configuration structure */
+typedef struct _HIF_CONFIG {
+ int dummy;
+} HIF_CONFIG;
+
+typedef struct _HIF_CALLBACK {
+ /* callback when a buffer has be sent to the host*/
+ void (*send_buf_done)(adf_nbuf_t buf, void *context);
+ /* callback when a receive message is received */
+ void (*recv_buf)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);
+ /* context used for all callbacks */
+ void *context;
+} HIF_CALLBACK;
+
+typedef void* hif_handle_t;
+
+/* hardware API table structure (API descriptions below) */
+struct hif_api {
+ hif_handle_t (*_init)(HIF_CONFIG *pConfig);
+
+ void (* _shutdown)(hif_handle_t);
+
+ void (*_register_callback)(hif_handle_t, HIF_CALLBACK *);
+
+ int (*_get_total_credit_count)(hif_handle_t);
+
+ void (*_start)(hif_handle_t);
+
+ void (*_config_pipe)(hif_handle_t handle, int pipe, int creditCount);
+
+ int (*_send_buffer)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
+
+ void (*_return_recv_buf)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
+ //void (*_set_recv_bufsz)(int pipe, int bufsz);
+ //void (*_pause_recv)(int pipe);
+ //void (*_resume_recv)(int pipe);
+ int (*_is_pipe_supported)(hif_handle_t handle, int pipe);
+
+ int (*_get_max_msg_len)(hif_handle_t handle, int pipe);
+
+ int (*_get_reserved_headroom)(hif_handle_t handle);
+
+ void (*_isr_handler)(hif_handle_t handle);
+
+ void (*_get_default_pipe)(hif_handle_t handle, A_UINT8 *pipe_uplink, A_UINT8 *pipe_downlink);
+
+ /* room to expand this table by another table */
+ void *pReserved;
+};
+
+extern void hif_module_install(struct hif_api *apis);
+extern void generic_hif_module_install(struct hif_api *apis);
+
+#endif /* #ifndef _HIF_API_H */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __HIF_GMAC_H
+#define __HIF_GMAC_H
+
+#include <adf_os_types.h>
+#include <hif_api.h>
+
+
+#define ETH_ALEN 6
+#define GMAC_MAX_PKT_LEN 1600
+#define GMAC_MAX_DESC 5
+
+#define GMAC_DISCV_PKT_SZ 60
+#define GMAC_DISCV_WAIT 2000
+
+#define ATH_P_MAGBOOT 0x12 /*Magpie GMAC 18 for boot downloader*/
+#define ATH_P_MAGNORM 0x13 /*Magpie GMAC 19 for HTC & others*/
+
+#define ETH_P_ATH 0x88bd
+
+typedef enum hif_gmac_pipe{
+ HIF_GMAC_PIPE_RX = 1, /*Normal Priority RX*/
+ HIF_GMAC_PIPE_TX = 2, /*Normal Priority TX*/
+}hif_gmac_pipe_t;
+
+struct gmac_api{
+ void (*gmac_boot_init)(void);
+};
+
+void cmnos_gmac_module_install(struct gmac_api *boot_apis);
+void hif_gmac_module_install(struct hif_api *apis);
+
+
+#endif
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __HIF_PCI_H
+#define __HIF_PCI_H
+
+#include <hif_api.h>
+#include <dma_lib.h>
+
+
+#define PCI_MAX_DATA_PKT_LEN 1664
+#define PCI_MAX_CMD_PKT_LEN 512
+#define PCI_MAX_BOOT_DESC 2
+
+typedef enum hif_pci_pipe_rx{
+ HIF_PCI_PIPE_RX0, /*Normal Priority RX*/
+ HIF_PCI_PIPE_RX1,
+ HIF_PCI_PIPE_RX2,
+ HIF_PCI_PIPE_RX3,
+ HIF_PCI_PIPE_RX_MAX
+}hif_pci_pipe_rx_t;
+
+typedef enum hif_pci_pipe_tx{
+ HIF_PCI_PIPE_TX0, /*Normal Priority TX*/
+ HIF_PCI_PIPE_TX1,
+ HIF_PCI_PIPE_TX_MAX
+}hif_pci_pipe_tx_t;
+
+typedef struct __pci_softc{
+ HIF_CALLBACK sw;
+}__pci_softc_t;
+
+struct hif_pci_api{
+ void (*pci_boot_init)(void);
+ hif_handle_t (*pci_init)(HIF_CONFIG *pConfig);
+ void (*pci_reset)(void);
+ void (*pci_enable)(void);
+ void (*pci_reap_xmitted)(__pci_softc_t *sc,
+ dma_engine_t eng_no);
+ void (*pci_reap_recv)(__pci_softc_t *sc, dma_engine_t eng_no);
+ A_UINT8 (*pci_get_pipe)(dma_engine_t eng);
+ dma_engine_t (*pci_get_tx_eng)(hif_pci_pipe_tx_t pipe);
+ dma_engine_t (*pci_get_rx_eng)(hif_pci_pipe_rx_t pipe);
+
+};
+
+void hif_pci_api_install(struct hif_pci_api *apis);
+void hif_pci_module_install(struct hif_api *apis);
+#endif
+
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * @File: mbox_hw.h
+ *
+ * @Abstract: mailbox hardware definitions
+ *
+ * @Notes:
+ */
+
+#ifndef __HIF_USB_H__
+#define __HIF_USB_H__
+
+#include <sys_cfg.h>
+#include <vdesc_api.h>
+//#include <desc.h>
+#include <dma_engine_api.h>
+
+#define HIF_USB_PIPE_TX 1
+#define HIF_USB_PIPE_RX 2
+#define HIF_USB_PIPE_INTERRUPT 3
+#define HIF_USB_PIPE_COMMAND 4
+#define HIF_USB_PIPE_HP_TX 5
+#define HIF_USB_PIPE_MP_TX 6
+
+struct VBUF_QUEUE
+{
+ VBUF *head;
+ VBUF *tail;
+};
+
+ /* the mailbox hardware layer context */
+typedef struct _HIF_USB_CONTEXT {
+ HIF_CALLBACK hifCb;
+ struct zsDmaQueue dnQ;
+ struct zsTxDmaQueue upQ;
+#if SYSTEM_MODULE_HP_EP5
+ struct zsDmaQueue hpdnQ; // high priority
+#endif
+#if SYSTEM_MODULE_HP_EP6
+ struct zsDmaQueue mpdnQ; // medium priority
+#endif
+ //struct VBUF_QUEUE upVbufQ;
+ VBUF *cmdQueue;
+ struct VBUF_QUEUE eventBufQ;
+
+ // Left a door for extension the structure
+ void *pReserved;
+} HIF_USB_CONTEXT;
+
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __INTR_API_H__
+#define __INTR_API_H__
+
+/*
+ * Interrupt handler, for application-managed interrupts.
+ * When an interrupt occurs, it is automatically disabled.
+ * See A_WMAC_INTR_ATTACH() and A_MBOX_INTR_ATTACH().
+ *
+ * If a handler returns A_HANDLER_DONE, the interrupt is
+ * re-enabled. The OS calls the handler next time service
+ * is required. This is the normal case for a handler.
+ *
+ * If a handler returns A_HANDLER_YIELD, the interrupt
+ * remains masked. The handler is called again when
+ * it is "convenient". This gives the OS an opportunity
+ * to run other code/handlers. A handler should return
+ * A_HANDLER_YIELD if it might dominate the CPU for too
+ * long.
+ *
+ * If a handler returns A_HANDLER_NOENABLE, the interrupt
+ * remains disabled. It is up to the application to re-enable
+ * the interrupt (via A_*_INTR_UNMASK) when it's appropriate.
+ *
+ * Note that many combinations of interrupt functions and
+ * interrupt vectors are NOT supported: Callers should use
+ * only the macros defined in cmnos_api.h to access the
+ * interrupt API.
+ */
+#include "cmnos_api.h"
+
+typedef uint32_t A_old_intr_t;
+
+//////////////////////////////////////////////////////////////////
+// this is copied from mercury/cmnos_xtensa.h
+/*
+ * These are CMNOS interrupt manifest constants.
+ * They have specially-chosen values that align with hardware and or
+ * operating system values (see cmnos_interrupt_info).
+ */
+#if defined(__XTENSA__)
+/*
+ * Enumeration of low and medium priority interrupt numbers
+ * which match the CPU hardware configuration:
+ */
+
+/* XTensa Level 1 interrupt */
+#define A_INUM_SOFTWARE 0 /* currently unused */
+
+/* XTensa Level2 interrupts */
+#define A_INUM_XTTIMER 1 /* Tensilica timer */
+#define A_INUM_TBD_2 2 /* TBD */
+#define A_INUM_CPU_WDT 3 /* RST_CPU watchodg interrupt */
+#define A_INUM_TBD_4 4 /* TBD */
+#define A_INUM_TBD_5 5 /* TBD */
+#define A_INUM_TBD_6 6 /* TBD */
+#define A_INUM_CPU_GEN_TIMER 7 /* CPU general timer */
+#define A_INUM_TBD_8 8 /* TBD */
+#define A_INUM_TBD_9 9 /* TBD */
+#define A_INUM_USB_CTRL 10 /* USB core control */
+#define A_INUM_USB_DMA 11 /* USB DMA */
+#define A_INUM_TBD_12 12 /* TBD */
+#define A_INUM_TBD_13 13 /* TBD */
+#define A_INUM_TBD_14 14 /* TBD */
+
+/* Level 3 interrupts */
+#define A_INUM_ERROR 15 /* Errors (e.g. access illegal address) */
+#define A_INUM_TBD_16 16 /* TBD */
+#define A_INUM_MAC 17 /* MAC */
+
+/* Level 5 interrupts */
+#define A_INUM_CPU_NMI 18 /* CPU NMI */
+
+/* Number of interrupts that map directly into CPU/hal interrupt bits. */
+#define NUM_DIRECT_INTR 19
+
+#endif
+//////////////////////////////////////////////////////////////////
+
+#define CMNOS_IMASK_XTTIMER (1<<A_INUM_XTTIMER)
+#define CMNOS_IMASK_CPU_WDT (1<<A_INUM_CPU_WDT)
+#define CMNOS_IMASK_CPU_GEN_TIMER (1<<A_INUM_CPU_GEN_TIMER)
+#define CMNOS_IMASK_USB_CTRL (1<<A_INUM_USB_CTRL)
+#define CMNOS_IMASK_USB_DMA (1<<A_INUM_USB_DMA)
+#define CMNOS_IMASK_ERROR (1<<A_INUM_ERROR)
+#define CMNOS_IMASK_MAC (1<<A_INUM_MAC)
+#define CMNOS_IMASK_CPU_NMI (1<<A_INUM_CPU_NMI)
+
+typedef enum inum_intr {
+ A_INTR_TIMER = 0,
+ A_INTR_USB_CTRL,
+ A_INTR_USB_DMA,
+ A_INTR_ERROR,
+ /* add intr above here */
+ A_INTR_NUM
+} A_INUM_INTR_T;
+
+//////////////////////////////////////////////////////////////////
+
+/*
+ * An interrupt handler, which is a function called in response
+ * to a hardware interrupt, possibly as a Delayed Service Routine.
+ */
+typedef int (* A_handler_t)(void *);
+/* Return values from a handler/DSR, A_handler_t */
+#define A_HANDLER_NOENABLE 0 /* do not re-enable interrupts */
+#define A_HANDLER_DONE 1 /* all intrs handled, call on next intr */
+#define A_HANDLER_YIELD 2 /* leave intrs disabled and
+ call back later regardless of intr state */
+
+/*
+ * An Interrupt Service Routine, which must be called
+ * directly in interrupt context (not delayed), and which
+ * must be very small and may not have access to all OS
+ * functions. These are for use only when interrupt
+ * latency is critical; otherwise, an A_handler_t ("dsr")
+ * is preferable.
+ */
+typedef uint32_t (* A_isr_t)(void *);
+/* Return values from an ISR */
+#if defined(CYG_ISR_HANDLED)
+#define A_ISR_HANDLED CYG_ISR_HANDLED
+#define A_ISR_CALL_DSR CYG_ISR_CALL_DSR
+#else
+#define A_ISR_HANDLED 1
+#define A_ISR_CALL_DSR 2
+#endif
+
+struct intr_api {
+ void (*_intr_init)(void);
+ uint32_t (* _intr_invoke_isr)(uint32_t inum);
+ A_old_intr_t(* _intr_disable)(void);
+ void (* _intr_restore)(A_old_intr_t);
+
+ void (* _intr_mask_inum)(uint32_t inum);
+ void (* _intr_unmask_inum)(uint32_t inum);
+ void (* _intr_attach_isr)(uint32_t inum, A_isr_t isr, void *arg);
+ /* Low-level interrupt access, intended for use by OS modules */
+ unsigned int (* _get_intrenable)(void);
+ void (* _set_intrenable)(unsigned int);
+ unsigned int (* _get_intrpending)(void);
+ void (* _unblock_all_intrlvl)(void);
+};
+
+#endif /* __INTR_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __ALLOCRAM_API_H__
-#define __ALLOCRAM_API_H__
-
-/* API for Target-side startup-time RAM allocations */
-
-struct allocram_api {
- /*
- * Initialize allocram, providing it with a block of RAM
- * (an "arena") from which to allocate.
- *
- * If arena_start is 0, a default start -- the end of
- * the application's text & data -- is used.
- *
- * If arena_sz is 0, a default size -- which uses most
- * of physical RAM beyond arena_start -- is used.
- *
- * Return value is reserved for future use -- it's an arena handle.
- */
- void *(* cmnos_allocram_init)(void *arena_start, A_UINT32 arena_sz);
-
- /*
- * Allocate nbytes of memory, returning a pointer to the start
- * of the allocated block. Allocation size is rounded up to the
- * nearest A_CACHE_LINE_SIZE and the returned address similarly
- * aligned.
- *
- * There is no need to check the return value from this function.
- * A failure to satisfy a RAM allocation request is treated as a
- * fatal error.
- *
- * Allocations are expected to occur only during startup; this
- * API does not, for instance, guarantee atomicity with respect
- * to allocations that might (foolishly) be attempted from
- * interrupt handlers.
- *
- * The "which_arena" parameter is currently unused, and should
- * be set to 0 -- only a single arena is currently supported.
- */
- void *(* cmnos_allocram)(void *which_arena, A_UINT32 nbytes);
-
- void (* cmnos_allocram_debug)(void);
-};
-
-extern void allocram_module_install(struct allocram_api *api);
-
-
-#endif /* __ALLOCRAM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __ATHOS_API_H__
-#define __ATHOS_API_H__
-
-/*
- * This file contains wrappers to OS operating system functions
- * that are available in the Athos version of the operating system.
- *
- * Target software must always use these wrappers to access OS
- * services -- it may not access any OS services directly.
- *
- * These wrappers are intended to provide OS-independence for applications.
- * Using this header file, an application should be able to compile and
- * fully link without any other OS header files, source files, or
- * binary files.
- */
-
-#include <osapi.h>
-#include "dt_defs.h"
-#include "cmnos_api.h"
-#include "Magpie_api.h"
-
-/* ROM Patch API */
-
-/* save the ROM printf function point */
-extern int (* save_cmnos_printf)(const char * fmt, ...);
-
-extern unsigned int _data_start_in_rom;
-extern unsigned int _data_start;
-extern unsigned int _data_end;
-extern unsigned int _bss_start;
-extern unsigned int _bss_end;
-extern unsigned int _stack_sentry;
-extern unsigned int __stack;
-extern unsigned int _fw_image_end;
-
-#if defined(__XTENSA__)
-#define START_DATA _data_start
-#define END_DATA _data_end
-#define START_BSS _bss_start
-#define END_BSS _bss_end
-
-#define STACK_START _stack_sentry
-#define STACK_END __stack
-#endif
-
-struct _A_os_linkage_check {
- int version;
- int table;
-};
-
-/*
- * A_INIT() handles any initialization needed by the OS abstraction,
- * and it clears the application's BSS, if necessary. (Application BSS
- * is not cleared if the application is linked into a single image that
- * includes AthOS.)
- *
- * A_INIT() must be called first thing in the application (from app_start)
- * in order to guarantee that BSS has been cleared properly.
- */
-static INLINE int
-A_INIT(void)
-{
- struct _A_os_linkage_check link_check;
- unsigned int *clrptr;
-
- if (&START_BSS != _A_MAGPIE_INDIRECTION_TABLE->cmnos.start_bss) {
- /* Clear BSS */
- for (clrptr = &START_BSS; clrptr < &END_BSS; clrptr++) {
- *clrptr = 0;
- }
- }
-
- /* Copy writable data from flash to RAM. */
- unsigned int *srcptr, *destptr;
-
- /*
- * The _data_start symbol points to the start of data IN FLASH.
- * It is defined by flash.ld at application link time. If flash.ld
- * is not used, it is defined (on the link line) as 0.
- */
- static int *data_start_addr = &_data_start;
-
- if (data_start_addr != 0) {
- for (srcptr = &_data_start, destptr = &START_DATA;
- destptr < &END_DATA;
- srcptr++, destptr++) {
- *destptr = *srcptr;
- }
- }
-
-#define OS_LINKAGE_VERSION 4
- link_check.version = OS_LINKAGE_VERSION;
- link_check.table = _A_MAGPIE_INDIRECTION_TABLE_SIZE;
-
- return A_CMN(hal_linkage_check(sizeof(link_check), &link_check));
-}
-
-#endif /* __ATHOS_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __CLOCK_API_H__
-#define __CLOCK_API_H__
-
-#define TICK_MSEC_RATIO 1
-#define TICK_TO_MSEC(tick) ((tick)/TICK_MSEC_RATIO)
-#define MSEC_TO_TICK(msec) ((msec)* TICK_MSEC_RATIO)
-
-typedef struct date_s {
- uint16_t miliseconds;
- uint16_t seconds;
- uint16_t minutes;
- uint16_t hours;
-} A_DATE_T;
-
-struct clock_api {
- void (* _clock_init)(A_UINT32 ref_clk);
- void (* _clockregs_init)(void);
- A_UINT32 (* _uart_frequency)(void);
- void (* _delay_us)(int);
- void (* _wlan_band_set)(int);
- A_UINT32 (* _refclk_speed_get)(void);
- A_UINT32 (* _milliseconds)(void);
- void (* _sysclk_change)(uint32_t sys_clk);
- A_UINT32 (* _sysclk_get)(void);
-
- void (* _clock_tick)(void);
-};
-
-#endif /* __CLOCK_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __CMNOS_API_H__
-#define __CMNOS_API_H__
-
-/*
- * This file contains wrappers to OS operating system functions
- * that are available in all versions of the operating system.
- *
- * Target software must always use these wrappers to access OS
- * services -- it may not access any OS services directly.
- */
-
-#include "xtensa/config/core.h"
-#include "xtensa/hal.h"
-#include "xtensa/xtruntime.h"
-#include "sys_cfg.h"
-
-/* cmnos interface */
-#include "printf_api.h"
-#include "uart_api.h"
-#include "dbg_api.h"
-#include "mem_api.h"
-#include "misc_api.h"
-#include "string_api.h"
-#include "timer_api.h"
-#include "romp_api.h"
-#include "allocram_api.h"
-#include "tasklet_api.h"
-#include "clock_api.h"
-#include "intr_api.h"
-#include "wdt_api.h"
-#include "eeprom_api.h"
-#include "usb_api.h"
-
-#if defined(PROJECT_K2)
-#if SYSTEM_MODULE_SFLASH
-#include "sflash_api.h"
-#endif
-#endif
-
-#define AR6K_ROM_START 0x004e0000
-#define AR6K_ROM_ADDR(byte_offset) (AR6K_ROM_START+(byte_offset))
-#define TARG_ROM_ADDRS(byte_offset) AR6K_ROM_ADDR(byte_offset)
-
-#define IML_SIGNAL_UNUSED0_ADDR TARG_ROM_ADDRS(0) /* Cannot be used -- aligned */
-#define IML_SIGNAL_ASSERT_ADDR TARG_ROM_ADDRS(1) /* Signal an assertion failure */
-#define IML_SIGNAL_PRINTF_ADDR TARG_ROM_ADDRS(2) /* Signal a printf request */
-#define IML_SIGNAL_UNUSED4_ADDR TARG_ROM_ADDRS(4) /* Cannot be used -- aligned */
-#define IML_SIGNAL_UNUSED8_ADDR TARG_ROM_ADDRS(8) /* Cannot be used -- aligned */
-#define IML_SIGNAL_UNUSEDC_ADDR TARG_ROM_ADDRS(0xc) /* Cannot be used -- aligned */
-#define IML_SIGNAL_MASK 0xfffe000f
-#define IML_LINENUM_SHIFT 4
-
-#define NOW() xthal_get_ccount()
-
-#if defined(__XTENSA__)
-#define _A_BARRIER asm volatile("memw")
-#else
-#define _A_BARRIER
-#endif
-
-#define A_ASSERT( __bool ) \
- do { \
- if (0 == (__bool)) { \
- (void)*((volatile int *)(IML_SIGNAL_ASSERT_ADDR+(__LINE__<<4)));\
- _A_BARRIER; \
- } \
- } while (0)
-
-
-#define A_IML_IS_ASSERT(vaddr) \
- (((vaddr) & IML_SIGNAL_MASK) == (IML_SIGNAL_ASSERT_ADDR & IML_SIGNAL_MASK))
-
-
-#define PRINT_FAILURE_STATE() \
-do { \
- uint32_t epc1, epc2, epc3, epc4; \
- \
- asm volatile("rsr %0,%1" : "=r" (epc1) : "n" (EPC_1)); \
- asm volatile("rsr %0,%1" : "=r" (epc2) : "n" (EPC_2)); \
- asm volatile("rsr %0,%1" : "=r" (epc3) : "n" (EPC_3)); \
- asm volatile("rsr %0,%1" : "=r" (epc4) : "n" (EPC_4)); \
- \
- A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n", \
- epc1, epc2, epc3, epc4); \
- A_PRINTF("0x%08x, 0x%08x, 0x%08x, \n\r", \
- DEBUG_SYSTEM_STATE, WATCH_DOG_RESET_COUNTER, \
- WATCH_DOG_MAGIC_PATTERN); \
-} while(0)
-////////////////////////////////////////////////////////////////////////////////////
-
-
-//#define A_CMN(sym) _A_OS_INDIRECTION_TABLE->cmnos.sym
-#define A_CMN(sym) _A_MAGPIE_INDIRECTION_TABLE->cmnos.sym
-
-#if SYSTEM_MODULE_MEM
-/* Mem interfaces */
-#define A_MEMSET(addr, value, size) \
- A_CMN(mem._memset((char *)(addr), (int)(value), (int)(size)))
-
-#define A_MEMZERO(addr, size) \
- A_CMN(mem._memset((char *)(addr), (int)0, (int)(size)))
-
-#define A_MEMCPY(dst, src, size) \
- A_CMN(mem._memcpy((char *)(dst), (char *)(src), (int)(size)))
-
-#define A_MEMMOVE(dst, src, size) \
- A_CMN(mem._memmove((char *)(dst), (char *)(src), (int)(size)))
-
-#define A_MEMCMP(p1, p2, nbytes) \
- A_CMN(mem._memcmp)((void *)(p1), (void *)(p2), (int)(nbytes))
-#else
-/* Mem interfaces */
-#define A_MEMSET(addr, value, size)
-
-#define A_MEMZERO(addr, size)
-
-#define A_MEMCPY(dst, src, size)
-
-#define A_MEMMOVE(dst, src, size)
-
-#define A_MEMCMP(p1, p2, nbytes)
-#endif
-
-
-#if 1
- /* String interfaces */
- #define A_STRCPY(dst, src) A_CMN(string._strcpy((dst), (src)))
- #define A_STRNCPY(dst, src, n) A_CMN(string._strncpy((dst), (src), (n)))
- #define A_STRLEN(str) A_CMN(string._strlen(str))
- #define A_STRCMP(str1, str2) A_CMN(string._strcmp((str1), (str2)))
- #define A_STRNCMP(str1, str2, n) A_CMN(string._strncmp((str1), (str2), (n)))
-#endif
-
-#if SYSTEM_MODULE_PRINT
-/* Printf support */
-#define A_PRINTF_INIT() A_CMN(printf._printf_init())
-#define A_PRINTF A_CMN(printf._printf)
-#else
-#define A_PRINTF_INIT()
-#define A_PRINTF
-#endif /* SYSTEM_MODULE_PRINT */
-
-#if SYSTEM_MODULE_UART
-/* Serial port support */
-#define A_UART_INIT() A_CMN(uart._uart_init())
-
-#define A_UART_HWINIT(freq, baud) \
- A_CMN(uart._uart_hwinit((freq), (baud)))
-
-#define A_UART_ENABLED() (HOST_INTEREST->hi_uart_enable)
-
-#define A_PUTS(str) A_CMN(uart._uart_str_out(str))
-
-#define A_PUTC(ch) A_CMN(uart._uart_char_put(ch))
-#define A_GETC(pCh) A_CMN(uart._uart_char_get(pCh))
-
-#define A_UART_TASK() A_CMN(uart._uart_task())
-#define A_UART_CONFIG(x) A_CMN(uart._uart_config(x))
-
-#else
-
-#define A_UART_INIT()
-
-#define A_UART_HWINIT(freq, baud)
-
-#define A_UART_ENABLED()
-
-#define A_PUTS(str)
-
-#define A_PUTC(ch)
-#define A_GETC(pCh)
-
-#define A_UART_TASK()
-#define A_UART_CONFIG(x)
-
-#endif
-
-#if SYSTEM_MODULE_MISC
-/* Reset Support */
-#define A_RESET() A_CMN(misc._system_reset())
-#define A_RESET_MAC() A_CMN(misc._mac_reset())
-
-/* Assertion failure */
-#define A_ASSFAIL(regdump) A_CMN(misc._assfail((regdump)))
-
-/* Report a failure to the Host */
-#define A_REPORT_FAILURE(data, len) \
- A_CMN(misc._report_failure_to_host((data), (len)))
-
-/* UNALIGNED references are used for ASSERTs */
-#define A_MISALIGNED_LOAD_HANDLER(dump) A_CMN(misc._misaligned_load_handler(dump))
-
-/* reture the host interface type */
-#define A_IS_HOST_PRESENT() A_CMN(misc._is_host_present())
-#define A_KBHIT(delay) A_CMN(misc._kbhit(delay))
-#define A_GET_ROM_VER() A_CMN(misc._rom_version_get())
-#else
-/* Reset Support */
-#define A_RESET()
-#define A_RESET_MAC()
-
-/* Assertion failure */
-#define A_ASSFAIL(regdump)
-
-#define A_MISALIGNED_LOAD_HANDLER(dump)
-
-/* Report a failure to the Host */
-#define A_REPORT_FAILURE(data, len)
-
-#define A_IS_HOST_PRESENT()
-#define A_KBHIT(delay)
-#define A_GET_ROM_VER()
-#endif
-
-#if SYSTEM_MODULE_USB
-/* debug Support */
-#define A_USB_INIT() A_CMN(usb._usb_init())
-#define A_USB_ROM_TASK() A_CMN(usb._usb_rom_task())
-#define A_USB_FW_TASK() A_CMN(usb._usb_fw_task())
-#define A_USB_INIT_PHY() A_CMN(usb._usb_init_phy())
-
-#define A_USB_EP0_SETUP() A_CMN(usb._usb_ep0_setup())
-#define A_USB_EP0_TX_DATA() A_CMN(usb._usb_ep0_tx_data())
-#define A_USB_EP0_RX_DATA() A_CMN(usb._usb_ep0_rx_data())
-
-#define A_USB_GET_CONFIG() A_CMN(usb._usb_get_configuration())
-#define A_USB_SET_CONFIG() A_CMN(usb._usb_set_configuration())
-
-#define A_USB_GET_INTERFACE() A_CMN(usb._usb_get_interface())
-#define A_USB_SET_INTERFACE() A_CMN(usb._usb_set_interface())
-
-#define A_USB_STANDARD_CMD() A_CMN(usb._usb_standard_cmd())
-#define A_USB_VENDOR_CMD() A_CMN(usb._usb_vendor_cmd())
-
-#define A_USB_POWER_OFF() A_CMN(usb._usb_power_off())
-#define A_USB_RESET_FIFO() A_CMN(usb._usb_reset_fifo())
-#define A_USB_GEN_WDT() A_CMN(usb._usb_gen_wdt())
-#define A_USB_JUMP_BOOT() A_CMN(usb._usb_jump_boot())
-
-#define A_USB_GET_DESCRIPTOR() A_CMN(usb._usb_get_descriptor())
-#define A_USB_SET_ADDRESS() A_CMN(usb._usb_set_address())
-#define A_USB_SET_FEATURE() A_CMN(usb._usb_set_feature())
-#define A_USB_CLEAR_FEATURE() A_CMN(usb._usb_clr_feature())
-
-#define A_USB_GET_STATUS() A_CMN(usb._usb_get_status())
-#define A_USB_SETUP_DESC() A_CMN(usb._usb_setup_desc())
-#define A_USB_STATUS_IN() A_CMN(usb._usb_status_in())
-#define A_USB_REG_OUT() A_CMN(usb._usb_reg_out())
-
-#define A_USB_EP0_TX() A_CMN(usb._usb_ep0_tx())
-#define A_USB_EP0_RX() A_CMN(usb._usb_ep0_rx())
-#define A_USB_CLK_INIT() A_CMN(usb._usb_clk_init())
-
-#else
-#define A_USB_INIT()
-#define A_USB_TASK()
-#define A_USB_INIT_PHY()
-
-#define A_USB_EP0_SETUP()
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_GET_CONFIG()
-#define A_USB_SET_CONFIG()
-
-#define A_USB_GET_INTERFACE()
-#define A_USB_SET_INTERFACE()
-
-#define A_USB_STANDARD_CMD()
-#define A_USB_VENDOR_CMD()
-
-#define A_USB_POWER_OFF()
-#define A_USB_RESET_FIFO()
-#define A_USB_GEN_WDT()
-#define A_USB_JUMP_BOOT()
-
-#define A_USB_GET_DESCRIPTOR()
-#define A_USB_SET_ADDRESS()
-#define A_USB_SET_FEATURE()
-#define A_USB_CLEAR_FEATURE()
-
-#define A_USB_GET_STATUS()
-#define A_USB_SETUP_DESC()
-
-
-#define A_USB_STATUS_IN()
-#define A_USB_REG_OUT()
-
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_CLK_INIT()
-#endif
-
-#if SYSTEM_MODULE_INTR
-/* Low-level interrupt support intended for use by OS modules */
-#define A_INTR_GET_INTRENABLE() A_CMN(intr._get_intrenable())
-#define A_INTR_SET_INTRENABLE(val) A_CMN(intr._set_intrenable(val))
-#define A_INTR_GET_INTRPENDING() A_CMN(intr._get_intrpending())
-#define A_INTR_UNBLOCK_ALL_INTRLVL() A_CMN(intr._unblock_all_intrlvl())
-
-/* Interrupt support */
-#define A_INTR_INIT() A_CMN(intr._intr_init())
-
-#define A_INTR_DISABLE(pOld) \
- do { \
- *(pOld) = A_CMN(intr._intr_disable()); \
- } while (0)
-
-#define A_INTR_RESTORE(old) A_CMN(intr._intr_restore((old)))
-
-#define A_INVOKE_ISR(inum) A_CMN(intr._intr_invoke_isr(inum))
-
-#define A_INTR_MASK(inum) A_CMN(intr._intr_mask_inum(inum))
-#define A_INTR_UNMASK(inum) A_CMN(intr._intr_unmask_inum(inum))
-
-#define A_ATTACH_ISR(inum, isr, arg) A_CMN(intr._intr_attach_isr(inum, isr, arg))
-#else
-#define A_INTR_INIT()
-#define A_INTR_DISABLE(pOld)
-#define A_INTR_RESTORE(old)
-
-#define A_INTR_GET_INTRENABLE()
-#define A_INTR_SET_INTRENABLE(val)
-#define A_INTR_GET_INTRPENDING()
-#define A_INTR_UNBLOCK_ALL_INTRLVL()
-#define A_INVOKE_ISR(inum)
-#define A_INTR_MASK(inum)
-#define A_INTR_UNMASK(inum)
-#define A_ATTACH_ISR(inum, isr, arg)
-
-#endif
-
-/* Tasklet Support */
-#define A_TASKLET_INIT() A_CMN(tasklet._tasklet_init())
-#define A_TASKLET_INIT_TASK(f, arg, t) A_CMN(tasklet._tasklet_init_task(f, arg, t))
-#define A_TASKLET_DISABLE(t) A_CMN(tasklet._tasklet_disable(t))
-#define A_TASKLET_SCHEDULE(t) A_CMN(tasklet._tasklet_schedule(t))
-#define A_TASKLET_RUN() A_CMN(tasklet._tasklet_run())
-
-
-/* RAM Allocation Support */
-#if defined(__mips__)
-#define alloc_arena_start _end
-#endif
-#if defined(__XTENSA__)
-#define alloc_arena_start _end
-#endif
-
-#if SYSTEM_MODULE_CLOCK
-
-#define A_CLOCK_INIT(refclk_guess) A_CMN(clock._clock_init(refclk_guess))
-#define A_CLOCK_TICK() A_CMN(clock._clock_tick())
-#define A_CLOCK_GET_TICK() A_CMN(clock._clock_get_tick())
-
-/*
- * Get the number of millisecond ticks since the system was started.
- * Note that this only approximates 1Ms. It's actually 32 ticks of
- * a 32KHz clock.
- *
- * Returns a A_UINT32 value.
- */
-#define A_MILLISECONDS() A_CMN(clock._milliseconds())
-
-/*
- * Get the frequency of the reference clock, expressed as
- * an A_refclk_speed_t.
- */
-#define A_REFCLK_SPEED_GET() A_CMN(clock._refclk_speed_get())
-
-/* Spin delay */
-#define A_DELAY_USECS(us) A_CMN(clock._delay_us(us))
-
-#define A_UART_FREQUENCY() A_CMN(clock._uart_frequency())
-
-#define A_CLOCKREGS_INIT() A_CMN(clock._clockregs_init())
-
-/* which_band is either A_BAND_24GHZ or A_BAND_5GHZ */
-#define A_WLAN_BAND_SET(which_band) \
- A_CMN(clock._wlan_band_set(which_band))
-
-/* Called whenever the system clock changes speed */
-#define A_SYSCLK_CHANGE(mhz) A_CMN(clock._sysclk_change(mhz))
-
-#define A_SYSCLK_GET() A_CMN(clock._sysclk_get())
-
-#else
-
-#define A_CLOCK_INIT(refclk_guess)
-#define A_CLOCK_TICK()
-#define A_CLOCK_GET_TICK()
-#define A_MILLISECONDS()
-#define A_REFCLK_SPEED_GET()
-#define A_DELAY_USECS(us)
-#define A_UART_FREQUENCY()
-#define A_CLOCKREGS_INIT()
-#define A_WLAN_BAND_SET(which_band)
-#define A_SYSCLK_CHANGE(mhz)
-#define A_SYSCLK_GET()
-
-#endif
-
-// Timer
-#define A_INIT_TIMER(pTimer, pFunction, pArg) \
- A_CMN(timer._timer_setfn((pTimer), (pFunction), (pArg)))
-
-/* Set a (possibly periodic) timer for "period" Milliseconds. */
-#define A_TIMEOUT_MS(pTimer, period) \
- A_CMN(timer._timer_arm((pTimer), (period)))
-
-#define A_UNTIMEOUT(pTimer) \
- A_CMN(timer._timer_disarm(pTimer))
-
-#define A_TIMER_RUN() \
- A_CMN(timer._timer_run())
-
-#define A_PCI_BOOT_INIT() \
- A_CMN(pci.pci_boot_init())
-
-#define A_GMAC_BOOT_INIT() \
- A_CMN(gmac.gmac_boot_init())
-
-#if SYSTEM_MODULE_ALLOCRAM
-/* Default size of ALLOCRAM area */
-#define ARENA_SZ_DEFAULT 12000
-
-#define A_ALLOCRAM_INIT(arena_start, arena_size) \
- do { \
- extern unsigned int alloc_arena_start; \
- void *astart; \
- int asize; \
- astart = (arena_start) ? (void *)(arena_start) : &alloc_arena_start; \
- asize = (arena_size) ? (arena_size) : (ARENA_SZ_DEFAULT); \
- A_CMN(allocram.cmnos_allocram_init((astart), (asize))); \
- } while (0)
-
-#define A_ALLOCRAM(nbytes) A_CMN(allocram.cmnos_allocram(0, (nbytes)))
-
-#define A_ALLOCRAM_DEBUG() A_CMN(allocram.cmnos_allocram_debug())
-
-#else
-#define A_ALLOCRAM_INIT(arena_start, arena_size)
-#define A_ALLOCRAM(nbytes)
-#define A_ALLOCRAM_DEBUG()
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
-
-#define A_ROMP_INIT() A_CMN(romp._romp_init())
-#define A_ROMP_DOWNLOAD(x) A_CMN(romp._romp_download(x))
-#define A_ROMP_DECODE(addr) A_CMN(romp._romp_decode(addr))
-#define A_ROMP_INSTALL() A_CMN(romp._romp_install())
-#else
-#define A_ROMP_INIT()
-#define A_ROMP_DOWNLOAD(x)
-#define A_ROMP_DECODE(addr)
-#define A_ROMP_INSTALL()
-#endif
-
-#if SYSTEM_MODULE_WDT
-
-#define A_WDT_INIT() A_CMN(wdt_timer._wdt_init())
-#define A_WDT_ENABLE() A_CMN(wdt_timer._wdt_enable())
-#define A_WDT_DISABLE() A_CMN(wdt_timer._wdt_disable())
-#define A_WDT_SET(t) A_CMN(wdt_timer._wdt_set(t))
-#define A_WDT_TASK() A_CMN(wdt_timer._wdt_task())
-#define A_WDT_LASTBOOT() A_CMN(wdt_timer._wdt_last_boot())
-#define A_WDT_RESET() A_CMN(wdt_timer._wdt_reset())
-
-#else
-#define A_WDT_INIT()
-#define A_WDT_ENABLE()
-#define A_WDT_DISABLE()
-#define A_WDT_SET(t)
-#define A_WDT_TASK()
-#define A_WDT_LASTBOOT()
-#define A_WDT_RESET()
-#endif
-
-
-#if SYSTEM_MODULE_EEPROM
-#define A_EEP_INIT() A_CMN(eep._eep_init())
-#define A_EEP_READ(off, len, buf) A_CMN(eep._eep_read(off, len, buf))
-#define A_EEP_WRITE(off, len, buf) A_CMN(eep._eep_write(off, len, buf))
-#define A_EEP_IS_EXIST() A_CMN(eep._eep_is_exist())
-#else
-#define A_EEP_INIT()
-#define A_EEP_READ(off, len, buf)
-#define A_EEP_WRITE(off, len, buf)
-#define A_EEP_IS_EXIST()
-#endif
-
-
-
-struct _A_os_linkage_check; /* OS-dependent */
-
-typedef struct _A_cmnos_indirection_table {
- int (* hal_linkage_check)(int sz, struct _A_os_linkage_check *);
- unsigned int *start_bss;
- void (* app_start)(void);
-
-#if SYSTEM_MODULE_MEM
- struct mem_api mem;
-#endif
-
-#if SYSTEM_MODULE_MISC
- struct misc_api misc;
-#endif
-
-#if SYSTEM_MODULE_PRINT
- struct printf_api printf;
-#endif
-
-#if SYSTEM_MODULE_UART
- struct uart_api uart;
-#endif
-
-#if SYSTEM_MODULE_DBG
-#if !MOVE_DBG_TO_RAM // move to firmware not in cmnos
- struct dbg_api dbg;
-#endif
-#endif
-#if SYSTEM_MODULE_PCI
- struct pci_api pci;
-#endif
-
-#if SYSTEM_MODULE_GMAC
- struct gmac_api gmac;
-#endif
-
-#if SYSTEM_MODULE_USB
- struct usb_api usb;
-#endif
-
-#if SYSTEM_MODULE_CLOCK
- struct clock_api clock;
-#endif
-
-#if SYSTEM_MODULE_TIMER
- struct timer_api timer;
-#endif
-
-#if SYSTEM_MODULE_INTR
- struct intr_api intr;
-#endif
-
-#if SYSTEM_MODULE_ALLOCRAM
- struct allocram_api allocram;
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
- struct romp_api romp;
-#endif
-
-#if SYSTEM_MODULE_WDT
- struct wdt_api wdt_timer;
-#endif
-
-#if SYSTEM_MODULE_EEPROM
- struct eep_api eep;
-#endif
-
- struct string_api string;
- struct tasklet_api tasklet;
-
-} _A_cmnos_indirection_table_t;
-
-/* Module installation for cmnos modules */
-
-#if SYSTEM_MODULE_MEM
-extern void cmnos_mem_module_install(struct mem_api *);
-#endif
-
-#if SYSTEM_MODULE_MISC
-extern void cmnos_misc_module_install(struct misc_api *);
-#endif
-
-#if SYSTEM_MODULE_PRINT
-extern void cmnos_printf_module_install(struct printf_api *);
-#endif
-
-#if SYSTEM_MODULE_UART
-extern void cmnos_uart_module_install(struct uart_api *);
-#endif
-
-#if SYSTEM_MODULE_DBG
-extern void cmnos_dbg_module_install(struct dbg_api *);
-#endif
-
-#if SYSTEM_MODULE_USB
-extern void cmnos_usb_module_install(struct usb_api *);
-#endif
-
-#if SYSTEM_MODULE_INTR
-extern void cmnos_intr_module_install(struct intr_api *);
-#endif
-
-#if SYSTEM_MODULE_CLOCK
-extern void cmnos_clock_module_install(struct clock_api *);
-#endif
-
-#if SYSTEM_MODULE_TIMER
-extern void cmnos_timer_module_install(struct timer_api *);
-#endif
-
-#if SYSTEM_MODULE_ALLOCRAM
-extern void cmnos_allocram_module_install(struct allocram_api *);
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
-extern void cmnos_romp_module_install(struct romp_api *);
-#endif
-
-#if SYSTEM_MODULE_WDT
-extern void cmnos_wdt_module_install(struct wdt_api *);
-#endif
-
-#if SYSTEM_MODULE_EEPROM
-extern void cmnos_eep_module_install(struct eep_api *);
-#endif
-
-#if SYSTEM_MODULE_PCI
-extern void cmnos_pci_module_install(struct pci_api *);
-#endif
-
-extern void cmnos_tasklet_module_install(struct tasklet_api *);
-
-extern void cmnos_string_module_install(struct string_api *tbl);
-
-#endif /* __CMNOS_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: dma_engine_api.h
- *
- * @Abstract: DMA Engine api
- *
- * @Notes:
- */
-
-#ifndef _DMA_ENGINE_API_H
-#define _DMA_ENGINE_API_H
-
-#include <vbuf_api.h>
-#include <vdesc_api.h>
-
-struct zsDmaDesc
-{
-#if 1 // BIG_ENDIAN
- volatile u16_t ctrl; // Descriptor control
- volatile u16_t status; // Descriptor status
- volatile u16_t totalLen; // Total length
- volatile u16_t dataSize; // Data size
-#else
- volatile u16_t status; // Descriptor status
- volatile u16_t ctrl; // Descriptor control
- volatile u16_t dataSize; // Data size
- volatile u16_t totalLen; // Total length
-#endif
- struct zsDmaDesc* lastAddr; // Last address of this chain
- volatile u32_t dataAddr; // Data buffer address
- struct zsDmaDesc* nextAddr; // Next TD address
-};
-
-struct zsDmaQueue
-{
- struct zsDmaDesc* head;
- struct zsDmaDesc* terminator;
-};
-
-// Subclass of zsDmaQueue for TX
-struct zsTxDmaQueue
-{
- struct zsDmaDesc* head;
- struct zsDmaDesc* terminator;
-
- /* Below are fields specific to TX */
- VBUF *xmited_buf_head;
- VBUF *xmited_buf_tail;
-};
-
-/* hardware API table structure (API descriptions below) */
-struct dma_engine_api
-{
- void (*_init)();
-
- void (*_init_rx_queue)(struct zsDmaQueue *q);
-
- void (*_init_tx_queue)(struct zsTxDmaQueue *q);
-
- void (*_config_rx_queue)(struct zsDmaQueue *q, int num_desc, int buf_size);
-
- void (*_xmit_buf)(struct zsTxDmaQueue *q, VBUF *buf);
-
- void (*_flush_xmit)(struct zsDmaQueue *q);
-
- VBUF* (*_reap_recv_buf)(struct zsDmaQueue *q);
-
- void (*_return_recv_buf)(struct zsDmaQueue *q, VBUF *buf);
-
- VBUF* (*_reap_xmited_buf)(struct zsTxDmaQueue *q);
-
- void (*_swap_data)(struct zsDmaDesc* desc);
-
- int (*_has_compl_packets)(struct zsDmaQueue *q);
-
- void (*_desc_dump)(struct zsDmaQueue *q);
-
- /* The functions below are for patchable */
- struct zsDmaDesc* (*_get_packet)(struct zsDmaQueue* q);
- void (*_reclaim_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
- void (*_put_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void dma_engine_module_install(struct dma_engine_api *apis);
-
-#endif /* #ifndef _DMA_ENGINE_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __DMA_LIB_H
-#define __DMA_LIB_H
-
-
-/***********************External***************************/
-
-/**
- * @brief DMA engine numbers, HIF need to map them to there
- * respective order
- */
-typedef enum dma_engine{
- DMA_ENGINE_RX0,
- DMA_ENGINE_RX1,
- DMA_ENGINE_RX2,
- DMA_ENGINE_RX3,
- DMA_ENGINE_TX0,
- DMA_ENGINE_TX1,
- DMA_ENGINE_MAX
-}dma_engine_t;
-
-/**
- * @brief Interface type, each HIF should call with its own interface type
- */
-typedef enum dma_iftype{
- DMA_IF_GMAC = 0x0,/* GMAC */
- DMA_IF_PCI = 0x1,/*PCI */
- DMA_IF_PCIE = 0x2 /*PCI Express */
-}dma_iftype_t;
-
-
-struct dma_lib_api{
- A_UINT16 (*tx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
- void (*tx_start)(dma_engine_t eng_no);
- A_UINT16 (*rx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
- void (*rx_config)(dma_engine_t eng_no, a_uint16_t num_desc,
- a_uint16_t gran);
- void (*rx_start)(dma_engine_t eng_no);
- A_UINT32 (*intr_status)(dma_iftype_t if_type);
- A_UINT16 (*hard_xmit)(dma_engine_t eng_no, VBUF *buf);
- void (*flush_xmit)(dma_engine_t eng_no);
- A_UINT16 (*xmit_done)(dma_engine_t eng_no);
- VBUF * (*reap_xmitted)(dma_engine_t eng_no);
- VBUF * (*reap_recv)(dma_engine_t eng_no);
- void (*return_recv)(dma_engine_t eng_no, VBUF *buf);
- A_UINT16 (*recv_pkt)(dma_engine_t eng_no);
-};
-
-
-/**
- * @brief Install the DMA lib api's this for ROM patching
- * support
- *
- * @param apis
- */
-void dma_lib_module_install(struct dma_lib_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __EEPROM_API_H__
-#define __EEPROM_API_H__
-
-typedef enum {
- RET_SUCCESS = 0,
- RET_NOT_INIT,
- RET_NOT_EXIST,
- RET_EEP_CORRUPT,
- RET_EEP_OVERFLOW,
-
- // add return code from here
- RET_UNKNOWN
-} T_EEP_RET;
-
-
-/*!- interface of eeprom access
- *
- */
-struct eep_api {
- void (* _eep_init)(void);
- T_EEP_RET (* _eep_read)(uint16_t, uint16_t, uint16_t *);
- T_EEP_RET (* _eep_write)(uint16_t, uint16_t, uint16_t *);
- T_EEP_RET (*_eep_is_exist)(void);
-};
-
-#endif /* __EEPROM_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: HIF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _HIF_API_H
-#define _HIF_API_H
-
-#include <adf_nbuf.h>
-
-/* mailbox hw module configuration structure */
-typedef struct _HIF_CONFIG {
- int dummy;
-} HIF_CONFIG;
-
-typedef struct _HIF_CALLBACK {
- /* callback when a buffer has be sent to the host*/
- void (*send_buf_done)(adf_nbuf_t buf, void *context);
- /* callback when a receive message is received */
- void (*recv_buf)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);
- /* context used for all callbacks */
- void *context;
-} HIF_CALLBACK;
-
-typedef void* hif_handle_t;
-
-/* hardware API table structure (API descriptions below) */
-struct hif_api {
- hif_handle_t (*_init)(HIF_CONFIG *pConfig);
-
- void (* _shutdown)(hif_handle_t);
-
- void (*_register_callback)(hif_handle_t, HIF_CALLBACK *);
-
- int (*_get_total_credit_count)(hif_handle_t);
-
- void (*_start)(hif_handle_t);
-
- void (*_config_pipe)(hif_handle_t handle, int pipe, int creditCount);
-
- int (*_send_buffer)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
-
- void (*_return_recv_buf)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
- //void (*_set_recv_bufsz)(int pipe, int bufsz);
- //void (*_pause_recv)(int pipe);
- //void (*_resume_recv)(int pipe);
- int (*_is_pipe_supported)(hif_handle_t handle, int pipe);
-
- int (*_get_max_msg_len)(hif_handle_t handle, int pipe);
-
- int (*_get_reserved_headroom)(hif_handle_t handle);
-
- void (*_isr_handler)(hif_handle_t handle);
-
- void (*_get_default_pipe)(hif_handle_t handle, A_UINT8 *pipe_uplink, A_UINT8 *pipe_downlink);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void hif_module_install(struct hif_api *apis);
-
-#endif /* #ifndef _HIF_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __HIF_GMAC_H
-#define __HIF_GMAC_H
-
-#include <adf_os_types.h>
-#include <hif_api.h>
-
-
-#define ETH_ALEN 6
-#define GMAC_MAX_PKT_LEN 1600
-#define GMAC_MAX_DESC 5
-
-#define GMAC_DISCV_PKT_SZ 60
-#define GMAC_DISCV_WAIT 2000
-
-#define ATH_P_MAGBOOT 0x12 /*Magpie GMAC 18 for boot downloader*/
-#define ATH_P_MAGNORM 0x13 /*Magpie GMAC 19 for HTC & others*/
-
-#define ETH_P_ATH 0x88bd
-
-typedef enum hif_gmac_pipe{
- HIF_GMAC_PIPE_RX = 1, /*Normal Priority RX*/
- HIF_GMAC_PIPE_TX = 2, /*Normal Priority TX*/
-}hif_gmac_pipe_t;
-
-struct gmac_api{
- void (*gmac_boot_init)(void);
-};
-
-void cmnos_gmac_module_install(struct gmac_api *boot_apis);
-void hif_gmac_module_install(struct hif_api *apis);
-
-
-#endif
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __HIF_PCI_H
-#define __HIF_PCI_H
-
-#include <hif_api.h>
-
-
-#define PCI_MAX_PKT_LEN 1600
-#define PCI_MAX_DESC 2
-
-typedef enum hif_pci_pipe_rx{
- HIF_PCI_PIPE_RX0, /*Normal Priority RX*/
- HIF_PCI_PIPE_RX1,
- HIF_PCI_PIPE_RX2,
- HIF_PCI_PIPE_RX3,
- HIF_PCI_PIPE_RX_MAX
-}hif_pci_pipe_rx_t;
-
-typedef enum hif_pci_pipe_tx{
- HIF_PCI_PIPE_TX0, /*Normal Priority TX*/
- HIF_PCI_PIPE_TX1,
- HIF_PCI_PIPE_TX_MAX
-}hif_pci_pipe_tx_t;
-
-struct pci_api{
- void (*pci_boot_init)(void);
-};
-
-void cmnos_pci_module_install(struct pci_api *apis);
-void hif_pci_module_install(struct hif_api *apis);
-#endif
-
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: mbox_hw.h
- *
- * @Abstract: mailbox hardware definitions
- *
- * @Notes:
- */
-
-#ifndef __HIF_USB_H__
-#define __HIF_USB_H__
-
-#include <sys_cfg.h>
-#include <vdesc_api.h>
-//#include <desc.h>
-#include <dma_engine_api.h>
-
-#define HIF_USB_PIPE_TX 1
-#define HIF_USB_PIPE_RX 2
-#define HIF_USB_PIPE_INTERRUPT 3
-#define HIF_USB_PIPE_COMMAND 4
-#define HIF_USB_PIPE_HP_TX 5
-#define HIF_USB_PIPE_MP_TX 6
-
-struct VBUF_QUEUE
-{
- VBUF *head;
- VBUF *tail;
-};
-
- /* the mailbox hardware layer context */
-typedef struct _HIF_USB_CONTEXT {
- HIF_CALLBACK hifCb;
- struct zsDmaQueue dnQ;
- struct zsTxDmaQueue upQ;
-#if SYSTEM_MODULE_HP_EP5
- struct zsDmaQueue hpdnQ; // high priority
-#endif
-#if SYSTEM_MODULE_HP_EP6
- struct zsDmaQueue mpdnQ; // medium priority
-#endif
- //struct VBUF_QUEUE upVbufQ;
- VBUF *cmdQueue;
- struct VBUF_QUEUE eventBufQ;
-
- // Left a door for extension the structure
- void *pReserved;
-} HIF_USB_CONTEXT;
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __INTR_API_H__
-#define __INTR_API_H__
-
-/*
- * Interrupt handler, for application-managed interrupts.
- * When an interrupt occurs, it is automatically disabled.
- * See A_WMAC_INTR_ATTACH() and A_MBOX_INTR_ATTACH().
- *
- * If a handler returns A_HANDLER_DONE, the interrupt is
- * re-enabled. The OS calls the handler next time service
- * is required. This is the normal case for a handler.
- *
- * If a handler returns A_HANDLER_YIELD, the interrupt
- * remains masked. The handler is called again when
- * it is "convenient". This gives the OS an opportunity
- * to run other code/handlers. A handler should return
- * A_HANDLER_YIELD if it might dominate the CPU for too
- * long.
- *
- * If a handler returns A_HANDLER_NOENABLE, the interrupt
- * remains disabled. It is up to the application to re-enable
- * the interrupt (via A_*_INTR_UNMASK) when it's appropriate.
- *
- * Note that many combinations of interrupt functions and
- * interrupt vectors are NOT supported: Callers should use
- * only the macros defined in cmnos_api.h to access the
- * interrupt API.
- */
-#include "cmnos_api.h"
-
-typedef uint32_t A_old_intr_t;
-
-//////////////////////////////////////////////////////////////////
-// this is copied from mercury/cmnos_xtensa.h
-/*
- * These are CMNOS interrupt manifest constants.
- * They have specially-chosen values that align with hardware and or
- * operating system values (see cmnos_interrupt_info).
- */
-#if defined(__XTENSA__)
-/*
- * Enumeration of low and medium priority interrupt numbers
- * which match the CPU hardware configuration:
- */
-
-/* XTensa Level 1 interrupt */
-#define A_INUM_SOFTWARE 0 /* currently unused */
-
-/* XTensa Level2 interrupts */
-#define A_INUM_XTTIMER 1 /* Tensilica timer */
-#define A_INUM_TBD_2 2 /* TBD */
-#define A_INUM_CPU_WDT 3 /* RST_CPU watchodg interrupt */
-#define A_INUM_TBD_4 4 /* TBD */
-#define A_INUM_TBD_5 5 /* TBD */
-#define A_INUM_TBD_6 6 /* TBD */
-#define A_INUM_CPU_GEN_TIMER 7 /* CPU general timer */
-#define A_INUM_TBD_8 8 /* TBD */
-#define A_INUM_TBD_9 9 /* TBD */
-#define A_INUM_USB_CTRL 10 /* USB core control */
-#define A_INUM_USB_DMA 11 /* USB DMA */
-#define A_INUM_TBD_12 12 /* TBD */
-#define A_INUM_TBD_13 13 /* TBD */
-#define A_INUM_TBD_14 14 /* TBD */
-
-/* Level 3 interrupts */
-#define A_INUM_ERROR 15 /* Errors (e.g. access illegal address) */
-#define A_INUM_TBD_16 16 /* TBD */
-#define A_INUM_MAC 17 /* MAC */
-
-/* Level 5 interrupts */
-#define A_INUM_CPU_NMI 18 /* CPU NMI */
-
-/* Number of interrupts that map directly into CPU/hal interrupt bits. */
-#define NUM_DIRECT_INTR 19
-
-#endif
-//////////////////////////////////////////////////////////////////
-
-#define CMNOS_IMASK_XTTIMER (1<<A_INUM_XTTIMER)
-#define CMNOS_IMASK_CPU_WDT (1<<A_INUM_CPU_WDT)
-#define CMNOS_IMASK_CPU_GEN_TIMER (1<<A_INUM_CPU_GEN_TIMER)
-#define CMNOS_IMASK_USB_CTRL (1<<A_INUM_USB_CTRL)
-#define CMNOS_IMASK_USB_DMA (1<<A_INUM_USB_DMA)
-#define CMNOS_IMASK_ERROR (1<<A_INUM_ERROR)
-#define CMNOS_IMASK_MAC (1<<A_INUM_MAC)
-#define CMNOS_IMASK_CPU_NMI (1<<A_INUM_CPU_NMI)
-
-typedef enum inum_intr {
- A_INTR_TIMER = 0,
- A_INTR_USB_CTRL,
- A_INTR_USB_DMA,
- A_INTR_ERROR,
- /* add intr above here */
- A_INTR_NUM
-} A_INUM_INTR_T;
-
-//////////////////////////////////////////////////////////////////
-
-/*
- * An interrupt handler, which is a function called in response
- * to a hardware interrupt, possibly as a Delayed Service Routine.
- */
-typedef int (* A_handler_t)(void *);
-/* Return values from a handler/DSR, A_handler_t */
-#define A_HANDLER_NOENABLE 0 /* do not re-enable interrupts */
-#define A_HANDLER_DONE 1 /* all intrs handled, call on next intr */
-#define A_HANDLER_YIELD 2 /* leave intrs disabled and
- call back later regardless of intr state */
-
-/*
- * An Interrupt Service Routine, which must be called
- * directly in interrupt context (not delayed), and which
- * must be very small and may not have access to all OS
- * functions. These are for use only when interrupt
- * latency is critical; otherwise, an A_handler_t ("dsr")
- * is preferable.
- */
-typedef uint32_t (* A_isr_t)(void *);
-/* Return values from an ISR */
-#if defined(CYG_ISR_HANDLED)
-#define A_ISR_HANDLED CYG_ISR_HANDLED
-#define A_ISR_CALL_DSR CYG_ISR_CALL_DSR
-#else
-#define A_ISR_HANDLED 1
-#define A_ISR_CALL_DSR 2
-#endif
-
-struct intr_api {
- void (*_intr_init)(void);
- uint32_t (* _intr_invoke_isr)(uint32_t inum);
- A_old_intr_t(* _intr_disable)(void);
- void (* _intr_restore)(A_old_intr_t);
-
- void (* _intr_mask_inum)(uint32_t inum);
- void (* _intr_unmask_inum)(uint32_t inum);
- void (* _intr_attach_isr)(uint32_t inum, A_isr_t isr, void *arg);
- /* Low-level interrupt access, intended for use by OS modules */
- unsigned int (* _get_intrenable)(void);
- void (* _set_intrenable)(unsigned int);
- unsigned int (* _get_intrpending)(void);
- void (* _unblock_all_intrlvl)(void);
-};
-
-#endif /* __INTR_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*************************************************************************/
-/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : mem_addrs.h */
-/* */
-/* Abstract */
-/* This file contains definition of the memory related information. */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _MEM_ADDRS_H_
-#define _MEM_ADDRS_H_
-
-#define SYS_ROM_BLOCK_SIZE (32*1024)
-#if MAGPIE_FPGA_RAM_256K == 1
-#define SYS_ROM_BLOCK_NUM 2 //ram 256K version is also rom 64k version
-#else
-#define SYS_ROM_BLOCK_NUM 3
-#endif
-#define SYS_ROM_SIZE (SYS_ROM_BLOCK_SIZE*SYS_ROM_BLOCK_NUM)
-
-#if MAGPIE_FPGA_RAM_256K == 1
-#define SYS_RAM_BLOCK_SIZE 64*1024
-#else
-#define SYS_RAM_BLOCK_SIZE 40*1024
-#endif
-
-#define SYS_RAM_BLOCK_NUM 4
-#define SYS_RAM_SZIE (SYS_RAM_BLOCK_SIZE*SYS_RAM_BLOCK_NUM)
-
-/* instruction port area */
-#define SYS_I_R0M_REGION_0_BASE 0x8e0000
-
-#define SYS_I_RAM_REGION_0_BASE 0x900000
-#define SYS_I_RAM_REGION_1_BASE (SYS_I_RAM_REGION_0_BASE+SYS_RAM_BLOCK_SIZE)
-#define SYS_I_RAM_REGION_2_BASE (SYS_I_RAM_REGION_1_BASE+SYS_RAM_BLOCK_SIZE)
-#define SYS_I_RAM_REGION_3_BASE (SYS_I_RAM_REGION_2_BASE+SYS_RAM_BLOCK_SIZE)
-
-/* data port area */
-#define SYS_D_R0M_REGION_0_BASE 0x4e0000
-
-#define SYS_D_RAM_REGION_0_BASE 0x500000
-#define SYS_D_RAM_REGION_1_BASE (SYS_D_RAM_REGION_0_BASE+SYS_RAM_BLOCK_SIZE)
-#define SYS_D_RAM_REGION_2_BASE (SYS_D_RAM_REGION_1_BASE+SYS_RAM_BLOCK_SIZE)
-#define SYS_D_RAM_REGION_3_BASE (SYS_D_RAM_REGION_2_BASE+SYS_RAM_BLOCK_SIZE)
-
-/* data and bss section */
-
-#define SYS_D_RAM_DATA_BSS SYS_D_RAM_REGION_0_BASE
-#define SYS_D_RAM_DATA_BSS_SZ SYS_RAM_BLOCK_SIZE
-#define SYS_D_RAM_STACK_SIZE (2*1024)
-
-/////////////////////////////////////////////////////////////////////////////////////
-#define EEPROM_CTRL_BASE 0x10ff0000
-#define EEPROM_ADDR_BASE (EEPROM_CTRL_BASE+0x2000)
-
-#define EEPROM_SIZE 0xfff // 4K addressing space, each has 2 bytes, (a half word)
-#define EEPROM_START_OFFSET 0 // THIS SHOULD NOT MODIFY
-#define EEPROM_END_OFFSET (EEPROM_START_OFFSET+EEPROM_SIZE) // end of the eeprom offset
-
-/////////////////////////////////////////////////////////////////////////////////////
-#define EEPROM_USB_DESCRIPTOR_ADDR ((uint32_t)&_bss_end) // address at RAM to put descriptor data
-#define USB_DESC_START_ADDR 0x780
-#define USB_DESCRIPTOR_ADDR USB_DESC_START_ADDR // eeprom offset to sotre the descriptor data
-
-#define USB_DESC_IN_EEPROM_SIZE 2 // indicate eeprom is exist in eeprom
-#define USB_DEVICE_DESCRIPTOR_SIZE 16 // Device Descriptor
-#define USB_STRING00_DESCRIPTOR_SIZE 6 // 16 half word
-#define USB_STRING10_DESCRIPTOR_SIZE 12 // Manufacture data
-#define USB_STRING20_DESCRIPTOR_SIZE 16 // Product/Company data
-#define USB_STRING30_DESCRIPTOR_SIZE 8 // Serial Number
-
-#define USB_DEVICE_PID_SIZE 1 // PID SIZE, 1 halfword offset
-#define USB_DEVICE_VID_SIZE 1 // VID SIZE, 1 halfword offset
-
-#define USB_DESC_IN_EEPROM_FLAG_OFFSET USB_DESCRIPTOR_ADDR
-#define USB_DEVICE_DESCRIPTOR_OFFSET (USB_DESC_IN_EEPROM_FLAG_OFFSET+USB_DESC_IN_EEPROM_SIZE)
-#define USB_STRING00_DESCRIPTOR_OFFSET (USB_DEVICE_DESCRIPTOR_OFFSET+USB_DEVICE_DESCRIPTOR_SIZE)
-#define USB_STRING10_DESCRIPTOR_OFFSET (USB_STRING00_DESCRIPTOR_OFFSET+USB_STRING00_DESCRIPTOR_SIZE)
-#define USB_STRING20_DESCRIPTOR_OFFSET (USB_STRING10_DESCRIPTOR_OFFSET+USB_STRING10_DESCRIPTOR_SIZE)
-#define USB_STRING30_DESCRIPTOR_OFFSET (USB_STRING20_DESCRIPTOR_OFFSET+USB_STRING20_DESCRIPTOR_SIZE)
-
-#define USB_DEVICE_VID_OFFSET (USB_DEVICE_DESCRIPTOR_OFFSET+4)
-#define USB_DEVICE_PID_OFFSET (USB_DEVICE_VID_OFFSET+USB_DEVICE_VID_SIZE)
-
-#define USB_DESC_IN_EEPROM_FLAG_ADDR EEPROM_USB_DESCRIPTOR_ADDR
-#define USB_DEVICE_DESCRIPTOR_ADDR (USB_DESC_IN_EEPROM_FLAG_ADDR+(USB_DESC_IN_EEPROM_SIZE*2))
-#define USB_STRING00_DESCRIPTOR_ADDR (USB_DEVICE_DESCRIPTOR_ADDR+(USB_DEVICE_DESCRIPTOR_SIZE*2))
-#define USB_STRING10_DESCRIPTOR_ADDR (USB_STRING00_DESCRIPTOR_ADDR+(USB_STRING00_DESCRIPTOR_SIZE*2))
-#define USB_STRING20_DESCRIPTOR_ADDR (USB_STRING10_DESCRIPTOR_ADDR+(USB_STRING10_DESCRIPTOR_SIZE*2))
-#define USB_STRING30_DESCRIPTOR_ADDR (USB_STRING20_DESCRIPTOR_ADDR+(USB_STRING20_DESCRIPTOR_SIZE*2))
-
-#define USB_DEVICE_VID_ADDR (USB_DEVICE_DESCRIPTOR_ADDR+4)
-#define USB_DEVICE_PID_ADDR (USB_DEVICE_VID_ADDR+USB_DEVICE_VID_SIZE)
-
-#define USB_DESC_IN_EEP_PATTERN 0x41544852 //ATHR
-
-/****************************** patch in eeprom *****************************************/
-#define ROM_PATCH_EEPROM_SIZE 2 // 4 bytes
-
-#define ROM_PATCH_EEPROM_OFFSET 0xfc
-#define ROM_PATCH_BUF_ADDR SYS_D_RAM_REGION_3_BASE
-
-#endif /* _MEM_ADDRS_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __MAGPIE_REGDUMP_H__
-#define __MAGPIE_REGDUMP_H__
-
-#if !defined(__ASSEMBLER__)
-/*
- * XTensa CPU state
- * This must match the state saved by the target exception handler.
- */
-struct XTensa_exception_frame_s {
- uint32_t xt_pc;
- uint32_t xt_ps;
- uint32_t xt_sar;
- uint32_t xt_vpri;
- uint32_t xt_a2;
- uint32_t xt_a3;
- uint32_t xt_a4;
- uint32_t xt_a5;
- uint32_t xt_exccause;
- uint32_t xt_lcount;
- uint32_t xt_lbeg;
- uint32_t xt_lend;
-
- /* Extra info to simplify post-mortem stack walkback */
-#define MAGPIE_REGDUMP_FRAMES 5
- struct {
- uint32_t a0; /* pc */
- uint32_t a1; /* sp */
- uint32_t a2;
- uint32_t a3;
- } wb[MAGPIE_REGDUMP_FRAMES];
-};
-
-typedef struct XTensa_exception_frame_s CPU_exception_frame_t;
-#define RD_SIZE sizeof(CPU_exception_frame_t)
-
-#endif
-#endif /* __MAGPIE_REGDUMP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __MEM_API_H__
-#define __MEM_API_H__
-
-struct mem_api {
- void (* _mem_init)(void);
- void *(* _memset)(void *, int, unsigned int);
- void *(* _memcpy)(void *, const void *, unsigned int);
- void *(* _memmove)(void *, const void *, unsigned int);
- int (* _memcmp)(const void *, const void *, unsigned int);
-};
-
-#endif /* __MEM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __MISC_API_H__
-#define __MISC_API_H__
-
-enum hostif_s{
- HIF_USB = 0,
- HIF_PCIE,
- HIF_GMAC,
- HIF_PCI,
-
- // HIF should be added above here
- HIF_NUM,
- HIF_NONE
-
-};
-
-typedef enum hostif_s A_HOSTIF;
-
-struct register_dump_s;
-
-struct misc_api {
- void (* _system_reset)(void);
- void (* _mac_reset)(void);
- void (* _assfail)(struct register_dump_s *);
- void (* _misaligned_load_handler)(struct register_dump_s *);
-
- void (* _report_failure_to_host)(struct register_dump_s *, int);
- int (* _target_id_get)(void);
- A_HOSTIF (* _is_host_present)(void);
-
- uint8_t (*_kbhit)(uint8_t);
-
- uint16_t (* _rom_version_get)(void);
-};
-
-#endif /* __MISC_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#define AH_SUPPORT_AR5416 1
-#define AH_SUPPORT_2133 1
-#define AH_SUPPORT_5413 1
-#define AH_DEBUG 1
-#define AR5416_EMULATION 1
-#define ATH_FORCE_PPM 1
-#define ATH_FORCE_BIAS 1
-#define AH_SUPPORT_DFS 1
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __PRINTF_API_H__
-#define __PRINTF_API_H__
-
-struct printf_api {
- void (* _printf_init)(void);
- int (* _printf)(const char * fmt, ...);
-};
-
-/* NB: The printf module requires the serial module. */
-void cmnos_printf_module_install(struct printf_api *tbl);
-
-
-#endif /* __PRINTF_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __REGDUMP_H__
-#define __REGDUMP_H__
-
-#include "magpie_regdump.h"
-
-
-#if !defined(__ASSEMBLER__)
-
-/*
- * XTensa CPU state
- * This must match the state saved by the target exception handler.
- */
-
-#define RD_SIZE sizeof(CPU_exception_frame_t)
-
-/*
- * Target CPU state at the time of failure is reflected
- * in a register dump, which the Host can fetch through
- * the diagnostic window.
- */
-struct register_dump_s {
- uint32_t target_id; /* Target ID */
- uint32_t assline; /* Line number (if assertion failure) */
- uint32_t pc; /* Program Counter at time of exception */
- uint32_t badvaddr; /* Virtual address causing exception */
- CPU_exception_frame_t exc_frame; /* CPU-specific exception info */
-
- /* Could copy top of stack here, too.... */
-};
-
-#endif /* __ASSEMBLER__ */
-#endif /* __REGDUMP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*************************************************************************/
-/* Copyright (c) 2008 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : romp_api.h */
-/* */
-/* Abstract */
-/* This file contains definition of data structure and interface */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _ROMP_API_H_
-#define _ROMP_API_H_
-
-#include "dt_defs.h"
-
-/******** hardware API table structure (API descriptions below) *************/
-
-struct romp_api {
- void (*_romp_init)(void);
- BOOLEAN (*_romp_download)(uint16_t );
- BOOLEAN (*_romp_install)(void);
- BOOLEAN (*_romp_decode)(uint32_t );
-};
-
-#define _ROMP_MAGIC_ "[PaTcH]"
-
-struct rom_patch_st {
- uint16_t crc16; // crc filed to maintain the integrity
- uint16_t len; // length of the patch code
- uint32_t ld_addr; // load address of the patch code
- uint32_t fun_addr; // entry address of the patch code
- uint8_t *pfun; // patch code
-};
-
-
-struct eep_redir_addr {
- uint16_t offset;
- uint16_t size;
-};
-
-/************************* EXPORT function ***************************/
-uint16_t cal_crc16(uint32_t sz, uint8_t *p);
-
-#endif // end of _UART_API_H_
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __STRING_API_H__
-#define __STRING_API_H__
-
-struct string_api {
- void (* _string_init)(void);
- char *(* _strcpy)(char *, const char *);
- char *(* _strncpy)(char *, const char *, unsigned int);
- int (* _strlen)(const char *);
- int (* _strcmp)(const char *, const char *);
- int (* _strncmp)(const char *, const char *, unsigned int);
-};
-
-#endif /* __STRING_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __TASKLET_API_H__
-#define __TASKLET_API_H__
-
-typedef void (*A_TASKLET_FUNC)(void *arg);
-
-#define A_TASKLET_STATE_DISABLE 0
-#define A_TASKLET_STATE_SCHEDULED 1
-#define A_TASKLET_STATE_RUNNING 2
-
-struct _tasklet {
- A_TASKLET_FUNC func;
- void *arg;
- int state;
- struct _tasklet *next;
-};
-
-typedef struct _tasklet A_tasklet_t;
-
-struct tasklet_api {
- void (* _tasklet_init)(void);
- void (* _tasklet_init_task)(A_TASKLET_FUNC, void * arg, A_tasklet_t *);
- void (* _tasklet_disable)(A_tasklet_t *);
- void (* _tasklet_schedule)(A_tasklet_t *);
- void (* _tasklet_run)(void);
-};
-#endif /* __TASKLET_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __TIMER_API_H__
-#define __TIMER_API_H__
-/*
- * In order to remain completely independent of OS header files,
- * "_SPACE" structures are declared with sufficient room to hold
- * corresponding OS structures.
- */
-typedef unsigned int _A_TIMER_SPACE[5];
-typedef _A_TIMER_SPACE A_timer_t;
-#define A_TIMER A_timer_t /* historical */
-
-typedef unsigned int A_HANDLE; /* historical */
-typedef void A_TIMER_FUNC(A_HANDLE timer_handle, void *arg);
-
-struct timer_api {
- void (* _timer_init)(void);
- void (* _timer_arm)(A_timer_t *, unsigned int);
- void (* _timer_disarm)(A_timer_t *);
- void (* _timer_setfn)(A_timer_t *, A_TIMER_FUNC, void *);
- void (* _timer_run)(void);
-};
-#endif /* __TIMER_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*************************************************************************/
-/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : uart.h */
-/* */
-/* Abstract */
-/* This file contains definition of uart registers, marco and api. */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _UART_API_H_
-#define _UART_API_H_
-
-#include "k2/reg_defs.h"
-
-/************************** Register deinition ***************************/
-#define RBR_ADDRESS 0x00051000
-#define RBR_OFFSET 0x00000000
-#define RBR_RBR_MSB 7
-#define RBR_RBR_LSB 0
-#define RBR_RBR_MASK 0x000000ff
-#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB)
-#define RBR_RBR_SET(x) (((x) << RBR_RBR_LSB) & RBR_RBR_MASK)
-
-#define THR_ADDRESS 0x00051000
-#define THR_OFFSET 0x00000000
-#define THR_THR_MSB 7
-#define THR_THR_LSB 0
-#define THR_THR_MASK 0x000000ff
-#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB)
-#define THR_THR_SET(x) (((x) << THR_THR_LSB) & THR_THR_MASK)
-
-#define DLL_ADDRESS 0x00051000
-#define DLL_OFFSET 0x00000000
-#define DLL_DLL_MSB 7
-#define DLL_DLL_LSB 0
-#define DLL_DLL_MASK 0x000000ff
-#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB)
-#define DLL_DLL_SET(x) (((x) << DLL_DLL_LSB) & DLL_DLL_MASK)
-
-#define DLH_ADDRESS 0x00051004
-#define DLH_OFFSET 0x00000004
-#define DLH_DLH_MSB 7
-#define DLH_DLH_LSB 0
-#define DLH_DLH_MASK 0x000000ff
-#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB)
-#define DLH_DLH_SET(x) (((x) << DLH_DLH_LSB) & DLH_DLH_MASK)
-
-#define IER_ADDRESS 0x00051004
-#define IER_OFFSET 0x00000004
-#define IER_EDDSI_MSB 3
-#define IER_EDDSI_LSB 3
-#define IER_EDDSI_MASK 0x00000008
-#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB)
-#define IER_EDDSI_SET(x) (((x) << IER_EDDSI_LSB) & IER_EDDSI_MASK)
-#define IER_ELSI_MSB 2
-#define IER_ELSI_LSB 2
-#define IER_ELSI_MASK 0x00000004
-#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB)
-#define IER_ELSI_SET(x) (((x) << IER_ELSI_LSB) & IER_ELSI_MASK)
-#define IER_ETBEI_MSB 1
-#define IER_ETBEI_LSB 1
-#define IER_ETBEI_MASK 0x00000002
-#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB)
-#define IER_ETBEI_SET(x) (((x) << IER_ETBEI_LSB) & IER_ETBEI_MASK)
-#define IER_ERBFI_MSB 0
-#define IER_ERBFI_LSB 0
-#define IER_ERBFI_MASK 0x00000001
-#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB)
-#define IER_ERBFI_SET(x) (((x) << IER_ERBFI_LSB) & IER_ERBFI_MASK)
-
-#define IIR_ADDRESS 0x00051008
-#define IIR_OFFSET 0x00000008
-#define IIR_FIFO_STATUS_MSB 7
-#define IIR_FIFO_STATUS_LSB 6
-#define IIR_FIFO_STATUS_MASK 0x000000c0
-#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB)
-#define IIR_FIFO_STATUS_SET(x) (((x) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK)
-#define IIR_IID_MSB 3
-#define IIR_IID_LSB 0
-#define IIR_IID_MASK 0x0000000f
-#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB)
-#define IIR_IID_SET(x) (((x) << IIR_IID_LSB) & IIR_IID_MASK)
-
-#define FCR_ADDRESS 0x00051008
-#define FCR_OFFSET 0x00000008
-#define FCR_RCVR_TRIG_MSB 7
-#define FCR_RCVR_TRIG_LSB 6
-#define FCR_RCVR_TRIG_MASK 0x000000c0
-#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB)
-#define FCR_RCVR_TRIG_SET(x) (((x) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK)
-#define FCR_DMA_MODE_MSB 3
-#define FCR_DMA_MODE_LSB 3
-#define FCR_DMA_MODE_MASK 0x00000008
-#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB)
-#define FCR_DMA_MODE_SET(x) (((x) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK)
-#define FCR_XMIT_FIFO_RST_MSB 2
-#define FCR_XMIT_FIFO_RST_LSB 2
-#define FCR_XMIT_FIFO_RST_MASK 0x00000004
-#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB)
-#define FCR_XMIT_FIFO_RST_SET(x) (((x) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK)
-#define FCR_RCVR_FIFO_RST_MSB 1
-#define FCR_RCVR_FIFO_RST_LSB 1
-#define FCR_RCVR_FIFO_RST_MASK 0x00000002
-#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB)
-#define FCR_RCVR_FIFO_RST_SET(x) (((x) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK)
-#define FCR_FIFO_EN_MSB 0
-#define FCR_FIFO_EN_LSB 0
-#define FCR_FIFO_EN_MASK 0x00000001
-#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB)
-#define FCR_FIFO_EN_SET(x) (((x) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK)
-
-#define LCR_ADDRESS 0x0005100c
-#define LCR_OFFSET 0x0000000c
-#define LCR_DLAB_MSB 7
-#define LCR_DLAB_LSB 7
-#define LCR_DLAB_MASK 0x00000080
-#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB)
-#define LCR_DLAB_SET(x) (((x) << LCR_DLAB_LSB) & LCR_DLAB_MASK)
-#define LCR_BREAK_MSB 6
-#define LCR_BREAK_LSB 6
-#define LCR_BREAK_MASK 0x00000040
-#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB)
-#define LCR_BREAK_SET(x) (((x) << LCR_BREAK_LSB) & LCR_BREAK_MASK)
-#define LCR_EPS_MSB 4
-#define LCR_EPS_LSB 4
-#define LCR_EPS_MASK 0x00000010
-#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB)
-#define LCR_EPS_SET(x) (((x) << LCR_EPS_LSB) & LCR_EPS_MASK)
-#define LCR_PEN_MSB 3
-#define LCR_PEN_LSB 3
-#define LCR_PEN_MASK 0x00000008
-#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB)
-#define LCR_PEN_SET(x) (((x) << LCR_PEN_LSB) & LCR_PEN_MASK)
-#define LCR_STOP_MSB 2
-#define LCR_STOP_LSB 2
-#define LCR_STOP_MASK 0x00000004
-#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB)
-#define LCR_STOP_SET(x) (((x) << LCR_STOP_LSB) & LCR_STOP_MASK)
-#define LCR_CLS_MSB 1
-#define LCR_CLS_LSB 0
-#define LCR_CLS_MASK 0x00000003
-#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB)
-#define LCR_CLS_SET(x) (((x) << LCR_CLS_LSB) & LCR_CLS_MASK)
-
-#define MCR_ADDRESS 0x00051010
-#define MCR_OFFSET 0x00000010
-#define MCR_LOOPBACK_MSB 5
-#define MCR_LOOPBACK_LSB 5
-#define MCR_LOOPBACK_MASK 0x00000020
-#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB)
-#define MCR_LOOPBACK_SET(x) (((x) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK)
-#define MCR_OUT2_MSB 3
-#define MCR_OUT2_LSB 3
-#define MCR_OUT2_MASK 0x00000008
-#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB)
-#define MCR_OUT2_SET(x) (((x) << MCR_OUT2_LSB) & MCR_OUT2_MASK)
-#define MCR_OUT1_MSB 2
-#define MCR_OUT1_LSB 2
-#define MCR_OUT1_MASK 0x00000004
-#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB)
-#define MCR_OUT1_SET(x) (((x) << MCR_OUT1_LSB) & MCR_OUT1_MASK)
-#define MCR_RTS_MSB 1
-#define MCR_RTS_LSB 1
-#define MCR_RTS_MASK 0x00000002
-#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB)
-#define MCR_RTS_SET(x) (((x) << MCR_RTS_LSB) & MCR_RTS_MASK)
-#define MCR_DTR_MSB 0
-#define MCR_DTR_LSB 0
-#define MCR_DTR_MASK 0x00000001
-#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB)
-#define MCR_DTR_SET(x) (((x) << MCR_DTR_LSB) & MCR_DTR_MASK)
-
-#define LSR_ADDRESS 0x00051014
-#define LSR_OFFSET 0x00000014
-#define LSR_FERR_MSB 7
-#define LSR_FERR_LSB 7
-#define LSR_FERR_MASK 0x00000080
-#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB)
-#define LSR_FERR_SET(x) (((x) << LSR_FERR_LSB) & LSR_FERR_MASK)
-#define LSR_TEMT_MSB 6
-#define LSR_TEMT_LSB 6
-#define LSR_TEMT_MASK 0x00000040
-#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB)
-#define LSR_TEMT_SET(x) (((x) << LSR_TEMT_LSB) & LSR_TEMT_MASK)
-#define LSR_THRE_MSB 5
-#define LSR_THRE_LSB 5
-#define LSR_THRE_MASK 0x00000020
-#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB)
-#define LSR_THRE_SET(x) (((x) << LSR_THRE_LSB) & LSR_THRE_MASK)
-#define LSR_BI_MSB 4
-#define LSR_BI_LSB 4
-#define LSR_BI_MASK 0x00000010
-#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB)
-#define LSR_BI_SET(x) (((x) << LSR_BI_LSB) & LSR_BI_MASK)
-#define LSR_FE_MSB 3
-#define LSR_FE_LSB 3
-#define LSR_FE_MASK 0x00000008
-#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB)
-#define LSR_FE_SET(x) (((x) << LSR_FE_LSB) & LSR_FE_MASK)
-#define LSR_PE_MSB 2
-#define LSR_PE_LSB 2
-#define LSR_PE_MASK 0x00000004
-#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB)
-#define LSR_PE_SET(x) (((x) << LSR_PE_LSB) & LSR_PE_MASK)
-#define LSR_OE_MSB 1
-#define LSR_OE_LSB 1
-#define LSR_OE_MASK 0x00000002
-#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB)
-#define LSR_OE_SET(x) (((x) << LSR_OE_LSB) & LSR_OE_MASK)
-#define LSR_DR_MSB 0
-#define LSR_DR_LSB 0
-#define LSR_DR_MASK 0x00000001
-#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB)
-#define LSR_DR_SET(x) (((x) << LSR_DR_LSB) & LSR_DR_MASK)
-
-#define MSR_ADDRESS 0x00051018
-#define MSR_OFFSET 0x00000018
-#define MSR_DCD_MSB 7
-#define MSR_DCD_LSB 7
-#define MSR_DCD_MASK 0x00000080
-#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB)
-#define MSR_DCD_SET(x) (((x) << MSR_DCD_LSB) & MSR_DCD_MASK)
-#define MSR_RI_MSB 6
-#define MSR_RI_LSB 6
-#define MSR_RI_MASK 0x00000040
-#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB)
-#define MSR_RI_SET(x) (((x) << MSR_RI_LSB) & MSR_RI_MASK)
-#define MSR_DSR_MSB 5
-#define MSR_DSR_LSB 5
-#define MSR_DSR_MASK 0x00000020
-#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB)
-#define MSR_DSR_SET(x) (((x) << MSR_DSR_LSB) & MSR_DSR_MASK)
-#define MSR_CTS_MSB 4
-#define MSR_CTS_LSB 4
-#define MSR_CTS_MASK 0x00000010
-#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB)
-#define MSR_CTS_SET(x) (((x) << MSR_CTS_LSB) & MSR_CTS_MASK)
-#define MSR_DDCD_MSB 3
-#define MSR_DDCD_LSB 3
-#define MSR_DDCD_MASK 0x00000008
-#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB)
-#define MSR_DDCD_SET(x) (((x) << MSR_DDCD_LSB) & MSR_DDCD_MASK)
-#define MSR_TERI_MSB 2
-#define MSR_TERI_LSB 2
-#define MSR_TERI_MASK 0x00000004
-#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB)
-#define MSR_TERI_SET(x) (((x) << MSR_TERI_LSB) & MSR_TERI_MASK)
-#define MSR_DDSR_MSB 1
-#define MSR_DDSR_LSB 1
-#define MSR_DDSR_MASK 0x00000002
-#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB)
-#define MSR_DDSR_SET(x) (((x) << MSR_DDSR_LSB) & MSR_DDSR_MASK)
-#define MSR_DCTS_MSB 0
-#define MSR_DCTS_LSB 0
-#define MSR_DCTS_MASK 0x00000001
-#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB)
-#define MSR_DCTS_SET(x) (((x) << MSR_DCTS_LSB) & MSR_DCTS_MASK)
-
-
-/************************** config definition ***************************/
-#define UART_FIFO_SIZE 512 //Must be 2^N
-
-#define USE_POST_BUFFER 0 // ENABLE a tx buffer for post processing,
-/*********************** data struction definition ************************/
-// data struction definition
-struct uart_fifo {
-#if USE_POST_BUFFER
- uint8_t buf[UART_FIFO_SIZE];
-#endif
- uint16_t start_index;
- uint16_t end_index;
- uint32_t overrun_err;
-};
-
-
-struct uart_blk {
- uint16_t debug_mode;
- uint16_t baud;
- struct uart_api *_uart;
- struct uart_fifo _tx;
-};
-
-/******** hardware API table structure (API descriptions below) *************/
-struct uart_api {
- uint32_t (*_uart_init)(void);
- void (*_uart_char_put)(uint8_t ch);
- uint16_t (*_uart_char_get)(uint8_t* ch);
- void (*_uart_str_out)(uint8_t* str);
- void (*_uart_task)(void);
- uint32_t (*_uart_status)(void);
- void (*_uart_config)(uint16_t flag);
- void (*_uart_hwinit)(uint32_t freq, uint32_t baud);
-};
-
-#endif // end of _UART_API_H_
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _USB_TABLE_H_
-#define _USB_TABLE_H_
-
-#include "sys_cfg.h"
-// UsbDeviceDescriptor
-#define USB_DEVICE_DESC_TYPE 0x01
-#define USB_DEVICE_DESC_LEN 0x12
-#define USB_SPEC_VERSION 0x0200
-#define USB_DEVICE_CLASS 0xFF
-#define USB_DEVICE_SUB_CLASS 0xFF
-#define USB_DEVICE_PROTOCOL 0xFF
-#define USB_MAX_PKT_SIZE 0x40
-#define USB_VENDOR_ID 0x0CF3
-#define USB_PRODUCT_ID 0x9271
-
-#if 1 /* USB Device Descriptor : byte 12, 13 Device BCD -> Device release number in binary-coded decimal. */
-#define USB_DEVICE_BCD BOOTROM_VER
-#else
-#define USB_DEVICE_BCD 0x0106
-#endif
-
-#define USB_MANUFACTURER_INDEX 0x10
-#define USB_PRODUCT_INDEX 0x20
-#define USB_SERIAL_INDEX 0x30
-#define USB_CONFIGURATION_NUM 0x01
-// end UsbDeviceDescriptor
-
-#define USB_CONFIG_DESC_TYPE 0x02
-#define USB_CONFIG_DESC_LEN 0x09
-//#define USB_TOTAL_DESC_LEN 0x002E // 4 ep
-//#define USB_TOTAL_DESC_LEN 0x0035 // 5 ep
-#define USB_TOTAL_DESC_LEN 0x003C // 6 ep
-#define USB_INTERFACE_NUM 0x01
-#define USB_CONFIG_NUM 0x01
-#define USB_STRING_INDEX 0x00
-#define USB_ATTRIBUTE 0x80
-#define USB_MAX_POWER 0xFA
-
-#define USB_INTERFACE_DESC_TYPE 0x04
-#define USB_INTERFACE_DESC_LEN 0x09
-#define USB_INTERFACE_INDEX_NUM 0x00
-#define USB_INTERFACE_ALT_SETTING 0x00
-//#define USB_INTERFACE_EP_NUM 0x04
-//#define USB_INTERFACE_EP_NUM 0x05
-#define USB_INTERFACE_EP_NUM 0x06
-#define USB_INTERFACE_CLASS 0xFF
-#define USB_INTERFACE_SUB_CLASS 0x00
-#define USB_INTERFACE_PROTOCOL 0x00
-#define USB_INTERFACE_STRING_INDEX 0x00
-
-#define USB_EP_DESC_TYPE 0x05
-#define USB_EP_DESC_LEN 0x07
-
-/* USB Endpoint attribute */
-#define bUSB_EP1_NUM 0x01
-#define bUSB_EP2_NUM 0x02
-#define bUSB_EP3_NUM 0x03
-#define bUSB_EP4_NUM 0x04
-#define bUSB_EP5_NUM 0x05
-#define bUSB_EP6_NUM 0x06
-
-#define bUSB_EP_DIRECTION_IN 0x80
-#define bUSB_EP_DIRECTION_OUT 0x00
-
-#define bUSB_EP_TYPE_CONTROL 0x00
-#define bUSB_EP_TYPE_ISOCHRONOUS 0x01
-#define bUSB_EP_TYPE_BULK 0x02
-#define bUSB_EP_TYPE_INTERRUPT 0x03
-
-#define bUSB_EP_MAX_PKT_SIZE_64 0x0040
-#define bUSB_EP_MAX_PKT_SIZE_512 0x0200
-
-/* High Speed Endpoint */
-#define USB_HS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
-#define USB_HS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP1_INTERVAL 0x00
-
-#define USB_HS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
-#define USB_HS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP2_INTERVAL 0x00
-
-#define USB_HS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
-#define USB_HS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
-#define USB_HS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_HS_EP3_INTERVAL 0x01
-
-#define USB_HS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
-#define USB_HS_EP4_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT //bUSB_EP_TYPE_BULK
-#define USB_HS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_HS_EP4_INTERVAL 0x01 //0x00
-
-#define USB_HS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
-#define USB_HS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP5_INTERVAL 0x00
-
-#define USB_HS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
-#define USB_HS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP6_INTERVAL 0x00
-
-/* Full Speed Endpoint */
-#define USB_FS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
-#define USB_FS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP1_INTERVAL 0x00
-
-#define USB_FS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
-#define USB_FS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP2_INTERVAL 0x00
-
-#define USB_FS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
-#define USB_FS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
-#define USB_FS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP3_INTERVAL 0x01
-
-#define USB_FS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
-#define USB_FS_EP4_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP4_INTERVAL 0x00
-
-#define USB_FS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
-#define USB_FS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP5_INTERVAL 0x00
-
-#define USB_FS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
-#define USB_FS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP6_INTERVAL 0x00
-
-//#define USB_QUALIFIER_DESC_ADDR 0x8cff00
-//#define USB_OTHER_SPEED_DESC_ADDR 0x8cffA
-
-#endif // end of _USB_TABLE_H_
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: VBUF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _VBUF_API_H
-#define _VBUF_API_H
-
-#include <vdesc_api.h>
-
-#define MAX_BUF_CTX_LEN 20
-
-typedef struct _VBUF
-{
- VDESC *desc_list;
- struct _VBUF *next_buf;
- A_UINT16 buf_length;
- A_UINT8 reserved[2];
- A_UINT8 ctx[MAX_BUF_CTX_LEN];
-} VBUF;
-
-#define VBUF_GET_DATA_ADDR(vbuf) (vbuf->desc_list->buf_addr + vbuf->desc_list->data_offset)
-
-/* hardware API table structure (API descriptions below) */
-struct vbuf_api {
- void (*_init)(int nBuf);
- VBUF* (*_alloc_vbuf)(void);
- VBUF* (*_alloc_vbuf_with_size)(int size, int reserve);
- void (*_free_vbuf)(VBUF *buf);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void vbuf_module_install(struct vbuf_api *apis);
-
-#endif /* #ifndef _HIF_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: VBUF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _VDESC_API_H
-#define _VDESC_API_H
-
-#define MAX_HW_DESC_SIZE 20
-
-typedef struct _VDESC
-{
- struct _VDESC *next_desc;
- A_UINT8 *buf_addr;
- A_UINT16 buf_size;
- A_UINT16 data_offset;
- A_UINT16 data_size;
- A_UINT16 control;
- A_UINT8 hw_desc_buf[MAX_HW_DESC_SIZE];
-} VDESC;
-
-#define VDESC_HW_TO_VDESC(hwdesc) ((VDESC *)(((A_UINT32 *)hwdesc - 4)))
-
-struct vdesc_api {
- void (*_init)(int nDesc);
- VDESC* (*_alloc_vdesc)();
- A_UINT8* (*_get_hw_desc)(VDESC *desc);
- void (*_swap_vdesc)(VDESC *dest, VDESC *src);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void vdesc_module_install(struct vdesc_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __WDT_API_H__
-#define __WDT_API_H__
-
-typedef enum {
- WDT_ACTION_NO = 0, // bit1, bit0: 00
- WDT_ACTION_INTR, // bit1, bit0: 01
- WDT_ACTION_NMI, // bit1, bit0: 10
- WDT_ACTION_RESET, // bit1, bit0: 11
-
- WDT_ACTION_UNKNOWN
-} T_WDT_ACTION_TYPE;
-
-typedef enum {
- WDT_TIMEOUT = 1,
- WDT_ACTION,
-
- WDT_UNKNOWN
-} T_WDT_CMD_TYPE;
-
-typedef struct {
- uint32_t cmd;
- union {
- uint32_t timeout;
- uint32_t action;
- };
-}T_WDT_CMD;
-
-typedef enum {
- ENUM_WDT_BOOT = 1,
- ENUM_COLD_BOOT,
- ENUM_SUSP_BOOT,
-
- // add above here
- ENUM_UNKNOWN_BOOT
-} T_BOOT_TYPE;
-
-
-/*!- interface of watchdog timer
- *
- */
-struct wdt_api {
- void (* _wdt_init)(void);
- void (* _wdt_enable)(void);
- void (* _wdt_disable)(void);
- void (* _wdt_set)(T_WDT_CMD);
- void (* _wdt_task)(void);
- void (* _wdt_reset)(void);
- T_BOOT_TYPE (*_wdt_last_boot)(void);
-};
-#endif /* __WDT_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * (c) Copyright Atheros Communications
- * FreeBSD specific prototypes
- */
-#ifndef _ADF_NBUF_PVT_H
-#define _ADF_NBUF_PVT_H
-
-#include <osapi.h>
-//#include <Magpie_api.h>
-#include <vbuf_api.h>
-//#include <adf_nbuf_api.h>
-
-#define __ADF_NBUF_NULL NULL
-#define __ADF_NBUF_CTX_BUF
-
-typedef VBUF * __adf_nbuf_t;
-
-/**
- * queue head
- */
-typedef struct __adf_nbuf_qhead {
- VBUF *head;
- VBUF *tail;
- a_uint32_t qlen;
-}__adf_nbuf_qhead_t;
-
-typedef __adf_nbuf_qhead_t __adf_nbuf_queue_t;
-
-__adf_nbuf_t
-__adf_nbuf_alloc(adf_os_size_t size,
- a_uint32_t reserve, a_uint32_t align);
-
-void
-__adf_nbuf_free(__adf_nbuf_t buf);
-
-#ifndef _ROM_
-a_uint8_t *
-__adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t size);
-
-a_uint8_t *
-__adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t size);
-
-a_uint8_t *
-__adf_nbuf_put_tail(__adf_nbuf_t buf, adf_os_size_t size);
-#endif
-
-void
-__adf_nbuf_trim_tail(__adf_nbuf_t buf, adf_os_size_t size);
-
-__adf_nbuf_t
-__adf_nbuf_realloc_headroom(__adf_nbuf_t buf,
- a_uint32_t headroom);
-
-__adf_nbuf_t
-__adf_nbuf_realloc_tailroom(__adf_nbuf_t buf,
- a_uint32_t tailroom);
-
-__adf_nbuf_t
-__adf_nbuf_expand(__adf_nbuf_t buf,
- a_uint32_t headroom, a_uint32_t tailroom);
-
-__adf_nbuf_t
-__adf_nbuf_copy(__adf_nbuf_t src);
-
-__adf_nbuf_t
-__adf_nbuf_unshare(__adf_nbuf_t src);
-
-void
-__adf_nbuf_frag_info(__adf_nbuf_t buf, adf_os_sglist_t *sg);
-
-#ifndef _ROM_
-a_uint8_t *
-__adf_nbuf_get_priv(__adf_nbuf_t buf);
-#endif
-
-void
-__adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead,
- __adf_nbuf_t buf);
-
-__adf_nbuf_t
-__adf_nbuf_queue_remove(__adf_nbuf_qhead_t *qhead);
-
-a_uint32_t
-__adf_nbuf_tx_cksum_info(__adf_nbuf_t buf,
- a_uint8_t **hdr_off,
- a_uint8_t **where);
-
-void
-__adf_nbuf_set_rx_cksum(__adf_nbuf_t buf, adf_nbuf_rx_cksum_t *cksum);
-void
-__adf_nbuf_get_tso_info(__adf_nbuf_t buf, adf_nbuf_tso_t *tso);
-
-a_status_t
-__adf_nbuf_get_vlan_info(adf_net_handle_t hdl,
- __adf_nbuf_t buf,
- adf_net_vlanhdr_t *vlan);
-
-void
-__adf_nbuf_dmamap_info(__adf_os_dma_map_t bmap, adf_os_dmamap_info_t *sg);
-
-/**
- * @brief return the last mbuf
- *
- * @param m0
- *
- * @return struct mbuf*
- */
-#ifndef _ROM_
-VDESC *
-__adf_nbuf_last(VBUF *buf);
-#endif
-
-/**
- * @brief num bytes in the head
- *
- * @param adf_nbuf
- *
- * @return num of bytes available
- */
-#ifndef _ROM_
-a_uint32_t
-__adf_nbuf_headroom(__adf_nbuf_t buf);
-#endif
-
-/**
- * @brief num of bytes available in the tail excluding the priv
- * portion
- *
- * @param adf_nbuf
- *
- * @return num of bytes
- */
-#ifndef _ROM_
-a_uint32_t
-__adf_nbuf_tailroom(__adf_nbuf_t buf);
-#endif
-
-/**
- * @brief get the entire packet length
- *
- * @param adf_nbuf
- *
- * @return total length of packet (sum of all frag lengths)
- */
-#ifndef _ROM_
-a_uint32_t
-__adf_nbuf_len(__adf_nbuf_t buf);
-#endif
-
-/**
- * @brief Clone the nbuf (will not create writeable copies)
- *
- * @param adf_nbuf
- *
- * @return Read-only copy of the nbuf (including clusters)
- */
-__adf_nbuf_t
-__adf_nbuf_clone(__adf_nbuf_t src);
-
-void
-__adf_nbuf_cat(__adf_nbuf_t dst, __adf_nbuf_t src);
-
-
-/*
- * @brief check if the mbuf is cloned or not
- *
- * @param buf
- *
- * @return a_bool_t
- */
-a_bool_t
-__adf_nbuf_is_cloned(__adf_nbuf_t buf);
-
-/**
- * @brief This will return the header's addr & m_len
- */
-#ifndef _ROM_
-void
-__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
- a_uint32_t *len);
-#endif
-
-/**
- * @brief init the queue
- * @param qhead
- */
-void
-__adf_nbuf_queue_init(__adf_nbuf_qhead_t *qhead);
-
-/**
- * @brief return the length of queue
- * @param adf_qhead
- *
- * @return length
- *
- */
-a_uint32_t
-__adf_nbuf_queue_len(__adf_nbuf_qhead_t *qhead);
-
-/**
- * @brief returns the first guy in the Q
- * @param qhead
- *
- * @return (NULL if the Q is empty)
- */
-#ifndef _ROM_
-__adf_nbuf_t
-__adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead);
-
-/**
- * @brief return the next packet from packet chain
- *
- * @param buf (packet)
- *
- * @return (NULL if no packets are there)
- */
-__adf_nbuf_t
-__adf_nbuf_queue_next(__adf_nbuf_t buf);
-#endif
-
-/**
- * @brief check if the queue is empty or not
- *
- * @param qhead
- *
- * @return a_bool_t
- */
-a_bool_t
-__adf_nbuf_is_queue_empty(__adf_nbuf_qhead_t *qhead);
-
-__adf_nbuf_t
-__adf_nbuf_create_frm_frag(__adf_nbuf_queue_t *head);
-void
-__adf_nbuf_split_to_frag(__adf_nbuf_t buf, __adf_nbuf_queue_t *qhead);
-
-#ifdef _ROM_
-
-/**
- * @brief This will return the header's addr & m_len
- */
-static inline void
-__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
- a_uint32_t *len)
-{
- VDESC *desc = buf->desc_list;
-
- *addr = desc->buf_addr + desc->data_offset;
- *len = desc->data_size;
-}
-
-/**
- * @brief return the last mbuf
- *
- * @param m0
- *
- * @return struct mbuf*
- */
-static inline VDESC *
-__adf_nbuf_last(VBUF *buf)
-{
- VDESC *desc = buf->desc_list;
-
- //for(; desc->next_desc != NULL; desc = desc->next_desc)
- // ;
- while(desc->next_desc != NULL)
- {
- desc = desc->next_desc;
- }
-
- return desc;
-}
-
-/**
- * @brief num bytes in the head
- *
- * @param adf_nbuf
- *
- * @return num of bytes available
- */
-static inline a_uint32_t
-__adf_nbuf_headroom(__adf_nbuf_t buf)
-{
- return buf->desc_list->data_offset;
-}
-
-/**
- * @brief num of bytes available in the tail excluding the priv
- * portion
- *
- * @param adf_nbuf
- *
- * @return num of bytes
- */
-
-static inline a_uint32_t
-__adf_nbuf_tailroom(__adf_nbuf_t buf)
-{
- VDESC *last_desc = __adf_nbuf_last(buf);
-
- return last_desc->buf_size - last_desc->data_offset - last_desc->data_size;
-}
-
-/**
- * @brief get the entire packet length
- *
- * @param adf_nbuf
- *
- * @return total length of packet (sum of all frag lengths)
- */
-static inline a_uint32_t
-__adf_nbuf_len(__adf_nbuf_t buf)
-{
- return buf->buf_length;
-}
-
-/**
- * @brief put data in the head
- *
- * @param buf
- * @param len (how much data to put)
- *
- * @return new data pointer ,NULL if the len is more than the
- * space available in the head frag.
- */
-static inline a_uint8_t *
-__adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t len)
-{
- a_uint8_t *ptr = NULL;
- VDESC *desc = buf->desc_list;
-
- desc->data_offset -= len;
- desc->data_size += len;
- buf->buf_length += len;
- ptr = desc->buf_addr + desc->data_offset;
- return(ptr);
-}
-
-/**
- *
- * @brief add data in the end of tail
- *
- * @param buf
- * @param len (how much data to put)
- *
- * @return previous tail (data+len),NULL if the len is more than
- * space available
- */
-static inline a_uint8_t *
-__adf_nbuf_put_tail(__adf_nbuf_t buf, adf_os_size_t len)
-{
- a_uint8_t *tail = NULL;
- VDESC *last_desc = __adf_nbuf_last(buf);
-
- tail = last_desc->buf_addr + last_desc->data_offset + last_desc->data_size;
- last_desc->data_size += len;
- buf->buf_length += len;
-
- return tail;
-}
-
-/**
- * @brief strip data from head
- *
- * @param adf_nbuf
- * @param len (how much data to rip)
- *
- * @return new data pointer
- */
-static inline a_uint8_t *
-__adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t len)
-{
- a_uint8_t *ptr = NULL;
- VDESC *desc = buf->desc_list;
-
- desc->data_offset += len;
- desc->data_size -= len;
- buf->buf_length -= len;
- ptr = desc->buf_addr + desc->data_offset;
-
- return ptr;
-}
-
-/**
- * @brief retrieve the priv space pointer from nbuf
- *
- * @param buf (nbuf to attach the priv space)
- *
- * @return uint8_t* ( pointer to the data )
- */
-static inline a_uint8_t *
-__adf_nbuf_get_priv(__adf_nbuf_t buf)
-{
- //adf_os_assert(buf != NULL);
-
- return buf->ctx;
-}
-
-/**
- * @brief returns the first guy in the Q
- * @param qhead
- *
- * @return (NULL if the Q is empty)
- */
-static inline __adf_nbuf_t
-__adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead)
-{
- return qhead->head;
-}
-/**
- * @brief return the next packet from packet chain
- *
- * @param buf (packet)
- *
- * @return (NULL if no packets are there)
- */
-static inline __adf_nbuf_t
-__adf_nbuf_queue_next(__adf_nbuf_t buf)
-{
- return buf->next_buf;
-}
-
-#endif
-
-#endif
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __ALLOCRAM_API_H__
-#define __ALLOCRAM_API_H__
-
-/* API for Target-side startup-time RAM allocations */
-
-struct allocram_api {
- /*
- * Initialize allocram, providing it with a block of RAM
- * (an "arena") from which to allocate.
- *
- * If arena_start is 0, a default start -- the end of
- * the application's text & data -- is used.
- *
- * If arena_sz is 0, a default size -- which uses most
- * of physical RAM beyond arena_start -- is used.
- *
- * Return value is reserved for future use -- it's an arena handle.
- */
- void *(* cmnos_allocram_init)(void *arena_start, A_UINT32 arena_sz);
-
- /*
- * Allocate nbytes of memory, returning a pointer to the start
- * of the allocated block. Allocation size is rounded up to the
- * nearest A_CACHE_LINE_SIZE and the returned address similarly
- * aligned.
- *
- * There is no need to check the return value from this function.
- * A failure to satisfy a RAM allocation request is treated as a
- * fatal error.
- *
- * Allocations are expected to occur only during startup; this
- * API does not, for instance, guarantee atomicity with respect
- * to allocations that might (foolishly) be attempted from
- * interrupt handlers.
- *
- * The "which_arena" parameter is currently unused, and should
- * be set to 0 -- only a single arena is currently supported.
- */
- void *(* cmnos_allocram)(void *which_arena, A_UINT32 nbytes);
-
- void (* cmnos_allocram_debug)(void);
-};
-
-extern void allocram_module_install(struct allocram_api *api);
-
-
-#endif /* __ALLOCRAM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __ATHOS_API_H__
-#define __ATHOS_API_H__
-
-/*
- * This file contains wrappers to OS operating system functions
- * that are available in the Athos version of the operating system.
- *
- * Target software must always use these wrappers to access OS
- * services -- it may not access any OS services directly.
- *
- * These wrappers are intended to provide OS-independence for applications.
- * Using this header file, an application should be able to compile and
- * fully link without any other OS header files, source files, or
- * binary files.
- */
-
-#include <osapi.h>
-#include "dt_defs.h"
-#include "cmnos_api.h"
-//#include "HIF_api.h"
-//#include "vbuf_api.h"
-//#include "vdesc_api.h"
-//#include "htc_api.h"
-#include "Magpie_api.h"
-
-/* ROM Patch API */
-
-
-/* HTC API */
-
-
-/* WMI Adaptive API - required for WMI SVCs as they refer some of them*/
-
-
-/* WLAN WMI API - required for WMI SVCs and others...*/
-
-#if 0
-#define A_INDIR(sym) _A_OS_INDIRECTION_TABLE->sym
-
-/* HIF support */
-#define HIF_MODULE_INSTALL() hif_module_install(&_A_OS_INDIRECTION_TABLE->hif)
-#define HIF_init(pConfig) A_INDIR(hif._init(pConfig))
-#define HIF_start() A_INDIR(hif._start())
-#define HIF_config_pipe(pipe, desc_list) A_INDIR(hif._config_pipe(pipe, desc_list))
-#define HIF_send_buffer(pipe, buf) A_INDIR(hif._send_buffer(pipe, buf))
-#define HIF_return_recv_buf(pipe, buf) A_INDIR(hif._return_recv_buf(pipe, buf))
-#define HIF_isr_handler() A_INDIR(hif._isr_handler())
-#define HIF_is_pipe_supported(pipe) A_INDIR(hif._is_pipe_supported(pipe))
-
-/* VBUF APIs */
-#define VBUF_MODULE_INSTALL() vbuf_module_install(&_A_OS_INDIRECTION_TABLE->vbuf)
-#define VBUF_init(dataAddr, nBuf) A_INDIR(vbuf._init(dataAddr, nBuf))
-#define VBUF_alloc_vbuf() A_INDIR(vbuf._alloc_vbuf())
-#define VBUF_free_vbuf(buf) A_INDIR(vbuf._free_vbuf(buf))
-
-/* VDESC APIs */
-#define VDESC_MODULE_INSTALL() vdesc_module_install(&_A_OS_INDIRECTION_TABLE->vdesc)
-#define VDESC_init(dataAddr, nTxDesc, nRxDesc) A_INDIR(vdesc._init(dataAddr, nTxDesc, nRxDesc))
-#define VDESC_alloc_vdesc(type) A_INDIR(vdesc._alloc_vdesc(type))
-#define VDESC_get_hw_desc(type, desc) A_INDIR(vdesc._get_hw_desc(type, desc))
-//#define VDESC_free_vdesc(buf) A_INDIR(vdesc._free_vdesc(buf))
-
-#define HTC_MODULE_INSTALL() htc_module_install(&_A_OS_INDIRECTION_TABLE->htc)
-//#define HTC_init(dataAddr, SetupComplete, RecvBufferSize) A_INDIR(htc._HTC_Init(dataAddr, SetupComplete, RecvBufferSize))
-#define HTC_init(dataAddr, SetupComplete, pConfig) A_INDIR(htc._HTC_Init(dataAddr, SetupComplete, pConfig))
-#define HTC_RegisterService(s) A_INDIR(htc._HTC_RegisterService(s))
-#define HTC_Ready() A_INDIR(htc._HTC_Ready())
-#define HTC_SendMsg(endpt, buf) A_INDIR(htc._HTC_SendMsg(endpt, buf))
-#define HTC_ReturnBuffers(endpt, buf) A_INDIR(htc._HTC_ReturnBuffers(endpt, buf))
-
-#if 0
-/* WMI SVC module */
-#define WMI_SERVICE_MODULE_INSTALL() WMI_service_module_install(&_A_OS_INDIRECTION_TABLE->wmi_svc_api)
-#define WMI_Init(dataAddr, pCfg) A_INDIR(wmi_svc_api._WMI_Init(dataAddr, pCfg))
-#define WMI_RegisterDispatchTable(pT) A_INDIR(wmi_svc_api._WMI_RegisterDispatchTable(pT))
-#define WMI_AllocEvent(ec,len) A_INDIR(wmi_svc_api._WMI_AllocEvent(ec, len))
-#define WMI_SendEvent(ev,id,seq,len) A_INDIR(wmi_svc_api._WMI_SendEvent(ev, id, seq, len))
-#define WMI_GetPendingEventsCount() A_INDIR(wmi_svc_api._WMI_GetPendingEventsCount())
-#define WMI_GetControlEp() A_INDIR(wmi_svc_api._WMI_GetControlEp())
-#define WMI_SendCompleteHandler(ep, buf) A_INDIR(wmi_svc_api._WMI_SendCompleteHandler(ep, buf))
-#endif
-
-/*
- * This defines the layout of the indirection table, which
- * is used to access exported APIs of various modules. The
- * layout is shared across ROM and RAM code. RAM code may
- * call into ROM and ROM code may call into RAM. Because
- * of the latter, existing offsets must not change for the
- * lifetime of a revision of ROM; but new members may be
- * added at the end.
- */
-typedef struct _A_athos_indirection_table {
- _A_cmnos_indirection_table_t cmnos;
-
- /* TBD: to be added */
- struct hif_api hif;
- struct vbuf_api vbuf;
- struct vdesc_api vdesc;
- struct htc_apis htc;
- //WMI_SVC_APIS wmi_svc_api;
-} _A_athos_indirection_table_t;
-
-#if 1
-extern _A_athos_indirection_table_t _indir_tbl;
-#define _A_OS_INDIRECTION_TABLE_SIZE sizeof(_A_athos_indirection_table_t)
-#define _A_OS_INDIRECTION_TABLE (&_indir_tbl)
-#endif
-#endif
-
-extern unsigned int _data_start_in_rom;
-extern unsigned int _data_start;
-extern unsigned int _data_end;
-extern unsigned int _bss_start;
-extern unsigned int _bss_end;
-extern unsigned int _stack_sentry;
-extern unsigned int __stack;
-extern unsigned int _fw_image_end;
-
-#if defined(__XTENSA__)
-#define START_DATA _data_start
-#define END_DATA _data_end
-#define START_BSS _bss_start
-#define END_BSS _bss_end
-
-#define STACK_START _stack_sentry
-#define STACK_END __stack
-#endif
-
-
-struct _A_os_linkage_check {
- int version;
- int table;
-};
-
-
-/*
- * A_INIT() handles any initialization needed by the OS abstraction,
- * and it clears the application's BSS, if necessary. (Application BSS
- * is not cleared if the application is linked into a single image that
- * includes AthOS.)
- *
- * A_INIT() must be called first thing in the application (from app_start)
- * in order to guarantee that BSS has been cleared properly.
- */
-static INLINE int
-A_INIT(void)
-{
- struct _A_os_linkage_check link_check;
- unsigned int *clrptr;
-
- if (&START_BSS != _A_MAGPIE_INDIRECTION_TABLE->cmnos.start_bss) {
- /* Clear BSS */
- for (clrptr = &START_BSS; clrptr < &END_BSS; clrptr++) {
- *clrptr = 0;
- }
- }
-
- {
- /* Copy writable data from flash to RAM. */
- unsigned int *srcptr, *destptr;
-
- /*
- * The _data_start symbol points to the start of data IN FLASH.
- * It is defined by flash.ld at application link time. If flash.ld
- * is not used, it is defined (on the link line) as 0.
- */
- static int *data_start_addr = &_data_start;
-
- if (data_start_addr != 0) {
- for (srcptr = &_data_start, destptr = &START_DATA;
- destptr < &END_DATA;
- srcptr++, destptr++)
- {
- *destptr = *srcptr;
- }
- }
- }
-
-#define OS_LINKAGE_VERSION 4
- link_check.version = OS_LINKAGE_VERSION;
- link_check.table = _A_MAGPIE_INDIRECTION_TABLE_SIZE;
-
- return A_CMN(hal_linkage_check(sizeof(link_check), &link_check));
-}
-
-
-#endif /* __ATHOS_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: buf_pool_api.h
- *
- * @Abstract: BUF Pool api
- *
- * @Notes:
- */
-
-#ifndef _BUF_POOL_API_H
-#define _BUF_POOL_API_H
-
-#include <adf_nbuf.h>
-
-/* endpoint defines */
-typedef enum
-{
- POOL_ID_HTC_CONTROL = 0,
- POOL_ID_WMI_SVC_CMD_REPLY = 1,
- POOL_ID_WMI_SVC_EVENT = 2,
- POOL_ID_WLAN_RX_BUF = 3,
- POOL_ID_MAX = 10
-} BUF_POOL_ID;
-
-typedef void* pool_handle_t;
-
-/* hardware API table structure (API descriptions below) */
-struct buf_pool_api {
- pool_handle_t (*_init)(adf_os_handle_t handle);
-
- void (*_shutdown)(pool_handle_t handle);
-
- void (*_create_pool)(pool_handle_t handle, BUF_POOL_ID poolId, int nItems, int nSize);
-
- adf_nbuf_t (*_alloc_buf)(pool_handle_t handle, BUF_POOL_ID poolId, int reserve);
-
- adf_nbuf_t (*_alloc_buf_align)(pool_handle_t handle, BUF_POOL_ID poolId, int reserve, int align);
-
- void (*_free_buf)(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void buf_pool_module_install(struct buf_pool_api *apis);
-
-#endif /* #ifndef _BUF_POOL_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __CLOCK_API_H__
-#define __CLOCK_API_H__
-
-#define TICK_MSEC_RATIO 1
-#define TICK_TO_MSEC(tick) ((tick)/TICK_MSEC_RATIO)
-#define MSEC_TO_TICK(msec) ((msec)* TICK_MSEC_RATIO)
-
-struct clock_api {
- void (* _clock_init)(A_UINT32 ref_clk);
- void (* _clockregs_init)(void);
- A_UINT32 (* _uart_frequency)(void);
- void (* _delay_us)(int);
- void (* _wlan_band_set)(int);
- A_UINT32 (* _refclk_speed_get)(void);
- A_UINT32 (* _milliseconds)(void);
- void (* _sysclk_change)(void);
-
- void (* _clock_tick)(void);
-};
-
-#endif /* __CLOCK_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __CMNOS_API_H__
-#define __CMNOS_API_H__
-
-/*
- * This file contains wrappers to OS operating system functions
- * that are available in all versions of the operating system.
- *
- * Target software must always use these wrappers to access OS
- * services -- it may not access any OS services directly.
- */
-
-#include "sys_cfg.h"
-
-#include "xtensa/config/core.h"
-#include "xtensa/hal.h"
-#include "xtensa/xtruntime.h"
-
-/* cmnos interface */
-#include "printf_api.h"
-#include "uart_api.h"
-#include "dbg_api.h"
-#include "mem_api.h"
-#include "misc_api.h"
-#include "string_api.h"
-#include "timer_api.h"
-#include "romp_api.h"
-#include "allocram_api.h"
-#include "tasklet_api.h"
-#include "clock_api.h"
-#include "intr_api.h"
-#include "wdt_api.h"
-#include "eeprom_api.h"
-#include "usb_api.h"
-#include <hif_pci.h>
-#include <hif_gmac.h>
-
-#if defined(PROJECT_K2)
-#if SYSTEM_MODULE_SFLASH
-#include "cmnos/sflash_api.h"
-#endif
-#endif
-
-#define AR6K_ROM_START 0x004e0000
-#define AR6K_ROM_ADDR(byte_offset) (AR6K_ROM_START+(byte_offset))
-#define TARG_ROM_ADDRS(byte_offset) AR6K_ROM_ADDR(byte_offset)
-
-#define IML_SIGNAL_UNUSED0_ADDR TARG_ROM_ADDRS(0) /* Cannot be used -- aligned */
-#define IML_SIGNAL_ASSERT_ADDR TARG_ROM_ADDRS(1) /* Signal an assertion failure */
-#define IML_SIGNAL_PRINTF_ADDR TARG_ROM_ADDRS(2) /* Signal a printf request */
-#define IML_SIGNAL_UNUSED4_ADDR TARG_ROM_ADDRS(4) /* Cannot be used -- aligned */
-#define IML_SIGNAL_UNUSED8_ADDR TARG_ROM_ADDRS(8) /* Cannot be used -- aligned */
-#define IML_SIGNAL_UNUSEDC_ADDR TARG_ROM_ADDRS(0xc) /* Cannot be used -- aligned */
-#define IML_SIGNAL_MASK 0xfffe000f
-#define IML_LINENUM_SHIFT 4
-
-#define NOW() xthal_get_ccount()
-
-#if defined(__XTENSA__)
-#define _A_BARRIER asm volatile("memw")
-#else
-#define _A_BARRIER
-#endif
-
-#define A_ASSERT( __bool ) \
- do { \
- if (0 == (__bool)) { \
- (void)*((volatile int *)(IML_SIGNAL_ASSERT_ADDR+(__LINE__<<4)));\
- _A_BARRIER; \
- } \
- } while (0)
-
-
-#define A_IML_IS_ASSERT(vaddr) \
- (((vaddr) & IML_SIGNAL_MASK) == (IML_SIGNAL_ASSERT_ADDR & IML_SIGNAL_MASK))
-
-
-#define PRINT_FAILURE_STATE() \
-do { \
- uint32_t epc1, epc2, epc3, epc4; \
- \
- asm volatile("rsr %0,%1" : "=r" (epc1) : "n" (EPC_1)); \
- asm volatile("rsr %0,%1" : "=r" (epc2) : "n" (EPC_2)); \
- asm volatile("rsr %0,%1" : "=r" (epc3) : "n" (EPC_3)); \
- asm volatile("rsr %0,%1" : "=r" (epc4) : "n" (EPC_4)); \
- \
- A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n", \
- epc1, epc2, epc3, epc4); \
- A_PRINTF("0x%08x, 0x%08x, 0x%08x, \n\r", \
- DEBUG_SYSTEM_STATE, WATCH_DOG_RESET_COUNTER, \
- WATCH_DOG_MAGIC_PATTERN); \
-} while(0)
-////////////////////////////////////////////////////////////////////////////////////
-
-
-//#define A_CMN(sym) _A_OS_INDIRECTION_TABLE->cmnos.sym
-#define A_CMN(sym) _A_MAGPIE_INDIRECTION_TABLE->cmnos.sym
-
-#if SYSTEM_MODULE_MEM
-/* Mem interfaces */
-#define A_MEMSET(addr, value, size) \
- A_CMN(mem._memset((char *)(addr), (int)(value), (int)(size)))
-
-#define A_MEMZERO(addr, size) \
- A_CMN(mem._memset((char *)(addr), (int)0, (int)(size)))
-
-#define A_MEMCPY(dst, src, size) \
- A_CMN(mem._memcpy((char *)(dst), (char *)(src), (int)(size)))
-
-#define A_MEMMOVE(dst, src, size) \
- A_CMN(mem._memmove((char *)(dst), (char *)(src), (int)(size)))
-
-#define A_MEMCMP(p1, p2, nbytes) \
- A_CMN(mem._memcmp)((void *)(p1), (void *)(p2), (int)(nbytes))
-#else
-/* Mem interfaces */
-#define A_MEMSET(addr, value, size)
-
-#define A_MEMZERO(addr, size)
-
-#define A_MEMCPY(dst, src, size)
-
-#define A_MEMMOVE(dst, src, size)
-
-#define A_MEMCMP(p1, p2, nbytes)
-#endif
-
-
-#if 1
- /* String interfaces */
- #define A_STRCPY(dst, src) A_CMN(string._strcpy((dst), (src)))
- #define A_STRNCPY(dst, src, n) A_CMN(string._strncpy((dst), (src), (n)))
- #define A_STRLEN(str) A_CMN(string._strlen(str))
- #define A_STRCMP(str1, str2) A_CMN(string._strcmp((str1), (str2)))
- #define A_STRNCMP(str1, str2, n) A_CMN(string._strncmp((str1), (str2), (n)))
-#endif
-
-#if SYSTEM_MODULE_PRINT
-/* Printf support */
-#define A_PRINTF_INIT() A_CMN(printf._printf_init())
-#define A_PRINTF A_CMN(printf._printf)
-#else
-#define A_PRINTF_INIT()
-#define A_PRINTF
-#endif /* SYSTEM_MODULE_PRINT */
-
-#if SYSTEM_MODULE_UART
-/* Serial port support */
-#define A_UART_INIT() A_CMN(uart._uart_init())
-
-#define A_UART_HWINIT(freq, baud) \
- A_CMN(uart._uart_hwinit((freq), (baud)))
-
-#define A_UART_ENABLED() (HOST_INTEREST->hi_uart_enable)
-
-#define A_PUTS(str) A_CMN(uart._uart_str_out(str))
-
-#define A_PUTC(ch) A_CMN(uart._uart_char_put(ch))
-#define A_GETC(pCh) A_CMN(uart._uart_char_get(pCh))
-
-#define A_UART_TASK() A_CMN(uart._uart_task())
-#define A_UART_CONFIG(x) A_CMN(uart._uart_config(x))
-
-#else
-
-#define A_UART_INIT()
-
-#define A_UART_HWINIT(freq, baud)
-
-#define A_UART_ENABLED()
-
-#define A_PUTS(str)
-
-#define A_PUTC(ch)
-#define A_GETC(pCh)
-
-#define A_UART_TASK()
-#define A_UART_CONFIG(x)
-
-#endif
-
-#if SYSTEM_MODULE_MISC
-/* Reset Support */
-#define A_RESET() A_CMN(misc._system_reset())
-#define A_RESET_MAC() A_CMN(misc._mac_reset())
-
-/* Assertion failure */
-#define A_ASSFAIL(regdump) A_CMN(misc._assfail((regdump)))
-
-/* Report a failure to the Host */
-#define A_REPORT_FAILURE(data, len) \
- A_CMN(misc._report_failure_to_host((data), (len)))
-
-/* UNALIGNED references are used for ASSERTs */
-#define A_MISALIGNED_LOAD_HANDLER(dump) A_CMN(misc._misaligned_load_handler(dump))
-
-/* reture the host interface type */
-#define A_IS_HOST_PRESENT() A_CMN(misc._is_host_present())
-#define A_KBHIT(delay) A_CMN(misc._kbhit(delay))
-#define A_GET_ROM_VER() A_CMN(misc._rom_version_get())
-#else
-/* Reset Support */
-#define A_RESET()
-#define A_RESET_MAC()
-
-/* Assertion failure */
-#define A_ASSFAIL(regdump)
-
-#define A_MISALIGNED_LOAD_HANDLER(dump)
-
-/* Report a failure to the Host */
-#define A_REPORT_FAILURE(data, len)
-
-#define A_IS_HOST_PRESENT()
-#define A_KBHIT(delay)
-#define A_GET_ROM_VER()
-#endif
-
-//#if SYSTEM_MODULE_DBG
-/* debug Support */
-//#define A_DBG_INIT() A_CMN(dbg._dbg_init())
-//#define A_DBG_TASK() A_CMN(dbg._dbg_task())
-//#else
-//#define A_DBG_INIT()
-//#define A_DBG_TASK()
-//#endif
-
-#if SYSTEM_MODULE_USB
-/* debug Support */
-#define A_USB_INIT() A_CMN(usb._usb_init())
-#define A_USB_ROM_TASK() A_CMN(usb._usb_rom_task())
-#define A_USB_FW_TASK() A_CMN(usb._usb_fw_task())
-#define A_USB_INIT_PHY() A_CMN(usb._usb_init_phy())
-
-#define A_USB_EP0_SETUP() A_CMN(usb._usb_ep0_setup())
-#define A_USB_EP0_TX_DATA() A_CMN(usb._usb_ep0_tx_data())
-#define A_USB_EP0_RX_DATA() A_CMN(usb._usb_ep0_rx_data())
-
-#define A_USB_GET_CONFIG() A_CMN(usb._usb_get_configuration())
-#define A_USB_SET_CONFIG() A_CMN(usb._usb_set_configuration())
-
-#define A_USB_GET_INTERFACE() A_CMN(usb._usb_get_interface())
-#define A_USB_SET_INTERFACE() A_CMN(usb._usb_set_interface())
-
-#define A_USB_STANDARD_CMD() A_CMN(usb._usb_standard_cmd())
-#define A_USB_VENDOR_CMD() A_CMN(usb._usb_vendor_cmd())
-
-#define A_USB_POWER_OFF() A_CMN(usb._usb_power_off())
-#define A_USB_RESET_FIFO() A_CMN(usb._usb_reset_fifo())
-#define A_USB_GEN_WDT() A_CMN(usb._usb_gen_wdt())
-#define A_USB_JUMP_BOOT() A_CMN(usb._usb_jump_boot())
-
-#define A_USB_GET_DESCRIPTOR() A_CMN(usb._usb_get_descriptor())
-#define A_USB_SET_ADDRESS() A_CMN(usb._usb_set_address())
-#define A_USB_SET_FEATURE() A_CMN(usb._usb_set_feature())
-#define A_USB_CLEAR_FEATURE() A_CMN(usb._usb_clr_feature())
-
-#define A_USB_GET_STATUS() A_CMN(usb._usb_get_status())
-#define A_USB_SETUP_DESC() A_CMN(usb._usb_setup_desc())
-#define A_USB_STATUS_IN() A_CMN(usb._usb_status_in())
-#define A_USB_REG_OUT() A_CMN(usb._usb_reg_out())
-
-#define A_USB_EP0_TX() A_CMN(usb._usb_ep0_tx())
-#define A_USB_EP0_RX() A_CMN(usb._usb_ep0_rx())
-#define A_USB_CLK_INIT() A_CMN(usb._usb_clk_init())
-
-#else
-#define A_USB_INIT()
-#define A_USB_TASK()
-#define A_USB_INIT_PHY()
-
-#define A_USB_EP0_SETUP()
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_GET_CONFIG()
-#define A_USB_SET_CONFIG()
-
-#define A_USB_GET_INTERFACE()
-#define A_USB_SET_INTERFACE()
-
-#define A_USB_STANDARD_CMD()
-#define A_USB_VENDOR_CMD()
-
-#define A_USB_POWER_OFF()
-#define A_USB_RESET_FIFO()
-#define A_USB_GEN_WDT()
-#define A_USB_JUMP_BOOT()
-
-#define A_USB_GET_DESCRIPTOR()
-#define A_USB_SET_ADDRESS()
-#define A_USB_SET_FEATURE()
-#define A_USB_CLEAR_FEATURE()
-
-#define A_USB_GET_STATUS()
-#define A_USB_SETUP_DESC()
-
-
-#define A_USB_STATUS_IN()
-#define A_USB_REG_OUT()
-
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_CLK_INIT()
-#endif
-
-#if SYSTEM_MODULE_INTR
-/* Low-level interrupt support intended for use by OS modules */
-#define A_INTR_GET_INTRENABLE() A_CMN(intr._get_intrenable())
-#define A_INTR_SET_INTRENABLE(val) A_CMN(intr._set_intrenable(val))
-#define A_INTR_GET_INTRPENDING() A_CMN(intr._get_intrpending())
-#define A_INTR_UNBLOCK_ALL_INTRLVL() A_CMN(intr._unblock_all_intrlvl())
-
-/* Interrupt support */
-#define A_INTR_INIT() A_CMN(intr._intr_init())
-
-#define A_INTR_DISABLE(pOld) \
- do { \
- *(pOld) = A_CMN(intr._intr_disable()); \
- } while (0)
-
-#define A_INTR_RESTORE(old) A_CMN(intr._intr_restore((old)))
-
-#define A_INVOKE_ISR(inum) A_CMN(intr._intr_invoke_isr(inum))
-
-#define A_INTR_MASK(inum) A_CMN(intr._intr_mask_inum(inum))
-#define A_INTR_UNMASK(inum) A_CMN(intr._intr_unmask_inum(inum))
-
-#define A_ATTACH_ISR(inum, isr, arg) A_CMN(intr._intr_attach_isr(inum, isr, arg))
-#else
-#define A_INTR_INIT()
-#define A_INTR_DISABLE(pOld)
-#define A_INTR_RESTORE(old)
-
-#define A_INTR_GET_INTRENABLE()
-#define A_INTR_SET_INTRENABLE(val)
-#define A_INTR_GET_INTRPENDING()
-#define A_INTR_UNBLOCK_ALL_INTRLVL()
-#define A_INVOKE_ISR(inum)
-#define A_INTR_MASK(inum)
-#define A_INTR_UNMASK(inum)
-#define A_ATTACH_ISR(inum, isr, arg)
-
-#endif
-
-/* Tasklet Support */
-#define A_TASKLET_INIT() A_CMN(tasklet._tasklet_init())
-#define A_TASKLET_INIT_TASK(f, arg, t) A_CMN(tasklet._tasklet_init_task(f, arg, t))
-#define A_TASKLET_DISABLE(t) A_CMN(tasklet._tasklet_disable(t))
-#define A_TASKLET_SCHEDULE(t) A_CMN(tasklet._tasklet_schedule(t))
-#define A_TASKLET_RUN() A_CMN(tasklet._tasklet_run())
-
-
-/* RAM Allocation Support */
-#if defined(__mips__)
-#define alloc_arena_start _end
-#endif
-#if defined(__XTENSA__)
-#define alloc_arena_start _end
-#endif
-
-#if SYSTEM_MODULE_CLOCK
-
-#define A_CLOCK_INIT(refclk_guess) A_CMN(clock._clock_init(refclk_guess))
-#define A_CLOCK_TICK() A_CMN(clock._clock_tick())
-#define A_CLOCK_GET_TICK() A_CMN(clock._clock_get_tick())
-
-/*
- * Get the number of millisecond ticks since the system was started.
- * Note that this only approximates 1Ms. It's actually 32 ticks of
- * a 32KHz clock.
- *
- * Returns a A_UINT32 value.
- */
-#define A_MILLISECONDS() A_CMN(clock._milliseconds())
-
-/*
- * Get the frequency of the reference clock, expressed as
- * an A_refclk_speed_t.
- */
-#define A_REFCLK_SPEED_GET() A_CMN(clock._refclk_speed_get())
-
-/* Spin delay */
-#define A_DELAY_USECS(us) A_CMN(clock._delay_us(us))
-
-#define A_UART_FREQUENCY() A_CMN(clock._uart_frequency())
-
-#define A_CLOCKREGS_INIT() A_CMN(clock._clockregs_init())
-
-/* which_band is either A_BAND_24GHZ or A_BAND_5GHZ */
-#define A_WLAN_BAND_SET(which_band) \
- A_CMN(clock._wlan_band_set(which_band))
-
-/* Called whenever the system clock changes speed */
-#define A_SYSCLK_CHANGE() A_CMN(clock._sysclk_change())
-
-#else
-
-#define A_CLOCK_INIT(refclk_guess)
-#define A_CLOCK_TICK()
-#define A_CLOCK_GET_TICK()
-#define A_MILLISECONDS()
-#define A_REFCLK_SPEED_GET()
-#define A_DELAY_USECS(us)
-#define A_UART_FREQUENCY()
-#define A_CLOCKREGS_INIT()
-#define A_WLAN_BAND_SET(which_band)
-#define A_SYSCLK_CHANGE()
-
-#endif
-
-// Timer
-#define A_INIT_TIMER(pTimer, pFunction, pArg) \
- A_CMN(timer._timer_setfn((pTimer), (pFunction), (pArg)))
-
-/* Set a (possibly periodic) timer for "period" Milliseconds. */
-#define A_TIMEOUT_MS(pTimer, period) \
- A_CMN(timer._timer_arm((pTimer), (period)))
-
-#define A_UNTIMEOUT(pTimer) \
- A_CMN(timer._timer_disarm(pTimer))
-
-#define A_TIMER_RUN() \
- A_CMN(timer._timer_run())
-
-#define A_GMAC_BOOT_INIT() \
- A_CMN(gmac.gmac_boot_init())
-
-#if SYSTEM_MODULE_ALLOCRAM
-/* Default size of ALLOCRAM area */
-#define ARENA_SZ_DEFAULT 12000
-
-#define A_ALLOCRAM_INIT(arena_start, arena_size) \
-do { \
- extern unsigned int alloc_arena_start; \
- void *astart; \
- int asize; \
- astart = (arena_start) ? (void *)(arena_start) : &alloc_arena_start; \
- asize = (arena_size) ? (arena_size) : (ARENA_SZ_DEFAULT); \
- A_CMN(allocram.cmnos_allocram_init((astart), (asize))); \
-} while (0)
-
-#define A_ALLOCRAM(nbytes) A_CMN(allocram.cmnos_allocram(0, (nbytes)))
-
-#define A_ALLOCRAM_DEBUG() A_CMN(allocram.cmnos_allocram_debug())
-
-#else
-#define A_ALLOCRAM_INIT(arena_start, arena_size)
-#define A_ALLOCRAM(nbytes)
-#define A_ALLOCRAM_DEBUG()
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
-
-#define A_ROMP_INIT() A_CMN(romp._romp_init())
-#define A_ROMP_DOWNLOAD(x) A_CMN(romp._romp_download(x))
-#define A_ROMP_DECODE(addr) A_CMN(romp._romp_decode(addr))
-#define A_ROMP_INSTALL() A_CMN(romp._romp_install())
-#else
-#define A_ROMP_INIT()
-#define A_ROMP_DOWNLOAD(x)
-#define A_ROMP_DECODE(addr)
-#define A_ROMP_INSTALL()
-#endif
-
-#if SYSTEM_MODULE_WDT
-
-#define A_WDT_INIT() A_CMN(wdt_timer._wdt_init())
-#define A_WDT_ENABLE() A_CMN(wdt_timer._wdt_enable())
-#define A_WDT_DISABLE() A_CMN(wdt_timer._wdt_disable())
-#define A_WDT_SET(t) A_CMN(wdt_timer._wdt_set(t))
-#define A_WDT_TASK() A_CMN(wdt_timer._wdt_task())
-#define A_WDT_LASTBOOT() A_CMN(wdt_timer._wdt_last_boot())
-#define A_WDT_RESET() A_CMN(wdt_timer._wdt_reset())
-
-#else
-#define A_WDT_INIT()
-#define A_WDT_ENABLE()
-#define A_WDT_DISABLE()
-#define A_WDT_SET(t)
-#define A_WDT_TASK()
-#define A_WDT_LASTBOOT()
-#define A_WDT_RESET()
-#endif
-
-
-#if SYSTEM_MODULE_EEPROM
-#define A_EEP_INIT() A_CMN(eep._eep_init())
-#define A_EEP_READ(off, len, buf) A_CMN(eep._eep_read(off, len, buf))
-#define A_EEP_WRITE(off, len, buf) A_CMN(eep._eep_write(off, len, buf))
-#define A_EEP_IS_EXIST() A_CMN(eep._eep_is_exist())
-#else
-#define A_EEP_INIT()
-#define A_EEP_READ(off, len, buf)
-#define A_EEP_WRITE(off, len, buf)
-#define A_EEP_IS_EXIST()
-#endif
-
-
-
-struct _A_os_linkage_check; /* OS-dependent */
-
-typedef struct _A_cmnos_indirection_table {
- int (* hal_linkage_check)(int sz, struct _A_os_linkage_check *);
- unsigned int *start_bss;
- void (* app_start)(void);
-
-#if SYSTEM_MODULE_MEM
- struct mem_api mem;
-#endif
-
-#if SYSTEM_MODULE_MISC
- struct misc_api misc;
-#endif
-
-#if SYSTEM_MODULE_PRINT
- struct printf_api printf;
-#endif
-
-#if SYSTEM_MODULE_UART
- struct uart_api uart;
-#endif
-
-//#if SYSTEM_MODULE_DBG
-// struct dbg_api dbg;
-//#endif
-
-
-#if SYSTEM_MODULE_GMAC
- struct gmac_api gmac;
-#endif
-
-#if SYSTEM_MODULE_USB
- struct usb_api usb;
-#endif
-
-#if SYSTEM_MODULE_CLOCK
- struct clock_api clock;
-#endif
-
-#if SYSTEM_MODULE_TIMER
- struct timer_api timer;
-#endif
-
-#if SYSTEM_MODULE_INTR
- struct intr_api intr;
-#endif
-
-#if SYSTEM_MODULE_ALLOCRAM
- struct allocram_api allocram;
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
- struct romp_api romp;
-#endif
-
-#if SYSTEM_MODULE_WDT
- struct wdt_api wdt_timer;
-#endif
-
-#if SYSTEM_MODULE_EEPROM
- struct eep_api eep;
-#endif
-
- struct string_api string;
- struct tasklet_api tasklet;
-
-} _A_cmnos_indirection_table_t;
-
-/* Module installation for cmnos modules */
-
-#if SYSTEM_MODULE_MEM
-extern void cmnos_mem_module_install(struct mem_api *);
-#endif
-
-#if SYSTEM_MODULE_MISC
-extern void cmnos_misc_module_install(struct misc_api *);
-#endif
-
-#if SYSTEM_MODULE_PRINT
-extern void cmnos_printf_module_install(struct printf_api *);
-#endif
-
-#if SYSTEM_MODULE_UART
-extern void cmnos_uart_module_install(struct uart_api *);
-#endif
-
-//#if SYSTEM_MODULE_DBG
-//extern void cmnos_dbg_module_install(struct dbg_api *);
-//#endif
-
-#if SYSTEM_MODULE_USB
-extern void cmnos_usb_module_install(struct usb_api *);
-#endif
-
-#if SYSTEM_MODULE_INTR
-extern void cmnos_intr_module_install(struct intr_api *);
-#endif
-
-#if SYSTEM_MODULE_CLOCK
-extern void cmnos_clock_module_install(struct clock_api *);
-#endif
-
-#if SYSTEM_MODULE_TIMER
-extern void cmnos_timer_module_install(struct timer_api *);
-#endif
-
-#if SYSTEM_MODULE_ALLOCRAM
-extern void cmnos_allocram_module_install(struct allocram_api *);
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
-extern void cmnos_romp_module_install(struct romp_api *);
-#endif
-
-#if SYSTEM_MODULE_WDT
-extern void cmnos_wdt_module_install(struct wdt_api *);
-#endif
-
-#if SYSTEM_MODULE_EEPROM
-extern void cmnos_eep_module_install(struct eep_api *);
-#endif
-
-extern void cmnos_tasklet_module_install(struct tasklet_api *);
-
-extern void cmnos_string_module_install(struct string_api *tbl);
-
-#endif /* __CMNOS_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: dma_engine_api.h
- *
- * @Abstract: DMA Engine api
- *
- * @Notes:
- */
-
-#ifndef _DMA_ENGINE_API_H
-#define _DMA_ENGINE_API_H
-
-#include <vbuf_api.h>
-#include <vdesc_api.h>
-
-struct zsDmaDesc
-{
-#if 1 // BIG_ENDIAN
- volatile u16_t ctrl; // Descriptor control
- volatile u16_t status; // Descriptor status
- volatile u16_t totalLen; // Total length
- volatile u16_t dataSize; // Data size
-#else
- volatile u16_t status; // Descriptor status
- volatile u16_t ctrl; // Descriptor control
- volatile u16_t dataSize; // Data size
- volatile u16_t totalLen; // Total length
-#endif
- struct zsDmaDesc* lastAddr; // Last address of this chain
- volatile u32_t dataAddr; // Data buffer address
- struct zsDmaDesc* nextAddr; // Next TD address
-};
-
-struct zsDmaQueue
-{
- struct zsDmaDesc* head;
- struct zsDmaDesc* terminator;
-};
-
-// Subclass of zsDmaQueue for TX
-struct zsTxDmaQueue
-{
- struct zsDmaDesc* head;
- struct zsDmaDesc* terminator;
-
- /* Below are fields specific to TX */
- VBUF *xmited_buf_head;
- VBUF *xmited_buf_tail;
-};
-
-/* hardware API table structure (API descriptions below) */
-struct dma_engine_api
-{
- void (*_init)();
-
- void (*_init_rx_queue)(struct zsDmaQueue *q);
-
- void (*_init_tx_queue)(struct zsTxDmaQueue *q);
-
- void (*_config_rx_queue)(struct zsDmaQueue *q, int num_desc, int buf_size);
-
- void (*_xmit_buf)(struct zsTxDmaQueue *q, VBUF *buf);
-
- void (*_flush_xmit)(struct zsDmaQueue *q);
-
- VBUF* (*_reap_recv_buf)(struct zsDmaQueue *q);
-
- void (*_return_recv_buf)(struct zsDmaQueue *q, VBUF *buf);
-
- VBUF* (*_reap_xmited_buf)(struct zsTxDmaQueue *q);
-
- void (*_swap_data)(struct zsDmaDesc* desc);
-
- int (*_has_compl_packets)(struct zsDmaQueue *q);
-
- void (*_desc_dump)(struct zsDmaQueue *q);
-
- /* The functions below are for patchable */
- struct zsDmaDesc* (*_get_packet)(struct zsDmaQueue* q);
- void (*_reclaim_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
- void (*_put_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void dma_engine_module_install(struct dma_engine_api *apis);
-
-#endif /* #ifndef _DMA_ENGINE_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __DMA_LIB_H
-#define __DMA_LIB_H
-
-
-/***********************External***************************/
-
-/**
- * @brief DMA engine numbers, HIF need to map them to there
- * respective order
- */
-typedef enum dma_engine{
- DMA_ENGINE_RX0,
- DMA_ENGINE_RX1,
- DMA_ENGINE_RX2,
- DMA_ENGINE_RX3,
- DMA_ENGINE_TX0,
- DMA_ENGINE_TX1,
- DMA_ENGINE_MAX
-}dma_engine_t;
-
-/**
- * @brief Interface type, each HIF should call with its own interface type
- */
-typedef enum dma_iftype{
- DMA_IF_GMAC = 0x0,/* GMAC */
- DMA_IF_PCI = 0x1,/*PCI */
- DMA_IF_PCIE = 0x2 /*PCI Express */
-}dma_iftype_t;
-
-
-struct dma_lib_api{
- A_UINT16 (*tx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
- void (*tx_start)(dma_engine_t eng_no);
- A_UINT16 (*rx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
- void (*rx_config)(dma_engine_t eng_no, a_uint16_t num_desc,
- a_uint16_t gran);
- void (*rx_start)(dma_engine_t eng_no);
- A_UINT32 (*intr_status)(dma_iftype_t if_type);
- A_UINT16 (*hard_xmit)(dma_engine_t eng_no, VBUF *buf);
- void (*flush_xmit)(dma_engine_t eng_no);
- A_UINT16 (*xmit_done)(dma_engine_t eng_no);
- VBUF * (*reap_xmitted)(dma_engine_t eng_no);
- VBUF * (*reap_recv)(dma_engine_t eng_no);
- void (*return_recv)(dma_engine_t eng_no, VBUF *buf);
- A_UINT16 (*recv_pkt)(dma_engine_t eng_no);
-};
-
-
-/**
- * @brief Install the DMA lib api's this for ROM patching
- * support
- *
- * @param apis
- */
-void dma_lib_module_install(struct dma_lib_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __EEPROM_API_H__
-#define __EEPROM_API_H__
-/*
- *
- */
-
-
-typedef enum {
- RET_SUCCESS = 0,
- RET_NOT_INIT,
- RET_NOT_EXIST,
- RET_EEP_CORRUPT,
- RET_EEP_OVERFLOW,
-
- // add return code from here
- RET_UNKNOWN
-}T_EEP_RET;
-
-
-/*!- interface of eeprom access
- *
- */
-struct eep_api {
- void (* _eep_init)(void);
- T_EEP_RET (* _eep_read)(uint16_t, uint16_t, uint16_t *);
- T_EEP_RET (* _eep_write)(uint16_t, uint16_t, uint16_t *);
- T_EEP_RET (*_eep_is_exist)(void);
-
-};
-
-#endif /* __EEPROM_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: HIF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _HIF_API_H
-#define _HIF_API_H
-
-#include <adf_nbuf.h>
-
-/* mailbox hw module configuration structure */
-typedef struct _HIF_CONFIG {
- int dummy;
-} HIF_CONFIG;
-
-typedef struct _HIF_CALLBACK {
- /* callback when a buffer has be sent to the host*/
- void (*send_buf_done)(adf_nbuf_t buf, void *context);
- /* callback when a receive message is received */
- void (*recv_buf)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);
- /* context used for all callbacks */
- void *context;
-} HIF_CALLBACK;
-
-typedef void* hif_handle_t;
-
-/* hardware API table structure (API descriptions below) */
-struct hif_api {
- hif_handle_t (*_init)(HIF_CONFIG *pConfig);
-
- void (* _shutdown)(hif_handle_t);
-
- void (*_register_callback)(hif_handle_t, HIF_CALLBACK *);
-
- int (*_get_total_credit_count)(hif_handle_t);
-
- void (*_start)(hif_handle_t);
-
- void (*_config_pipe)(hif_handle_t handle, int pipe, int creditCount);
-
- int (*_send_buffer)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
-
- void (*_return_recv_buf)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
- //void (*_set_recv_bufsz)(int pipe, int bufsz);
- //void (*_pause_recv)(int pipe);
- //void (*_resume_recv)(int pipe);
- int (*_is_pipe_supported)(hif_handle_t handle, int pipe);
-
- int (*_get_max_msg_len)(hif_handle_t handle, int pipe);
-
- int (*_get_reserved_headroom)(hif_handle_t handle);
-
- void (*_isr_handler)(hif_handle_t handle);
-
- void (*_get_default_pipe)(hif_handle_t handle, A_UINT8 *pipe_uplink, A_UINT8 *pipe_downlink);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void generic_hif_module_install(struct hif_api *apis);
-
-#endif /* #ifndef _HIF_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __HIF_GMAC_H
-#define __HIF_GMAC_H
-
-#include <adf_os_types.h>
-#include <hif_api.h>
-
-
-#define ETH_ALEN 6
-#define GMAC_MAX_PKT_LEN 1600
-#define GMAC_MAX_DESC 5
-
-#define GMAC_DISCV_PKT_SZ 1024
-#define GMAC_DISCV_WAIT 2000
-
-#define ATH_P_MAGBOOT 0x12 /*Magpie GMAC 18 for boot downloader*/
-#define ATH_P_MAGNORM 0x13 /*Magpie GMAC 19 for HTC & others*/
-
-#define ETH_P_ATH 0x88bd
-
-typedef enum hif_gmac_pipe{
- HIF_GMAC_PIPE_RX = 1, /*Normal Priority RX*/
- HIF_GMAC_PIPE_TX = 2, /*Normal Priority TX*/
-}hif_gmac_pipe_t;
-
-struct gmac_api{
- void (*gmac_boot_init)(void);
-};
-
-void cmnos_gmac_module_install(struct gmac_api *boot_apis);
-void hif_gmac_module_install(struct hif_api *apis);
-
-enum __gmac_mii_mode {
- GMAC_MIIMODE_NONE=0,
- GMAC_MIIMODE_MII=1,
- GMAC_MIIMODE_RMII=2,
- GMAC_MIIMODE_GMII=3,
- GMAC_MIIMODE_RGMII=4,
- GMAC_MIIMODE_MAX=5
-};
-enum __gmac_msg_type{
- GMAC_HST_QUERY = 0x0001,
- GMAC_HST_REPLY = 0x0002,
- GMAC_TGT_QUERY = 0x0003,
- GMAC_TGT_REPLY = 0x0004
-};
-
-enum __magpie_regs{
- MAG_REG_GPIO_OE = 0x00052000,/*GPIO Output Enable*/
- MAG_REG_RST = 0x00050010,/*Magpie reset reg*/
- MAG_REG_RST_AHB = 0x00050018,/*Magpie AHB_ARB reset reg*/
- MAG_REG_MII0_CTRL = 0x00054100,/*Magpie MII0 Control reg*/
- MAG_REG_STAT_CTRL = 0x00054104,/*Magpie Status reg*/
-
- MAG_REG_ETH_PLL = 0x5600c,
- MAG_REG_ETHPLL_BYPASS = 0x56010,
-};
-
-enum __gmac_regs{
- GMAC_REG_BASE = 0x00060000,
- GMAC_REG_MAC_CFG1 = 0x00 + GMAC_REG_BASE,/*MAC config 1*/
- GMAC_REG_MAC_CFG2 = 0x04 + GMAC_REG_BASE,/*MAC config 2*/
- GMAC_REG_IPG_IFG = 0x08 + GMAC_REG_BASE,/*Inter-packet-gap*/
- GMAC_REG_HALF_DPLX = 0x0c + GMAC_REG_BASE,/*Half duplex*/
- GMAC_REG_MAX_FRAME = 0x10 + GMAC_REG_BASE,/*Max frame length*/
- GMAC_REG_MII_CFG = 0x20 + GMAC_REG_BASE,/*MII mgmt config*/
- GMAC_REG_MII_CMD = 0x24 + GMAC_REG_BASE,/*MII mgmt command*/
- GMAC_REG_MII_ADDR = 0x28 + GMAC_REG_BASE,/*MII mgmt address*/
- GMAC_REG_MII_CTRL = 0x2c + GMAC_REG_BASE,/*MII mgmt control*/
- GMAC_REG_MII_STAT = 0x30 + GMAC_REG_BASE,/*MII mgmt status*/
- GMAC_REG_MII_PSTAT = 0x34 + GMAC_REG_BASE,/*MII mgmt Phy status/ind*/
- GMAC_REG_IF_CTRL = 0x38 + GMAC_REG_BASE,/*Interface control*/
- GMAC_REG_IF_STAT = 0x3c + GMAC_REG_BASE,/*Interface status*/
- GMAC_REG_MAC_ADDR1 = 0x40 + GMAC_REG_BASE,/*MAC address 1*/
- GMAC_REG_MAC_ADDR2 = 0x44 + GMAC_REG_BASE,/*MAC address 2*/
- GMAC_REG_FIFO_CFG0 = 0x48 + GMAC_REG_BASE,/*FIFO config reg0*/
- GMAC_REG_FIFO_CFG1 = 0x4c + GMAC_REG_BASE,/*FIFO config reg1*/
- GMAC_REG_FIFO_CFG2 = 0x50 + GMAC_REG_BASE,/*FIFO config reg2*/
- GMAC_REG_FIFO_CFG3 = 0x54 + GMAC_REG_BASE,/*FIFO config reg3*/
- GMAC_REG_FIFO_CFG4 = 0x58 + GMAC_REG_BASE,/*FIFO config reg4*/
- GMAC_REG_FIFO_CFG5 = 0x5c + GMAC_REG_BASE,/*FIFO config reg5*/
- GMAC_REG_FIFO_RAM0 = 0x60 + GMAC_REG_BASE,/*FIFO RAM access reg0*/
- GMAC_REG_FIFO_RAM1 = 0x64 + GMAC_REG_BASE,/*FIFO RAM access reg1*/
- GMAC_REG_FIFO_RAM2 = 0x68 + GMAC_REG_BASE,/*FIFO RAM access reg2*/
- GMAC_REG_FIFO_RAM3 = 0x6c + GMAC_REG_BASE,/*FIFO RAM access reg3*/
- GMAC_REG_FIFO_RAM4 = 0x70 + GMAC_REG_BASE,/*FIFO RAM access reg4*/
- GMAC_REG_FIFO_RAM5 = 0x74 + GMAC_REG_BASE,/*FIFO RAM access reg5*/
- GMAC_REG_FIFO_RAM6 = 0x78 + GMAC_REG_BASE,/*FIFO RAM access reg6*/
- GMAC_REG_FIFO_RAM7 = 0x7c + GMAC_REG_BASE,/*FIFO RAM access reg7*/
-};
-
-enum __mag_reg_rst{
- RST_GMAC = (1 << 9),/*Reset the GMAC */
- RST_MII = (3 << 11),/*Reset the MII*/
- RST_OTHERS = 0x5df,/*Reset everybody other than GMAC & MII*/
-};
-
-enum __mag_reg_rst_ahb{
- RST_AHB_GMAC = 0x1
-};
-enum __mag_mii0_ctrl_mode{
- MII0_CTRL_MODE_GMII = 0x00, /* GMII*/
- MII0_CTRL_MODE_MII = 0x01, /*MII*/
- MII0_CTRL_MODE_RGMII = 0x02,/* RGMII */
- MII0_CTRL_MODE_RMII = 0x03, /* RMII */
- MII0_CTRL_MASTER_MODE = 0x04 /* master mode */
-};
-enum __mag_mii0_ctrl_speed {
- MII0_CTLR_SPEED_10 = 0x00, /* 10 mbps*/
- MII0_CTRL_SPEED_100 = 0x10, /*MII control address 100 Mbps*/
- MII0_CTRL_SPEED_1000 = 0x20 /* 1000 */
-};
-
-
-enum __gmac_reg_mac_cfg1{
- MAC_CFG1_TX_EN = (1 << 0),/*TX enable*/
- MAC_CFG1_RX_EN = (1 << 2),/*RX enable*/
- MAC_CFG1_TX_FLOW = (1 << 4),/*TX Flow control enable*/
- MAC_CFG1_RX_FLOW = (1 << 5),/*RX Flow control enable*/
- MAC_CFG1_LOOP_EN = (1 << 8),/*Enable loopback*/
-};
-enum __gmac_reg_mac_cfg2{
- MAC_CFG2_FULL_DUP = (1 << 0),/*Enable Full Duplex*/
- MAC_CFG2_PAD_CRC = (1 << 2),/*Enable MAC based CRC insertion*/
- MAC_CFG2_CHK_LEN = (1 << 4),/*Check Length field*/
- MAC_CFG2_HUGE_FRM = (1 << 5),/*Allow sending huge frames*/
- MAC_CFG2_MII = (1 << 8),/*MAC is MII in mode*/
- MAC_CFG2_GMII = (1 << 9),/*MAC is in GMII mode*/
- MAC_CFG2_PREAMBLE = (7 << 12),/*Default Preamble Length*/
-};
-enum __gmac_reg_mii_cfg{
- MII_CFG_CLK_2MHZ = 0x0006,/*Clock is 2Mhz*/
-};
-
-
-/* following are only for F1 phy on emulation board.*/
-enum __gmac_reg_mii_addr{
- MII_ADDR_RESET = 0x000,/*Flush the MII address register*/
- MII_ADDR_STATS = 0x001,/* Stauts register*/
- MII_ADDR_PHY_IDENT_1 = 0x002,/* phy identifier [18:3]*/
- MII_ADDR_PHY_IDENT_2 = 0x003,/* phy identifier [19:24]*/
- MII_ADDR_AUTONEG_ADV = 0x004,/* Autonegotiaion advertise*/
- MII_ADDR_LINKPART_ABILITY = 0x0005,/* link partner ability*/
- MII_ADDR_AUTONEG_EXP = 0x0006,/* Autonegotiation expansion*/
- MII_ADDR_NEXTPG_TX = 0x0007,/* Next page transmit*/
- MII_ADDR_LINKPART_NEXTPG = 0x0008,/* Link partnet next page*/
- MII_ADDR_1000BASET_CNTRL = 0x0009,/* 1000 base-t control*/
- MII_ADDR_1000BSAET_STATUS = 0x000a,/* 1000 base-t status*/
- MII_ADDR_EXTENDED_STATUS = 0x000f,/* extended status*/
- MII_ADDR_FUNCTION_CTRL = 0x0010,/* function control*/
- MII_ADDR_PHY_REG = 0x0011,/*Phy Status Reg*/
- MII_ADDR_INTERRUPT_ENA = 0x0012,/* interrupt enable*/
- MII_ADDR_INTERRUPT_STATUS = 0x0013,/* interrupt status*/
- MII_ADDR_EXTPHY_CTRL = 0x0014,/* extemded phy specific control*/
- MII_ADDR_CABDET_CTRL = 0x0016,/* cable detect testser control*/
- MII_ADDR_LED_CTRL = 0x0018,/* LED control*/
- MII_ADDR_MANLED_OVER = 0x0019,/* Manual LED override*/
- MII_ADDR_CABDET_STAT = 0x001c,/* cable detect tester status*/
- MII_ADDR_DEBUGPORT_OFF = 0x001d,/* Debug port address offset*/
- MII_ADDR_DEBUGPORT_DATA = 0x001e,/* Debug port data */
-};
-
-/* definitions for MII_ADDR_RESET register definitions*/
-#define MII_ADDR_RESET_RESTART_AUTONEG (1 << 9)
-#define MII_ADDR_RESET_ENABLE_AUTONEG (1 << 12)
-#define MII_ADDR_RESET_ENABLE_LOOPBACK (1<<14)
-#define MII_ADDR_RESET_SOFT_RESET (1<<15)
-/* flags for autonegotiaion register MII_ADDR_AUTONEG_ADV,
- All writes to this register should be followed by a soft
- reset on the phy
- The list is not exhaustive, only required fields added
- */
-#define MII_AUTONEG_10BT_HALF (1<<5)
-#define MII_AUTONEG_10BT_FULL (1<<6)
-#define MII_AUTONEG_100BT_HALF (1<<7)
-#define MII_AUTONEG_100BT_FULL (1<<8)
-#define MII_AUTONEG_PAUSE (1<<9)
-#define MII_1000BASET_1000BT_HALF (1<<8)
-#define MII_1000BASET_1000BT_FULL (1<<9)
-enum __gmac_reg_mii_ctrl{
- MII_CTRL_FULL_DPLX = 0x0100,/*Full Duplex mode*/
- MII_CTRL_SPEED_100 = 0x2000,/*Link Speed 100 Mbps*/
- MII_CTRL_LOOPBACK = 0x4000,/*Enable Loopback mode at PHY*/
- MII_CTRL_RESET = 0x8000,/*BMCR reset*/
-};
-enum __gma_reg_mii_cmd{
- MII_CMD_WRITE = 0x0,
- MII_CMD_READ = 0x1,/*Perform a Read cycle*/
-};
-enum __gmac_reg_fifo_cfg0{
- FIFO_CFG0_EN = 0x1f00,/*Enable all the Fifo module*/
-};
-enum __gmac_reg_fifo_cfg1{
- FIFO_CFG1_SIZE_2K = (0x7ff << 16),/*Fifo size is 2K*/
-};
-enum __gmac_reg_fifo_cfg4{
- FIFO_CFG4_RX_ALL = 0x3ffff,/*receive all frames*/
-};
-enum __gmac_reg_if_ctrl{
- IF_CTRL_SPEED_100 = (1 << 16),/*Interface speed 100 Mbps for MII*/
-};
-
-
-#define MAX_MDIO_IO_LEN 14
-#define MDIO_REG_WIDTH 4
-#define MDIO_REG_BASE 0x54200
-#define MDIO_REG_TO_OFFSET( __reg_number__)\
- (MDIO_REG_BASE + (MDIO_REG_WIDTH * (__reg_number__)))
-
-#define MDIO_OWN_TGT 0x01
-#define MDIO_OWN_HST 0x02
-#define MDIO_REG_WRITE_DELAY 5 /* 5 micro seconds */
-
-/*************************GMAC Data types*******************************/
-typedef enum __gmac_pkt_type{
- GMAC_PKT_IS_BCAST,
- GMAC_PKT_IS_UCAST
-}__gmac_pkt_type_t;
-
-struct __ethhdr{
- unsigned char dst[ETH_ALEN];/*destination eth addr */
- unsigned char src[ETH_ALEN]; /*source ether addr*/
- A_UINT16 etype;/*ether type*/
-}__attribute__((packed));
-/**
- * @brief this is will be in big endian format
- */
-struct __athhdr{
-#ifdef LITTLE_ENDIAN
- A_UINT8 proto:6,
- res:2;
-#else
- A_UINT8 res:2,
- proto:6;
-#endif
- A_UINT8 res_lo;
- A_UINT16 res_hi;
-}__attribute__((packed));
-
-typedef struct __gmac_hdr{
- struct __ethhdr eth;
- struct __athhdr ath;
- A_UINT16 align_pad;/*pad it for 4 byte boundary*/
-}__attribute__((packed)) __gmac_hdr_t;
-
-/*********************************GMAC softC************************/
-
-typedef struct __gmac_softc{
- __gmac_hdr_t hdr;
- A_UINT16 gran;
- HIF_CALLBACK sw;
-}__gmac_softc_t;
-
-
-
-#endif
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __HIF_PCI_H
-#define __HIF_PCI_H
-
-#include <hif_api.h>
-#include <dma_lib.h>
-
-
-#define PCI_MAX_DATA_PKT_LEN 1664
-#define PCI_MAX_CMD_PKT_LEN 512
-#define PCI_MAX_BOOT_DESC 2
-
-typedef enum hif_pci_pipe_rx{
- HIF_PCI_PIPE_RX0, /*Normal Priority RX*/
- HIF_PCI_PIPE_RX1,
- HIF_PCI_PIPE_RX2,
- HIF_PCI_PIPE_RX3,
- HIF_PCI_PIPE_RX_MAX
-}hif_pci_pipe_rx_t;
-
-typedef enum hif_pci_pipe_tx{
- HIF_PCI_PIPE_TX0, /*Normal Priority TX*/
- HIF_PCI_PIPE_TX1,
- HIF_PCI_PIPE_TX_MAX
-}hif_pci_pipe_tx_t;
-
-typedef struct __pci_softc{
- HIF_CALLBACK sw;
-}__pci_softc_t;
-
-struct hif_pci_api{
- void (*pci_boot_init)(void);
- hif_handle_t (*pci_init)(HIF_CONFIG *pConfig);
- void (*pci_reset)(void);
- void (*pci_enable)(void);
- void (*pci_reap_xmitted)(__pci_softc_t *sc,
- dma_engine_t eng_no);
- void (*pci_reap_recv)(__pci_softc_t *sc, dma_engine_t eng_no);
- A_UINT8 (*pci_get_pipe)(dma_engine_t eng);
- dma_engine_t (*pci_get_tx_eng)(hif_pci_pipe_tx_t pipe);
- dma_engine_t (*pci_get_rx_eng)(hif_pci_pipe_rx_t pipe);
-
-};
-
-void hif_pci_api_install(struct hif_pci_api *apis);
-void hif_pci_module_install(struct hif_api *apis);
-#endif
-
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __HIF_USB_H__
-#define __HIF_USB_H__
-
-#include <hif_api.h>
-
-#include <sys_cfg.h>
-#include <vdesc_api.h>
-#include <vbuf_api.h>
-//#include <desc.h>
-//#include <dma_engine_api.h>
-
-#define HIF_USB_PIPE_TX 1
-#define HIF_USB_PIPE_RX 2
-#define HIF_USB_PIPE_INTERRUPT 3
-#define HIF_USB_PIPE_COMMAND 4
-#define HIF_USB_PIPE_HP_TX 5
-#define HIF_USB_PIPE_MP_TX 6
-
-struct VBUF_QUEUE
-{
- VBUF *head;
- VBUF *tail;
-};
-
- /* the mailbox hardware layer context */
-typedef struct _HIF_USB_CONTEXT {
- HIF_CALLBACK hifCb;
- struct zsDmaQueue dnQ;
- struct zsTxDmaQueue upQ;
-#if SYSTEM_MODULE_HP_EP5
- struct zsDmaQueue hpdnQ; // high priority
-#endif
-#if SYSTEM_MODULE_HP_EP6
- struct zsDmaQueue mpdnQ; // medium priority
-#endif
- //struct VBUF_QUEUE upVbufQ;
- VBUF *cmdQueue;
- struct VBUF_QUEUE eventBufQ;
-
- // Left a door for extension the structure
- void *pReserved;
-} HIF_USB_CONTEXT;
-
-void hif_usb_module_install(struct hif_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __HTC_API_H__
-#define __HTC_API_H__
-
-#include <osapi.h>
-#include <htc.h>
-//#include <htc_buf.h>
-//#include <htc_services.h>
-#include <adf_nbuf.h>
-#include <buf_pool_api.h>
-
-#define HTC_HDR_SZ HTC_HDR_LENGTH
-#define HTC_BUFSZ_MAX_SEND 2048
-
-typedef void (* HTC_SERVICE_ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, adf_nbuf_t, void *ServiceCtx);
-typedef void (* HTC_SERVICE_ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, void *ServiceCtx);
-
-/* HTC service structure :
- * the caller is required to allocate storage for the service structure and register the
- * structure using HTC_RegisterService() The service must set the following fields:
- * ProcessRecvMsg
- * ProcessSendBufferComplete
- * ProcessConnect
- * ServiceID
- * MaxSvcMsgSize (for message validation)
- * */
-typedef struct _HTC_SERVICE {
- struct _HTC_SERVICE *pNext;
- /* Callback for processing receive messages. HTC calls this callback whenever a
- * message arrives on the endpoint assigned to this service.
- * HTC_BUFFER is a chain of buffers containing a full application message.
- * HTC_BUFFER->buffer points to the start of the msg buffer (past the HTC header) */
- //void (* ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, HTC_BUFFER *);
- void (* ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, adf_nbuf_t, void *ServiceCtx);
- /* callback to process completed send buffers */
- //void (* ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, HTC_BUFFER *);
- void (* ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, void *ServiceCtx);
- /* optional callback when a connection request occurs.
- * The EndpointID is the assigned endpoint, the callback returns a connect
- * response status code to allow or disallow the connection.
- * pDataIn points to the optional meta data supplied in the connection request
- * pDataOut points to a buffer to send back meta data
- * If no callback is supplied, HTC assumes the connect is allowed */
- A_UINT8 (* ProcessConnect)(struct _HTC_SERVICE *pService,
- HTC_ENDPOINT_ID EndpointID,
- A_UINT8 *pDataIn,
- int LengthIn,
- A_UINT8 *pDataOut,
- int *pLengthOut);
- A_UINT16 ServiceID; /* service ID to match connection requests */
- A_UINT16 ServiceFlags; /* service flags */
- A_UINT16 MaxSvcMsgSize; /* maximum length of service-specific messages exchanged on the endpoint */
- A_UINT16 TrailerSpcCheckLimit; /* amount of space in each send buffer that HTC can check for trailer
- data. This should be set to the smallest HTC buffer that can be sent
- through the service. The service can disable trailer data insertion
- by setting this value to 0. */
- void *ServiceCtx;
-} HTC_SERVICE;
-
-#define HTC_SERVICE_FLAGS_CONNECTED (1 << 0) /* service has at least 1 connection */
-
-#define IS_SERVICE_CONNECTED(s) ((s)->ServiceFlags & HTC_SERVICE_FLAGS_CONNECTED)
-
- /* configuration settings for the WMI service */
-typedef struct _HTC_CONFIG {
- int CreditSize; /* */
- int CreditNumber;
- //int ControlDownLinkPipeID;
- //int ControlUpLinkPipeID;
- adf_os_handle_t OSHandle;
- hif_handle_t HIFHandle;
- pool_handle_t PoolHandle;
-} HTC_CONFIG;
-
-typedef struct _HTC_BUF_CONTEXT {
- A_UINT8 end_point;
- A_UINT8 htc_flags; /* htc flags (used by HTC layer only) */
-} HTC_BUF_CONTEXT;
-
-typedef void* htc_handle_t;
-
-/*
- * setup complete function, supplied by HTC caller at HTC_init time.
- * HTC calls this function after the host has indicated that the service connection
- * phase is complete.
- *
- */
-typedef void (* HTC_SETUP_COMPLETE_CB)(void);
-
-struct htc_apis {
- htc_handle_t (* _HTC_Init)(HTC_SETUP_COMPLETE_CB, HTC_CONFIG *pConfig);
- void (* _HTC_Shutdown)(htc_handle_t);
- void (* _HTC_RegisterService)(htc_handle_t, HTC_SERVICE *);
- void (* _HTC_Ready)(htc_handle_t);
- void (* _HTC_ReturnBuffers)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_t);
- void (* _HTC_ReturnBuffersList)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_queue_t);
- void (* _HTC_SendMsg)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_t);
- int (* _HTC_GetReservedHeadroom)(htc_handle_t handle);
-
- //void (* _HTC_PauseRecv)(HTC_ENDPOINT_ID EndpointID);
- //void (* _HTC_ResumeRecv)(HTC_ENDPOINT_ID EndpointID);
- //void (* _HTC_AddBufferResources)(int buffers);
-
- /* These APIs below are for patch purpose only */
- void (*_HTC_MsgRecvHandler)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);
- void (*_HTC_SendDoneHandler)(adf_nbuf_t buf, void *context);
- void (*_HTC_ControlSvcProcessMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *arg);
- void (*_HTC_ControlSvcProcessSendComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t pBuffers, void *arg);
-
- void *pReserved; /* for expansion if need be */
-};
-
-extern void htc_module_install(struct htc_apis *pAPIs);
-
-#endif /* _HTC_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __INTR_API_H__
-#define __INTR_API_H__
-
-/*
- * Interrupt handler, for application-managed interrupts.
- * When an interrupt occurs, it is automatically disabled.
- * See A_WMAC_INTR_ATTACH() and A_MBOX_INTR_ATTACH().
- *
- * If a handler returns A_HANDLER_DONE, the interrupt is
- * re-enabled. The OS calls the handler next time service
- * is required. This is the normal case for a handler.
- *
- * If a handler returns A_HANDLER_YIELD, the interrupt
- * remains masked. The handler is called again when
- * it is "convenient". This gives the OS an opportunity
- * to run other code/handlers. A handler should return
- * A_HANDLER_YIELD if it might dominate the CPU for too
- * long.
- *
- * If a handler returns A_HANDLER_NOENABLE, the interrupt
- * remains disabled. It is up to the application to re-enable
- * the interrupt (via A_*_INTR_UNMASK) when it's appropriate.
- *
- * Note that many combinations of interrupt functions and
- * interrupt vectors are NOT supported: Callers should use
- * only the macros defined in cmnos_api.h to access the
- * interrupt API.
- */
-#include "cmnos_api.h"
-
-typedef uint32_t A_old_intr_t;
-
-//////////////////////////////////////////////////////////////////
-// this is copied from mercury/cmnos_xtensa.h
-/*
- * These are CMNOS interrupt manifest constants.
- * They have specially-chosen values that align with hardware and or
- * operating system values (see cmnos_interrupt_info).
- */
-#if defined(__XTENSA__)
-/*
- * Enumeration of low and medium priority interrupt numbers
- * which match the CPU hardware configuration:
- */
-
-/* XTensa Level 1 interrupt */
-#define A_INUM_SOFTWARE 0 /* currently unused */
-
-/* XTensa Level2 interrupts */
-#define A_INUM_XTTIMER 1 /* currently unused */
-
-#define A_INUM_TBD_0 2 /* TBD */
-#define A_INUM_CPU_WDT 3 /* RST_CPU watchodg interrupt */
-#define A_INUM_GMAC_DMA 4 /* GMAC DMA interrupt */
-#define A_INUM_GMAC_MDIO 5 /* GMAC MDIO interrupt */
-#define A_INUM_HOST_DMA 6 /* HOST DMA */
-#define A_INUM_CPU_GEN_TIMER 7 /* CPU general timer */
-#define A_INUM_TBD_8 8 /* TBD */
-#define A_INUM_TBD_9 9 /* TBD */
-#define A_INUM_USB_CTRL 10 /* USB core control */
-#define A_INUM_USB_DMA 11 /* USB DMA */
-#define A_INUM_TBD_12 12 /* TBD */
-#define A_INUM_TBD_13 13 /* TBD */
-#define A_INUM_EMUX_CPU 14 /* EMUX CPU */
-#define A_INUM_GPIO_CPU 15 /* GPIO CPU interrupt */
-#define A_INUM_TBD_16 16 /* TBD */
-#define A_INUM_PCIE_CPU 17 /* CPU PCIE interrupt */
-#define A_INUM_RST_CPU_NMI 18 /* RST CPU nmi interrupt */
-
-/* Number of interrupts that map directly into CPU/hal interrupt bits. */
-#define NUM_DIRECT_INTR 19
-
-#endif
-//////////////////////////////////////////////////////////////////
-
-#define CMNOS_IMASK_XTTIMER (1<<A_INUM_XTTIMER)
-#define CMNOS_IMASK_USB_CTRL (1<<A_INUM_USB_CTRL)
-#define CMNOS_IMASK_GMAC_DMA (1<<A_INUM_GMAC_DMA)
-#define CMNOS_IMASK_GMAC_MDIO (1<<A_INUM_GMAC_MDIO)
-#define CMNOS_IMASK_HOST_DMA (1<<A_INUM_HOST_DMA)
-#define CMNOS_IMASK_CPU_GEN_TIMER (1<<A_INUM_CPU_GEN_TIMER)
-
-#define CMNOS_IMASK_EMUX_CPU (1<<A_INUM_EMUX_CPU)
-#define CMNOS_IMASK_GPIO_CPU (1<<A_INUM_GPIO_CPU)
-#define CMNOS_IMASK_PCIE_CPU (1<<A_INUM_PCIE_CPU)
-#define CMNOS_IMASK_RST_CPU_NMI (1<<A_INUM_RST_CPU_NMI)
-
-
-
-typedef enum inum_intr {
- A_INTR_TIMER = 0,
- A_INTR_USB_CTRL,
- A_INTR_USB_DMA,
- A_INTR_ERROR,
- /* add intr above here */
- A_INTR_NUM
-}A_INUM_INTR_T;
-
-//////////////////////////////////////////////////////////////////
-
-/*
- * An interrupt handler, which is a function called in response
- * to a hardware interrupt, possibly as a Delayed Service Routine.
- */
-typedef int (* A_handler_t)(void *);
-/* Return values from a handler/DSR, A_handler_t */
-#define A_HANDLER_NOENABLE 0 /* do not re-enable interrupts */
-#define A_HANDLER_DONE 1 /* all intrs handled, call on next intr */
-#define A_HANDLER_YIELD 2 /* leave intrs disabled and
- call back later regardless of intr state */
-
-/*
- * An Interrupt Service Routine, which must be called
- * directly in interrupt context (not delayed), and which
- * must be very small and may not have access to all OS
- * functions. These are for use only when interrupt
- * latency is critical; otherwise, an A_handler_t ("dsr")
- * is preferable.
- */
-typedef uint32_t (* A_isr_t)(void *);
-/* Return values from an ISR */
-#if defined(CYG_ISR_HANDLED)
-#define A_ISR_HANDLED CYG_ISR_HANDLED
-#define A_ISR_CALL_DSR CYG_ISR_CALL_DSR
-#else
-#define A_ISR_HANDLED 1
-#define A_ISR_CALL_DSR 2
-#endif
-
-struct intr_api {
- void (*_intr_init)(void);
- uint32_t (* _intr_invoke_isr)(uint32_t inum);
- A_old_intr_t(* _intr_disable)(void);
- void (* _intr_restore)(A_old_intr_t);
-
- void (* _intr_mask_inum)(uint32_t inum);
- void (* _intr_unmask_inum)(uint32_t inum);
- void (* _intr_attach_isr)(uint32_t inum, A_isr_t isr, void *arg);
-/*
- BOOLEAN (*_intr_dsrs_pending)(void);
- void (* _intr_handle_pending_dsrs)(void);
- uint32_t (* _intr_nmi)(void *);
-*/
- /* Low-level interrupt access, intended for use by OS modules */
- unsigned int (* _get_intrenable)(void);
- void (* _set_intrenable)(unsigned int);
- unsigned int (* _get_intrpending)(void);
- void (* _unblock_all_intrlvl)(void);
-};
-#endif /* __INTR_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __MAGPIE_REGDUMP_H__
-#define __MAGPIE_REGDUMP_H__
-
-#if !defined(__ASSEMBLER__)
-/*
- * XTensa CPU state
- * This must match the state saved by the target exception handler.
- */
-struct XTensa_exception_frame_s {
- uint32_t xt_pc;
- uint32_t xt_ps;
- uint32_t xt_sar;
- uint32_t xt_vpri;
- uint32_t xt_a2;
- uint32_t xt_a3;
- uint32_t xt_a4;
- uint32_t xt_a5;
- uint32_t xt_exccause;
- uint32_t xt_lcount;
- uint32_t xt_lbeg;
- uint32_t xt_lend;
-
- /* Extra info to simplify post-mortem stack walkback */
-#define MAGPIE_REGDUMP_FRAMES 5
- struct {
- uint32_t a0; /* pc */
- uint32_t a1; /* sp */
- uint32_t a2;
- uint32_t a3;
- } wb[MAGPIE_REGDUMP_FRAMES];
-};
-
-typedef struct XTensa_exception_frame_s CPU_exception_frame_t;
-#define RD_SIZE sizeof(CPU_exception_frame_t)
-
-#endif
-#endif /* __MAGPIE_REGDUMP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __MEM_API_H__
-#define __MEM_API_H__
-struct mem_api {
- void (* _mem_init)(void);
- void *(* _memset)(void *, int, unsigned int);
- void *(* _memcpy)(void *, const void *, unsigned int);
- void *(* _memmove)(void *, const void *, unsigned int);
- int (* _memcmp)(const void *, const void *, unsigned int);
-};
-#endif /* __MEM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __MISC_API_H__
-#define __MISC_API_H__
-
-enum hostif_s{
- HIF_USB = 0,
- HIF_PCIE,
- HIF_GMAC,
- HIF_PCI,
-
- // HIF should be added above here
- HIF_NUM,
- HIF_NONE
-
-};
-
-typedef enum hostif_s A_HOSTIF;
-
-struct register_dump_s;
-
-struct misc_api {
- void (* _system_reset)(void);
- void (* _mac_reset)(void);
- void (* _assfail)(struct register_dump_s *);
- void (* _misaligned_load_handler)(struct register_dump_s *);
-
- void (* _report_failure_to_host)(struct register_dump_s *, int);
- int (* _target_id_get)(void);
- A_HOSTIF (* _is_host_present)(void);
-
- uint8_t (*_kbhit)(uint8_t);
-
- uint16_t (* _rom_version_get)(void);
-};
-#endif /* __MISC_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#define AH_SUPPORT_AR5416 1
-#define AH_SUPPORT_2133 1
-#define AH_SUPPORT_5413 1
-//#define AH_DEBUG 1
-//#define AR5416_EMULATION 1
-#define ATH_FORCE_PPM 1
-#define ATH_FORCE_BIAS 1
-#define AH_SUPPORT_DFS 1
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __PRINTF_API_H__
-#define __PRINTF_API_H__
-
-struct printf_api {
- void (* _printf_init)(void);
- int (* _printf)(const char * fmt, ...);
-};
-
-/* NB: The printf module requires the serial module. */
-void cmnos_printf_module_install(struct printf_api *tbl);
-int cmnos_printf(const char *fmt, ...);
-
-
-
-#endif /* __PRINTF_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __REGDUMP_H__
-#define __REGDUMP_H__
-
-#include "magpie_regdump.h"
-
-
-#if !defined(__ASSEMBLER__)
-
-/*
- * XTensa CPU state
- * This must match the state saved by the target exception handler.
- */
-
-#define RD_SIZE sizeof(CPU_exception_frame_t)
-
-/*
- * Target CPU state at the time of failure is reflected
- * in a register dump, which the Host can fetch through
- * the diagnostic window.
- */
-struct register_dump_s {
- uint32_t target_id; /* Target ID */
- uint32_t assline; /* Line number (if assertion failure) */
- uint32_t pc; /* Program Counter at time of exception */
- uint32_t badvaddr; /* Virtual address causing exception */
- CPU_exception_frame_t exc_frame; /* CPU-specific exception info */
-
- /* Could copy top of stack here, too.... */
-};
-
-
-#endif /* __ASSEMBLER__ */
-#endif /* __REGDUMP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*************************************************************************/
-/* Copyright (c) 2008 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : romp_api.h */
-/* */
-/* Abstract */
-/* This file contains definition of data structure and interface */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _ROMP_API_H_
-#define _ROMP_API_H_
-
-#include "dt_defs.h"
-
-/******** hardware API table structure (API descriptions below) *************/
-struct romp_api {
- void (*_romp_init)(void);
- BOOLEAN (*_romp_download)(uint16_t );
- BOOLEAN (*_romp_install)(void);
- BOOLEAN (*_romp_decode)(uint32_t );
-};
-
-#define _ROMP_MAGIC_ "[PaTcH]"
-
-struct rom_patch_st {
- uint16_t crc16; // crc filed to maintain the integrity
- uint16_t len; // length of the patch code
- uint32_t ld_addr; // load address of the patch code
- uint32_t fun_addr; // entry address of the patch code
- uint8_t *pfun; // patch code
-};
-
-
-struct eep_redir_addr {
- uint16_t offset;
- uint16_t size;
-};
-
-
-/************************* EXPORT function ***************************/
-uint16_t cal_crc16(uint32_t sz, uint8_t *p);
-
-#endif // end of _UART_API_H_
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __STRING_API_H__
-#define __STRING_API_H__
-struct string_api {
- void (* _string_init)(void);
- char *(* _strcpy)(char *, const char *);
- char *(* _strncpy)(char *, const char *, unsigned int);
- int (* _strlen)(const char *);
- int (* _strcmp)(const char *, const char *);
- int (* _strncmp)(const char *, const char *, unsigned int);
-};
-#endif /* __STRING_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __TASKLET_API_H__
-#define __TASKLET_API_H__
-
-//typedef int A_tasklet_t;
-
-typedef void (*A_TASKLET_FUNC)(void *arg);
-
-#define A_TASKLET_STATE_DISABLE 0
-#define A_TASKLET_STATE_SCHEDULED 1
-#define A_TASKLET_STATE_RUNNING 2
-
-struct _tasklet {
- A_TASKLET_FUNC func;
- void *arg;
- int state;
- struct _tasklet *next;
-};
-
-typedef struct _tasklet A_tasklet_t;
-
-struct tasklet_api {
- void (* _tasklet_init)(void);
- void (* _tasklet_init_task)(A_TASKLET_FUNC, void * arg, A_tasklet_t *);
- void (* _tasklet_disable)(A_tasklet_t *);
- void (* _tasklet_schedule)(A_tasklet_t *);
- void (* _tasklet_run)(void);
-};
-#endif /* __TASKLET_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __TIMER_API_H__
-#define __TIMER_API_H__
-/*
- * In order to remain completely independent of OS header files,
- * "_SPACE" structures are declared with sufficient room to hold
- * corresponding OS structures.
- */
-typedef unsigned int _A_TIMER_SPACE[5];
-typedef _A_TIMER_SPACE A_timer_t;
-#define A_TIMER A_timer_t /* historical */
-
-typedef unsigned int A_HANDLE; /* historical */
-typedef void A_TIMER_FUNC(A_HANDLE timer_handle, void *arg);
-
-struct timer_api {
- void (* _timer_init)(void);
- void (* _timer_arm)(A_timer_t *, unsigned int);
- void (* _timer_disarm)(A_timer_t *);
- void (* _timer_setfn)(A_timer_t *, A_TIMER_FUNC, void *);
- void (* _timer_run)(void);
-};
-#endif /* __TIMER_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*************************************************************************/
-/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : uart.h */
-/* */
-/* Abstract */
-/* This file contains definition of uart registers, marco and api. */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _UART_API_H_
-#define _UART_API_H_
-
-#include "reg_defs.h"
-
-/************************** Register deinition ***************************/
-#define RBR_ADDRESS 0x00051000
-#define RBR_OFFSET 0x00000000
-#define RBR_RBR_MSB 7
-#define RBR_RBR_LSB 0
-#define RBR_RBR_MASK 0x000000ff
-#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB)
-#define RBR_RBR_SET(x) (((x) << RBR_RBR_LSB) & RBR_RBR_MASK)
-
-#define THR_ADDRESS 0x00051000
-#define THR_OFFSET 0x00000000
-#define THR_THR_MSB 7
-#define THR_THR_LSB 0
-#define THR_THR_MASK 0x000000ff
-#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB)
-#define THR_THR_SET(x) (((x) << THR_THR_LSB) & THR_THR_MASK)
-
-#define DLL_ADDRESS 0x00051000
-#define DLL_OFFSET 0x00000000
-#define DLL_DLL_MSB 7
-#define DLL_DLL_LSB 0
-#define DLL_DLL_MASK 0x000000ff
-#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB)
-#define DLL_DLL_SET(x) (((x) << DLL_DLL_LSB) & DLL_DLL_MASK)
-
-#define DLH_ADDRESS 0x00051004
-#define DLH_OFFSET 0x00000004
-#define DLH_DLH_MSB 7
-#define DLH_DLH_LSB 0
-#define DLH_DLH_MASK 0x000000ff
-#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB)
-#define DLH_DLH_SET(x) (((x) << DLH_DLH_LSB) & DLH_DLH_MASK)
-
-#define IER_ADDRESS 0x00051004
-#define IER_OFFSET 0x00000004
-#define IER_EDDSI_MSB 3
-#define IER_EDDSI_LSB 3
-#define IER_EDDSI_MASK 0x00000008
-#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB)
-#define IER_EDDSI_SET(x) (((x) << IER_EDDSI_LSB) & IER_EDDSI_MASK)
-#define IER_ELSI_MSB 2
-#define IER_ELSI_LSB 2
-#define IER_ELSI_MASK 0x00000004
-#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB)
-#define IER_ELSI_SET(x) (((x) << IER_ELSI_LSB) & IER_ELSI_MASK)
-#define IER_ETBEI_MSB 1
-#define IER_ETBEI_LSB 1
-#define IER_ETBEI_MASK 0x00000002
-#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB)
-#define IER_ETBEI_SET(x) (((x) << IER_ETBEI_LSB) & IER_ETBEI_MASK)
-#define IER_ERBFI_MSB 0
-#define IER_ERBFI_LSB 0
-#define IER_ERBFI_MASK 0x00000001
-#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB)
-#define IER_ERBFI_SET(x) (((x) << IER_ERBFI_LSB) & IER_ERBFI_MASK)
-
-#define IIR_ADDRESS 0x00051008
-#define IIR_OFFSET 0x00000008
-#define IIR_FIFO_STATUS_MSB 7
-#define IIR_FIFO_STATUS_LSB 6
-#define IIR_FIFO_STATUS_MASK 0x000000c0
-#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB)
-#define IIR_FIFO_STATUS_SET(x) (((x) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK)
-#define IIR_IID_MSB 3
-#define IIR_IID_LSB 0
-#define IIR_IID_MASK 0x0000000f
-#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB)
-#define IIR_IID_SET(x) (((x) << IIR_IID_LSB) & IIR_IID_MASK)
-
-#define FCR_ADDRESS 0x00051008
-#define FCR_OFFSET 0x00000008
-#define FCR_RCVR_TRIG_MSB 7
-#define FCR_RCVR_TRIG_LSB 6
-#define FCR_RCVR_TRIG_MASK 0x000000c0
-#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB)
-#define FCR_RCVR_TRIG_SET(x) (((x) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK)
-#define FCR_DMA_MODE_MSB 3
-#define FCR_DMA_MODE_LSB 3
-#define FCR_DMA_MODE_MASK 0x00000008
-#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB)
-#define FCR_DMA_MODE_SET(x) (((x) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK)
-#define FCR_XMIT_FIFO_RST_MSB 2
-#define FCR_XMIT_FIFO_RST_LSB 2
-#define FCR_XMIT_FIFO_RST_MASK 0x00000004
-#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB)
-#define FCR_XMIT_FIFO_RST_SET(x) (((x) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK)
-#define FCR_RCVR_FIFO_RST_MSB 1
-#define FCR_RCVR_FIFO_RST_LSB 1
-#define FCR_RCVR_FIFO_RST_MASK 0x00000002
-#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB)
-#define FCR_RCVR_FIFO_RST_SET(x) (((x) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK)
-#define FCR_FIFO_EN_MSB 0
-#define FCR_FIFO_EN_LSB 0
-#define FCR_FIFO_EN_MASK 0x00000001
-#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB)
-#define FCR_FIFO_EN_SET(x) (((x) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK)
-
-#define LCR_ADDRESS 0x0005100c
-#define LCR_OFFSET 0x0000000c
-#define LCR_DLAB_MSB 7
-#define LCR_DLAB_LSB 7
-#define LCR_DLAB_MASK 0x00000080
-#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB)
-#define LCR_DLAB_SET(x) (((x) << LCR_DLAB_LSB) & LCR_DLAB_MASK)
-#define LCR_BREAK_MSB 6
-#define LCR_BREAK_LSB 6
-#define LCR_BREAK_MASK 0x00000040
-#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB)
-#define LCR_BREAK_SET(x) (((x) << LCR_BREAK_LSB) & LCR_BREAK_MASK)
-#define LCR_EPS_MSB 4
-#define LCR_EPS_LSB 4
-#define LCR_EPS_MASK 0x00000010
-#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB)
-#define LCR_EPS_SET(x) (((x) << LCR_EPS_LSB) & LCR_EPS_MASK)
-#define LCR_PEN_MSB 3
-#define LCR_PEN_LSB 3
-#define LCR_PEN_MASK 0x00000008
-#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB)
-#define LCR_PEN_SET(x) (((x) << LCR_PEN_LSB) & LCR_PEN_MASK)
-#define LCR_STOP_MSB 2
-#define LCR_STOP_LSB 2
-#define LCR_STOP_MASK 0x00000004
-#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB)
-#define LCR_STOP_SET(x) (((x) << LCR_STOP_LSB) & LCR_STOP_MASK)
-#define LCR_CLS_MSB 1
-#define LCR_CLS_LSB 0
-#define LCR_CLS_MASK 0x00000003
-#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB)
-#define LCR_CLS_SET(x) (((x) << LCR_CLS_LSB) & LCR_CLS_MASK)
-
-#define MCR_ADDRESS 0x00051010
-#define MCR_OFFSET 0x00000010
-#define MCR_LOOPBACK_MSB 5
-#define MCR_LOOPBACK_LSB 5
-#define MCR_LOOPBACK_MASK 0x00000020
-#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB)
-#define MCR_LOOPBACK_SET(x) (((x) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK)
-#define MCR_OUT2_MSB 3
-#define MCR_OUT2_LSB 3
-#define MCR_OUT2_MASK 0x00000008
-#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB)
-#define MCR_OUT2_SET(x) (((x) << MCR_OUT2_LSB) & MCR_OUT2_MASK)
-#define MCR_OUT1_MSB 2
-#define MCR_OUT1_LSB 2
-#define MCR_OUT1_MASK 0x00000004
-#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB)
-#define MCR_OUT1_SET(x) (((x) << MCR_OUT1_LSB) & MCR_OUT1_MASK)
-#define MCR_RTS_MSB 1
-#define MCR_RTS_LSB 1
-#define MCR_RTS_MASK 0x00000002
-#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB)
-#define MCR_RTS_SET(x) (((x) << MCR_RTS_LSB) & MCR_RTS_MASK)
-#define MCR_DTR_MSB 0
-#define MCR_DTR_LSB 0
-#define MCR_DTR_MASK 0x00000001
-#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB)
-#define MCR_DTR_SET(x) (((x) << MCR_DTR_LSB) & MCR_DTR_MASK)
-
-#define LSR_ADDRESS 0x00051014
-#define LSR_OFFSET 0x00000014
-#define LSR_FERR_MSB 7
-#define LSR_FERR_LSB 7
-#define LSR_FERR_MASK 0x00000080
-#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB)
-#define LSR_FERR_SET(x) (((x) << LSR_FERR_LSB) & LSR_FERR_MASK)
-#define LSR_TEMT_MSB 6
-#define LSR_TEMT_LSB 6
-#define LSR_TEMT_MASK 0x00000040
-#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB)
-#define LSR_TEMT_SET(x) (((x) << LSR_TEMT_LSB) & LSR_TEMT_MASK)
-#define LSR_THRE_MSB 5
-#define LSR_THRE_LSB 5
-#define LSR_THRE_MASK 0x00000020
-#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB)
-#define LSR_THRE_SET(x) (((x) << LSR_THRE_LSB) & LSR_THRE_MASK)
-#define LSR_BI_MSB 4
-#define LSR_BI_LSB 4
-#define LSR_BI_MASK 0x00000010
-#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB)
-#define LSR_BI_SET(x) (((x) << LSR_BI_LSB) & LSR_BI_MASK)
-#define LSR_FE_MSB 3
-#define LSR_FE_LSB 3
-#define LSR_FE_MASK 0x00000008
-#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB)
-#define LSR_FE_SET(x) (((x) << LSR_FE_LSB) & LSR_FE_MASK)
-#define LSR_PE_MSB 2
-#define LSR_PE_LSB 2
-#define LSR_PE_MASK 0x00000004
-#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB)
-#define LSR_PE_SET(x) (((x) << LSR_PE_LSB) & LSR_PE_MASK)
-#define LSR_OE_MSB 1
-#define LSR_OE_LSB 1
-#define LSR_OE_MASK 0x00000002
-#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB)
-#define LSR_OE_SET(x) (((x) << LSR_OE_LSB) & LSR_OE_MASK)
-#define LSR_DR_MSB 0
-#define LSR_DR_LSB 0
-#define LSR_DR_MASK 0x00000001
-#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB)
-#define LSR_DR_SET(x) (((x) << LSR_DR_LSB) & LSR_DR_MASK)
-
-#define MSR_ADDRESS 0x00051018
-#define MSR_OFFSET 0x00000018
-#define MSR_DCD_MSB 7
-#define MSR_DCD_LSB 7
-#define MSR_DCD_MASK 0x00000080
-#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB)
-#define MSR_DCD_SET(x) (((x) << MSR_DCD_LSB) & MSR_DCD_MASK)
-#define MSR_RI_MSB 6
-#define MSR_RI_LSB 6
-#define MSR_RI_MASK 0x00000040
-#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB)
-#define MSR_RI_SET(x) (((x) << MSR_RI_LSB) & MSR_RI_MASK)
-#define MSR_DSR_MSB 5
-#define MSR_DSR_LSB 5
-#define MSR_DSR_MASK 0x00000020
-#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB)
-#define MSR_DSR_SET(x) (((x) << MSR_DSR_LSB) & MSR_DSR_MASK)
-#define MSR_CTS_MSB 4
-#define MSR_CTS_LSB 4
-#define MSR_CTS_MASK 0x00000010
-#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB)
-#define MSR_CTS_SET(x) (((x) << MSR_CTS_LSB) & MSR_CTS_MASK)
-#define MSR_DDCD_MSB 3
-#define MSR_DDCD_LSB 3
-#define MSR_DDCD_MASK 0x00000008
-#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB)
-#define MSR_DDCD_SET(x) (((x) << MSR_DDCD_LSB) & MSR_DDCD_MASK)
-#define MSR_TERI_MSB 2
-#define MSR_TERI_LSB 2
-#define MSR_TERI_MASK 0x00000004
-#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB)
-#define MSR_TERI_SET(x) (((x) << MSR_TERI_LSB) & MSR_TERI_MASK)
-#define MSR_DDSR_MSB 1
-#define MSR_DDSR_LSB 1
-#define MSR_DDSR_MASK 0x00000002
-#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB)
-#define MSR_DDSR_SET(x) (((x) << MSR_DDSR_LSB) & MSR_DDSR_MASK)
-#define MSR_DCTS_MSB 0
-#define MSR_DCTS_LSB 0
-#define MSR_DCTS_MASK 0x00000001
-#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB)
-#define MSR_DCTS_SET(x) (((x) << MSR_DCTS_LSB) & MSR_DCTS_MASK)
-
-
-/************************** config definition ***************************/
-#define UART_FIFO_SIZE 512 //Must be 2^N
-
-#define USE_POST_BUFFER 0 // ENABLE a tx buffer for post processing,
-/*********************** data struction definition ************************/
-// data struction definition
-struct uart_fifo {
-#if USE_POST_BUFFER
- uint8_t buf[UART_FIFO_SIZE];
-#endif
- uint16_t start_index;
- uint16_t end_index;
- uint32_t overrun_err;
-};
-
-
-struct uart_blk {
- uint16_t debug_mode;
- uint16_t baud;
- struct uart_api *_uart;
- struct uart_fifo _tx;
-};
-
-
-/******** hardware API table structure (API descriptions below) *************/
-struct uart_api {
- uint32_t (*_uart_init)(void);
- void (*_uart_char_put)(uint8_t ch);
- uint16_t (*_uart_char_get)(uint8_t* ch);
- void (*_uart_str_out)(uint8_t* str);
- void (*_uart_task)(void);
- uint32_t (*_uart_status)(void);
- void (*_uart_config)(uint16_t flag);
- void (*_uart_hwinit)(uint32_t freq, uint32_t baud);
- //void (*_uart_config)(uint8_t cmd, void *pData);
-};
-
-/************************* EXPORT function ***************************/
-
-
-#endif // end of _UART_API_H_
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _USB_TABLE_H_
-#define _USB_TABLE_H_
-
-// UsbDeviceDescriptor
-#define USB_DEVICE_DESC_TYPE 0x01
-#define USB_DEVICE_DESC_LEN 0x12
-#define USB_SPEC_VERSION 0x0200
-#define USB_DEVICE_CLASS 0xFF
-#define USB_DEVICE_SUB_CLASS 0xFF
-#define USB_DEVICE_PROTOCOL 0xFF
-#define USB_MAX_PKT_SIZE 0x40
-#define USB_VENDOR_ID 0x0CF3
-#define USB_PRODUCT_ID 0x7010
-#define USB_DEVICE_BCD BOOTROM_VER
-#define USB_MANUFACTURER_INDEX 0x10
-#define USB_PRODUCT_INDEX 0x20
-#define USB_SERIAL_INDEX 0x30
-#define USB_CONFIGURATION_NUM 0x01
-// end UsbDeviceDescriptor
-
-#define USB_CONFIG_DESC_TYPE 0x02
-#define USB_CONFIG_DESC_LEN 0x09
-//#define USB_TOTAL_DESC_LEN 0x002E // 4 ep
-//#define USB_TOTAL_DESC_LEN 0x0035 // 5 ep
-#define USB_TOTAL_DESC_LEN 0x003C // 6 ep
-#define USB_INTERFACE_NUM 0x01
-#define USB_CONFIG_NUM 0x01
-#define USB_STRING_INDEX 0x00
-#define USB_ATTRIBUTE 0x80
-#define USB_MAX_POWER 0xFA
-
-#define USB_INTERFACE_DESC_TYPE 0x04
-#define USB_INTERFACE_DESC_LEN 0x09
-#define USB_INTERFACE_INDEX_NUM 0x00
-#define USB_INTERFACE_ALT_SETTING 0x00
-//#define USB_INTERFACE_EP_NUM 0x04
-//#define USB_INTERFACE_EP_NUM 0x05
-#define USB_INTERFACE_EP_NUM 0x06
-#define USB_INTERFACE_CLASS 0xFF
-#define USB_INTERFACE_SUB_CLASS 0x00
-#define USB_INTERFACE_PROTOCOL 0x00
-#define USB_INTERFACE_STRING_INDEX 0x00
-
-#define USB_EP_DESC_TYPE 0x05
-#define USB_EP_DESC_LEN 0x07
-
-/* USB Endpoint attribute */
-#define bUSB_EP1_NUM 0x01
-#define bUSB_EP2_NUM 0x02
-#define bUSB_EP3_NUM 0x03
-#define bUSB_EP4_NUM 0x04
-#define bUSB_EP5_NUM 0x05
-#define bUSB_EP6_NUM 0x06
-
-#define bUSB_EP_DIRECTION_IN 0x80
-#define bUSB_EP_DIRECTION_OUT 0x00
-
-#define bUSB_EP_TYPE_CONTROL 0x00
-#define bUSB_EP_TYPE_ISOCHRONOUS 0x01
-#define bUSB_EP_TYPE_BULK 0x02
-#define bUSB_EP_TYPE_INTERRUPT 0x03
-
-#define bUSB_EP_MAX_PKT_SIZE_64 0x0040
-#define bUSB_EP_MAX_PKT_SIZE_512 0x0200
-
-/* High Speed Endpoint */
-#define USB_HS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
-#define USB_HS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP1_INTERVAL 0x00
-
-#define USB_HS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
-#define USB_HS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP2_INTERVAL 0x00
-
-#define USB_HS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
-#define USB_HS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
-#define USB_HS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_HS_EP3_INTERVAL 0x01
-
-#define USB_HS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
-#define USB_HS_EP4_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT //bUSB_EP_TYPE_BULK
-#define USB_HS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_HS_EP4_INTERVAL 0x01 //0x00
-
-#define USB_HS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
-#define USB_HS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP5_INTERVAL 0x00
-
-#define USB_HS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
-#define USB_HS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP6_INTERVAL 0x00
-
-/* Full Speed Endpoint */
-#define USB_FS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
-#define USB_FS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP1_INTERVAL 0x00
-
-#define USB_FS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
-#define USB_FS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP2_INTERVAL 0x00
-
-#define USB_FS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
-#define USB_FS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
-#define USB_FS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP3_INTERVAL 0x01
-
-#define USB_FS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
-#define USB_FS_EP4_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP4_INTERVAL 0x00
-
-#define USB_FS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
-#define USB_FS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP5_INTERVAL 0x00
-
-#define USB_FS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
-#define USB_FS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP6_INTERVAL 0x00
-
-//#define USB_QUALIFIER_DESC_ADDR 0x8cff00
-//#define USB_OTHER_SPEED_DESC_ADDR 0x8cffA
-
-#endif // end of _USB_TABLE_H_
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * @File: VBUF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _VBUF_API_H
-#define _VBUF_API_H
-
-#include <vdesc_api.h>
-
-#define MAX_BUF_CTX_LEN 20
-
-typedef struct _VBUF
-{
- VDESC *desc_list;
- struct _VBUF *next_buf;
- A_UINT16 buf_length;
- A_UINT8 reserved[2];
- A_UINT8 ctx[MAX_BUF_CTX_LEN];
- //A_UINT8 end_point;
- //A_UINT8 reserved[1];
-} VBUF;
-
-#define VBUF_GET_DATA_ADDR(vbuf) (vbuf->desc_list->buf_addr + vbuf->desc_list->data_offset)
-
-/* hardware API table structure (API descriptions below) */
-struct vbuf_api {
- void (*_init)(int nBuf);
- VBUF* (*_alloc_vbuf)(void);
- VBUF* (*_alloc_vbuf_with_size)(int size, int reserve);
- void (*_free_vbuf)(VBUF *buf);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void vbuf_module_install(struct vbuf_api *apis);
-
-#endif /* #ifndef _HIF_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _VDESC_API_H
-#define _VDESC_API_H
-
-//#define VDESC_CONTROL_BUF_HDR (1 << 6) /* the buffer was manipulated and a header added */
-
-#define MAX_HW_DESC_SIZE 20
-
-typedef struct _VDESC
-{
- struct _VDESC *next_desc;
- A_UINT8 *buf_addr;
- A_UINT16 buf_size;
- A_UINT16 data_offset;
- A_UINT16 data_size;
- A_UINT16 control;
- A_UINT8 hw_desc_buf[MAX_HW_DESC_SIZE];
-} VDESC;
-
-//#define VDESC_HW_TO_VDESC(hwdesc) ((VDESC *)(((A_UINT32 *)hwdesc - 4)))
-#define VDESC_HW_TO_VDESC(hwdesc) ((VDESC *)(((A_UINT32 *)hwdesc - 4)))
-
-struct vdesc_api {
- void (*_init)(int nDesc);
- VDESC* (*_alloc_vdesc)();
- A_UINT8* (*_get_hw_desc)(VDESC *desc);
- void (*_swap_vdesc)(VDESC *dest, VDESC *src);
- //void (*_free_vdesc)(void);
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void vdesc_module_install(struct vdesc_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * * Neither the name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef __WDT_API_H__
-#define __WDT_API_H__
-/*
- *
- */
-
-typedef enum {
- WDT_ACTION_NO = 0, // bit1, bit0: 00
- WDT_ACTION_INTR, // bit1, bit0: 01
- WDT_ACTION_NMI, // bit1, bit0: 10
- WDT_ACTION_RESET, // bit1, bit0: 11
-
- WDT_ACTION_UNKNOWN
-}T_WDT_ACTION_TYPE;
-
-
-typedef enum {
- WDT_TIMEOUT = 1,
- WDT_ACTION,
-
- WDT_UNKNOWN
-}T_WDT_CMD_TYPE;
-
-typedef struct {
- uint32_t cmd;
- union {
- uint32_t timeout;
- uint32_t action;
- };
-}T_WDT_CMD;
-
-
-typedef enum{
- ENUM_WDT_BOOT = 1,
- ENUM_COLD_BOOT,
- ENUM_SUSP_BOOT,
-
- // add above here
- ENUM_UNKNOWN_BOOT
-}T_BOOT_TYPE;
-
-
-/*!- interface of watchdog timer
- *
- */
-struct wdt_api {
- void (* _wdt_init)(void);
- void (* _wdt_enable)(void);
- void (* _wdt_disable)(void);
- void (* _wdt_set)(T_WDT_CMD);
- void (* _wdt_task)(void);
- void (* _wdt_reset)(void);
- T_BOOT_TYPE (*_wdt_last_boot)(void);
-};
-#endif /* __WDT_API_H__ */
-
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __MAGPIE_REGDUMP_H__
+#define __MAGPIE_REGDUMP_H__
+
+#if !defined(__ASSEMBLER__)
+/*
+ * XTensa CPU state
+ * This must match the state saved by the target exception handler.
+ */
+struct XTensa_exception_frame_s {
+ uint32_t xt_pc;
+ uint32_t xt_ps;
+ uint32_t xt_sar;
+ uint32_t xt_vpri;
+ uint32_t xt_a2;
+ uint32_t xt_a3;
+ uint32_t xt_a4;
+ uint32_t xt_a5;
+ uint32_t xt_exccause;
+ uint32_t xt_lcount;
+ uint32_t xt_lbeg;
+ uint32_t xt_lend;
+
+ /* Extra info to simplify post-mortem stack walkback */
+#define MAGPIE_REGDUMP_FRAMES 5
+ struct {
+ uint32_t a0; /* pc */
+ uint32_t a1; /* sp */
+ uint32_t a2;
+ uint32_t a3;
+ } wb[MAGPIE_REGDUMP_FRAMES];
+};
+
+typedef struct XTensa_exception_frame_s CPU_exception_frame_t;
+#define RD_SIZE sizeof(CPU_exception_frame_t)
+
+#endif
+#endif /* __MAGPIE_REGDUMP_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __MEM_API_H__
+#define __MEM_API_H__
+
+struct mem_api {
+ void (* _mem_init)(void);
+ void *(* _memset)(void *, int, unsigned int);
+ void *(* _memcpy)(void *, const void *, unsigned int);
+ void *(* _memmove)(void *, const void *, unsigned int);
+ int (* _memcmp)(const void *, const void *, unsigned int);
+};
+
+#endif /* __MEM_API_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __MISC_API_H__
+#define __MISC_API_H__
+
+enum hostif_s{
+ HIF_USB = 0,
+ HIF_PCIE,
+ HIF_GMAC,
+ HIF_PCI,
+
+ // HIF should be added above here
+ HIF_NUM,
+ HIF_NONE
+
+};
+
+typedef enum hostif_s A_HOSTIF;
+
+struct register_dump_s;
+
+struct misc_api {
+ void (* _system_reset)(void);
+ void (* _mac_reset)(void);
+ void (* _assfail)(struct register_dump_s *);
+ void (* _misaligned_load_handler)(struct register_dump_s *);
+
+ void (* _report_failure_to_host)(struct register_dump_s *, int);
+ int (* _target_id_get)(void);
+ A_HOSTIF (* _is_host_present)(void);
+
+ uint8_t (*_kbhit)(uint8_t);
+
+ uint16_t (* _rom_version_get)(void);
+};
+
+#endif /* __MISC_API_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __REGDUMP_H__
+#define __REGDUMP_H__
+
+#include "magpie_regdump.h"
+
+
+#if !defined(__ASSEMBLER__)
+
+/*
+ * XTensa CPU state
+ * This must match the state saved by the target exception handler.
+ */
+
+#define RD_SIZE sizeof(CPU_exception_frame_t)
+
+/*
+ * Target CPU state at the time of failure is reflected
+ * in a register dump, which the Host can fetch through
+ * the diagnostic window.
+ */
+struct register_dump_s {
+ uint32_t target_id; /* Target ID */
+ uint32_t assline; /* Line number (if assertion failure) */
+ uint32_t pc; /* Program Counter at time of exception */
+ uint32_t badvaddr; /* Virtual address causing exception */
+ CPU_exception_frame_t exc_frame; /* CPU-specific exception info */
+
+ /* Could copy top of stack here, too.... */
+};
+
+#endif /* __ASSEMBLER__ */
+#endif /* __REGDUMP_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*************************************************************************/
+/* Copyright (c) 2008 Atheros Communications, Inc., All Rights Reserved */
+/* */
+/* Module Name : romp_api.h */
+/* */
+/* Abstract */
+/* This file contains definition of data structure and interface */
+/* */
+/* NOTES */
+/* None */
+/* */
+/*************************************************************************/
+
+#ifndef _ROMP_API_H_
+#define _ROMP_API_H_
+
+#include "dt_defs.h"
+
+/******** hardware API table structure (API descriptions below) *************/
+
+struct romp_api {
+ void (*_romp_init)(void);
+ BOOLEAN (*_romp_download)(uint16_t );
+ BOOLEAN (*_romp_install)(void);
+ BOOLEAN (*_romp_decode)(uint32_t );
+};
+
+#define _ROMP_MAGIC_ "[PaTcH]"
+
+struct rom_patch_st {
+ uint16_t crc16; // crc filed to maintain the integrity
+ uint16_t len; // length of the patch code
+ uint32_t ld_addr; // load address of the patch code
+ uint32_t fun_addr; // entry address of the patch code
+ uint8_t *pfun; // patch code
+};
+
+
+struct eep_redir_addr {
+ uint16_t offset;
+ uint16_t size;
+};
+
+/************************* EXPORT function ***************************/
+uint16_t cal_crc16(uint32_t sz, uint8_t *p);
+
+#endif // end of _UART_API_H_
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __STRING_API_H__
+#define __STRING_API_H__
+
+struct string_api {
+ void (* _string_init)(void);
+ char *(* _strcpy)(char *, const char *);
+ char *(* _strncpy)(char *, const char *, unsigned int);
+ int (* _strlen)(const char *);
+ int (* _strcmp)(const char *, const char *);
+ int (* _strncmp)(const char *, const char *, unsigned int);
+};
+
+#endif /* __STRING_API_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __TASKLET_API_H__
+#define __TASKLET_API_H__
+
+typedef void (*A_TASKLET_FUNC)(void *arg);
+
+#define A_TASKLET_STATE_DISABLE 0
+#define A_TASKLET_STATE_SCHEDULED 1
+#define A_TASKLET_STATE_RUNNING 2
+
+struct _tasklet {
+ A_TASKLET_FUNC func;
+ void *arg;
+ int state;
+ struct _tasklet *next;
+};
+
+typedef struct _tasklet A_tasklet_t;
+
+struct tasklet_api {
+ void (* _tasklet_init)(void);
+ void (* _tasklet_init_task)(A_TASKLET_FUNC, void * arg, A_tasklet_t *);
+ void (* _tasklet_disable)(A_tasklet_t *);
+ void (* _tasklet_schedule)(A_tasklet_t *);
+ void (* _tasklet_run)(void);
+};
+#endif /* __TASKLET_API_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __TIMER_API_H__
+#define __TIMER_API_H__
+/*
+ * In order to remain completely independent of OS header files,
+ * "_SPACE" structures are declared with sufficient room to hold
+ * corresponding OS structures.
+ */
+typedef unsigned int _A_TIMER_SPACE[5];
+typedef _A_TIMER_SPACE A_timer_t;
+#define A_TIMER A_timer_t /* historical */
+
+typedef unsigned int A_HANDLE; /* historical */
+typedef void A_TIMER_FUNC(A_HANDLE timer_handle, void *arg);
+
+struct timer_api {
+ void (* _timer_init)(void);
+ void (* _timer_arm)(A_timer_t *, unsigned int);
+ void (* _timer_disarm)(A_timer_t *);
+ void (* _timer_setfn)(A_timer_t *, A_TIMER_FUNC, void *);
+ void (* _timer_run)(void);
+};
+#endif /* __TIMER_API_H__ */
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*************************************************************************/
+/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
+/* */
+/* Module Name : uart.h */
+/* */
+/* Abstract */
+/* This file contains definition of uart registers, marco and api. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/*************************************************************************/
+
+#ifndef _UART_API_H_
+#define _UART_API_H_
+
+#include "reg_defs.h"
+
+/************************** Register deinition ***************************/
+#define RBR_ADDRESS 0x00051000
+#define RBR_OFFSET 0x00000000
+#define RBR_RBR_MSB 7
+#define RBR_RBR_LSB 0
+#define RBR_RBR_MASK 0x000000ff
+#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB)
+#define RBR_RBR_SET(x) (((x) << RBR_RBR_LSB) & RBR_RBR_MASK)
+
+#define THR_ADDRESS 0x00051000
+#define THR_OFFSET 0x00000000
+#define THR_THR_MSB 7
+#define THR_THR_LSB 0
+#define THR_THR_MASK 0x000000ff
+#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB)
+#define THR_THR_SET(x) (((x) << THR_THR_LSB) & THR_THR_MASK)
+
+#define DLL_ADDRESS 0x00051000
+#define DLL_OFFSET 0x00000000
+#define DLL_DLL_MSB 7
+#define DLL_DLL_LSB 0
+#define DLL_DLL_MASK 0x000000ff
+#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB)
+#define DLL_DLL_SET(x) (((x) << DLL_DLL_LSB) & DLL_DLL_MASK)
+
+#define DLH_ADDRESS 0x00051004
+#define DLH_OFFSET 0x00000004
+#define DLH_DLH_MSB 7
+#define DLH_DLH_LSB 0
+#define DLH_DLH_MASK 0x000000ff
+#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB)
+#define DLH_DLH_SET(x) (((x) << DLH_DLH_LSB) & DLH_DLH_MASK)
+
+#define IER_ADDRESS 0x00051004
+#define IER_OFFSET 0x00000004
+#define IER_EDDSI_MSB 3
+#define IER_EDDSI_LSB 3
+#define IER_EDDSI_MASK 0x00000008
+#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB)
+#define IER_EDDSI_SET(x) (((x) << IER_EDDSI_LSB) & IER_EDDSI_MASK)
+#define IER_ELSI_MSB 2
+#define IER_ELSI_LSB 2
+#define IER_ELSI_MASK 0x00000004
+#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB)
+#define IER_ELSI_SET(x) (((x) << IER_ELSI_LSB) & IER_ELSI_MASK)
+#define IER_ETBEI_MSB 1
+#define IER_ETBEI_LSB 1
+#define IER_ETBEI_MASK 0x00000002
+#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB)
+#define IER_ETBEI_SET(x) (((x) << IER_ETBEI_LSB) & IER_ETBEI_MASK)
+#define IER_ERBFI_MSB 0
+#define IER_ERBFI_LSB 0
+#define IER_ERBFI_MASK 0x00000001
+#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB)
+#define IER_ERBFI_SET(x) (((x) << IER_ERBFI_LSB) & IER_ERBFI_MASK)
+
+#define IIR_ADDRESS 0x00051008
+#define IIR_OFFSET 0x00000008
+#define IIR_FIFO_STATUS_MSB 7
+#define IIR_FIFO_STATUS_LSB 6
+#define IIR_FIFO_STATUS_MASK 0x000000c0
+#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB)
+#define IIR_FIFO_STATUS_SET(x) (((x) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK)
+#define IIR_IID_MSB 3
+#define IIR_IID_LSB 0
+#define IIR_IID_MASK 0x0000000f
+#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB)
+#define IIR_IID_SET(x) (((x) << IIR_IID_LSB) & IIR_IID_MASK)
+
+#define FCR_ADDRESS 0x00051008
+#define FCR_OFFSET 0x00000008
+#define FCR_RCVR_TRIG_MSB 7
+#define FCR_RCVR_TRIG_LSB 6
+#define FCR_RCVR_TRIG_MASK 0x000000c0
+#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB)
+#define FCR_RCVR_TRIG_SET(x) (((x) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK)
+#define FCR_DMA_MODE_MSB 3
+#define FCR_DMA_MODE_LSB 3
+#define FCR_DMA_MODE_MASK 0x00000008
+#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB)
+#define FCR_DMA_MODE_SET(x) (((x) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK)
+#define FCR_XMIT_FIFO_RST_MSB 2
+#define FCR_XMIT_FIFO_RST_LSB 2
+#define FCR_XMIT_FIFO_RST_MASK 0x00000004
+#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB)
+#define FCR_XMIT_FIFO_RST_SET(x) (((x) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK)
+#define FCR_RCVR_FIFO_RST_MSB 1
+#define FCR_RCVR_FIFO_RST_LSB 1
+#define FCR_RCVR_FIFO_RST_MASK 0x00000002
+#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB)
+#define FCR_RCVR_FIFO_RST_SET(x) (((x) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK)
+#define FCR_FIFO_EN_MSB 0
+#define FCR_FIFO_EN_LSB 0
+#define FCR_FIFO_EN_MASK 0x00000001
+#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB)
+#define FCR_FIFO_EN_SET(x) (((x) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK)
+
+#define LCR_ADDRESS 0x0005100c
+#define LCR_OFFSET 0x0000000c
+#define LCR_DLAB_MSB 7
+#define LCR_DLAB_LSB 7
+#define LCR_DLAB_MASK 0x00000080
+#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB)
+#define LCR_DLAB_SET(x) (((x) << LCR_DLAB_LSB) & LCR_DLAB_MASK)
+#define LCR_BREAK_MSB 6
+#define LCR_BREAK_LSB 6
+#define LCR_BREAK_MASK 0x00000040
+#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB)
+#define LCR_BREAK_SET(x) (((x) << LCR_BREAK_LSB) & LCR_BREAK_MASK)
+#define LCR_EPS_MSB 4
+#define LCR_EPS_LSB 4
+#define LCR_EPS_MASK 0x00000010
+#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB)
+#define LCR_EPS_SET(x) (((x) << LCR_EPS_LSB) & LCR_EPS_MASK)
+#define LCR_PEN_MSB 3
+#define LCR_PEN_LSB 3
+#define LCR_PEN_MASK 0x00000008
+#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB)
+#define LCR_PEN_SET(x) (((x) << LCR_PEN_LSB) & LCR_PEN_MASK)
+#define LCR_STOP_MSB 2
+#define LCR_STOP_LSB 2
+#define LCR_STOP_MASK 0x00000004
+#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB)
+#define LCR_STOP_SET(x) (((x) << LCR_STOP_LSB) & LCR_STOP_MASK)
+#define LCR_CLS_MSB 1
+#define LCR_CLS_LSB 0
+#define LCR_CLS_MASK 0x00000003
+#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB)
+#define LCR_CLS_SET(x) (((x) << LCR_CLS_LSB) & LCR_CLS_MASK)
+
+#define MCR_ADDRESS 0x00051010
+#define MCR_OFFSET 0x00000010
+#define MCR_LOOPBACK_MSB 5
+#define MCR_LOOPBACK_LSB 5
+#define MCR_LOOPBACK_MASK 0x00000020
+#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB)
+#define MCR_LOOPBACK_SET(x) (((x) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK)
+#define MCR_OUT2_MSB 3
+#define MCR_OUT2_LSB 3
+#define MCR_OUT2_MASK 0x00000008
+#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB)
+#define MCR_OUT2_SET(x) (((x) << MCR_OUT2_LSB) & MCR_OUT2_MASK)
+#define MCR_OUT1_MSB 2
+#define MCR_OUT1_LSB 2
+#define MCR_OUT1_MASK 0x00000004
+#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB)
+#define MCR_OUT1_SET(x) (((x) << MCR_OUT1_LSB) & MCR_OUT1_MASK)
+#define MCR_RTS_MSB 1
+#define MCR_RTS_LSB 1
+#define MCR_RTS_MASK 0x00000002
+#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB)
+#define MCR_RTS_SET(x) (((x) << MCR_RTS_LSB) & MCR_RTS_MASK)
+#define MCR_DTR_MSB 0
+#define MCR_DTR_LSB 0
+#define MCR_DTR_MASK 0x00000001
+#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB)
+#define MCR_DTR_SET(x) (((x) << MCR_DTR_LSB) & MCR_DTR_MASK)
+
+#define LSR_ADDRESS 0x00051014
+#define LSR_OFFSET 0x00000014
+#define LSR_FERR_MSB 7
+#define LSR_FERR_LSB 7
+#define LSR_FERR_MASK 0x00000080
+#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB)
+#define LSR_FERR_SET(x) (((x) << LSR_FERR_LSB) & LSR_FERR_MASK)
+#define LSR_TEMT_MSB 6
+#define LSR_TEMT_LSB 6
+#define LSR_TEMT_MASK 0x00000040
+#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB)
+#define LSR_TEMT_SET(x) (((x) << LSR_TEMT_LSB) & LSR_TEMT_MASK)
+#define LSR_THRE_MSB 5
+#define LSR_THRE_LSB 5
+#define LSR_THRE_MASK 0x00000020
+#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB)
+#define LSR_THRE_SET(x) (((x) << LSR_THRE_LSB) & LSR_THRE_MASK)
+#define LSR_BI_MSB 4
+#define LSR_BI_LSB 4
+#define LSR_BI_MASK 0x00000010
+#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB)
+#define LSR_BI_SET(x) (((x) << LSR_BI_LSB) & LSR_BI_MASK)
+#define LSR_FE_MSB 3
+#define LSR_FE_LSB 3
+#define LSR_FE_MASK 0x00000008
+#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB)
+#define LSR_FE_SET(x) (((x) << LSR_FE_LSB) & LSR_FE_MASK)
+#define LSR_PE_MSB 2
+#define LSR_PE_LSB 2
+#define LSR_PE_MASK 0x00000004
+#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB)
+#define LSR_PE_SET(x) (((x) << LSR_PE_LSB) & LSR_PE_MASK)
+#define LSR_OE_MSB 1
+#define LSR_OE_LSB 1
+#define LSR_OE_MASK 0x00000002
+#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB)
+#define LSR_OE_SET(x) (((x) << LSR_OE_LSB) & LSR_OE_MASK)
+#define LSR_DR_MSB 0
+#define LSR_DR_LSB 0
+#define LSR_DR_MASK 0x00000001
+#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB)
+#define LSR_DR_SET(x) (((x) << LSR_DR_LSB) & LSR_DR_MASK)
+
+#define MSR_ADDRESS 0x00051018
+#define MSR_OFFSET 0x00000018
+#define MSR_DCD_MSB 7
+#define MSR_DCD_LSB 7
+#define MSR_DCD_MASK 0x00000080
+#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB)
+#define MSR_DCD_SET(x) (((x) << MSR_DCD_LSB) & MSR_DCD_MASK)
+#define MSR_RI_MSB 6
+#define MSR_RI_LSB 6
+#define MSR_RI_MASK 0x00000040
+#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB)
+#define MSR_RI_SET(x) (((x) << MSR_RI_LSB) & MSR_RI_MASK)
+#define MSR_DSR_MSB 5
+#define MSR_DSR_LSB 5
+#define MSR_DSR_MASK 0x00000020
+#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB)
+#define MSR_DSR_SET(x) (((x) << MSR_DSR_LSB) & MSR_DSR_MASK)
+#define MSR_CTS_MSB 4
+#define MSR_CTS_LSB 4
+#define MSR_CTS_MASK 0x00000010
+#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB)
+#define MSR_CTS_SET(x) (((x) << MSR_CTS_LSB) & MSR_CTS_MASK)
+#define MSR_DDCD_MSB 3
+#define MSR_DDCD_LSB 3
+#define MSR_DDCD_MASK 0x00000008
+#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB)
+#define MSR_DDCD_SET(x) (((x) << MSR_DDCD_LSB) & MSR_DDCD_MASK)
+#define MSR_TERI_MSB 2
+#define MSR_TERI_LSB 2
+#define MSR_TERI_MASK 0x00000004
+#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB)
+#define MSR_TERI_SET(x) (((x) << MSR_TERI_LSB) & MSR_TERI_MASK)
+#define MSR_DDSR_MSB 1
+#define MSR_DDSR_LSB 1
+#define MSR_DDSR_MASK 0x00000002
+#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB)
+#define MSR_DDSR_SET(x) (((x) << MSR_DDSR_LSB) & MSR_DDSR_MASK)
+#define MSR_DCTS_MSB 0
+#define MSR_DCTS_LSB 0
+#define MSR_DCTS_MASK 0x00000001
+#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB)
+#define MSR_DCTS_SET(x) (((x) << MSR_DCTS_LSB) & MSR_DCTS_MASK)
+
+
+/************************** config definition ***************************/
+#define UART_FIFO_SIZE 512 //Must be 2^N
+
+#define USE_POST_BUFFER 0 // ENABLE a tx buffer for post processing,
+/*********************** data struction definition ************************/
+// data struction definition
+struct uart_fifo {
+#if USE_POST_BUFFER
+ uint8_t buf[UART_FIFO_SIZE];
+#endif
+ uint16_t start_index;
+ uint16_t end_index;
+ uint32_t overrun_err;
+};
+
+
+struct uart_blk {
+ uint16_t debug_mode;
+ uint16_t baud;
+ struct uart_api *_uart;
+ struct uart_fifo _tx;
+};
+
+
+/******** hardware API table structure (API descriptions below) *************/
+struct uart_api {
+ uint32_t (*_uart_init)(void);
+ void (*_uart_char_put)(uint8_t ch);
+ uint16_t (*_uart_char_get)(uint8_t* ch);
+ void (*_uart_str_out)(uint8_t* str);
+ void (*_uart_task)(void);
+ uint32_t (*_uart_status)(void);
+ void (*_uart_config)(uint16_t flag);
+ void (*_uart_hwinit)(uint32_t freq, uint32_t baud);
+ //void (*_uart_config)(uint8_t cmd, void *pData);
+};
+
+/************************* EXPORT function ***************************/
+
+
+#endif // end of _UART_API_H_
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _USB_TABLE_H_
+#define _USB_TABLE_H_
+
+#include "sys_cfg.h"
+// UsbDeviceDescriptor
+#define USB_DEVICE_DESC_TYPE 0x01
+#define USB_DEVICE_DESC_LEN 0x12
+#define USB_SPEC_VERSION 0x0200
+#define USB_DEVICE_CLASS 0xFF
+#define USB_DEVICE_SUB_CLASS 0xFF
+#define USB_DEVICE_PROTOCOL 0xFF
+#define USB_MAX_PKT_SIZE 0x40
+#define USB_VENDOR_ID 0x0CF3
+#define USB_PRODUCT_ID 0x9271
+
+#if 1 /* USB Device Descriptor : byte 12, 13 Device BCD -> Device release number in binary-coded decimal. */
+#define USB_DEVICE_BCD BOOTROM_VER
+#else
+#define USB_DEVICE_BCD 0x0106
+#endif
+
+#define USB_MANUFACTURER_INDEX 0x10
+#define USB_PRODUCT_INDEX 0x20
+#define USB_SERIAL_INDEX 0x30
+#define USB_CONFIGURATION_NUM 0x01
+// end UsbDeviceDescriptor
+
+#define USB_CONFIG_DESC_TYPE 0x02
+#define USB_CONFIG_DESC_LEN 0x09
+//#define USB_TOTAL_DESC_LEN 0x002E // 4 ep
+//#define USB_TOTAL_DESC_LEN 0x0035 // 5 ep
+#define USB_TOTAL_DESC_LEN 0x003C // 6 ep
+#define USB_INTERFACE_NUM 0x01
+#define USB_CONFIG_NUM 0x01
+#define USB_STRING_INDEX 0x00
+#define USB_ATTRIBUTE 0x80
+#define USB_MAX_POWER 0xFA
+
+#define USB_INTERFACE_DESC_TYPE 0x04
+#define USB_INTERFACE_DESC_LEN 0x09
+#define USB_INTERFACE_INDEX_NUM 0x00
+#define USB_INTERFACE_ALT_SETTING 0x00
+//#define USB_INTERFACE_EP_NUM 0x04
+//#define USB_INTERFACE_EP_NUM 0x05
+#define USB_INTERFACE_EP_NUM 0x06
+#define USB_INTERFACE_CLASS 0xFF
+#define USB_INTERFACE_SUB_CLASS 0x00
+#define USB_INTERFACE_PROTOCOL 0x00
+#define USB_INTERFACE_STRING_INDEX 0x00
+
+#define USB_EP_DESC_TYPE 0x05
+#define USB_EP_DESC_LEN 0x07
+
+/* USB Endpoint attribute */
+#define bUSB_EP1_NUM 0x01
+#define bUSB_EP2_NUM 0x02
+#define bUSB_EP3_NUM 0x03
+#define bUSB_EP4_NUM 0x04
+#define bUSB_EP5_NUM 0x05
+#define bUSB_EP6_NUM 0x06
+
+#define bUSB_EP_DIRECTION_IN 0x80
+#define bUSB_EP_DIRECTION_OUT 0x00
+
+#define bUSB_EP_TYPE_CONTROL 0x00
+#define bUSB_EP_TYPE_ISOCHRONOUS 0x01
+#define bUSB_EP_TYPE_BULK 0x02
+#define bUSB_EP_TYPE_INTERRUPT 0x03
+
+#define bUSB_EP_MAX_PKT_SIZE_64 0x0040
+#define bUSB_EP_MAX_PKT_SIZE_512 0x0200
+
+/* High Speed Endpoint */
+#define USB_HS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
+#define USB_HS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_HS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
+#define USB_HS_EP1_INTERVAL 0x00
+
+#define USB_HS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
+#define USB_HS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_HS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
+#define USB_HS_EP2_INTERVAL 0x00
+
+#define USB_HS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
+#define USB_HS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
+#define USB_HS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_HS_EP3_INTERVAL 0x01
+
+#define USB_HS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
+#define USB_HS_EP4_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT //bUSB_EP_TYPE_BULK
+#define USB_HS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_HS_EP4_INTERVAL 0x01 //0x00
+
+#define USB_HS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
+#define USB_HS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_HS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
+#define USB_HS_EP5_INTERVAL 0x00
+
+#define USB_HS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
+#define USB_HS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_HS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
+#define USB_HS_EP6_INTERVAL 0x00
+
+/* Full Speed Endpoint */
+#define USB_FS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
+#define USB_FS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP1_INTERVAL 0x00
+
+#define USB_FS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
+#define USB_FS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP2_INTERVAL 0x00
+
+#define USB_FS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
+#define USB_FS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
+#define USB_FS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP3_INTERVAL 0x01
+
+#define USB_FS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
+#define USB_FS_EP4_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP4_INTERVAL 0x00
+
+#define USB_FS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
+#define USB_FS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP5_INTERVAL 0x00
+
+#define USB_FS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
+#define USB_FS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP6_INTERVAL 0x00
+
+//#define USB_QUALIFIER_DESC_ADDR 0x8cff00
+//#define USB_OTHER_SPEED_DESC_ADDR 0x8cffA
+
+#endif // end of _USB_TABLE_H_
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * @File: VBUF_api.h
+ *
+ * @Abstract: Host Interface api
+ *
+ * @Notes:
+ */
+
+#ifndef _VBUF_API_H
+#define _VBUF_API_H
+
+#include <vdesc_api.h>
+
+#define MAX_BUF_CTX_LEN 20
+
+typedef struct _VBUF
+{
+ VDESC *desc_list;
+ struct _VBUF *next_buf;
+ A_UINT16 buf_length;
+ A_UINT8 reserved[2];
+ A_UINT8 ctx[MAX_BUF_CTX_LEN];
+} VBUF;
+
+#define VBUF_GET_DATA_ADDR(vbuf) (vbuf->desc_list->buf_addr + vbuf->desc_list->data_offset)
+
+/* hardware API table structure (API descriptions below) */
+struct vbuf_api {
+ void (*_init)(int nBuf);
+ VBUF* (*_alloc_vbuf)(void);
+ VBUF* (*_alloc_vbuf_with_size)(int size, int reserve);
+ void (*_free_vbuf)(VBUF *buf);
+
+ /* room to expand this table by another table */
+ void *pReserved;
+};
+
+extern void vbuf_module_install(struct vbuf_api *apis);
+
+#endif /* #ifndef _HIF_API_H */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * @File: VBUF_api.h
+ *
+ * @Abstract: Host Interface api
+ *
+ * @Notes:
+ */
+
+#ifndef _VDESC_API_H
+#define _VDESC_API_H
+
+#define MAX_HW_DESC_SIZE 20
+
+typedef struct _VDESC
+{
+ struct _VDESC *next_desc;
+ A_UINT8 *buf_addr;
+ A_UINT16 buf_size;
+ A_UINT16 data_offset;
+ A_UINT16 data_size;
+ A_UINT16 control;
+ A_UINT8 hw_desc_buf[MAX_HW_DESC_SIZE];
+} VDESC;
+
+#define VDESC_HW_TO_VDESC(hwdesc) ((VDESC *)(((A_UINT32 *)hwdesc - 4)))
+
+struct vdesc_api {
+ void (*_init)(int nDesc);
+ VDESC* (*_alloc_vdesc)();
+ A_UINT8* (*_get_hw_desc)(VDESC *desc);
+ void (*_swap_vdesc)(VDESC *dest, VDESC *src);
+
+ /* room to expand this table by another table */
+ void *pReserved;
+};
+
+extern void vdesc_module_install(struct vdesc_api *apis);
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __WDT_API_H__
+#define __WDT_API_H__
+
+typedef enum {
+ WDT_ACTION_NO = 0, // bit1, bit0: 00
+ WDT_ACTION_INTR, // bit1, bit0: 01
+ WDT_ACTION_NMI, // bit1, bit0: 10
+ WDT_ACTION_RESET, // bit1, bit0: 11
+
+ WDT_ACTION_UNKNOWN
+} T_WDT_ACTION_TYPE;
+
+typedef enum {
+ WDT_TIMEOUT = 1,
+ WDT_ACTION,
+
+ WDT_UNKNOWN
+} T_WDT_CMD_TYPE;
+
+typedef struct {
+ uint32_t cmd;
+ union {
+ uint32_t timeout;
+ uint32_t action;
+ };
+}T_WDT_CMD;
+
+typedef enum {
+ ENUM_WDT_BOOT = 1,
+ ENUM_COLD_BOOT,
+ ENUM_SUSP_BOOT,
+
+ // add above here
+ ENUM_UNKNOWN_BOOT
+} T_BOOT_TYPE;
+
+
+/*!- interface of watchdog timer
+ *
+ */
+struct wdt_api {
+ void (* _wdt_init)(void);
+ void (* _wdt_enable)(void);
+ void (* _wdt_disable)(void);
+ void (* _wdt_set)(T_WDT_CMD);
+ void (* _wdt_task)(void);
+ void (* _wdt_reset)(void);
+ T_BOOT_TYPE (*_wdt_last_boot)(void);
+};
+#endif /* __WDT_API_H__ */
+