Staging: delete westbridge code
It's been stagnant for a while with out much forward progress for a variety of different reasons. So remove it for now. It can be reverted at any time if development picks back up again. Acked-by: David Cross <odc@cypress.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Родитель
966b9016a1
Коммит
78f23926df
|
@ -124,8 +124,6 @@ source "drivers/staging/tidspbridge/Kconfig"
|
|||
|
||||
source "drivers/staging/quickstart/Kconfig"
|
||||
|
||||
source "drivers/staging/westbridge/Kconfig"
|
||||
|
||||
source "drivers/staging/sbe-2t3e3/Kconfig"
|
||||
|
||||
source "drivers/staging/ath6kl/Kconfig"
|
||||
|
|
|
@ -53,7 +53,6 @@ obj-$(CONFIG_EASYCAP) += easycap/
|
|||
obj-$(CONFIG_SOLO6X10) += solo6x10/
|
||||
obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/
|
||||
obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/
|
||||
obj-$(CONFIG_WESTBRIDGE_ASTORIA) += westbridge/astoria/
|
||||
obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/
|
||||
obj-$(CONFIG_ATH6K_LEGACY) += ath6kl/
|
||||
obj-$(CONFIG_USB_ENESTORAGE) += keucr/
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
#
|
||||
# West Bridge configuration
|
||||
#
|
||||
|
||||
menuconfig WESTBRIDGE
|
||||
tristate "West Bridge support"
|
||||
depends on WESTBRIDGE_HAL_SELECTED
|
||||
help
|
||||
This selects West Bridge Peripheral controller support.
|
||||
|
||||
If you want West Bridge support, you should say Y here.
|
||||
|
||||
menuconfig WESTBRIDGE_ASTORIA
|
||||
bool "West Bridge Astoria support"
|
||||
depends on WESTBRIDGE != n && WESTBRIDGE_HAL_SELECTED
|
||||
help
|
||||
This option enables support for West Bridge Astoria
|
||||
|
||||
if WESTBRIDGE_ASTORIA
|
||||
source "drivers/staging/westbridge/astoria/Kconfig"
|
||||
endif #WESTBRIDGE_ASTORIA
|
||||
|
||||
config WESTBRIDGE_HAL_SELECTED
|
||||
boolean
|
||||
|
||||
choice
|
||||
prompt "West Bridge HAL"
|
||||
help
|
||||
West Bridge HAL/processor interface to be used
|
||||
|
||||
#
|
||||
# HAL Layers
|
||||
#
|
||||
|
||||
config MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
|
||||
bool "WESTBRIDGE OMAP3430 Astoria PNAND HAL"
|
||||
depends on ARCH_OMAP3
|
||||
select WESTBRIDGE_HAL_SELECTED
|
||||
help
|
||||
Include the OMAP3430 HAL for PNAND interface
|
||||
|
||||
config MACH_NO_WESTBRIDGE
|
||||
bool "no West Bridge HAL selected"
|
||||
help
|
||||
Do not include any HAL layer(de-activates West Bridge option)
|
||||
endchoice
|
||||
|
||||
config WESTBRIDGE_DEBUG
|
||||
bool "West Bridge debugging"
|
||||
depends on WESTBRIDGE != n
|
||||
help
|
||||
This is an option for use by developers; most people should
|
||||
say N here. This enables WESTBRIDGE core and driver debugging.
|
|
@ -1,7 +0,0 @@
|
|||
TODO:
|
||||
- checkpatch.pl fixes
|
||||
- determine where to put the hal and common api code
|
||||
- modify the driver directory structure in an intuitive way
|
||||
|
||||
Please send any patches to Greg Kroah-Hartman <gregkh@suse.de>
|
||||
and David Cross <david.cross@cypress.com>.
|
|
@ -1,9 +0,0 @@
|
|||
#
|
||||
# West Bridge configuration
|
||||
#
|
||||
source "drivers/staging/westbridge/astoria/device/Kconfig"
|
||||
|
||||
source "drivers/staging/westbridge/astoria/block/Kconfig"
|
||||
|
||||
source "drivers/staging/westbridge/astoria/gadget/Kconfig"
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#
|
||||
# Makefile for the kernel westbridge device drivers.
|
||||
#
|
||||
|
||||
ifneq ($(CONFIG_WESTBRIDGE_DEBUG),y)
|
||||
EXTRA_CFLAGS += -WESTBRIDGE_NDEBUG
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_WESTBRIDGE) += device/
|
||||
obj-$(CONFIG_WESTBRIDGE) += block/
|
||||
obj-$(CONFIG_WESTBRIDGE) += gadget/
|
|
@ -1,14 +0,0 @@
|
|||
#
|
||||
# Makefile for the kernel westbridge core.
|
||||
#
|
||||
|
||||
ifeq ($(CONFIG_WESTBRIDGE_DEBUG),n)
|
||||
EXTRA_CFLAGS += -NDEBUG
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_WESTBRIDGE_DEVICE_DRIVER) += cyasapi.o
|
||||
cyasapi-y := src/cyasdma.o src/cyasintr.o src/cyaslep2pep.o \
|
||||
src/cyaslowlevel.o src/cyasmisc.o src/cyasmtp.o \
|
||||
src/cyasstorage.o src/cyasusb.o
|
||||
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,143 +0,0 @@
|
|||
/* Cypress West Bridge API source file (cyasintr.c)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#include "../../include/linux/westbridge/cyashal.h"
|
||||
#include "../../include/linux/westbridge/cyasdevice.h"
|
||||
#include "../../include/linux/westbridge/cyasregs.h"
|
||||
#include "../../include/linux/westbridge/cyaserr.h"
|
||||
|
||||
extern void cy_as_mail_box_interrupt_handler(cy_as_device *);
|
||||
|
||||
void
|
||||
cy_as_mcu_interrupt_handler(cy_as_device *dev_p)
|
||||
{
|
||||
/* Read and clear the interrupt. */
|
||||
uint16_t v;
|
||||
|
||||
v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_MCU_STAT);
|
||||
v = v;
|
||||
}
|
||||
|
||||
void
|
||||
cy_as_power_management_interrupt_handler(cy_as_device *dev_p)
|
||||
{
|
||||
uint16_t v;
|
||||
|
||||
v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PWR_MAGT_STAT);
|
||||
v = v;
|
||||
}
|
||||
|
||||
void
|
||||
cy_as_pll_lock_loss_interrupt_handler(cy_as_device *dev_p)
|
||||
{
|
||||
uint16_t v;
|
||||
|
||||
v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PLL_LOCK_LOSS_STAT);
|
||||
v = v;
|
||||
}
|
||||
|
||||
uint32_t cy_as_intr_start(cy_as_device *dev_p, cy_bool dmaintr)
|
||||
{
|
||||
uint16_t v;
|
||||
|
||||
cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
|
||||
|
||||
if (cy_as_device_is_intr_running(dev_p) != 0)
|
||||
return CY_AS_ERROR_ALREADY_RUNNING;
|
||||
|
||||
v = CY_AS_MEM_P0_INT_MASK_REG_MMCUINT |
|
||||
CY_AS_MEM_P0_INT_MASK_REG_MMBINT |
|
||||
CY_AS_MEM_P0_INT_MASK_REG_MPMINT;
|
||||
|
||||
if (dmaintr)
|
||||
v |= CY_AS_MEM_P0_INT_MASK_REG_MDRQINT;
|
||||
|
||||
/* Enable the interrupts of interest */
|
||||
cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_INT_MASK_REG, v);
|
||||
|
||||
/* Mark the interrupt module as initialized */
|
||||
cy_as_device_set_intr_running(dev_p);
|
||||
|
||||
return CY_AS_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t cy_as_intr_stop(cy_as_device *dev_p)
|
||||
{
|
||||
cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
|
||||
|
||||
if (cy_as_device_is_intr_running(dev_p) == 0)
|
||||
return CY_AS_ERROR_NOT_RUNNING;
|
||||
|
||||
cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_INT_MASK_REG, 0);
|
||||
cy_as_device_set_intr_stopped(dev_p);
|
||||
|
||||
return CY_AS_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
void cy_as_intr_service_interrupt(cy_as_hal_device_tag tag)
|
||||
{
|
||||
uint16_t v;
|
||||
cy_as_device *dev_p;
|
||||
|
||||
dev_p = cy_as_device_find_from_tag(tag);
|
||||
|
||||
/*
|
||||
* only power management interrupts can occur before the
|
||||
* antioch API setup is complete. if this is a PM interrupt
|
||||
* handle it here; otherwise output a warning message.
|
||||
*/
|
||||
if (dev_p == 0) {
|
||||
v = cy_as_hal_read_register(tag, CY_AS_MEM_P0_INTR_REG);
|
||||
if (v == CY_AS_MEM_P0_INTR_REG_PMINT) {
|
||||
/* Read the PWR_MAGT_STAT register
|
||||
* to clear this interrupt. */
|
||||
v = cy_as_hal_read_register(tag,
|
||||
CY_AS_MEM_PWR_MAGT_STAT);
|
||||
} else
|
||||
cy_as_hal_print_message("stray antioch "
|
||||
"interrupt detected"
|
||||
", tag not associated "
|
||||
"with any created device.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make sure we got a valid object from CyAsDeviceFindFromTag */
|
||||
cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
|
||||
|
||||
v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_INTR_REG);
|
||||
|
||||
if (v & CY_AS_MEM_P0_INTR_REG_MCUINT)
|
||||
cy_as_mcu_interrupt_handler(dev_p);
|
||||
|
||||
if (v & CY_AS_MEM_P0_INTR_REG_PMINT)
|
||||
cy_as_power_management_interrupt_handler(dev_p);
|
||||
|
||||
if (v & CY_AS_MEM_P0_INTR_REG_PLLLOCKINT)
|
||||
cy_as_pll_lock_loss_interrupt_handler(dev_p);
|
||||
|
||||
/* If the interrupt module is not running, no mailbox
|
||||
* interrupts are expected from the west bridge. */
|
||||
if (cy_as_device_is_intr_running(dev_p) == 0)
|
||||
return;
|
||||
|
||||
if (v & CY_AS_MEM_P0_INTR_REG_MBINT)
|
||||
cy_as_mail_box_interrupt_handler(dev_p);
|
||||
}
|
|
@ -1,358 +0,0 @@
|
|||
/* Cypress West Bridge API source file (cyaslep2pep.c)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#include "../../include/linux/westbridge/cyashal.h"
|
||||
#include "../../include/linux/westbridge/cyasusb.h"
|
||||
#include "../../include/linux/westbridge/cyaserr.h"
|
||||
#include "../../include/linux/westbridge/cyaslowlevel.h"
|
||||
#include "../../include/linux/westbridge/cyasdma.h"
|
||||
|
||||
typedef enum cy_as_physical_endpoint_state {
|
||||
cy_as_e_p_free,
|
||||
cy_as_e_p_in,
|
||||
cy_as_e_p_out,
|
||||
cy_as_e_p_iso_in,
|
||||
cy_as_e_p_iso_out
|
||||
} cy_as_physical_endpoint_state;
|
||||
|
||||
|
||||
/*
|
||||
* This map is used to map an index between 1 and 10
|
||||
* to a logical endpoint number. This is used to map
|
||||
* LEP register indexes into actual EP numbers.
|
||||
*/
|
||||
static cy_as_end_point_number_t end_point_map[] = {
|
||||
3, 5, 7, 9, 10, 11, 12, 13, 14, 15 };
|
||||
|
||||
#define CY_AS_EPCFG_1024 (1 << 3)
|
||||
#define CY_AS_EPCFG_DBL (0x02)
|
||||
#define CY_AS_EPCFG_TRIPLE (0x03)
|
||||
#define CY_AS_EPCFG_QUAD (0x00)
|
||||
|
||||
/*
|
||||
* NB: This table contains the register values for PEP1
|
||||
* and PEP3. PEP2 and PEP4 only have a bit to change the
|
||||
* direction of the PEP and therefre are not represented
|
||||
* in this table.
|
||||
*/
|
||||
static uint8_t pep_register_values[12][4] = {
|
||||
/* Bit 1:0 buffering, 0 = quad, 2 = double, 3 = triple */
|
||||
/* Bit 3 size, 0 = 512, 1 = 1024 */
|
||||
{
|
||||
CY_AS_EPCFG_DBL,
|
||||
CY_AS_EPCFG_DBL,
|
||||
},/* Config 1 - PEP1 (2 * 512), PEP2 (2 * 512),
|
||||
* PEP3 (2 * 512), PEP4 (2 * 512) */
|
||||
{
|
||||
CY_AS_EPCFG_DBL,
|
||||
CY_AS_EPCFG_QUAD,
|
||||
}, /* Config 2 - PEP1 (2 * 512), PEP2 (2 * 512),
|
||||
* PEP3 (4 * 512), PEP4 (N/A) */
|
||||
{
|
||||
CY_AS_EPCFG_DBL,
|
||||
CY_AS_EPCFG_DBL | CY_AS_EPCFG_1024,
|
||||
},/* Config 3 - PEP1 (2 * 512), PEP2 (2 * 512),
|
||||
* PEP3 (2 * 1024), PEP4(N/A) */
|
||||
{
|
||||
CY_AS_EPCFG_QUAD,
|
||||
CY_AS_EPCFG_DBL,
|
||||
},/* Config 4 - PEP1 (4 * 512), PEP2 (N/A),
|
||||
* PEP3 (2 * 512), PEP4 (2 * 512) */
|
||||
{
|
||||
CY_AS_EPCFG_QUAD,
|
||||
CY_AS_EPCFG_QUAD,
|
||||
},/* Config 5 - PEP1 (4 * 512), PEP2 (N/A),
|
||||
* PEP3 (4 * 512), PEP4 (N/A) */
|
||||
{
|
||||
CY_AS_EPCFG_QUAD,
|
||||
CY_AS_EPCFG_1024 | CY_AS_EPCFG_DBL,
|
||||
},/* Config 6 - PEP1 (4 * 512), PEP2 (N/A),
|
||||
* PEP3 (2 * 1024), PEP4 (N/A) */
|
||||
{
|
||||
CY_AS_EPCFG_1024 | CY_AS_EPCFG_DBL,
|
||||
CY_AS_EPCFG_DBL,
|
||||
},/* Config 7 - PEP1 (2 * 1024), PEP2 (N/A),
|
||||
* PEP3 (2 * 512), PEP4 (2 * 512) */
|
||||
{
|
||||
CY_AS_EPCFG_1024 | CY_AS_EPCFG_DBL,
|
||||
CY_AS_EPCFG_QUAD,
|
||||
},/* Config 8 - PEP1 (2 * 1024), PEP2 (N/A),
|
||||
* PEP3 (4 * 512), PEP4 (N/A) */
|
||||
{
|
||||
CY_AS_EPCFG_1024 | CY_AS_EPCFG_DBL,
|
||||
CY_AS_EPCFG_1024 | CY_AS_EPCFG_DBL,
|
||||
},/* Config 9 - PEP1 (2 * 1024), PEP2 (N/A),
|
||||
* PEP3 (2 * 1024), PEP4 (N/A)*/
|
||||
{
|
||||
CY_AS_EPCFG_TRIPLE,
|
||||
CY_AS_EPCFG_TRIPLE,
|
||||
},/* Config 10 - PEP1 (3 * 512), PEP2 (N/A),
|
||||
* PEP3 (3 * 512), PEP4 (2 * 512)*/
|
||||
{
|
||||
CY_AS_EPCFG_TRIPLE | CY_AS_EPCFG_1024,
|
||||
CY_AS_EPCFG_DBL,
|
||||
},/* Config 11 - PEP1 (3 * 1024), PEP2 (N/A),
|
||||
* PEP3 (N/A), PEP4 (2 * 512) */
|
||||
{
|
||||
CY_AS_EPCFG_QUAD | CY_AS_EPCFG_1024,
|
||||
CY_AS_EPCFG_DBL,
|
||||
},/* Config 12 - PEP1 (4 * 1024), PEP2 (N/A),
|
||||
* PEP3 (N/A), PEP4 (N/A) */
|
||||
};
|
||||
|
||||
static cy_as_return_status_t
|
||||
find_endpoint_directions(cy_as_device *dev_p,
|
||||
cy_as_physical_endpoint_state epstate[4])
|
||||
{
|
||||
int i;
|
||||
cy_as_physical_endpoint_state desired;
|
||||
|
||||
/*
|
||||
* note, there is no error checking here because
|
||||
* ISO error checking happens when the API is called.
|
||||
*/
|
||||
for (i = 0; i < 10; i++) {
|
||||
int epno = end_point_map[i];
|
||||
if (dev_p->usb_config[epno].enabled) {
|
||||
int pep = dev_p->usb_config[epno].physical;
|
||||
if (dev_p->usb_config[epno].type == cy_as_usb_iso) {
|
||||
/*
|
||||
* marking this as an ISO endpoint, removes the
|
||||
* physical EP from consideration when
|
||||
* mapping the remaining E_ps.
|
||||
*/
|
||||
if (dev_p->usb_config[epno].dir == cy_as_usb_in)
|
||||
desired = cy_as_e_p_iso_in;
|
||||
else
|
||||
desired = cy_as_e_p_iso_out;
|
||||
} else {
|
||||
if (dev_p->usb_config[epno].dir == cy_as_usb_in)
|
||||
desired = cy_as_e_p_in;
|
||||
else
|
||||
desired = cy_as_e_p_out;
|
||||
}
|
||||
|
||||
/*
|
||||
* NB: Note the API calls insure that an ISO endpoint
|
||||
* has a physical and logical EP number that are the
|
||||
* same, therefore this condition is not enforced here.
|
||||
*/
|
||||
if (epstate[pep - 1] !=
|
||||
cy_as_e_p_free && epstate[pep - 1] != desired)
|
||||
return CY_AS_ERROR_INVALID_CONFIGURATION;
|
||||
|
||||
epstate[pep - 1] = desired;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* create the EP1 config values directly.
|
||||
* both EP1OUT and EP1IN are invalid by default.
|
||||
*/
|
||||
dev_p->usb_ep1cfg[0] = 0;
|
||||
dev_p->usb_ep1cfg[1] = 0;
|
||||
if (dev_p->usb_config[1].enabled) {
|
||||
if ((dev_p->usb_config[1].dir == cy_as_usb_out) ||
|
||||
(dev_p->usb_config[1].dir == cy_as_usb_in_out)) {
|
||||
/* Set the valid bit and type field. */
|
||||
dev_p->usb_ep1cfg[0] = (1 << 7);
|
||||
if (dev_p->usb_config[1].type == cy_as_usb_bulk)
|
||||
dev_p->usb_ep1cfg[0] |= (2 << 4);
|
||||
else
|
||||
dev_p->usb_ep1cfg[0] |= (3 << 4);
|
||||
}
|
||||
|
||||
if ((dev_p->usb_config[1].dir == cy_as_usb_in) ||
|
||||
(dev_p->usb_config[1].dir == cy_as_usb_in_out)) {
|
||||
/* Set the valid bit and type field. */
|
||||
dev_p->usb_ep1cfg[1] = (1 << 7);
|
||||
if (dev_p->usb_config[1].type == cy_as_usb_bulk)
|
||||
dev_p->usb_ep1cfg[1] |= (2 << 4);
|
||||
else
|
||||
dev_p->usb_ep1cfg[1] |= (3 << 4);
|
||||
}
|
||||
}
|
||||
|
||||
return CY_AS_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
create_register_settings(cy_as_device *dev_p,
|
||||
cy_as_physical_endpoint_state epstate[4])
|
||||
{
|
||||
int i;
|
||||
uint8_t v;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (i == 0) {
|
||||
/* Start with the values that specify size */
|
||||
dev_p->usb_pepcfg[i] =
|
||||
pep_register_values
|
||||
[dev_p->usb_phy_config - 1][0];
|
||||
} else if (i == 2) {
|
||||
/* Start with the values that specify size */
|
||||
dev_p->usb_pepcfg[i] =
|
||||
pep_register_values
|
||||
[dev_p->usb_phy_config - 1][1];
|
||||
} else
|
||||
dev_p->usb_pepcfg[i] = 0;
|
||||
|
||||
/* Adjust direction if it is in */
|
||||
if (epstate[i] == cy_as_e_p_iso_in ||
|
||||
epstate[i] == cy_as_e_p_in)
|
||||
dev_p->usb_pepcfg[i] |= (1 << 6);
|
||||
}
|
||||
|
||||
/* Configure the logical EP registers */
|
||||
for (i = 0; i < 10; i++) {
|
||||
int val;
|
||||
int epnum = end_point_map[i];
|
||||
|
||||
v = 0x10; /* PEP 1, Bulk Endpoint, EP not valid */
|
||||
if (dev_p->usb_config[epnum].enabled) {
|
||||
v |= (1 << 7); /* Enabled */
|
||||
|
||||
val = dev_p->usb_config[epnum].physical - 1;
|
||||
cy_as_hal_assert(val >= 0 && val <= 3);
|
||||
v |= (val << 5);
|
||||
|
||||
switch (dev_p->usb_config[epnum].type) {
|
||||
case cy_as_usb_bulk:
|
||||
val = 2;
|
||||
break;
|
||||
case cy_as_usb_int:
|
||||
val = 3;
|
||||
break;
|
||||
case cy_as_usb_iso:
|
||||
val = 1;
|
||||
break;
|
||||
default:
|
||||
cy_as_hal_assert(cy_false);
|
||||
break;
|
||||
}
|
||||
v |= (val << 3);
|
||||
}
|
||||
|
||||
dev_p->usb_lepcfg[i] = v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cy_as_return_status_t
|
||||
cy_as_usb_map_logical2_physical(cy_as_device *dev_p)
|
||||
{
|
||||
cy_as_return_status_t ret;
|
||||
|
||||
/* Physical EPs 3 5 7 9 respectively in the array */
|
||||
cy_as_physical_endpoint_state epstate[4] = {
|
||||
cy_as_e_p_free, cy_as_e_p_free,
|
||||
cy_as_e_p_free, cy_as_e_p_free };
|
||||
|
||||
/* Find the direction for the endpoints */
|
||||
ret = find_endpoint_directions(dev_p, epstate);
|
||||
if (ret != CY_AS_ERROR_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* now create the register settings based on the given
|
||||
* assigned of logical E_ps to physical endpoints.
|
||||
*/
|
||||
create_register_settings(dev_p, epstate);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
get_max_dma_size(cy_as_device *dev_p, cy_as_end_point_number_t ep)
|
||||
{
|
||||
uint16_t size = dev_p->usb_config[ep].size;
|
||||
|
||||
if (size == 0) {
|
||||
switch (dev_p->usb_config[ep].type) {
|
||||
case cy_as_usb_control:
|
||||
size = 64;
|
||||
break;
|
||||
|
||||
case cy_as_usb_bulk:
|
||||
size = cy_as_device_is_usb_high_speed(dev_p) ?
|
||||
512 : 64;
|
||||
break;
|
||||
|
||||
case cy_as_usb_int:
|
||||
size = cy_as_device_is_usb_high_speed(dev_p) ?
|
||||
1024 : 64;
|
||||
break;
|
||||
|
||||
case cy_as_usb_iso:
|
||||
size = cy_as_device_is_usb_high_speed(dev_p) ?
|
||||
1024 : 1023;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
cy_as_return_status_t
|
||||
cy_as_usb_set_dma_sizes(cy_as_device *dev_p)
|
||||
{
|
||||
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
cy_as_usb_end_point_config *config_p =
|
||||
&dev_p->usb_config[end_point_map[i]];
|
||||
if (config_p->enabled) {
|
||||
ret = cy_as_dma_set_max_dma_size(dev_p,
|
||||
end_point_map[i],
|
||||
get_max_dma_size(dev_p, end_point_map[i]));
|
||||
if (ret != CY_AS_ERROR_SUCCESS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
cy_as_return_status_t
|
||||
cy_as_usb_setup_dma(cy_as_device *dev_p)
|
||||
{
|
||||
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
cy_as_usb_end_point_config *config_p =
|
||||
&dev_p->usb_config[end_point_map[i]];
|
||||
if (config_p->enabled) {
|
||||
/* Map the endpoint direction to the DMA direction */
|
||||
cy_as_dma_direction dir = cy_as_direction_out;
|
||||
if (config_p->dir == cy_as_usb_in)
|
||||
dir = cy_as_direction_in;
|
||||
|
||||
ret = cy_as_dma_enable_end_point(dev_p,
|
||||
end_point_map[i], cy_true, dir);
|
||||
if (ret != CY_AS_ERROR_SUCCESS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,55 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyashaldef.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASHALDEF_H_
|
||||
#define _INCLUDED_CYASHALDEF_H_
|
||||
|
||||
/* Summary
|
||||
* If set to TRUE, the basic numeric types are defined by the
|
||||
* West Bridge API code
|
||||
*
|
||||
* Description
|
||||
* The West Bridge API relies on some basic integral types to be
|
||||
* defined. These types include uint8_t, int8_t, uint16_t,
|
||||
* int16_t, uint32_t, and int32_t. If this macro is defined the
|
||||
* West Bridge API will define these types based on some basic
|
||||
* assumptions. If this value is set and the West Bridge API is
|
||||
* used to set these types, the definition of these types must be
|
||||
* examined to insure that they are appropriate for the given
|
||||
* target architecture and compiler.
|
||||
*
|
||||
* Notes
|
||||
* It is preferred that if the basic platform development
|
||||
* environment defines these types that the CY_DEFINE_BASIC_TYPES
|
||||
* macro be undefined and the appropriate target system header file
|
||||
* be added to the file cyashaldef.h.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
|
||||
#if !defined(__doxygen__)
|
||||
typedef int cy_bool;
|
||||
#define cy_true (1)
|
||||
#define cy_false (0)
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDED_CYASHALDEF_H_ */
|
|
@ -1,319 +0,0 @@
|
|||
/* Cypress Antioch HAL for OMAP KERNEL header file (cyashalomapkernel.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains the definition of the hardware abstraction
|
||||
* layer on OMAP3430 talking to the West Bridge Astoria device
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _INCLUDED_CYASHALOMAP_KERNEL_H_
|
||||
#define _INCLUDED_CYASHALOMAP_KERNEL_H_
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/string.h>
|
||||
/* include does not seem to work
|
||||
* moving for patch submission
|
||||
#include <mach/gpmc.h>
|
||||
*/
|
||||
#include <linux/../../arch/arm/plat-omap/include/plat/gpmc.h>
|
||||
typedef struct cy_as_hal_sleep_channel_t {
|
||||
wait_queue_head_t wq;
|
||||
} cy_as_hal_sleep_channel;
|
||||
|
||||
/* moved to staging location, eventual location
|
||||
* considered is here
|
||||
#include <mach/westbridge/cyashaldef.h>
|
||||
#include <linux/westbridge/cyastypes.h>
|
||||
#include <linux/westbridge/cyas_cplus_start.h>
|
||||
*/
|
||||
#include "../cyashaldef.h"
|
||||
#include "../../../../../../../include/linux/westbridge/cyastypes.h"
|
||||
#include "../../../../../../../include/linux/westbridge/cyas_cplus_start.h"
|
||||
#include "cyasomapdev_kernel.h"
|
||||
|
||||
/*
|
||||
* Below are the data structures that must be defined by the HAL layer
|
||||
*/
|
||||
|
||||
/*
|
||||
* The HAL layer must define a TAG for identifying a specific Astoria
|
||||
* device in the system. In this case the tag is a void * which is
|
||||
* really an OMAP device pointer
|
||||
*/
|
||||
typedef void *cy_as_hal_device_tag;
|
||||
|
||||
|
||||
/* This must be included after the CyAsHalDeviceTag type is defined */
|
||||
|
||||
/* moved to staging location, eventual location
|
||||
* considered is here
|
||||
* #include <linux/westbridge/cyashalcb.h>
|
||||
*/
|
||||
#include "../../../../../../../include/linux/westbridge/cyashalcb.h"
|
||||
/*
|
||||
* Below are the functions that communicate with the West Bridge
|
||||
* device. These are system dependent and must be defined by
|
||||
* the HAL layer for a given system.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function must be defined to write a register within the Antioch
|
||||
* device. The addr value is the address of the register to write with
|
||||
* respect to the base address of the Antioch device.
|
||||
*/
|
||||
void
|
||||
cy_as_hal_write_register(cy_as_hal_device_tag tag,
|
||||
uint16_t addr, uint16_t data);
|
||||
|
||||
/*
|
||||
* This function must be defined to read a register from
|
||||
* the west bridge device. The addr value is the address of
|
||||
* the register to read with respect to the base address
|
||||
* of the west bridge device.
|
||||
*/
|
||||
uint16_t
|
||||
cy_as_hal_read_register(cy_as_hal_device_tag tag, uint16_t addr);
|
||||
|
||||
/*
|
||||
* This function must be defined to transfer a block of data
|
||||
* to the west bridge device. This function can use the burst write
|
||||
* (DMA) capabilities of Antioch to do this, or it can just copy
|
||||
* the data using writes.
|
||||
*/
|
||||
void
|
||||
cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
|
||||
uint8_t ep, void *buf, uint32_t size, uint16_t maxsize);
|
||||
|
||||
/*
|
||||
* This function must be defined to transfer a block of data
|
||||
* from the Antioch device. This function can use the burst
|
||||
* read (DMA) capabilities of Antioch to do this, or it can
|
||||
* just copy the data using reads.
|
||||
*/
|
||||
void
|
||||
cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag, uint8_t ep,
|
||||
void *buf, uint32_t size, uint16_t maxsize);
|
||||
|
||||
/*
|
||||
* This function must be defined to cancel any pending DMA request.
|
||||
*/
|
||||
void
|
||||
cy_as_hal_dma_cancel_request(cy_as_hal_device_tag tag, uint8_t ep);
|
||||
|
||||
/*
|
||||
* This function must be defined to allow the Antioch API to
|
||||
* register a callback function that is called when a DMA transfer
|
||||
* is complete.
|
||||
*/
|
||||
void
|
||||
cy_as_hal_dma_register_callback(cy_as_hal_device_tag tag,
|
||||
cy_as_hal_dma_complete_callback cb);
|
||||
|
||||
/*
|
||||
* This function must be defined to return the maximum size of DMA
|
||||
* request that can be handled on the given endpoint. The return
|
||||
* value should be the maximum size in bytes that the DMA module can
|
||||
* handle.
|
||||
*/
|
||||
uint32_t
|
||||
cy_as_hal_dma_max_request_size(cy_as_hal_device_tag tag,
|
||||
cy_as_end_point_number_t ep);
|
||||
|
||||
/*
|
||||
* This function must be defined to set the state of the WAKEUP pin
|
||||
* on the Antioch device. Generally this is done via a GPIO of some
|
||||
* type.
|
||||
*/
|
||||
cy_bool
|
||||
cy_as_hal_set_wakeup_pin(cy_as_hal_device_tag tag, cy_bool state);
|
||||
|
||||
/*
|
||||
* This function is called when the Antioch PLL loses lock, because
|
||||
* of a problem in the supply voltage or the input clock.
|
||||
*/
|
||||
void
|
||||
cy_as_hal_pll_lock_loss_handler(cy_as_hal_device_tag tag);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Below are the functions that must be defined to provide the basic
|
||||
* operating system services required by the API.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
* This function is required by the API to allocate memory. This function
|
||||
* is expected to work exactly like malloc().
|
||||
*/
|
||||
void *
|
||||
cy_as_hal_alloc(uint32_t cnt);
|
||||
|
||||
/*
|
||||
* This function is required by the API to free memory allocated with
|
||||
* CyAsHalAlloc(). This function is expected to work exacly like free().
|
||||
*/
|
||||
void
|
||||
cy_as_hal_free(void *mem_p);
|
||||
|
||||
/*
|
||||
* This function is required by the API to allocate memory during a
|
||||
* callback. This function must be able to provide storage at inturupt
|
||||
* time.
|
||||
*/
|
||||
void *
|
||||
cy_as_hal_c_b_alloc(uint32_t cnt);
|
||||
|
||||
/*
|
||||
* This function is required by the API to free memory allocated with
|
||||
* CyAsCBHalAlloc().
|
||||
*/
|
||||
void
|
||||
cy_as_hal_c_b_free(void *ptr);
|
||||
|
||||
/*
|
||||
* This function is required to set a block of memory to a specific
|
||||
* value. This function is expected to work exactly like memset()
|
||||
*/
|
||||
void
|
||||
cy_as_hal_mem_set(void *ptr, uint8_t value, uint32_t cnt);
|
||||
|
||||
/*
|
||||
* This function is expected to create a sleep channel. The data
|
||||
* structure that represents the sleep channel is given by the
|
||||
* pointer in the argument.
|
||||
*/
|
||||
cy_bool
|
||||
cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel);
|
||||
|
||||
/*
|
||||
* This function is expected to destroy a sleep channel. The data
|
||||
* structure that represents the sleep channel is given by
|
||||
* the pointer in the argument.
|
||||
*/
|
||||
|
||||
|
||||
cy_bool
|
||||
cy_as_hal_destroy_sleep_channel(cy_as_hal_sleep_channel *channel);
|
||||
|
||||
cy_bool
|
||||
cy_as_hal_sleep_on(cy_as_hal_sleep_channel *channel, uint32_t ms);
|
||||
|
||||
cy_bool
|
||||
cy_as_hal_wake(cy_as_hal_sleep_channel *channel);
|
||||
|
||||
uint32_t
|
||||
cy_as_hal_disable_interrupts(void);
|
||||
|
||||
void
|
||||
cy_as_hal_enable_interrupts(uint32_t);
|
||||
|
||||
void
|
||||
cy_as_hal_sleep150(void);
|
||||
|
||||
void
|
||||
cy_as_hal_sleep(uint32_t ms);
|
||||
|
||||
cy_bool
|
||||
cy_as_hal_is_polling(void);
|
||||
|
||||
void cy_as_hal_init_dev_registers(cy_as_hal_device_tag tag,
|
||||
cy_bool is_standby_wakeup);
|
||||
|
||||
/*
|
||||
* required only in spi mode
|
||||
*/
|
||||
cy_bool cy_as_hal_sync_device_clocks(cy_as_hal_device_tag tag);
|
||||
|
||||
void cy_as_hal_read_regs_before_standby(cy_as_hal_device_tag tag);
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define cy_as_hal_assert(cond) if (!(cond))\
|
||||
printk(KERN_WARNING"assertion failed at %s:%d\n", __FILE__, __LINE__);
|
||||
#else
|
||||
#define cy_as_hal_assert(cond)
|
||||
#endif
|
||||
|
||||
#define cy_as_hal_print_message printk
|
||||
|
||||
/* removable debug printks */
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
#define DBG_PRINT_ENABLED
|
||||
#endif
|
||||
|
||||
/*#define MBOX_ACCESS_DBG_PRINT_ENABLED*/
|
||||
|
||||
|
||||
#ifdef DBG_PRINT_ENABLED
|
||||
/* Debug printing enabled */
|
||||
|
||||
#define DBGPRN(...) printk(__VA_ARGS__)
|
||||
#define DBGPRN_FUNC_NAME printk("<1> %x:_func: %s\n", \
|
||||
current->pid, __func__)
|
||||
|
||||
#else
|
||||
/** NO DEBUG PRINTING **/
|
||||
#define DBGPRN(...)
|
||||
#define DBGPRN_FUNC_NAME
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
CyAsMiscSetLogLevel(uint8_t level)
|
||||
{
|
||||
debug_level = level;
|
||||
}
|
||||
|
||||
#ifdef CY_AS_LOG_SUPPORT
|
||||
|
||||
void
|
||||
cy_as_log_debug_message(int level, const char *str)
|
||||
{
|
||||
if (level <= debug_level)
|
||||
cy_as_hal_print_message("log %d: %s\n", level, str);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* print buffer helper
|
||||
*/
|
||||
void cyashal_prn_buf(void *buf, uint16_t offset, int len);
|
||||
|
||||
/*
|
||||
* These are the functions that are not part of the HAL layer,
|
||||
* but are required to be called for this HAL.
|
||||
*/
|
||||
int start_o_m_a_p_kernel(const char *pgm,
|
||||
cy_as_hal_device_tag *tag, cy_bool debug);
|
||||
int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag);
|
||||
int omap_start_intr(cy_as_hal_device_tag tag);
|
||||
void cy_as_hal_set_ep_dma_mode(uint8_t ep, bool sg_xfer_enabled);
|
||||
|
||||
/* moved to staging location
|
||||
#include <linux/westbridge/cyas_cplus_end.h>
|
||||
*/
|
||||
#include "../../../../../../../include/linux/westbridge/cyas_cplus_start.h"
|
||||
#endif
|
|
@ -1,558 +0,0 @@
|
|||
/*
|
||||
OMAP3430 ZOOM MDK astoria interface defs(cyasmemmap.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
/* include does not seem to work
|
||||
* moving for patch submission
|
||||
#include <mach/gpmc.h>
|
||||
#include <mach/mux.h>
|
||||
*/
|
||||
#include <linux/../../arch/arm/plat-omap/include/plat/gpmc.h>
|
||||
#include <linux/../../arch/arm/plat-omap/include/plat/mux.h>
|
||||
|
||||
#ifndef _INCLUDED_CYASMEMMAP_H_
|
||||
#define _INCLUDED_CYASMEMMAP_H_
|
||||
|
||||
/* defines copied from OMAP kernel branch */
|
||||
|
||||
#define OMAP2_PULL_UP (1 << 4)
|
||||
#define OMAP2_PULL_ENA (1 << 3)
|
||||
#define OMAP34XX_MUX_MODE0 0
|
||||
#define OMAP34XX_MUX_MODE4 4
|
||||
#define OMAP3_INPUT_EN (1 << 8)
|
||||
#define OMAP34XX_PIN_INPUT_PULLUP (OMAP2_PULL_ENA | OMAP3_INPUT_EN \
|
||||
| OMAP2_PULL_UP)
|
||||
|
||||
/*
|
||||
* for OMAP3430 <-> astoria : ADmux mode, 8 bit data path
|
||||
* WB Signal- OMAP3430 signal COMMENTS
|
||||
* --------------------------- --------------------
|
||||
* CS_L -GPMC_nCS4_GPIO_53 ZOOM I SOM board
|
||||
* signal: up_nCS_A_EXT
|
||||
* AD[7:0]-upD[7:0] buffered on the
|
||||
* transposer board
|
||||
* GPMC_ADDR
|
||||
* [A8:A1]->upD[7:0]
|
||||
* INT# -GPMC_nWP_GPIO_62
|
||||
* DACK -N/C not connected
|
||||
* WAKEUP-GPIO_167
|
||||
* RESET-GPIO_126
|
||||
* R/B -GPMC_WAIT2_GPIO_64
|
||||
* -------------------------------------------
|
||||
* The address range for nCS1B is 0x06000000 - 0x07FF FFFF.
|
||||
*/
|
||||
|
||||
/*
|
||||
*OMAP_ZOOM LEDS
|
||||
*/
|
||||
#define LED_0 156
|
||||
#define LED_1 128
|
||||
#define LED_2 64
|
||||
#define LED_3 60
|
||||
|
||||
#define HIGH 1
|
||||
#define LOW 1
|
||||
|
||||
/*
|
||||
*omap GPIO number
|
||||
*/
|
||||
#define AST_WAKEUP 167
|
||||
#define AST_RESET 126
|
||||
#define AST__rn_b 64
|
||||
|
||||
/*
|
||||
* NOTE THIS PIN IS USED AS WP for OMAP NAND
|
||||
*/
|
||||
#define AST_INT 62
|
||||
|
||||
/*
|
||||
* as an I/O, it is actually controlled by GPMC
|
||||
*/
|
||||
#define AST_CS 55
|
||||
|
||||
|
||||
/*
|
||||
*GPMC prefetch engine
|
||||
*/
|
||||
|
||||
/* register and its bit fields */
|
||||
#define GPMC_PREFETCH_CONFIG1 0x01E0
|
||||
|
||||
/*32 bytes for 16 bit pnand mode*/
|
||||
#define PFE_THRESHOLD 31
|
||||
|
||||
/*
|
||||
* bit fields
|
||||
* PF_ACCESSMODE - 0 - read mode, 1 - write mode
|
||||
* PF_DMAMODE - 0 - default only intr line signal will be generated
|
||||
* PF_SYNCHROMODE - default 0 - engin will start access as soon as
|
||||
* ctrl re STARTENGINE is set
|
||||
* PF_WAITPINSEL - FOR synchro mode selects WAIT pin whch edge
|
||||
* will be monitored
|
||||
* PF_EN_ENGINE - 1- ENABLES ENGINE, but it needs to be started after
|
||||
* that C ctrl reg bit 0
|
||||
* PF_FIFO_THRESHOLD - FIFO threshold in number of BUS(8 or 16) words
|
||||
* PF_WEIGHTED_PRIO - NUM of cycles granted to PFE if RND_ROBIN
|
||||
* prioritization is enabled
|
||||
* PF_ROUND_ROBIN - if enabled, gives priority to other CS, but
|
||||
* reserves NUM of cycles for PFE's turn
|
||||
* PF_ENGIN_CS_SEL - GPMC CS assotiated with PFE function
|
||||
*/
|
||||
#define PF_ACCESSMODE (0 << 0)
|
||||
#define PF_DMAMODE (0 << 2)
|
||||
#define PF_SYNCHROMODE (0 << 3)
|
||||
#define PF_WAITPINSEL (0x0 << 4)
|
||||
#define PF_EN_ENGINE (1 << 7)
|
||||
#define PF_FIFO_THRESHOLD (PFE_THRESHOLD << 8)
|
||||
#define PF_WEIGHTED_PRIO (0x0 << 16)
|
||||
#define PF_ROUND_ROBIN (0 << 23)
|
||||
#define PF_ENGIN_CS_SEL (AST_GPMC_CS << 24)
|
||||
#define PF_EN_OPTIM_ACC (0 << 27)
|
||||
#define PF_CYCLEOPTIM (0x0 << 28)
|
||||
|
||||
#define GPMC_PREFETCH_CONFIG1_VAL (PF_ACCESSMODE | \
|
||||
PF_DMAMODE | PF_SYNCHROMODE | \
|
||||
PF_WAITPINSEL | PF_EN_ENGINE | \
|
||||
PF_FIFO_THRESHOLD | PF_FIFO_THRESHOLD | \
|
||||
PF_WEIGHTED_PRIO | PF_ROUND_ROBIN | \
|
||||
PF_ENGIN_CS_SEL | PF_EN_OPTIM_ACC | \
|
||||
PF_CYCLEOPTIM)
|
||||
|
||||
/* register and its bit fields */
|
||||
#define GPMC_PREFETCH_CONFIG2 0x01E4
|
||||
/*
|
||||
* bit fields
|
||||
* 14 bit field NOTE this counts is also
|
||||
* is in number of BUS(8 or 16) words
|
||||
*/
|
||||
#define PF_TRANSFERCOUNT (0x000)
|
||||
|
||||
|
||||
/* register and its bit fields */
|
||||
#define GPMC_PREFETCH_CONTROL 0x01EC
|
||||
/*
|
||||
* bit fields , ONLY BIT 0 is implemented
|
||||
* PFWE engin must be programmed with this bit = 0
|
||||
*/
|
||||
#define PFPW_STARTENGINE (1 << 0)
|
||||
|
||||
/* register and its bit fields */
|
||||
#define GPMC_PREFETCH_STATUS 0x01F0
|
||||
|
||||
/* */
|
||||
#define PFE_FIFO_THRESHOLD (1 << 16)
|
||||
|
||||
/*
|
||||
* GPMC posted write/prefetch engine end
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* chip select number on GPMC ( 0..7 )
|
||||
*/
|
||||
#define AST_GPMC_CS 4
|
||||
|
||||
/*
|
||||
* not connected
|
||||
*/
|
||||
#define AST_DACK 00
|
||||
|
||||
|
||||
/*
|
||||
* Physical address above the NAND flash
|
||||
* we use CS For mapping in OMAP3430 RAM space use 0x0600 0000
|
||||
*/
|
||||
#define CYAS_DEV_BASE_ADDR (0x20000000)
|
||||
|
||||
#define CYAS_DEV_MAX_ADDR (0xFF)
|
||||
#define CYAS_DEV_ADDR_RANGE (CYAS_DEV_MAX_ADDR << 1)
|
||||
|
||||
#ifdef p_s_r_a_m_INTERFACE
|
||||
/* in CRAM or PSRAM mode OMAP A1..An wires-> Astoria, there is no A0 line */
|
||||
#define CYAS_DEV_CALC_ADDR(cyas_addr) (cyas_addr << 1)
|
||||
#define CYAS_DEV_CALC_EP_ADDR(ep) (ep << 1)
|
||||
#else
|
||||
/*
|
||||
* For pNAND interface it depends on NAND emulation mode
|
||||
* SBD/LBD etc we use NON-LNA_LBD mode, so it goes like this:
|
||||
* forlbd <CMD><CA0,CA1,RA0,RA1,RA2> <CMD>,
|
||||
* where CA1 address must have bits 2,3 = "11"
|
||||
* ep is mapped into RA1 bits {4:0}
|
||||
*/
|
||||
#define CYAS_DEV_CALC_ADDR(cyas_addr) (cyas_addr | 0x0c00)
|
||||
#define CYAS_DEV_CALC_EP_ADDR(ep) ep
|
||||
#endif
|
||||
|
||||
/*
|
||||
*OMAP3430 i/o access macros
|
||||
*/
|
||||
#define IORD32(addr) (*(volatile u32 *)(addr))
|
||||
#define IOWR32(addr, val) (*(volatile u32 *)(addr) = val)
|
||||
|
||||
#define IORD16(addr) (*(volatile u16 *)(addr))
|
||||
#define IOWR16(addr, val) (*(volatile u16 *)(addr) = val)
|
||||
|
||||
#define IORD8(addr) (*(volatile u8 *)(addr))
|
||||
#define IOWR8(addr, val) (*(volatile u8 *)(addr) = val)
|
||||
|
||||
/*
|
||||
* local defines for accessing to OMAP GPIO ***
|
||||
*/
|
||||
#define CTLPADCONF_BASE_ADDR 0x48002000
|
||||
#define CTLPADCONF_SIZE 0x1000
|
||||
|
||||
#define GPIO1_BASE_ADDR 0x48310000
|
||||
#define GPIO2_BASE_ADDR 0x49050000
|
||||
#define GPIO3_BASE_ADDR 0x49052000
|
||||
#define GPIO4_BASE_ADDR 0x49054000
|
||||
#define GPIO5_BASE_ADDR 0x49056000
|
||||
#define GPIO6_BASE_ADDR 0x49058000
|
||||
#define GPIO_SPACE_SIZE 0x1000
|
||||
|
||||
|
||||
/*
|
||||
* OMAP3430 GPMC timing for pNAND interface
|
||||
*/
|
||||
#define GPMC_BASE 0x6E000000
|
||||
#define GPMC_REGION_SIZE 0x1000
|
||||
#define GPMC_CONFIG_REG (0x50)
|
||||
|
||||
/*
|
||||
* bit 0 in the GPMC_CONFIG_REG
|
||||
*/
|
||||
#define NAND_FORCE_POSTED_WRITE_B 1
|
||||
|
||||
/*
|
||||
* WAIT2STATUS, must be (1 << 10)
|
||||
*/
|
||||
#define AS_WAIT_PIN_MASK (1 << 10)
|
||||
|
||||
|
||||
/*
|
||||
* GPMC_CONFIG(reg number [1..7] [for chip sel CS[0..7])
|
||||
*/
|
||||
#define GPMC_CFG_REG(N, CS) ((0x60 + (4*(N-1))) + (0x30*CS))
|
||||
|
||||
/*
|
||||
*gpmc nand registers for CS4
|
||||
*/
|
||||
#define AST_GPMC_NAND_CMD (0x7c + (0x30*AST_GPMC_CS))
|
||||
#define AST_GPMC_NAND_ADDR (0x80 + (0x30*AST_GPMC_CS))
|
||||
#define AST_GPMC_NAND_DATA (0x84 + (0x30*AST_GPMC_CS))
|
||||
|
||||
#define GPMC_STAT_REG (0x54)
|
||||
#define GPMC_ERR_TYPE (0x48)
|
||||
|
||||
/*
|
||||
* we get "gpmc_base" from kernel
|
||||
*/
|
||||
#define GPMC_VMA(offset) (gpmc_base + offset)
|
||||
|
||||
/*
|
||||
* GPMC CS space VMA start address
|
||||
*/
|
||||
#define GPMC_CS_VMA(offset) (gpmc_data_vma + offset)
|
||||
|
||||
/*
|
||||
* PAD_CFG mux space VMA
|
||||
*/
|
||||
#define PADCFG_VMA(offset) (iomux_vma + offset)
|
||||
|
||||
/*
|
||||
* CONFIG1: by default, sngle access, async r/w RD_MULTIPLE[30]
|
||||
* WR_MULTIPLE[28]; GPMC_FCL_DIV[1:0]
|
||||
*/
|
||||
#define GPMC_FCLK_DIV ((0) << 0)
|
||||
|
||||
/*
|
||||
* ADDITIONAL DIVIDER FOR ALL TIMING PARAMS
|
||||
*/
|
||||
#define TIME_GRAN_SCALE ((0) << 4)
|
||||
|
||||
/*
|
||||
* for use by gpmc_set_timings api, measured in ns, not clocks
|
||||
*/
|
||||
#define WB_GPMC_BUSCYC_t (7 * 6)
|
||||
#define WB_GPMC_CS_t_o_n (0)
|
||||
#define WB_GPMC_ADV_t_o_n (0)
|
||||
#define WB_GPMC_OE_t_o_n (0)
|
||||
#define WB_GPMC_OE_t_o_f_f (5 * 6)
|
||||
#define WB_GPMC_WE_t_o_n (1 * 6)
|
||||
#define WB_GPMC_WE_t_o_f_f (5 * 6)
|
||||
#define WB_GPMC_RDS_ADJ (2 * 6)
|
||||
#define WB_GPMC_RD_t_a_c_c (WB_GPMC_OE_t_o_f_f + WB_GPMC_RDS_ADJ)
|
||||
#define WB_GPMC_WR_t_a_c_c (WB_GPMC_BUSCYC_t)
|
||||
|
||||
#define DIR_OUT 0
|
||||
#define DIR_INP 1
|
||||
#define DRV_HI 1
|
||||
#define DRV_LO 0
|
||||
|
||||
/*
|
||||
* GPMC_CONFIG7[cs] register bit fields
|
||||
* AS_CS_MASK - 3 bit mask for A26,A25,A24,
|
||||
* AS_CS_BADDR - 6 BIT VALUE A29 ...A24
|
||||
* CSVALID_B - CSVALID bit on GPMC_CONFIG7[cs] register
|
||||
*/
|
||||
#define AS_CS_MASK (0X7 << 8)
|
||||
#define AS_CS_BADDR 0x02
|
||||
#define CSVALID_B (1 << 6)
|
||||
|
||||
/*
|
||||
* DEFINE OMAP34XX GPIO OFFSETS (should have been defined in kernel /arch
|
||||
* these are offsets from the BASE_ADDRESS of the GPIO BLOCK
|
||||
*/
|
||||
#define GPIO_REVISION 0x000
|
||||
#define GPIO_SYSCONFIG 0x010
|
||||
#define GPIO_SYSSTATUS1 0x014
|
||||
#define GPIO_IRQSTATUS1 0x018
|
||||
#define GPIO_IRQENABLE1 0x01C
|
||||
#define GPIO_IRQSTATUS2 0x028
|
||||
#define GPIO_CTRL 0x030
|
||||
#define GPIO_OE 0x034
|
||||
#define GPIO_DATA_IN 0x038
|
||||
#define GPIO_DATA_OUT 0x03C
|
||||
#define GPIO_LEVELDETECT0 0x040
|
||||
#define GPIO_LEVELDETECT1 0x044
|
||||
#define GPIO_RISINGDETECT 0x048
|
||||
#define GPIO_FALLINGDETECT 0x04c
|
||||
#define GPIO_CLEAR_DATAOUT 0x090
|
||||
#define GPIO_SET_DATAOUT 0x094
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
u32 phy_addr;
|
||||
u32 virt_addr;
|
||||
u32 size;
|
||||
} io2vma_tab_t;
|
||||
|
||||
/*
|
||||
* GPIO phy to translation VMA table
|
||||
*/
|
||||
static io2vma_tab_t gpio_vma_tab[6] = {
|
||||
{"GPIO1_BASE_ADDR", GPIO1_BASE_ADDR , 0 , GPIO_SPACE_SIZE},
|
||||
{"GPIO2_BASE_ADDR", GPIO2_BASE_ADDR , 0 , GPIO_SPACE_SIZE},
|
||||
{"GPIO3_BASE_ADDR", GPIO3_BASE_ADDR , 0 , GPIO_SPACE_SIZE},
|
||||
{"GPIO4_BASE_ADDR", GPIO4_BASE_ADDR , 0 , GPIO_SPACE_SIZE},
|
||||
{"GPIO5_BASE_ADDR", GPIO5_BASE_ADDR , 0 , GPIO_SPACE_SIZE},
|
||||
{"GPIO6_BASE_ADDR", GPIO6_BASE_ADDR , 0 , GPIO_SPACE_SIZE}
|
||||
};
|
||||
/*
|
||||
* name - USER signal name assigned to the pin ( for printks)
|
||||
* mux_func - enum index NAME for the pad_cfg function
|
||||
* pin_num - pin_number if mux_func is GPIO, if not a GPIO it is -1
|
||||
* mux_ptr - pointer to the corresponding pad_cfg_reg
|
||||
* (used for pad release )
|
||||
* mux_save - preserve here original PAD_CNF value for this
|
||||
* pin (used for pad release)
|
||||
* dir - if GPIO: 0 - OUT , 1 - IN
|
||||
* dir_save - save original pin direction
|
||||
* drv - initial drive level "0" or "1"
|
||||
* drv_save - save original pin drive level
|
||||
* valid - 1 if successfuly configured
|
||||
*/
|
||||
typedef struct {
|
||||
char *name;
|
||||
u32 mux_func;
|
||||
int pin_num;
|
||||
u16 *mux_ptr;
|
||||
u16 mux_save;
|
||||
u8 dir;
|
||||
u8 dir_save;
|
||||
u8 drv;
|
||||
u8 drv_save;
|
||||
u8 valid;
|
||||
} user_pad_cfg_t;
|
||||
|
||||
/*
|
||||
* need to ensure that enums are in sync with the
|
||||
* omap_mux_pin_cfg table, these enums designate
|
||||
* functions that OMAP pads can be configured to
|
||||
*/
|
||||
enum {
|
||||
B23_OMAP3430_GPIO_167,
|
||||
D23_OMAP3430_GPIO_126,
|
||||
H1_OMAP3430_GPIO_62,
|
||||
H1_OMAP3430_GPMC_n_w_p,
|
||||
T8_OMAP3430_GPMC_n_c_s4,
|
||||
T8_OMAP3430_GPIO_55,
|
||||
R25_OMAP3430_GPIO_156,
|
||||
R27_OMAP3430_GPIO_128,
|
||||
K8_OMAP3430_GPIO_64,
|
||||
K8_GPMC_WAIT2,
|
||||
G3_OMAP3430_GPIO_60,
|
||||
G3_OMAP3430_n_b_e0_CLE,
|
||||
C6_GPMC_WAIT3,
|
||||
J1_OMAP3430_GPIO_61,
|
||||
C6_OMAP3430_GPIO_65,
|
||||
|
||||
END_OF_TABLE
|
||||
};
|
||||
|
||||
/*
|
||||
* number of GPIOS we plan to grab
|
||||
*/
|
||||
#define GPIO_SLOTS 8
|
||||
|
||||
/*
|
||||
* user_pads_init() reads(and saves) from/to this table
|
||||
* used in conjunction with omap_3430_mux_t table in .h file
|
||||
* because the way it's done in the kernel code
|
||||
* TODO: implement restore of the the original cfg and i/o regs
|
||||
*/
|
||||
|
||||
static user_pad_cfg_t user_pad_cfg[] = {
|
||||
/*
|
||||
* name,pad_func,pin_num, mux_ptr, mux_sav, dir,
|
||||
* dir_sav, drv, drv_save, valid
|
||||
*/
|
||||
{"AST_WAKEUP", B23_OMAP3430_GPIO_167, 167, NULL, 0,
|
||||
DIR_OUT, 0, DRV_HI, 0, 0},
|
||||
{"AST_RESET", D23_OMAP3430_GPIO_126, 126, NULL, 0,
|
||||
DIR_OUT, 0, DRV_HI, 0, 0},
|
||||
{"AST__rn_b", K8_GPMC_WAIT2, 64, NULL, 0,
|
||||
DIR_INP, 0, 0, 0, 0},
|
||||
{"AST_INTR", H1_OMAP3430_GPIO_62, 62, NULL, 0,
|
||||
DIR_INP, 0, DRV_HI, 0, 0},
|
||||
{"AST_CS", T8_OMAP3430_GPMC_n_c_s4, 55, NULL, 0,
|
||||
DIR_OUT, 0, DRV_HI, 0, 0},
|
||||
{"LED_0", R25_OMAP3430_GPIO_156, 156, NULL, 0,
|
||||
DIR_OUT, 0, DRV_LO, 0, 0},
|
||||
{"LED_1", R27_OMAP3430_GPIO_128, 128, NULL, 0,
|
||||
DIR_OUT, 0, DRV_LO, 0, 0},
|
||||
{"AST_CLE", G3_OMAP3430_n_b_e0_CLE , 60, NULL, 0,
|
||||
DIR_OUT, 0, DRV_LO, 0, 0},
|
||||
/*
|
||||
* Z terminator, must always be present
|
||||
* for sanity check, don't remove
|
||||
*/
|
||||
{NULL}
|
||||
};
|
||||
|
||||
#define GPIO_BANK(pin) (pin >> 5)
|
||||
#define REG_WIDTH 32
|
||||
#define GPIO_REG_VMA(pin_num, offset) \
|
||||
(gpio_vma_tab[GPIO_BANK(pin_num)].virt_addr + offset)
|
||||
|
||||
/*
|
||||
* OMAP GPIO_REG 32 BIT MASK for a bit or
|
||||
* flag in gpio_No[0..191] apply it to a 32 bit
|
||||
* location to set clear or check on a corresponding
|
||||
* gpio bit or flag
|
||||
*/
|
||||
#define GPIO_REG_MASK(pin_num) (1 << \
|
||||
(pin_num - (GPIO_BANK(pin_num) * REG_WIDTH)))
|
||||
|
||||
/*
|
||||
* OMAP GPIO registers bitwise access macros
|
||||
*/
|
||||
|
||||
#define OMAP_GPIO_BIT(pin_num, reg) \
|
||||
((*((u32 *)GPIO_REG_VMA(pin_num, reg)) \
|
||||
& GPIO_REG_MASK(pin_num)) ? 1 : 0)
|
||||
|
||||
#define RD_OMAP_GPIO_BIT(pin_num, v) OMAP_GPIO_BIT(pin_num, reg)
|
||||
|
||||
/*
|
||||
*these are superfast set/clr bitbang macro, 48ns cyc tyme
|
||||
*/
|
||||
#define OMAP_SET_GPIO(pin_num) \
|
||||
(*(u32 *)GPIO_REG_VMA(pin_num, GPIO_SET_DATAOUT) \
|
||||
= GPIO_REG_MASK(pin_num))
|
||||
#define OMAP_CLR_GPIO(pin_num) \
|
||||
(*(u32 *)GPIO_REG_VMA(pin_num, GPIO_CLEAR_DATAOUT) \
|
||||
= GPIO_REG_MASK(pin_num))
|
||||
|
||||
#define WR_OMAP_GPIO_BIT(pin_num, v) \
|
||||
(v ? (*(u32 *)GPIO_REG_VMA(pin_num, \
|
||||
GPIO_SET_DATAOUT) = GPIO_REG_MASK(pin_num)) \
|
||||
: (*(u32 *)GPIO_REG_VMA(pin_num, \
|
||||
GPIO_CLEAR_DATAOUT) = GPIO_REG_MASK(pin_num)))
|
||||
|
||||
/*
|
||||
* Note this pin cfg mimicks similar implementation
|
||||
* in linux kernel, which unfortunately doesn't allow
|
||||
* us to dynamically insert new custom GPIO mux
|
||||
* configurations all REG definitions used in this
|
||||
* applications. to add a new pad_cfg function, insert
|
||||
* a new ENUM and new pin_cfg entry in omap_mux_pin_cfg[]
|
||||
* table below
|
||||
*
|
||||
* offset - note this is a word offset since the
|
||||
* SCM regs are 16 bit packed in one 32 bit word
|
||||
* mux_val - just enough to describe pins used
|
||||
*/
|
||||
typedef struct {
|
||||
char *name;
|
||||
u16 offset;
|
||||
u16 mux_val;
|
||||
} omap_3430_mux_t;
|
||||
|
||||
/*
|
||||
* "OUTIN" is configuration when DATA reg drives the
|
||||
* pin but the level at the pin can be sensed
|
||||
*/
|
||||
#define PAD_AS_OUTIN (OMAP34XX_MUX_MODE4 | \
|
||||
OMAP34XX_PIN_OUTPUT | OMAP34XX_PIN_INPUT)
|
||||
|
||||
omap_3430_mux_t omap_mux_pin_cfg[] = {
|
||||
/*
|
||||
* B23_OMAP3430_GPIO_167 - GPIO func to PAD 167 WB wakeup
|
||||
* D23_OMAP3430_GPIO_126 - drive GPIO_126 ( AST RESET)
|
||||
* H1_OMAP3430_GPIO_62 - need a pullup on this pin
|
||||
* H1_OMAP3430_GPMC_n_w_p - GPMC NAND CTRL n_w_p out
|
||||
* T8_OMAP3430_GPMC_n_c_s4" - T8 is controlled b_y GPMC NAND ctrl
|
||||
* R25_OMAP3430_GPIO_156 - OMAPZOOM drive LED_0
|
||||
* R27_OMAP3430_GPIO_128 - OMAPZOOM drive LED_1
|
||||
* K8_OMAP3430_GPIO_64 - OMAPZOOM drive LED_2
|
||||
* K8_GPMC_WAIT2 - GPMC WAIT2 function on PAD K8
|
||||
* G3_OMAP3430_GPIO_60 - OMAPZOOM drive LED_3
|
||||
* G3_OMAP3430_n_b_e0_CLE -GPMC NAND ctrl CLE signal
|
||||
*/
|
||||
|
||||
{"B23_OMAP3430_GPIO_167", 0x0130, (OMAP34XX_MUX_MODE4)},
|
||||
{"D23_OMAP3430_GPIO_126", 0x0132, (OMAP34XX_MUX_MODE4)},
|
||||
{"H1_OMAP3430_GPIO_62", 0x00CA, (OMAP34XX_MUX_MODE4 |
|
||||
OMAP3_INPUT_EN | OMAP34XX_PIN_INPUT_PULLUP) },
|
||||
{"H1_OMAP3430_GPMC_n_w_p", 0x00CA, (OMAP34XX_MUX_MODE0)},
|
||||
{"T8_OMAP3430_GPMC_n_c_s4", 0x00B6, (OMAP34XX_MUX_MODE0) },
|
||||
{"T8_OMAP3430_GPIO_55", 0x00B6, (OMAP34XX_MUX_MODE4) },
|
||||
{"R25_OMAP3430_GPIO_156", 0x018C, (OMAP34XX_MUX_MODE4) },
|
||||
{"R27_OMAP3430_GPIO_128", 0x0154, (OMAP34XX_MUX_MODE4) },
|
||||
{"K8_OMAP3430_GPIO_64", 0x00d0, (OMAP34XX_MUX_MODE4) },
|
||||
{"K8_GPMC_WAIT2", 0x00d0, (OMAP34XX_MUX_MODE0) },
|
||||
{"G3_OMAP3430_GPIO_60", 0x00C6, (OMAP34XX_MUX_MODE4 |
|
||||
OMAP3_INPUT_EN)},
|
||||
{"G3_OMAP3430_n_b_e0_CLE", 0x00C6, (OMAP34XX_MUX_MODE0)},
|
||||
{"C6_GPMC_WAIT3", 0x00d2, (OMAP34XX_MUX_MODE0)},
|
||||
{"C6_OMAP3430_GPIO_65", 0x00d2, (OMAP34XX_MUX_MODE4 |
|
||||
OMAP3_INPUT_EN)},
|
||||
{"J1_OMAP3430_GPIO_61", 0x00C8, (OMAP34XX_MUX_MODE4 |
|
||||
OMAP3_INPUT_EN | OMAP34XX_PIN_INPUT_PULLUP)},
|
||||
/*
|
||||
* don't remove, used for sanity check.
|
||||
*/
|
||||
{"END_OF_TABLE"}
|
||||
};
|
||||
|
||||
|
||||
#endif /* _INCLUDED_CYASMEMMAP_H_ */
|
||||
|
||||
/*[]*/
|
|
@ -1,72 +0,0 @@
|
|||
/* Cypress Antioch OMAP KERNEL file (cyanomapdev_kernel.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef __CY_AS_OMAP_DEV_KERNEL_H__
|
||||
#define __CY_AS_OMAP_DEV_KERNEL_H__
|
||||
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/completion.h>
|
||||
|
||||
/* include does not seem to work
|
||||
* moving for patch submission
|
||||
#include <mach/gpmc.h>
|
||||
*/
|
||||
#include <linux/../../arch/arm/plat-omap/include/plat/gpmc.h>
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
#define CY_AS_OMAP_KERNEL_HAL_SIG (0x1441)
|
||||
|
||||
|
||||
/*
|
||||
* Data structures
|
||||
*/
|
||||
typedef struct cy_as_omap_dev_kernel {
|
||||
/* This is the signature for this data structure */
|
||||
unsigned int m_sig;
|
||||
|
||||
/* Address base of Antioch Device */
|
||||
void *m_addr_base;
|
||||
|
||||
/* This is a pointer to the next Antioch device in the system */
|
||||
struct cy_as_omap_dev_kernel *m_next_p;
|
||||
|
||||
/* This is for thread sync */
|
||||
struct completion thread_complete;
|
||||
|
||||
/* This is for thread to wait for interrupts */
|
||||
cy_as_hal_sleep_channel thread_sc;
|
||||
|
||||
/* This is for thread to exit upon StopOmapKernel */
|
||||
int thread_flag; /* set 1 to exit */
|
||||
|
||||
int dma_ch;
|
||||
|
||||
/* This is for dma sync */
|
||||
struct completion dma_complete;
|
||||
} cy_as_omap_dev_kernel;
|
||||
|
||||
#endif
|
||||
|
||||
/*[]*/
|
|
@ -1,9 +0,0 @@
|
|||
#
|
||||
# West Bridge block driver configuration
|
||||
#
|
||||
|
||||
config WESTBRIDGE_BLOCK_DRIVER
|
||||
tristate "West Bridge Block Driver"
|
||||
help
|
||||
Include the West Bridge based block driver
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#
|
||||
# Makefile for the kernel westbridge block driver
|
||||
#
|
||||
|
||||
ifneq ($(CONFIG_WESTBRIDGE_DEBUG),y)
|
||||
EXTRA_CFLAGS += -DWESTBRIDGE_NDEBUG
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_WESTBRIDGE_BLOCK_DRIVER) += cyasblkdev.o
|
||||
cyasblkdev-y := cyasblkdev_block.o cyasblkdev_queue.o
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,417 +0,0 @@
|
|||
/* cyanblkdev_queue.h - Antioch Linux Block Driver queue source file
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Request queue handling for Antioch block device driver.
|
||||
* Based on the mmc queue handling code by Russell King in the
|
||||
* linux 2.6.10 kernel.
|
||||
*/
|
||||
|
||||
/*
|
||||
* linux/drivers/mmc/mmc_queue.c
|
||||
*
|
||||
* Copyright (C) 2003 Russell King, All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
#include "cyasblkdev_queue.h"
|
||||
|
||||
#define CYASBLKDEV_QUEUE_EXIT (1 << 0)
|
||||
#define CYASBLKDEV_QUEUE_SUSPENDED (1 << 1)
|
||||
#define CY_AS_USE_ASYNC_API
|
||||
|
||||
|
||||
|
||||
/* print flags by name */
|
||||
const char *rq_flag_bit_names[] = {
|
||||
"REQ_RW", /* not set, read. set, write */
|
||||
"REQ_FAILFAST", /* no low level driver retries */
|
||||
"REQ_SORTED", /* elevator knows about this request */
|
||||
"REQ_SOFTBARRIER", /* may not be passed by ioscheduler */
|
||||
"REQ_HARDBARRIER", /* may not be passed by drive either */
|
||||
"REQ_FUA", /* forced unit access */
|
||||
"REQ_NOMERGE", /* don't touch this for merging */
|
||||
"REQ_STARTED", /* drive already may have started this one */
|
||||
"REQ_DONTPREP", /* don't call prep for this one */
|
||||
"REQ_QUEUED", /* uses queueing */
|
||||
"REQ_ELVPRIV", /* elevator private data attached */
|
||||
"REQ_FAILED", /* set if the request failed */
|
||||
"REQ_QUIET", /* don't worry about errors */
|
||||
"REQ_PREEMPT", /* set for "ide_preempt" requests */
|
||||
"REQ_ORDERED_COLOR",/* is before or after barrier */
|
||||
"REQ_RW_SYNC", /* request is sync (O_DIRECT) */
|
||||
"REQ_ALLOCED", /* request came from our alloc pool */
|
||||
"REQ_RW_META", /* metadata io request */
|
||||
"REQ_COPY_USER", /* contains copies of user pages */
|
||||
"REQ_NR_BITS", /* stops here */
|
||||
};
|
||||
|
||||
void verbose_rq_flags(int flags)
|
||||
{
|
||||
int i;
|
||||
uint32_t j;
|
||||
j = 1;
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (flags & j)
|
||||
DBGPRN("<1>%s", rq_flag_bit_names[i]);
|
||||
j = j << 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prepare a -BLK_DEV request. Essentially, this means passing the
|
||||
* preparation off to the media driver. The media driver will
|
||||
* create request to CyAsDev.
|
||||
*/
|
||||
static int cyasblkdev_prep_request(
|
||||
struct request_queue *q, struct request *req)
|
||||
{
|
||||
DBGPRN_FUNC_NAME;
|
||||
|
||||
/* we only like normal block requests.*/
|
||||
if (req->cmd_type != REQ_TYPE_FS && !(req->cmd_flags & REQ_DISCARD)) {
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message("%s:%x bad request received\n",
|
||||
__func__, current->pid);
|
||||
#endif
|
||||
|
||||
blk_dump_rq_flags(req, "cyasblkdev bad request");
|
||||
return BLKPREP_KILL;
|
||||
}
|
||||
|
||||
req->cmd_flags |= REQ_DONTPREP;
|
||||
|
||||
return BLKPREP_OK;
|
||||
}
|
||||
|
||||
/* queue worker thread */
|
||||
static int cyasblkdev_queue_thread(void *d)
|
||||
{
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
struct cyasblkdev_queue *bq = d;
|
||||
struct request_queue *q = bq->queue;
|
||||
u32 qth_pid;
|
||||
|
||||
DBGPRN_FUNC_NAME;
|
||||
|
||||
/*
|
||||
* set iothread to ensure that we aren't put to sleep by
|
||||
* the process freezing. we handle suspension ourselves.
|
||||
*/
|
||||
daemonize("cyasblkdev_queue_thread");
|
||||
|
||||
/* signal to queue_init() so it could contnue */
|
||||
complete(&bq->thread_complete);
|
||||
|
||||
down(&bq->thread_sem);
|
||||
add_wait_queue(&bq->thread_wq, &wait);
|
||||
|
||||
qth_pid = current->pid;
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s:%x started, bq:%p, q:%p\n", __func__, qth_pid, bq, q);
|
||||
#endif
|
||||
|
||||
do {
|
||||
struct request *req = NULL;
|
||||
|
||||
/* the thread wants to be woken up by signals as well */
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
|
||||
spin_lock_irq(q->queue_lock);
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s: for bq->queue is null\n", __func__);
|
||||
#endif
|
||||
|
||||
if (!bq->req) {
|
||||
/* chk if queue is plugged */
|
||||
if (!blk_queue_plugged(q)) {
|
||||
bq->req = req = blk_fetch_request(q);
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s: blk_fetch_request:%x\n",
|
||||
__func__, (uint32_t)req);
|
||||
#endif
|
||||
} else {
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s: queue plugged, "
|
||||
"skip blk_fetch()\n", __func__);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
spin_unlock_irq(q->queue_lock);
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s: checking if request queue is null\n", __func__);
|
||||
#endif
|
||||
|
||||
if (!req) {
|
||||
if (bq->flags & CYASBLKDEV_QUEUE_EXIT) {
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s:got QUEUE_EXIT flag\n", __func__);
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s: request queue is null, goto sleep, "
|
||||
"thread_sem->count=%d\n",
|
||||
__func__, bq->thread_sem.count);
|
||||
if (spin_is_locked(q->queue_lock)) {
|
||||
cy_as_hal_print_message("%s: queue_lock "
|
||||
"is locked, need to release\n", __func__);
|
||||
spin_unlock(q->queue_lock);
|
||||
|
||||
if (spin_is_locked(q->queue_lock))
|
||||
cy_as_hal_print_message(
|
||||
"%s: unlock did not work\n",
|
||||
__func__);
|
||||
} else {
|
||||
cy_as_hal_print_message(
|
||||
"%s: checked lock, is not locked\n",
|
||||
__func__);
|
||||
}
|
||||
#endif
|
||||
|
||||
up(&bq->thread_sem);
|
||||
|
||||
/* yields to the next rdytorun proc,
|
||||
* then goes back to sleep*/
|
||||
schedule();
|
||||
down(&bq->thread_sem);
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s: wake_up,continue\n",
|
||||
__func__);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
/* new req received, issue it to the driver */
|
||||
set_current_state(TASK_RUNNING);
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s: issued a RQ:%x\n",
|
||||
__func__, (uint32_t)req);
|
||||
#endif
|
||||
|
||||
bq->issue_fn(bq, req);
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s: bq->issue_fn() returned\n",
|
||||
__func__);
|
||||
#endif
|
||||
|
||||
|
||||
} while (1);
|
||||
|
||||
set_current_state(TASK_RUNNING);
|
||||
remove_wait_queue(&bq->thread_wq, &wait);
|
||||
up(&bq->thread_sem);
|
||||
|
||||
complete_and_exit(&bq->thread_complete, 0);
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message("%s: is finished\n", __func__);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic request handler. it is called for any queue on a
|
||||
* particular host. When the host is not busy, we look for a request
|
||||
* on any queue on this host, and attempt to issue it. This may
|
||||
* not be the queue we were asked to process.
|
||||
*/
|
||||
static void cyasblkdev_request(struct request_queue *q)
|
||||
{
|
||||
struct cyasblkdev_queue *bq = q->queuedata;
|
||||
DBGPRN_FUNC_NAME;
|
||||
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message(
|
||||
"%s new request on cyasblkdev_queue_t bq:=%x\n",
|
||||
__func__, (uint32_t)bq);
|
||||
#endif
|
||||
|
||||
if (!bq->req) {
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message("%s wake_up(&bq->thread_wq)\n",
|
||||
__func__);
|
||||
#endif
|
||||
|
||||
/* wake up cyasblkdev_queue worker thread*/
|
||||
wake_up(&bq->thread_wq);
|
||||
} else {
|
||||
#ifndef WESTBRIDGE_NDEBUG
|
||||
cy_as_hal_print_message("%s: don't wake Q_thr, bq->req:%x\n",
|
||||
__func__, (uint32_t)bq->req);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* cyasblkdev_init_queue - initialise a queue structure.
|
||||
* @bq: cyasblkdev queue
|
||||
* @dev: CyAsDeviceHandle to attach this queue
|
||||
* @lock: queue lock
|
||||
*
|
||||
* Initialise a cyasblkdev_request queue.
|
||||
*/
|
||||
|
||||
/* MAX NUMBER OF SECTORS PER REQUEST **/
|
||||
#define Q_MAX_SECTORS 128
|
||||
|
||||
/* MAX NUMBER OF PHYS SEGMENTS (entries in the SG list)*/
|
||||
#define Q_MAX_SGS 16
|
||||
|
||||
int cyasblkdev_init_queue(struct cyasblkdev_queue *bq, spinlock_t *lock)
|
||||
{
|
||||
int ret;
|
||||
|
||||
DBGPRN_FUNC_NAME;
|
||||
|
||||
/* 1st param is a function that wakes up the queue thread */
|
||||
bq->queue = blk_init_queue(cyasblkdev_request, lock);
|
||||
if (!bq->queue)
|
||||
return -ENOMEM;
|
||||
|
||||
blk_queue_prep_rq(bq->queue, cyasblkdev_prep_request);
|
||||
|
||||
blk_queue_bounce_limit(bq->queue, BLK_BOUNCE_ANY);
|
||||
blk_queue_max_hw_sectors(bq->queue, Q_MAX_SECTORS);
|
||||
|
||||
/* As of now, we have the HAL/driver support to
|
||||
* merge scattered segments and handle them simultaneously.
|
||||
* so, setting the max_phys_segments to 8. */
|
||||
/*blk_queue_max_phys_segments(bq->queue, Q_MAX_SGS);
|
||||
blk_queue_max_hw_segments(bq->queue, Q_MAX_SGS);*/
|
||||
blk_queue_max_segments(bq->queue, Q_MAX_SGS);
|
||||
|
||||
/* should be < then HAL can handle */
|
||||
blk_queue_max_segment_size(bq->queue, 512*Q_MAX_SECTORS);
|
||||
|
||||
bq->queue->queuedata = bq;
|
||||
bq->req = NULL;
|
||||
|
||||
init_completion(&bq->thread_complete);
|
||||
init_waitqueue_head(&bq->thread_wq);
|
||||
sema_init(&bq->thread_sem, 1);
|
||||
|
||||
ret = kernel_thread(cyasblkdev_queue_thread, bq, CLONE_KERNEL);
|
||||
if (ret >= 0) {
|
||||
/* wait until the thread is spawned */
|
||||
wait_for_completion(&bq->thread_complete);
|
||||
|
||||
/* reinitialize the completion */
|
||||
init_completion(&bq->thread_complete);
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(cyasblkdev_init_queue);
|
||||
|
||||
/*called from blk_put() */
|
||||
void cyasblkdev_cleanup_queue(struct cyasblkdev_queue *bq)
|
||||
{
|
||||
DBGPRN_FUNC_NAME;
|
||||
|
||||
bq->flags |= CYASBLKDEV_QUEUE_EXIT;
|
||||
wake_up(&bq->thread_wq);
|
||||
wait_for_completion(&bq->thread_complete);
|
||||
|
||||
blk_cleanup_queue(bq->queue);
|
||||
}
|
||||
EXPORT_SYMBOL(cyasblkdev_cleanup_queue);
|
||||
|
||||
|
||||
/**
|
||||
* cyasblkdev_queue_suspend - suspend a CyAsBlkDev request queue
|
||||
* @bq: CyAsBlkDev queue to suspend
|
||||
*
|
||||
* Stop the block request queue, and wait for our thread to
|
||||
* complete any outstanding requests. This ensures that we
|
||||
* won't suspend while a request is being processed.
|
||||
*/
|
||||
void cyasblkdev_queue_suspend(struct cyasblkdev_queue *bq)
|
||||
{
|
||||
struct request_queue *q = bq->queue;
|
||||
unsigned long flags;
|
||||
|
||||
DBGPRN_FUNC_NAME;
|
||||
|
||||
if (!(bq->flags & CYASBLKDEV_QUEUE_SUSPENDED)) {
|
||||
bq->flags |= CYASBLKDEV_QUEUE_SUSPENDED;
|
||||
|
||||
spin_lock_irqsave(q->queue_lock, flags);
|
||||
blk_stop_queue(q);
|
||||
spin_unlock_irqrestore(q->queue_lock, flags);
|
||||
|
||||
down(&bq->thread_sem);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(cyasblkdev_queue_suspend);
|
||||
|
||||
/*cyasblkdev_queue_resume - resume a previously suspended
|
||||
* CyAsBlkDev request queue @bq: CyAsBlkDev queue to resume */
|
||||
void cyasblkdev_queue_resume(struct cyasblkdev_queue *bq)
|
||||
{
|
||||
struct request_queue *q = bq->queue;
|
||||
unsigned long flags;
|
||||
|
||||
DBGPRN_FUNC_NAME;
|
||||
|
||||
if (bq->flags & CYASBLKDEV_QUEUE_SUSPENDED) {
|
||||
bq->flags &= ~CYASBLKDEV_QUEUE_SUSPENDED;
|
||||
|
||||
up(&bq->thread_sem);
|
||||
|
||||
spin_lock_irqsave(q->queue_lock, flags);
|
||||
blk_start_queue(q);
|
||||
spin_unlock_irqrestore(q->queue_lock, flags);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(cyasblkdev_queue_resume);
|
||||
|
||||
/*[]*/
|
|
@ -1,64 +0,0 @@
|
|||
/* cyanblkdev_queue.h - Antioch Linux Block Driver queue header file
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANBLKDEV_QUEUE_H_
|
||||
#define _INCLUDED_CYANBLKDEV_QUEUE_H_
|
||||
|
||||
/*
|
||||
* may contain various useful MACRO and debug printks
|
||||
*/
|
||||
|
||||
/* moved to staging location, eventual implementation
|
||||
* considered is here
|
||||
* #include <linux/westbridge/cyashal.h>
|
||||
* #include <linux/westbridge/cyastoria.h>
|
||||
* */
|
||||
|
||||
#include "../include/linux/westbridge/cyashal.h"
|
||||
#include "../include/linux/westbridge/cyastoria.h"
|
||||
|
||||
struct request;
|
||||
struct task_struct;
|
||||
|
||||
struct cyasblkdev_queue {
|
||||
struct completion thread_complete;
|
||||
wait_queue_head_t thread_wq;
|
||||
struct semaphore thread_sem;
|
||||
unsigned int flags;
|
||||
struct request *req;
|
||||
int (*prep_fn)(struct cyasblkdev_queue *, struct request *);
|
||||
int (*issue_fn)(struct cyasblkdev_queue *, struct request *);
|
||||
void *data;
|
||||
struct request_queue *queue;
|
||||
};
|
||||
|
||||
extern int cyasblkdev_init_queue(struct cyasblkdev_queue *, spinlock_t *);
|
||||
extern void cyasblkdev_cleanup_queue(struct cyasblkdev_queue *);
|
||||
extern void cyasblkdev_queue_suspend(struct cyasblkdev_queue *);
|
||||
extern void cyasblkdev_queue_resume(struct cyasblkdev_queue *);
|
||||
|
||||
extern cy_as_device_handle cyasdevice_getdevhandle(void);
|
||||
#define MOD_LOGS 1
|
||||
void verbose_rq_flags(int flags);
|
||||
|
||||
#endif /* _INCLUDED_CYANBLKDEV_QUEUE_H_ */
|
||||
|
||||
/*[]*/
|
|
@ -1,9 +0,0 @@
|
|||
#
|
||||
# West Bridge block driver configuration
|
||||
#
|
||||
|
||||
config WESTBRIDGE_DEVICE_DRIVER
|
||||
tristate "West Bridge Device Driver"
|
||||
help
|
||||
Include the West Bridge based device driver
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
# Makefile for the kernel westbridge device driver
|
||||
#
|
||||
|
||||
ifneq ($(CONFIG_WESTBRIDGE_DEBUG),y)
|
||||
EXTRA_CFLAGS += -DWESTBRIDGE_NDEBUG
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_WESTBRIDGE_DEVICE_DRIVER) += cyasdev.o
|
||||
|
||||
|
||||
ifeq ($(CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL),y)
|
||||
#moved for staging compatbility
|
||||
#cyasdev-y := ../../../arch/arm/mach-omap2/cyashalomap_kernel.o cyasdevice.o
|
||||
cyasdev-y := ../arch/arm/mach-omap2/cyashalomap_kernel.o cyasdevice.o \
|
||||
../api/src/cyasdma.o ../api/src/cyasintr.o ../api/src/cyaslep2pep.o \
|
||||
../api/src/cyaslowlevel.o ../api/src/cyasmisc.o ../api/src/cyasmtp.o \
|
||||
../api/src/cyasstorage.o ../api/src/cyasusb.o
|
||||
|
||||
else
|
||||
# should not get here, need to be built with some hal
|
||||
cyasdev-y := cyasdevice.o
|
||||
endif
|
|
@ -1,409 +0,0 @@
|
|||
/*
|
||||
## cyandevice.c - Linux Antioch device driver file
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
/* moved for staging location
|
||||
* update/patch submission
|
||||
#include <linux/westbridge/cyastoria.h>
|
||||
#include <linux/westbridge/cyashal.h>
|
||||
#include <linux/westbridge/cyasregs.h>
|
||||
*/
|
||||
|
||||
#include "../include/linux/westbridge/cyastoria.h"
|
||||
#include "../include/linux/westbridge/cyashal.h"
|
||||
#include "../include/linux/westbridge/cyasregs.h"
|
||||
|
||||
typedef struct cyasdevice {
|
||||
/* Handle to the Antioch device */
|
||||
cy_as_device_handle dev_handle;
|
||||
/* Handle to the HAL */
|
||||
cy_as_hal_device_tag hal_tag;
|
||||
spinlock_t common_lock;
|
||||
unsigned long flags;
|
||||
} cyasdevice;
|
||||
|
||||
/* global ptr to astoria device */
|
||||
static cyasdevice *cy_as_device_controller;
|
||||
int cy_as_device_init_done;
|
||||
const char *dev_handle_name = "cy_astoria_dev_handle";
|
||||
|
||||
#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
|
||||
extern void cy_as_hal_config_c_s_mux(void);
|
||||
#endif
|
||||
|
||||
static void cyasdevice_deinit(cyasdevice *cy_as_dev)
|
||||
{
|
||||
cy_as_hal_print_message("<1>_cy_as_device deinitialize called\n");
|
||||
if (!cy_as_dev) {
|
||||
cy_as_hal_print_message("<1>_cy_as_device_deinit: "
|
||||
"device handle %x is invalid\n", (uint32_t)cy_as_dev);
|
||||
return;
|
||||
}
|
||||
|
||||
/* stop west_brige */
|
||||
if (cy_as_dev->dev_handle) {
|
||||
cy_as_hal_print_message("<1>_cy_as_device: "
|
||||
"cy_as_misc_destroy_device called\n");
|
||||
if (cy_as_misc_destroy_device(cy_as_dev->dev_handle) !=
|
||||
CY_AS_ERROR_SUCCESS) {
|
||||
cy_as_hal_print_message(
|
||||
"<1>_cy_as_device: destroying failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (cy_as_dev->hal_tag) {
|
||||
|
||||
#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
|
||||
if (stop_o_m_a_p_kernel(dev_handle_name,
|
||||
cy_as_dev->hal_tag) != 0)
|
||||
cy_as_hal_print_message("<1>_cy_as_device: stopping "
|
||||
"OMAP kernel HAL failed\n");
|
||||
|
||||
#endif
|
||||
}
|
||||
cy_as_hal_print_message("<1>_cy_as_device:HAL layer stopped\n");
|
||||
|
||||
kfree(cy_as_dev);
|
||||
cy_as_device_controller = NULL;
|
||||
cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n");
|
||||
}
|
||||
|
||||
/*called from src/cyasmisc.c:MyMiscCallback() as a func
|
||||
* pointer [dev_p->misc_event_cb] which was previously
|
||||
* registered by CyAsLLRegisterRequestCallback(...,
|
||||
* MyMiscCallback); called from CyAsMiscConfigureDevice()
|
||||
* which is in turn called from cyasdevice_initialize() in
|
||||
* this src
|
||||
*/
|
||||
static void cy_misc_callback(cy_as_device_handle h,
|
||||
cy_as_misc_event_type evtype, void *evdata)
|
||||
{
|
||||
(void)h;
|
||||
(void)evdata;
|
||||
|
||||
switch (evtype) {
|
||||
case cy_as_event_misc_initialized:
|
||||
cy_as_hal_print_message("<1>_cy_as_device: "
|
||||
"initialization done callback triggered\n");
|
||||
cy_as_device_init_done = 1;
|
||||
break;
|
||||
|
||||
case cy_as_event_misc_awake:
|
||||
cy_as_hal_print_message("<1>_cy_as_device: "
|
||||
"cy_as_event_misc_awake event callback triggered\n");
|
||||
cy_as_device_init_done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void cy_as_acquire_common_lock()
|
||||
{
|
||||
spin_lock_irqsave(&cy_as_device_controller->common_lock,
|
||||
cy_as_device_controller->flags);
|
||||
}
|
||||
EXPORT_SYMBOL(cy_as_acquire_common_lock);
|
||||
|
||||
void cy_as_release_common_lock()
|
||||
{
|
||||
spin_unlock_irqrestore(&cy_as_device_controller->common_lock,
|
||||
cy_as_device_controller->flags);
|
||||
}
|
||||
EXPORT_SYMBOL(cy_as_release_common_lock);
|
||||
|
||||
/* reset astoria and reinit all regs */
|
||||
#define PNAND_REG_CFG_INIT_VAL 0x0000
|
||||
void hal_reset(cy_as_hal_device_tag tag)
|
||||
{
|
||||
cy_as_hal_print_message("<1> send soft hard rst: "
|
||||
"MEM_RST_CTRL_REG_HARD...\n");
|
||||
cy_as_hal_write_register(tag, CY_AS_MEM_RST_CTRL_REG,
|
||||
CY_AS_MEM_RST_CTRL_REG_HARD);
|
||||
mdelay(60);
|
||||
|
||||
cy_as_hal_print_message("<1> after RST: si_rev_REG:%x, "
|
||||
"PNANDCFG_reg:%x\n",
|
||||
cy_as_hal_read_register(tag, CY_AS_MEM_CM_WB_CFG_ID),
|
||||
cy_as_hal_read_register(tag, CY_AS_MEM_PNAND_CFG)
|
||||
);
|
||||
|
||||
/* set it to LBD */
|
||||
cy_as_hal_write_register(tag, CY_AS_MEM_PNAND_CFG,
|
||||
PNAND_REG_CFG_INIT_VAL);
|
||||
}
|
||||
EXPORT_SYMBOL(hal_reset);
|
||||
|
||||
|
||||
/* below structures and functions primarily
|
||||
* implemented for firmware loading */
|
||||
static struct platform_device *westbridge_pd;
|
||||
|
||||
static int __devinit wb_probe(struct platform_device *devptr)
|
||||
{
|
||||
cy_as_hal_print_message("%s called\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devexit wb_remove(struct platform_device *devptr)
|
||||
{
|
||||
cy_as_hal_print_message("%s called\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver west_bridge_driver = {
|
||||
.probe = wb_probe,
|
||||
.remove = __devexit_p(wb_remove),
|
||||
.driver = {
|
||||
.name = "west_bridge_dev"},
|
||||
};
|
||||
|
||||
/* west bridge device driver main init */
|
||||
static int cyasdevice_initialize(void)
|
||||
{
|
||||
cyasdevice *cy_as_dev = 0;
|
||||
int ret = 0;
|
||||
int retval = 0;
|
||||
cy_as_device_config config;
|
||||
cy_as_hal_sleep_channel channel;
|
||||
cy_as_get_firmware_version_data ver_data = {0};
|
||||
const char *str = "";
|
||||
int spin_lim;
|
||||
const struct firmware *fw_entry;
|
||||
|
||||
cy_as_device_init_done = 0;
|
||||
|
||||
cy_as_misc_set_log_level(8);
|
||||
|
||||
cy_as_hal_print_message("<1>_cy_as_device initialize called\n");
|
||||
|
||||
if (cy_as_device_controller != 0) {
|
||||
cy_as_hal_print_message("<1>_cy_as_device: the device "
|
||||
"has already been initilaized. ignoring\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/* cy_as_dev = CyAsHalAlloc (sizeof(cyasdevice), SLAB_KERNEL); */
|
||||
cy_as_dev = cy_as_hal_alloc(sizeof(cyasdevice));
|
||||
if (cy_as_dev == NULL) {
|
||||
cy_as_hal_print_message("<1>_cy_as_device: "
|
||||
"memory allocation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset(cy_as_dev, 0, sizeof(cyasdevice));
|
||||
|
||||
|
||||
/* Init the HAL & CyAsDeviceHandle */
|
||||
|
||||
#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
|
||||
/* start OMAP HAL init instsnce */
|
||||
|
||||
if (!start_o_m_a_p_kernel(dev_handle_name,
|
||||
&(cy_as_dev->hal_tag), cy_false)) {
|
||||
|
||||
cy_as_hal_print_message(
|
||||
"<1>_cy_as_device: start OMAP34xx HAL failed\n");
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now create the device */
|
||||
if (cy_as_misc_create_device(&(cy_as_dev->dev_handle),
|
||||
cy_as_dev->hal_tag) != CY_AS_ERROR_SUCCESS) {
|
||||
|
||||
cy_as_hal_print_message(
|
||||
"<1>_cy_as_device: create device failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
memset(&config, 0, sizeof(config));
|
||||
config.dmaintr = cy_true;
|
||||
|
||||
ret = cy_as_misc_configure_device(cy_as_dev->dev_handle, &config);
|
||||
if (ret != CY_AS_ERROR_SUCCESS) {
|
||||
|
||||
cy_as_hal_print_message(
|
||||
"<1>_cy_as_device: configure device "
|
||||
"failed. reason code: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = cy_as_misc_register_callback(cy_as_dev->dev_handle,
|
||||
cy_misc_callback);
|
||||
if (ret != CY_AS_ERROR_SUCCESS) {
|
||||
cy_as_hal_print_message("<1>_cy_as_device: "
|
||||
"cy_as_misc_register_callback failed. "
|
||||
"reason code: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = platform_driver_register(&west_bridge_driver);
|
||||
if (unlikely(ret < 0))
|
||||
return ret;
|
||||
westbridge_pd = platform_device_register_simple(
|
||||
"west_bridge_dev", -1, NULL, 0);
|
||||
|
||||
if (IS_ERR(westbridge_pd)) {
|
||||
platform_driver_unregister(&west_bridge_driver);
|
||||
return PTR_ERR(westbridge_pd);
|
||||
}
|
||||
/* Load the firmware */
|
||||
ret = request_firmware(&fw_entry,
|
||||
"west bridge fw", &westbridge_pd->dev);
|
||||
if (ret) {
|
||||
cy_as_hal_print_message("cy_as_device: "
|
||||
"request_firmware failed return val = %d\n", ret);
|
||||
} else {
|
||||
cy_as_hal_print_message("cy_as_device: "
|
||||
"got the firmware %d size=0x%x\n", ret, fw_entry->size);
|
||||
|
||||
ret = cy_as_misc_download_firmware(
|
||||
cy_as_dev->dev_handle,
|
||||
fw_entry->data,
|
||||
fw_entry->size ,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
if (ret != CY_AS_ERROR_SUCCESS) {
|
||||
cy_as_hal_print_message("<1>_cy_as_device: cannot download "
|
||||
"firmware. reason code: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* spin until the device init is completed */
|
||||
/* 50 -MAX wait time for the FW load & init
|
||||
* to complete is 5sec*/
|
||||
spin_lim = 50;
|
||||
|
||||
cy_as_hal_create_sleep_channel(&channel);
|
||||
while (!cy_as_device_init_done) {
|
||||
|
||||
cy_as_hal_sleep_on(&channel, 100);
|
||||
|
||||
if (spin_lim-- <= 0) {
|
||||
cy_as_hal_print_message(
|
||||
"<1>\n_e_r_r_o_r!: "
|
||||
"wait for FW init has timed out !!!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
cy_as_hal_destroy_sleep_channel(&channel);
|
||||
|
||||
if (spin_lim > 0)
|
||||
cy_as_hal_print_message(
|
||||
"cy_as_device: astoria firmware is loaded\n");
|
||||
|
||||
ret = cy_as_misc_get_firmware_version(cy_as_dev->dev_handle,
|
||||
&ver_data, 0, 0);
|
||||
if (ret != CY_AS_ERROR_SUCCESS) {
|
||||
cy_as_hal_print_message("<1>_cy_as_device: cannot get firmware "
|
||||
"version. reason code: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((ver_data.media_type & 0x01) && (ver_data.media_type & 0x06))
|
||||
str = "nand and SD/MMC.";
|
||||
else if ((ver_data.media_type & 0x01) && (ver_data.media_type & 0x08))
|
||||
str = "nand and CEATA.";
|
||||
else if (ver_data.media_type & 0x01)
|
||||
str = "nand.";
|
||||
else if (ver_data.media_type & 0x08)
|
||||
str = "CEATA.";
|
||||
else
|
||||
str = "SD/MMC.";
|
||||
|
||||
cy_as_hal_print_message("<1> cy_as_device:_firmware version: %s "
|
||||
"major=%d minor=%d build=%d,\n_media types supported:%s\n",
|
||||
((ver_data.is_debug_mode) ? "debug" : "release"),
|
||||
ver_data.major, ver_data.minor, ver_data.build, str);
|
||||
|
||||
spin_lock_init(&cy_as_dev->common_lock);
|
||||
|
||||
/* done now */
|
||||
cy_as_device_controller = cy_as_dev;
|
||||
|
||||
return 0;
|
||||
|
||||
done:
|
||||
if (cy_as_dev)
|
||||
cyasdevice_deinit(cy_as_dev);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cy_as_device_handle cyasdevice_getdevhandle(void)
|
||||
{
|
||||
if (cy_as_device_controller) {
|
||||
#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
|
||||
cy_as_hal_config_c_s_mux();
|
||||
#endif
|
||||
|
||||
return cy_as_device_controller->dev_handle;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(cyasdevice_getdevhandle);
|
||||
|
||||
cy_as_hal_device_tag cyasdevice_gethaltag(void)
|
||||
{
|
||||
if (cy_as_device_controller)
|
||||
return (cy_as_hal_device_tag)
|
||||
cy_as_device_controller->hal_tag;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(cyasdevice_gethaltag);
|
||||
|
||||
|
||||
/*init Westbridge device driver **/
|
||||
static int __init cyasdevice_init(void)
|
||||
{
|
||||
if (cyasdevice_initialize() != 0)
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void __exit cyasdevice_cleanup(void)
|
||||
{
|
||||
|
||||
cyasdevice_deinit(cy_as_device_controller);
|
||||
}
|
||||
|
||||
|
||||
MODULE_DESCRIPTION("west bridge device driver");
|
||||
MODULE_AUTHOR("cypress semiconductor");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_init(cyasdevice_init);
|
||||
module_exit(cyasdevice_cleanup);
|
||||
|
||||
/*[]*/
|
|
@ -1,9 +0,0 @@
|
|||
#
|
||||
# West Bridge gadget driver configuration
|
||||
#
|
||||
|
||||
config WESTBRIDGE_GADGET_DRIVER
|
||||
tristate "West Bridge Gadget Driver"
|
||||
help
|
||||
Include the West Bridge based gadget peripheral controller driver
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#
|
||||
# Makefile for the kernel westbridge hal
|
||||
#
|
||||
|
||||
ifneq ($(CONFIG_WESTBRIDGE_DEBUG),y)
|
||||
EXTRA_CFLAGS += -DWESTBRIDGE_NDEBUG
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_WESTBRIDGE_GADGET_DRIVER) += cyasgadgetctrl.o
|
||||
cyasgadgetctrl-y := cyasgadget.o
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,193 +0,0 @@
|
|||
/* cyangadget.h - Linux USB Gadget driver file for the Cypress West Bridge
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Cypress West Bridge high/full speed USB device controller code
|
||||
* Based on the Netchip 2280 device controller by David Brownell
|
||||
* in the linux 2.6.10 kernel
|
||||
*
|
||||
* linux/drivers/usb/gadget/net2280.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
|
||||
* Copyright (C) 2003 David Brownell
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANGADGET_H_
|
||||
#define _INCLUDED_CYANGADGET_H_
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#include "../include/linux/westbridge/cyastoria.h"
|
||||
#include "../include/linux/westbridge/cyashal.h"
|
||||
#include "../include/linux/westbridge/cyasdevice.h"
|
||||
#include "cyasgadget_ioctl.h"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
/*char driver defines, revisit*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/fs.h> /* everything... */
|
||||
#include <linux/errno.h> /* error codes */
|
||||
#include <linux/types.h> /* size_t */
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/fcntl.h> /* O_ACCMODE */
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/vmalloc.h> /* vmalloc(), vfree */
|
||||
#include <linux/msdos_fs.h> /*fat_alloc_cluster*/
|
||||
#include <linux/buffer_head.h>
|
||||
#include <asm/system.h> /* cli(), *_flags */
|
||||
#include <linux/uaccess.h> /* copy_*_user */
|
||||
|
||||
extern int mpage_cleardirty(struct address_space *mapping, int num_pages);
|
||||
extern int fat_get_block(struct inode *, sector_t , struct buffer_head *, int);
|
||||
extern cy_as_device_handle *cyasdevice_getdevhandle(void);
|
||||
|
||||
/* Driver data structures and utilities */
|
||||
typedef struct cyasgadget_ep {
|
||||
struct usb_ep usb_ep_inst;
|
||||
struct cyasgadget *dev;
|
||||
|
||||
/* analogous to a host-side qh */
|
||||
struct list_head queue;
|
||||
const struct usb_endpoint_descriptor *desc;
|
||||
unsigned num:8,
|
||||
fifo_size:12,
|
||||
in_fifo_validate:1,
|
||||
out_overflow:1,
|
||||
stopped:1,
|
||||
is_in:1,
|
||||
is_iso:1;
|
||||
cy_as_usb_end_point_config cyepconfig;
|
||||
} cyasgadget_ep;
|
||||
|
||||
typedef struct cyasgadget_req {
|
||||
struct usb_request req;
|
||||
struct list_head queue;
|
||||
int ep_num;
|
||||
unsigned mapped:1,
|
||||
valid:1,
|
||||
complete:1,
|
||||
ep_stopped:1;
|
||||
} cyasgadget_req;
|
||||
|
||||
typedef struct cyasgadget {
|
||||
/* each device provides one gadget, several endpoints */
|
||||
struct usb_gadget gadget;
|
||||
spinlock_t lock;
|
||||
struct cyasgadget_ep an_gadget_ep[16];
|
||||
struct usb_gadget_driver *driver;
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle dev_handle;
|
||||
unsigned enabled:1,
|
||||
protocol_stall:1,
|
||||
softconnect:1,
|
||||
outsetupreq:1;
|
||||
struct completion thread_complete;
|
||||
wait_queue_head_t thread_wq;
|
||||
struct semaphore thread_sem;
|
||||
struct list_head thread_queue;
|
||||
|
||||
cy_bool tmtp_send_complete;
|
||||
cy_bool tmtp_get_complete;
|
||||
cy_bool tmtp_need_new_blk_tbl;
|
||||
/* Data member used to store the SendObjectComplete event data */
|
||||
cy_as_mtp_send_object_complete_data tmtp_send_complete_data;
|
||||
/* Data member used to store the GetObjectComplete event data */
|
||||
cy_as_mtp_get_object_complete_data tmtp_get_complete_data;
|
||||
|
||||
} cyasgadget;
|
||||
|
||||
static inline void set_halt(cyasgadget_ep *ep)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void clear_halt(cyasgadget_ep *ep)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#define xprintk(dev, level, fmt, args...) \
|
||||
printk(level "%s %s: " fmt, driver_name, \
|
||||
pci_name(dev->pdev), ## args)
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG
|
||||
#define DEBUG(dev, fmt, args...) \
|
||||
xprintk(dev, KERN_DEBUG, fmt, ## args)
|
||||
#else
|
||||
#define DEBUG(dev, fmt, args...) \
|
||||
do { } while (0)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef VERBOSE
|
||||
#define VDEBUG DEBUG
|
||||
#else
|
||||
#define VDEBUG(dev, fmt, args...) \
|
||||
do { } while (0)
|
||||
#endif /* VERBOSE */
|
||||
|
||||
#define ERROR(dev, fmt, args...) \
|
||||
xprintk(dev, KERN_ERR, fmt, ## args)
|
||||
#define GADG_WARN(dev, fmt, args...) \
|
||||
xprintk(dev, KERN_WARNING, fmt, ## args)
|
||||
#define INFO(dev, fmt, args...) \
|
||||
xprintk(dev, KERN_INFO, fmt, ## args)
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static inline void start_out_naking(struct cyasgadget_ep *ep)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void stop_out_naking(struct cyasgadget_ep *ep)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* _INCLUDED_CYANGADGET_H_ */
|
|
@ -1,99 +0,0 @@
|
|||
/* cyasgadget_ioctl.h - Linux USB Gadget driver ioctl file for
|
||||
* Cypress West Bridge
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef CYASGADGET_IOCTL_H
|
||||
#define CYASGADGET_IOCTL_H
|
||||
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
typedef struct cy_as_gadget_ioctl_send_object {
|
||||
uint32_t status;
|
||||
uint32_t byte_count;
|
||||
uint32_t transaction_id;
|
||||
} cy_as_gadget_ioctl_send_object;
|
||||
|
||||
typedef struct cy_as_gadget_ioctl_get_object {
|
||||
uint32_t status;
|
||||
uint32_t byte_count;
|
||||
} cy_as_gadget_ioctl_get_object;
|
||||
|
||||
|
||||
typedef struct cy_as_gadget_ioctl_tmtp_status {
|
||||
cy_bool tmtp_send_complete;
|
||||
cy_bool tmtp_get_complete;
|
||||
cy_bool tmtp_need_new_blk_tbl;
|
||||
cy_as_gadget_ioctl_send_object tmtp_send_complete_data;
|
||||
cy_as_gadget_ioctl_get_object tmtp_get_complete_data;
|
||||
uint32_t t_usec;
|
||||
} cy_as_gadget_ioctl_tmtp_status;
|
||||
|
||||
/*Init send object data*/
|
||||
typedef struct cy_as_gadget_ioctl_i_s_o_j_d {
|
||||
uint32_t *blk_addr_p; /* starting sector */
|
||||
uint16_t *blk_count_p; /* num of sectors in the block */
|
||||
/* number of entries in the blk table */
|
||||
uint32_t item_count;
|
||||
uint32_t num_bytes;
|
||||
/* in case if more prcise timestamping is done in kernel mode */
|
||||
uint32_t t_usec;
|
||||
uint32_t ret_val;
|
||||
char *file_name;
|
||||
uint32_t name_length;
|
||||
|
||||
} cy_as_gadget_ioctl_i_s_o_j_d;
|
||||
|
||||
|
||||
/*Init get object data*/
|
||||
typedef struct cy_as_gadget_ioctl_i_g_o_j_d {
|
||||
uint32_t *blk_addr_p;
|
||||
uint16_t *blk_count_p;
|
||||
uint32_t item_count;
|
||||
uint32_t num_bytes;
|
||||
uint32_t tid;
|
||||
uint32_t ret_val;
|
||||
char *file_name;
|
||||
uint32_t name_length;
|
||||
|
||||
} cy_as_gadget_ioctl_i_g_o_j_d;
|
||||
|
||||
typedef struct cy_as_gadget_ioctl_cancel {
|
||||
uint32_t ret_val;
|
||||
} cy_as_gadget_ioctl_cancel;
|
||||
|
||||
#define CYASGADGET_IOC_MAGIC 0xEF
|
||||
#define CYASGADGET_GETMTPSTATUS \
|
||||
_IOW(CYASGADGET_IOC_MAGIC, 0, cy_as_gadget_ioctl_tmtp_status)
|
||||
#define CYASGADGET_CLEARTMTPSTATUS \
|
||||
_IO(CYASGADGET_IOC_MAGIC, 1)
|
||||
#define CYASGADGET_INITSOJ \
|
||||
_IOW(CYASGADGET_IOC_MAGIC, 2, cy_as_gadget_ioctl_i_s_o_j_d)
|
||||
#define CYASGADGET_INITGOJ \
|
||||
_IOW(CYASGADGET_IOC_MAGIC, 3, cy_as_gadget_ioctl_i_g_o_j_d)
|
||||
#define CYASGADGET_CANCELSOJ \
|
||||
_IOW(CYASGADGET_IOC_MAGIC, 4, cy_as_gadget_ioctl_cancel)
|
||||
#define CYASGADGET_CANCELGOJ \
|
||||
_IOW(CYASGADGET_IOC_MAGIC, 5, cy_as_gadget_ioctl_cancel)
|
||||
#define CYASGADGET_IOC_MAXNR 6
|
||||
|
||||
#endif
|
|
@ -1,418 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyanerr.h)
|
||||
## Symbols for backward compatibility with previous releases of Antioch SDK.
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANERR_H_
|
||||
#define _INCLUDED_CYANERR_H_
|
||||
|
||||
#include "cyaserr.h"
|
||||
|
||||
#ifndef __doxygen__
|
||||
|
||||
/*
|
||||
* Function completed successfully.
|
||||
*/
|
||||
#define CY_AN_ERROR_SUCCESS (CY_AS_ERROR_SUCCESS)
|
||||
|
||||
/*
|
||||
* A function trying to acquire a resource was unable to do so.
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_ACQUIRED (CY_AS_ERROR_NOT_ACQUIRED)
|
||||
|
||||
/*
|
||||
* A function trying to acquire a resource was unable to do so.
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_RELEASED (CY_AS_ERROR_NOT_RELEASED)
|
||||
|
||||
/*
|
||||
* The West Bridge firmware is not loaded.
|
||||
*/
|
||||
#define CY_AN_ERROR_NO_FIRMWARE (CY_AS_ERROR_NO_FIRMWARE)
|
||||
|
||||
/*
|
||||
* A timeout occurred waiting on a response from the West Bridge device
|
||||
*/
|
||||
#define CY_AN_ERROR_TIMEOUT (CY_AS_ERROR_TIMEOUT)
|
||||
|
||||
/*
|
||||
* A request to download firmware was made while not in the CONFIG mode
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_IN_CONFIG_MODE (CY_AS_ERROR_NOT_IN_CONFIG_MODE)
|
||||
|
||||
/*
|
||||
* This error is returned if the firmware size specified is too invalid.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_SIZE (CY_AS_ERROR_INVALID_SIZE)
|
||||
|
||||
/*
|
||||
* This error is returned if a request is made to acquire a resource that has
|
||||
* already been acquired.
|
||||
*/
|
||||
#define CY_AN_ERROR_RESOURCE_ALREADY_OWNED (CY_AS_ERROR_RESOURCE_ALREADY_OWNED)
|
||||
|
||||
/*
|
||||
* This error is returned if a request is made to release a resource that has
|
||||
* not previously been acquired.
|
||||
*/
|
||||
#define CY_AN_ERROR_RESOURCE_NOT_OWNED (CY_AS_ERROR_RESOURCE_NOT_OWNED)
|
||||
|
||||
/*
|
||||
* This error is returned when a request is made for a media that does not
|
||||
* exist
|
||||
*/
|
||||
#define CY_AN_ERROR_NO_SUCH_MEDIA (CY_AS_ERROR_NO_SUCH_MEDIA)
|
||||
|
||||
/*
|
||||
* This error is returned when a request is made for a device that does
|
||||
* not exist
|
||||
*/
|
||||
#define CY_AN_ERROR_NO_SUCH_DEVICE (CY_AS_ERROR_NO_SUCH_DEVICE)
|
||||
|
||||
/*
|
||||
* This error is returned when a request is made for a unit that does
|
||||
* not exist
|
||||
*/
|
||||
#define CY_AN_ERROR_NO_SUCH_UNIT (CY_AS_ERROR_NO_SUCH_UNIT)
|
||||
|
||||
/*
|
||||
* This error is returned when a request is made for a block that does
|
||||
* not exist
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_BLOCK (CY_AS_ERROR_INVALID_BLOCK)
|
||||
|
||||
/*
|
||||
* This error is returned when an invalid trace level is set.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_TRACE_LEVEL (CY_AS_ERROR_INVALID_TRACE_LEVEL)
|
||||
|
||||
/*
|
||||
* This error is returned when West Bridge is already in the standby state
|
||||
* and an attempt is made to put West Bridge into this state again.
|
||||
*/
|
||||
#define CY_AN_ERROR_ALREADY_STANDBY (CY_AS_ERROR_ALREADY_STANDBY)
|
||||
|
||||
/*
|
||||
* This error is returned when the API needs to set a pin on the
|
||||
* West Bridge device, but this is not supported by the underlying HAL
|
||||
* layer.
|
||||
*/
|
||||
#define CY_AN_ERROR_SETTING_WAKEUP_PIN (CY_AS_ERROR_SETTING_WAKEUP_PIN)
|
||||
|
||||
/*
|
||||
* This error is returned when a module is being started that has
|
||||
* already been started.
|
||||
*/
|
||||
#define CY_AN_ERROR_ALREADY_RUNNING (CY_AS_ERROR_ALREADY_RUNNING)
|
||||
|
||||
/*
|
||||
* This error is returned when a module is being stopped that has
|
||||
* already been stopped.
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_RUNNING (CY_AS_ERROR_NOT_RUNNING)
|
||||
|
||||
/*
|
||||
* This error is returned when the caller tries to claim a media that has
|
||||
* already been claimed.
|
||||
*/
|
||||
#define CY_AN_ERROR_MEDIA_ALREADY_CLAIMED (CY_AS_ERROR_MEDIA_ALREADY_CLAIMED)
|
||||
|
||||
/*
|
||||
* This error is returned when the caller tries to release a media that
|
||||
* has already been released.
|
||||
*/
|
||||
#define CY_AN_ERROR_MEDIA_NOT_CLAIMED (CY_AS_ERROR_MEDIA_NOT_CLAIMED)
|
||||
|
||||
/*
|
||||
* This error is returned when canceling trying to cancel an asynchronous
|
||||
* operation when an async operation is not pending.
|
||||
*/
|
||||
#define CY_AN_ERROR_NO_OPERATION_PENDING (CY_AS_ERROR_NO_OPERATION_PENDING)
|
||||
|
||||
/*
|
||||
* This error is returned when an invalid endpoint number is provided
|
||||
* to an API call.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_ENDPOINT (CY_AS_ERROR_INVALID_ENDPOINT)
|
||||
|
||||
/*
|
||||
* This error is returned when an invalid descriptor type
|
||||
* is specified in an API call.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_DESCRIPTOR (CY_AS_ERROR_INVALID_DESCRIPTOR)
|
||||
|
||||
/*
|
||||
* This error is returned when an invalid descriptor index
|
||||
* is specified in an API call.
|
||||
*/
|
||||
#define CY_AN_ERROR_BAD_INDEX (CY_AS_ERROR_BAD_INDEX)
|
||||
|
||||
/*
|
||||
* This error is returned if trying to set a USB descriptor
|
||||
* when in the P port enumeration mode.
|
||||
*/
|
||||
#define CY_AN_ERROR_BAD_ENUMERATION_MODE (CY_AS_ERROR_BAD_ENUMERATION_MODE)
|
||||
|
||||
/*
|
||||
* This error is returned when the endpoint configuration specified
|
||||
* is not valid.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_CONFIGURATION (CY_AS_ERROR_INVALID_CONFIGURATION)
|
||||
|
||||
/*
|
||||
* This error is returned when the API cannot verify it is connected
|
||||
* to an West Bridge device.
|
||||
*/
|
||||
#define CY_AN_ERROR_NO_ANTIOCH (CY_AS_ERROR_NO_ANTIOCH)
|
||||
|
||||
/*
|
||||
* This error is returned when an API function is called and
|
||||
* CyAnMiscConfigureDevice has not been called to configure West
|
||||
* Bridge for the current environment.
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_CONFIGURED (CY_AS_ERROR_NOT_CONFIGURED)
|
||||
|
||||
/*
|
||||
* This error is returned when West Bridge cannot allocate memory required for
|
||||
* internal API operations.
|
||||
*/
|
||||
#define CY_AN_ERROR_OUT_OF_MEMORY (CY_AS_ERROR_OUT_OF_MEMORY)
|
||||
|
||||
/*
|
||||
* This error is returned when a module is being started that has
|
||||
* already been started.
|
||||
*/
|
||||
#define CY_AN_ERROR_NESTED_SLEEP (CY_AS_ERROR_NESTED_SLEEP)
|
||||
|
||||
/*
|
||||
* This error is returned when an operation is attempted on an endpoint that has
|
||||
* been disabled.
|
||||
*/
|
||||
#define CY_AN_ERROR_ENDPOINT_DISABLED (CY_AS_ERROR_ENDPOINT_DISABLED)
|
||||
|
||||
/*
|
||||
* This error is returned when a call is made to an API function when the device
|
||||
* is in standby.
|
||||
*/
|
||||
#define CY_AN_ERROR_IN_STANDBY (CY_AS_ERROR_IN_STANDBY)
|
||||
|
||||
/*
|
||||
* This error is returned when an API call is made with an invalid handle value.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_HANDLE (CY_AS_ERROR_INVALID_HANDLE)
|
||||
|
||||
/*
|
||||
* This error is returned when an invalid response is returned from the West
|
||||
* Bridge device.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_RESPONSE (CY_AS_ERROR_INVALID_RESPONSE)
|
||||
|
||||
/*
|
||||
* This error is returned from the callback function for any asynchronous
|
||||
* read or write request that is canceled.
|
||||
*/
|
||||
#define CY_AN_ERROR_CANCELED (CY_AS_ERROR_CANCELED)
|
||||
|
||||
/*
|
||||
* This error is returned when the call to create sleep channel fails
|
||||
* in the HAL layer.
|
||||
*/
|
||||
#define CY_AN_ERROR_CREATE_SLEEP_CHANNEL_FAILED \
|
||||
(CY_AS_ERROR_CREATE_SLEEP_CHANNEL_FAILED)
|
||||
|
||||
/*
|
||||
* This error is returned when the call to CyAnMiscLeaveStandby
|
||||
* is made and the device is not in standby.
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_IN_STANDBY (CY_AS_ERROR_NOT_IN_STANDBY)
|
||||
|
||||
/*
|
||||
* This error is returned when the call to destroy sleep channel fails
|
||||
* in the HAL layer.
|
||||
*/
|
||||
#define CY_AN_ERROR_DESTROY_SLEEP_CHANNEL_FAILED \
|
||||
(CY_AS_ERROR_DESTROY_SLEEP_CHANNEL_FAILED)
|
||||
|
||||
/*
|
||||
* This error is returned when an invalid resource is specified to a call
|
||||
* to CyAnMiscAcquireResource() or CyAnMiscReleaseResource()
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_RESOURCE (CY_AS_ERROR_INVALID_RESOURCE)
|
||||
|
||||
/*
|
||||
* This error occurs when an operation is requested on an endpoint that has
|
||||
* a currently pending async operation.
|
||||
*/
|
||||
#define CY_AN_ERROR_ASYNC_PENDING (CY_AS_ERROR_ASYNC_PENDING)
|
||||
|
||||
/*
|
||||
* This error is returned when a call to CyAnStorageCancelAsync() or
|
||||
* CyAnUsbCancelAsync() is made when no asynchronous request is pending.
|
||||
*/
|
||||
#define CY_AN_ERROR_ASYNC_NOT_PENDING (CY_AS_ERROR_ASYNC_NOT_PENDING)
|
||||
|
||||
/*
|
||||
* This error is returned when a request is made to put the West Bridge device
|
||||
* into standby mode while the USB stack is still active.
|
||||
*/
|
||||
#define CY_AN_ERROR_USB_RUNNING (CY_AS_ERROR_USB_RUNNING)
|
||||
|
||||
/*
|
||||
* A request for in the wrong direction was issued on an endpoint.
|
||||
*/
|
||||
#define CY_AN_ERROR_USB_BAD_DIRECTION (CY_AS_ERROR_USB_BAD_DIRECTION)
|
||||
|
||||
/*
|
||||
* An invalid request was received
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_REQUEST (CY_AS_ERROR_INVALID_REQUEST)
|
||||
|
||||
/*
|
||||
* An ACK request was requested while no setup packet was pending.
|
||||
*/
|
||||
#define CY_AN_ERROR_NO_SETUP_PACKET_PENDING \
|
||||
(CY_AS_ERROR_NO_SETUP_PACKET_PENDING)
|
||||
|
||||
/*
|
||||
* A call was made to a API function that cannot be called from a callback.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_IN_CALLBACK (CY_AS_ERROR_INVALID_IN_CALLBACK)
|
||||
|
||||
/*
|
||||
* A call was made to CyAnUsbSetEndPointConfig() before
|
||||
* CyAnUsbSetPhysicalConfiguration() was called.
|
||||
*/
|
||||
#define CY_AN_ERROR_ENDPOINT_CONFIG_NOT_SET \
|
||||
(CY_AS_ERROR_ENDPOINT_CONFIG_NOT_SET)
|
||||
|
||||
/*
|
||||
* The physical endpoint referenced is not valid in the current
|
||||
* physical configuration
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_PHYSICAL_ENDPOINT \
|
||||
(CY_AS_ERROR_INVALID_PHYSICAL_ENDPOINT)
|
||||
|
||||
/*
|
||||
* The data supplied to the CyAnMiscDownloadFirmware() call is not aligned on a
|
||||
* WORD (16 bit) boundary.
|
||||
*/
|
||||
#define CY_AN_ERROR_ALIGNMENT_ERROR (CY_AS_ERROR_ALIGNMENT_ERROR)
|
||||
|
||||
/*
|
||||
* A call was made to destroy the West Bridge device, but the USB stack or the
|
||||
* storage stack was will running.
|
||||
*/
|
||||
#define CY_AN_ERROR_STILL_RUNNING (CY_AS_ERROR_STILL_RUNNING)
|
||||
|
||||
/*
|
||||
* A call was made to the API for a function that is not yet supported.
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_YET_SUPPORTED (CY_AS_ERROR_NOT_YET_SUPPORTED)
|
||||
|
||||
/*
|
||||
* A NULL callback was provided where a non-NULL callback was required
|
||||
*/
|
||||
#define CY_AN_ERROR_NULL_CALLBACK (CY_AS_ERROR_NULL_CALLBACK)
|
||||
|
||||
/*
|
||||
* This error is returned when a request is made to put the West Bridge device
|
||||
* into standby mode while the storage stack is still active.
|
||||
*/
|
||||
#define CY_AN_ERROR_STORAGE_RUNNING (CY_AS_ERROR_STORAGE_RUNNING)
|
||||
|
||||
/*
|
||||
* This error is returned when an operation is attempted that cannot be
|
||||
* completed while the USB stack is connected to a USB host.
|
||||
*/
|
||||
#define CY_AN_ERROR_USB_CONNECTED (CY_AS_ERROR_USB_CONNECTED)
|
||||
|
||||
/*
|
||||
* This error is returned when a USB disconnect is attempted and the
|
||||
* West Bridge device is not connected.
|
||||
*/
|
||||
#define CY_AN_ERROR_USB_NOT_CONNECTED (CY_AS_ERROR_USB_NOT_CONNECTED)
|
||||
|
||||
/*
|
||||
* This error is returned when an P2S storage operation attempted and
|
||||
* data could not be read or written to the storage media.
|
||||
*/
|
||||
#define CY_AN_ERROR_MEDIA_ACCESS_FAILURE (CY_AS_ERROR_MEDIA_ACCESS_FAILURE)
|
||||
|
||||
/*
|
||||
* This error is returned when an P2S storage operation attempted and
|
||||
* the media is write protected.
|
||||
*/
|
||||
#define CY_AN_ERROR_MEDIA_WRITE_PROTECTED (CY_AS_ERROR_MEDIA_WRITE_PROTECTED)
|
||||
|
||||
/*
|
||||
* This error is returned when an attempt is made to cancel a request
|
||||
* that has already been sent to the West Bridge.
|
||||
*/
|
||||
#define CY_AN_ERROR_OPERATION_IN_TRANSIT (CY_AS_ERROR_OPERATION_IN_TRANSIT)
|
||||
|
||||
/*
|
||||
* This error is returned when an invalid parameter is passed to one of
|
||||
* the APIs.
|
||||
*/
|
||||
#define CY_AN_ERROR_INVALID_PARAMETER (CY_AS_ERROR_INVALID_PARAMETER)
|
||||
|
||||
/*
|
||||
* This error is returned if an API is not supported by the current
|
||||
* West Bridge device or the active firmware version.
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_SUPPORTED (CY_AS_ERROR_NOT_SUPPORTED)
|
||||
|
||||
/*
|
||||
* This error is returned when a call is made to one of the Storage or
|
||||
* USB APIs while the device is in suspend mode.
|
||||
*/
|
||||
#define CY_AN_ERROR_IN_SUSPEND (CY_AS_ERROR_IN_SUSPEND)
|
||||
|
||||
/*
|
||||
* This error is returned when the call to CyAnMiscLeaveSuspend
|
||||
* is made and the device is not in suspend mode.
|
||||
*/
|
||||
#define CY_AN_ERROR_NOT_IN_SUSPEND (CY_AS_ERROR_NOT_IN_SUSPEND)
|
||||
|
||||
/*
|
||||
* This error is returned when a command that is disabled by USB is called.
|
||||
*/
|
||||
#define CY_AN_ERROR_FEATURE_NOT_ENABLED (CY_AS_ERROR_FEATURE_NOT_ENABLED)
|
||||
|
||||
/*
|
||||
* This error is returned when an Async storage read or write is called before a
|
||||
* query device call is issued.
|
||||
*/
|
||||
#define CY_AN_ERROR_QUERY_DEVICE_NEEDED (CY_AS_ERROR_QUERY_DEVICE_NEEDED)
|
||||
|
||||
/*
|
||||
* This error is returned when a call is made to USB or STORAGE Start or
|
||||
* Stop before a prior Start or Stop has finished.
|
||||
*/
|
||||
#define CY_AN_ERROR_STARTSTOP_PENDING (CY_AS_ERROR_STARTSTOP_PENDING)
|
||||
|
||||
/*
|
||||
* This error is returned when a request is made for a bus that does not exist
|
||||
*/
|
||||
#define CY_AN_ERROR_NO_SUCH_BUS (CY_AS_ERROR_NO_SUCH_BUS)
|
||||
|
||||
#endif /* __doxygen__ */
|
||||
|
||||
#endif /* _INCLUDED_CYANERR_H_ */
|
|
@ -1,59 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyanmedia.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANMEDIA_H_
|
||||
#define _INCLUDED_CYANMEDIA_H_
|
||||
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
/* Summary
|
||||
Specifies a specific type of media supported by West Bridge
|
||||
|
||||
Description
|
||||
The West Bridge device supports five specific types
|
||||
of media as storage/IO devices attached to it's S-Port. This
|
||||
type is used to indicate the type of media being referenced in
|
||||
any API call.
|
||||
*/
|
||||
#include "cyasmedia.h"
|
||||
|
||||
/* Flash NAND memory (may be SLC or MLC) */
|
||||
#define cy_an_media_nand cy_as_media_nand
|
||||
|
||||
/* An SD flash memory device */
|
||||
#define cy_an_media_sd_flash cy_as_media_sd_flash
|
||||
|
||||
/* An MMC flash memory device */
|
||||
#define cy_an_media_mmc_flash cy_as_media_mmc_flash
|
||||
|
||||
/* A CE-ATA disk drive */
|
||||
#define cy_an_media_ce_ata cy_as_media_ce_ata
|
||||
|
||||
/* SDIO device. */
|
||||
#define cy_an_media_sdio cy_as_media_sdio
|
||||
#define cy_an_media_max_media_value \
|
||||
cy_as_media_max_media_value
|
||||
|
||||
typedef cy_as_media_type cy_an_media_type;
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
|
||||
#endif /* _INCLUDED_CYANMEDIA_H_ */
|
|
@ -1,614 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyanmisc.h)
|
||||
## Version for backward compatibility with previous Antioch SDK releases.
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANMISC_H_
|
||||
#define _INCLUDED_CYANMISC_H_
|
||||
|
||||
#include "cyantypes.h"
|
||||
#include <cyasmisc.h>
|
||||
#include "cyanmedia.h"
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
#define CY_AN_LEAVE_STANDBY_DELAY_CLOCK \
|
||||
(CY_AS_LEAVE_STANDBY_DELAY_CLOCK)
|
||||
#define CY_AN_RESET_DELAY_CLOCK \
|
||||
(CY_AS_RESET_DELAY_CLOCK)
|
||||
|
||||
#define CY_AN_LEAVE_STANDBY_DELAY_CRYSTAL \
|
||||
(CY_AS_LEAVE_STANDBY_DELAY_CRYSTAL)
|
||||
|
||||
#define CY_AN_RESET_DELAY_CRYSTAL \
|
||||
(CY_AS_RESET_DELAY_CRYSTAL)
|
||||
|
||||
/* Defines to convert the old CyAn names to the new
|
||||
* CyAs names
|
||||
*/
|
||||
typedef cy_as_device_handle cy_an_device_handle;
|
||||
|
||||
#define cy_an_device_dack_ack cy_as_device_dack_ack
|
||||
#define cy_an_device_dack_eob cy_as_device_dack_eob
|
||||
typedef cy_as_device_dack_mode cy_an_device_dack_mode;
|
||||
|
||||
typedef cy_as_device_config cy_an_device_config;
|
||||
|
||||
#define cy_an_resource_u_s_b cy_as_bus_u_sB
|
||||
#define cy_an_resource_sdio_MMC cy_as_bus_1
|
||||
#define cy_an_resource_nand cy_as_bus_0
|
||||
typedef cy_as_resource_type cy_an_resource_type;
|
||||
|
||||
#define cy_an_reset_soft cy_as_reset_soft
|
||||
#define cy_an_reset_hard cy_as_reset_hard
|
||||
typedef cy_as_reset_type cy_an_reset_type;
|
||||
typedef cy_as_funct_c_b_type cy_an_funct_c_b_type;
|
||||
typedef cy_as_function_callback cy_an_function_callback;
|
||||
|
||||
#define cy_an_event_misc_initialized \
|
||||
cy_as_event_misc_initialized
|
||||
#define cy_an_event_misc_awake \
|
||||
cy_as_event_misc_awake
|
||||
#define cy_an_event_misc_heart_beat \
|
||||
cy_as_event_misc_heart_beat
|
||||
#define cy_an_event_misc_wakeup \
|
||||
cy_as_event_misc_wakeup
|
||||
#define cy_an_event_misc_device_mismatch \
|
||||
cy_as_event_misc_device_mismatch
|
||||
typedef cy_as_misc_event_type \
|
||||
cy_an_misc_event_type;
|
||||
typedef cy_as_misc_event_callback \
|
||||
cy_an_misc_event_callback;
|
||||
|
||||
#define cy_an_misc_gpio_0 cy_as_misc_gpio_0
|
||||
#define cy_an_misc_gpio_1 cy_as_misc_gpio_1
|
||||
#define cy_an_misc_gpio__nand_CE \
|
||||
cy_as_misc_gpio__nand_CE
|
||||
#define cy_an_misc_gpio__nand_CE2 \
|
||||
cy_as_misc_gpio__nand_CE2
|
||||
#define cy_an_misc_gpio__nand_WP \
|
||||
cy_as_misc_gpio__nand_WP
|
||||
#define cy_an_misc_gpio__nand_CLE \
|
||||
cy_as_misc_gpio__nand_CLE
|
||||
#define cy_an_misc_gpio__nand_ALE \
|
||||
cy_as_misc_gpio__nand_ALE
|
||||
#define cy_an_misc_gpio_U_valid \
|
||||
cy_as_misc_gpio_U_valid
|
||||
#define cy_an_misc_gpio_SD_POW \
|
||||
cy_as_misc_gpio_SD_POW
|
||||
typedef cy_as_misc_gpio cy_an_misc_gpio;
|
||||
|
||||
#define CY_AN_SD_DEFAULT_FREQ CY_AS_SD_DEFAULT_FREQ
|
||||
#define CY_AN_SD_RATED_FREQ CY_AS_SD_RATED_FREQ
|
||||
typedef cy_as_low_speed_sd_freq cy_an_low_speed_sd_freq;
|
||||
|
||||
#define CY_AN_HS_SD_FREQ_48 CY_AS_HS_SD_FREQ_48
|
||||
#define CY_AN_HS_SD_FREQ_24 CY_AS_HS_SD_FREQ_24
|
||||
typedef cy_as_high_speed_sd_freq \
|
||||
cy_an_high_speed_sd_freq;
|
||||
|
||||
#define cy_an_misc_active_high cy_as_misc_active_high
|
||||
#define cy_an_misc_active_low cy_as_misc_active_low
|
||||
typedef cy_as_misc_signal_polarity cy_an_misc_signal_polarity;
|
||||
|
||||
typedef cy_as_get_firmware_version_data \
|
||||
cy_an_get_firmware_version_data;
|
||||
|
||||
enum {
|
||||
CYAN_FW_TRACE_LOG_NONE = 0,
|
||||
CYAN_FW_TRACE_LOG_STATE,
|
||||
CYAN_FW_TRACE_LOG_CALLS,
|
||||
CYAN_FW_TRACE_LOG_STACK_TRACE,
|
||||
CYAN_FW_TRACE_MAX_LEVEL
|
||||
};
|
||||
|
||||
|
||||
/***********************************/
|
||||
/***********************************/
|
||||
/* FUNCTIONS */
|
||||
/***********************************/
|
||||
/***********************************/
|
||||
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_create_device(
|
||||
cy_an_device_handle *handle_p,
|
||||
cy_an_hal_device_tag tag
|
||||
);
|
||||
#define cy_an_misc_create_device(h, tag) \
|
||||
cy_as_misc_create_device((cy_as_device_handle *)(h), \
|
||||
(cy_as_hal_device_tag)(tag))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_destroy_device(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_misc_destroy_device(h) \
|
||||
cy_as_misc_destroy_device((cy_as_device_handle)(h))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_configure_device(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_device_config *config_p
|
||||
);
|
||||
#define cy_an_misc_configure_device(h, cfg) \
|
||||
cy_as_misc_configure_device((cy_as_device_handle)(h), \
|
||||
(cy_as_device_config *)(cfg))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_in_standby(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool *standby
|
||||
);
|
||||
#define cy_an_misc_in_standby(h, standby) \
|
||||
cy_as_misc_in_standby((cy_as_device_handle)(h), (standby))
|
||||
|
||||
/* Sync version of Download Firmware */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_download_firmware(
|
||||
cy_an_device_handle handle,
|
||||
const void *fw_p,
|
||||
uint16_t size
|
||||
);
|
||||
|
||||
#define cy_an_misc_download_firmware(handle, fw_p, size) \
|
||||
cy_as_misc_download_firmware((cy_as_device_handle)\
|
||||
(handle), (fw_p), (size), 0, 0)
|
||||
|
||||
/* Async version of Download Firmware */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_download_firmware_e_x(
|
||||
cy_an_device_handle handle,
|
||||
const void *fw_p,
|
||||
uint16_t size,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
#define cy_an_misc_download_firmware_e_x(h, fw_p, size, cb, client) \
|
||||
cy_as_misc_download_firmware((cy_as_device_handle)(h), \
|
||||
(fw_p), (size), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Get Firmware Version */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_as_misc_get_firmware_version_dep(
|
||||
cy_as_device_handle handle,
|
||||
uint16_t *major,
|
||||
uint16_t *minor,
|
||||
uint16_t *build,
|
||||
uint8_t *media_type,
|
||||
cy_bool *is_debug_mode);
|
||||
|
||||
#define cy_an_misc_get_firmware_version\
|
||||
(h, major, minor, bld, type, mode) \
|
||||
cy_as_misc_get_firmware_version_dep((cy_as_device_handle)(h), \
|
||||
(major), (minor), (bld), (type), (mode))
|
||||
|
||||
/* Async version of Get Firmware Version*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_get_firmware_version_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_get_firmware_version_data *data,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_get_firmware_version_e_x\
|
||||
(h, data, cb, client) \
|
||||
cy_as_misc_get_firmware_version((cy_as_device_handle)(h), \
|
||||
(data), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Read MCU Register*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_read_m_c_u_register(
|
||||
cy_an_device_handle handle,
|
||||
uint16_t address,
|
||||
uint8_t *value
|
||||
);
|
||||
|
||||
#define cy_an_misc_read_m_c_u_register(handle, address, value) \
|
||||
cy_as_misc_read_m_c_u_register((cy_as_device_handle)(handle), \
|
||||
(address), (value), 0, 0)
|
||||
|
||||
/* Async version of Read MCU Register*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_read_m_c_u_register_e_x(
|
||||
cy_an_device_handle handle,
|
||||
uint16_t address,
|
||||
uint8_t *value,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
#define cy_an_misc_read_m_c_u_register_e_x\
|
||||
(h, addr, val, cb, client) \
|
||||
cy_as_misc_read_m_c_u_register((cy_as_device_handle)(h), \
|
||||
(addr), (val), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Write MCU Register*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_write_m_c_u_register(
|
||||
cy_an_device_handle handle,
|
||||
uint16_t address,
|
||||
uint8_t mask,
|
||||
uint8_t value
|
||||
);
|
||||
#define cy_an_misc_write_m_c_u_register\
|
||||
(handle, address, mask, value) \
|
||||
cy_as_misc_write_m_c_u_register((cy_as_device_handle)(handle), \
|
||||
(address), (mask), (value), 0, 0)
|
||||
|
||||
/* Async version of Write MCU Register*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_write_m_c_u_register_e_x(
|
||||
cy_an_device_handle handle,
|
||||
uint16_t address,
|
||||
uint8_t mask,
|
||||
uint8_t value,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_write_m_c_u_register_e_x\
|
||||
(h, addr, mask, val, cb, client) \
|
||||
cy_as_misc_write_m_c_u_register((cy_as_device_handle)(h), \
|
||||
(addr), (mask), (val), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Write MCU Register*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_reset(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_reset_type type,
|
||||
cy_bool flush
|
||||
);
|
||||
#define cy_an_misc_reset(handle, type, flush) \
|
||||
cy_as_misc_reset((cy_as_device_handle)(handle), \
|
||||
(type), (flush), 0, 0)
|
||||
|
||||
/* Async version of Write MCU Register*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_reset_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_reset_type type,
|
||||
cy_bool flush,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_reset_e_x(h, type, flush, cb, client) \
|
||||
cy_as_misc_reset((cy_as_device_handle)(h), \
|
||||
(cy_as_reset_type)(type), (flush), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Synchronous version of CyAnMiscAcquireResource. */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_acquire_resource(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_resource_type type,
|
||||
cy_bool force
|
||||
);
|
||||
#define cy_an_misc_acquire_resource(h, type, force) \
|
||||
cy_as_misc_acquire_resource_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_resource_type)(type), (force))
|
||||
|
||||
/* Asynchronous version of CyAnMiscAcquireResource. */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_acquire_resource_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_resource_type *type,
|
||||
cy_bool force,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_acquire_resource_e_x\
|
||||
(h, type_p, force, cb, client) \
|
||||
cy_as_misc_acquire_resource((cy_as_device_handle)(h), \
|
||||
(cy_as_resource_type *)(type_p), \
|
||||
(force), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* The one and only version of Release resource */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_release_resource(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_resource_type type
|
||||
);
|
||||
#define cy_an_misc_release_resource(h, type)\
|
||||
cy_as_misc_release_resource((cy_as_device_handle)(h), \
|
||||
(cy_as_resource_type)(type))
|
||||
|
||||
/* Synchronous version of CyAnMiscSetTraceLevel. */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_set_trace_level(
|
||||
cy_an_device_handle handle,
|
||||
uint8_t level,
|
||||
cy_an_media_type media,
|
||||
uint32_t device,
|
||||
uint32_t unit
|
||||
);
|
||||
|
||||
#define cy_an_misc_set_trace_level\
|
||||
(handle, level, media, device, unit) \
|
||||
cy_as_misc_set_trace_level_dep((cy_as_device_handle)(handle), \
|
||||
(level), (cy_as_media_type)(media), (device), (unit), 0, 0)
|
||||
|
||||
/* Asynchronous version of CyAnMiscSetTraceLevel. */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_set_trace_level_e_x(
|
||||
cy_an_device_handle handle,
|
||||
uint8_t level,
|
||||
cy_an_media_type media,
|
||||
uint32_t device,
|
||||
uint32_t unit,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_set_trace_level_e_x\
|
||||
(h, level, media, device, unit, cb, client) \
|
||||
cy_as_misc_set_trace_level_dep((cy_as_device_handle)(h), \
|
||||
(level), (cy_as_media_type)(media), (device), (unit), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Synchronous version of CyAnMiscEnterStandby. */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_enter_standby(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool pin
|
||||
);
|
||||
#define cy_an_misc_enter_standby(handle, pin) \
|
||||
cy_as_misc_enter_standby(\
|
||||
(cy_as_device_handle)(handle), (pin), 0, 0)
|
||||
|
||||
/* Synchronous version of CyAnMiscEnterStandby. */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_enter_standby_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool pin,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_enter_standby_e_x(h, pin, cb, client) \
|
||||
cy_as_misc_enter_standby((cy_as_device_handle)(h), \
|
||||
(pin), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Only one version of CyAnMiscLeaveStandby. */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_leave_standby(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_resource_type type
|
||||
);
|
||||
#define cy_an_misc_leave_standby(h, type) \
|
||||
cy_as_misc_leave_standby((cy_as_device_handle)(h), \
|
||||
(cy_as_resource_type)(type))
|
||||
|
||||
/* The one version of Misc Register Callback */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_register_callback(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_misc_event_callback callback
|
||||
);
|
||||
#define cy_an_misc_register_callback(h, cb) \
|
||||
cy_as_misc_register_callback((cy_as_device_handle)(h), \
|
||||
(cy_as_misc_event_callback)(cb))
|
||||
|
||||
/* The only version of SetLogLevel */
|
||||
EXTERN void
|
||||
cy_an_misc_set_log_level(
|
||||
uint8_t level
|
||||
);
|
||||
#define cy_an_misc_set_log_level(level) \
|
||||
cy_as_misc_set_log_level(level)
|
||||
|
||||
/* Sync version of Misc Storage Changed */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_storage_changed(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_misc_storage_changed(handle) \
|
||||
cy_as_misc_storage_changed((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/* Async version of Misc Storage Changed */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_storage_changed_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_storage_changed_e_x(h, cb, client) \
|
||||
cy_as_misc_storage_changed((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Heartbeat control */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_heart_beat_control(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool enable
|
||||
);
|
||||
#define cy_an_misc_heart_beat_control(handle, enable) \
|
||||
cy_as_misc_heart_beat_control((cy_as_device_handle)\
|
||||
(handle), (enable), 0, 0)
|
||||
|
||||
/* Async version of Heartbeat control */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_heart_beat_control_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool enable,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_heart_beat_control_e_x(h, enable, cb, client) \
|
||||
cy_as_misc_heart_beat_control((cy_as_device_handle)(h), \
|
||||
(enable), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Get Gpio */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_get_gpio_value(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_misc_gpio pin,
|
||||
uint8_t *value
|
||||
);
|
||||
#define cy_an_misc_get_gpio_value(handle, pin, value) \
|
||||
cy_as_misc_get_gpio_value((cy_as_device_handle)(handle), \
|
||||
(cy_as_misc_gpio)(pin), (value), 0, 0)
|
||||
|
||||
/* Async version of Get Gpio */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_get_gpio_value_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_misc_gpio pin,
|
||||
uint8_t *value,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_get_gpio_value_e_x(h, pin, value, cb, client) \
|
||||
cy_as_misc_get_gpio_value((cy_as_device_handle)(h), \
|
||||
(cy_as_misc_gpio)(pin), (value), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Set Gpio */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_set_gpio_value(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_misc_gpio pin,
|
||||
uint8_t value
|
||||
);
|
||||
#define cy_an_misc_set_gpio_value(handle, pin, value) \
|
||||
cy_as_misc_set_gpio_value((cy_as_device_handle)(handle), \
|
||||
(cy_as_misc_gpio)(pin), (value), 0, 0)
|
||||
|
||||
/* Async version of Set Gpio */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_set_gpio_value_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_misc_gpio pin,
|
||||
uint8_t value,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_set_gpio_value_e_x\
|
||||
(h, pin, value, cb, client) \
|
||||
cy_as_misc_set_gpio_value((cy_as_device_handle)(h), \
|
||||
(cy_as_misc_gpio)(pin), (value), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Enter suspend */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_enter_suspend(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool usb_wakeup_en,
|
||||
cy_bool gpio_wakeup_en
|
||||
);
|
||||
#define cy_an_misc_enter_suspend(handle, usb_wakeup_en, \
|
||||
gpio_wakeup_en) \
|
||||
cy_as_misc_enter_suspend((cy_as_device_handle)(handle), \
|
||||
(usb_wakeup_en), (gpio_wakeup_en), 0, 0)
|
||||
|
||||
/* Async version of Enter suspend */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_enter_suspend_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool usb_wakeup_en,
|
||||
cy_bool gpio_wakeup_en,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_enter_suspend_e_x(h, usb_en, gpio_en, cb, client)\
|
||||
cy_as_misc_enter_suspend((cy_as_device_handle)(h), (usb_en), \
|
||||
(gpio_en), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Enter suspend */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_leave_suspend(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_misc_leave_suspend(handle) \
|
||||
cy_as_misc_leave_suspend((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/* Async version of Enter suspend */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_leave_suspend_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
#define cy_an_misc_leave_suspend_e_x(h, cb, client) \
|
||||
cy_as_misc_leave_suspend((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of SetLowSpeedSDFreq */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_set_low_speed_sd_freq(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_low_speed_sd_freq setting
|
||||
);
|
||||
#define cy_an_misc_set_low_speed_sd_freq(h, setting) \
|
||||
cy_as_misc_set_low_speed_sd_freq((cy_as_device_handle)(h), \
|
||||
(cy_as_low_speed_sd_freq)(setting), 0, 0)
|
||||
|
||||
/* Async version of SetLowSpeedSDFreq */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_set_low_speed_sd_freq_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_low_speed_sd_freq setting,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_set_low_speed_sd_freq_e_x\
|
||||
(h, setting, cb, client) \
|
||||
cy_as_misc_set_low_speed_sd_freq((cy_as_device_handle)(h), \
|
||||
(cy_as_low_speed_sd_freq)(setting), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* SetHighSpeedSDFreq */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_set_high_speed_sd_freq(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_high_speed_sd_freq setting,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_misc_set_high_speed_sd_freq(h, setting, cb, client) \
|
||||
cy_as_misc_set_high_speed_sd_freq((cy_as_device_handle)(h), \
|
||||
(cy_as_high_speed_sd_freq)(setting), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* ReserveLNABootArea */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_reserve_l_n_a_boot_area(
|
||||
cy_an_device_handle handle,
|
||||
uint8_t numzones,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client);
|
||||
#define cy_an_misc_reserve_l_n_a_boot_area(h, num, cb, client) \
|
||||
cy_as_misc_reserve_l_n_a_boot_area((cy_as_device_handle)(h), \
|
||||
num, (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* SetSDPowerPolarity */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_misc_set_sd_power_polarity(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_misc_signal_polarity polarity,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client);
|
||||
#define cy_an_misc_set_sd_power_polarity(h, pol, cb, client) \
|
||||
cy_as_misc_set_sd_power_polarity((cy_as_device_handle)(h), \
|
||||
(cy_as_misc_signal_polarity)(pol), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyanregs.h)
|
||||
## Register and field definitions for the Antioch device.
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANREG_H_
|
||||
#define _INCLUDED_CYANREG_H_
|
||||
|
||||
#if !defined(__doxygen__)
|
||||
|
||||
#define CY_AN_MEM_CM_WB_CFG_ID (0x80)
|
||||
#define CY_AN_MEM_CM_WB_CFG_ID_VER_MASK (0x000F)
|
||||
#define CY_AN_MEM_CM_WB_CFG_ID_HDID_MASK (0xFFF0)
|
||||
#define CY_AN_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE (0xA100)
|
||||
#define CY_AN_MEM_CM_WB_CFG_ID_HDID_ASTORIA_FPGA_VALUE (0x6800)
|
||||
#define CY_AN_MEM_CM_WB_CFG_ID_HDID_ASTORIA_VALUE (0xA200)
|
||||
|
||||
|
||||
#define CY_AN_MEM_RST_CTRL_REG (0x81)
|
||||
#define CY_AN_MEM_RST_CTRL_REG_HARD (0x0003)
|
||||
#define CY_AN_MEM_RST_CTRL_REG_SOFT (0x0001)
|
||||
#define CY_AN_MEM_RST_RSTCMPT (0x0004)
|
||||
|
||||
#define CY_AN_MEM_P0_ENDIAN (0x82)
|
||||
#define CY_AN_LITTLE_ENDIAN (0x0000)
|
||||
#define CY_AN_BIG_ENDIAN (0x0101)
|
||||
|
||||
#define CY_AN_MEM_P0_VM_SET (0x83)
|
||||
#define CY_AN_MEM_P0_VM_SET_VMTYPE_MASK (0x0007)
|
||||
#define CY_AN_MEM_P0_VM_SET_VMTYPE_RAM (0x0005)
|
||||
#define CY_AN_MEM_P0_VM_SET_VMTYPE_VMWIDTH (0x0008)
|
||||
#define CY_AN_MEM_P0_VM_SET_VMTYPE_FLOWCTRL (0x0010)
|
||||
#define CY_AN_MEM_P0_VM_SET_IFMODE (0x0020)
|
||||
#define CY_AN_MEM_P0_VM_SET_CFGMODE (0x0040)
|
||||
#define CY_AN_MEM_P0_VM_SET_DACKEOB (0x0080)
|
||||
#define CY_AN_MEM_P0_VM_SET_OVERRIDE (0x0100)
|
||||
#define CY_AN_MEM_P0_VM_SET_INTOVERD (0x0200)
|
||||
#define CY_AN_MEM_P0_VM_SET_DRQOVERD (0x0400)
|
||||
#define CY_AN_MEM_P0_VM_SET_DRQPOL (0x0800)
|
||||
#define CY_AN_MEM_P0_VM_SET_DACKPOL (0x1000)
|
||||
|
||||
|
||||
#define CY_AN_MEM_P0_NV_SET (0x84)
|
||||
#define CY_AN_MEM_P0_NV_SET_WPSWEN (0x0001)
|
||||
#define CY_AN_MEM_P0_NV_SET_WPPOLAR (0x0002)
|
||||
|
||||
#define CY_AN_MEM_PMU_UPDATE (0x85)
|
||||
#define CY_AN_MEM_PMU_UPDATE_UVALID (0x0001)
|
||||
#define CY_AN_MEM_PMU_UPDATE_USBUPDATE (0x0002)
|
||||
#define CY_AN_MEM_PMU_UPDATE_SDIOUPDATE (0x0004)
|
||||
|
||||
#define CY_AN_MEM_P0_INTR_REG (0x90)
|
||||
#define CY_AN_MEM_P0_INTR_REG_MCUINT (0x0020)
|
||||
#define CY_AN_MEM_P0_INTR_REG_DRQINT (0x0800)
|
||||
#define CY_AN_MEM_P0_INTR_REG_MBINT (0x1000)
|
||||
#define CY_AN_MEM_P0_INTR_REG_PMINT (0x2000)
|
||||
#define CY_AN_MEM_P0_INTR_REG_PLLLOCKINT (0x4000)
|
||||
|
||||
#define CY_AN_MEM_P0_INT_MASK_REG (0x91)
|
||||
#define CY_AN_MEM_P0_INT_MASK_REG_MMCUINT (0x0020)
|
||||
#define CY_AN_MEM_P0_INT_MASK_REG_MDRQINT (0x0800)
|
||||
#define CY_AN_MEM_P0_INT_MASK_REG_MMBINT (0x1000)
|
||||
#define CY_AN_MEM_P0_INT_MASK_REG_MPMINT (0x2000)
|
||||
#define CY_AN_MEM_P0_INT_MASK_REG_MPLLLOCKINT (0x4000)
|
||||
|
||||
#define CY_AN_MEM_MCU_MB_STAT (0x92)
|
||||
#define CY_AN_MEM_P0_MCU_MBNOTRD (0x0001)
|
||||
|
||||
#define CY_AN_MEM_P0_MCU_STAT (0x94)
|
||||
#define CY_AN_MEM_P0_MCU_STAT_CARDINS (0x0001)
|
||||
#define CY_AN_MEM_P0_MCU_STAT_CARDREM (0x0002)
|
||||
|
||||
#define CY_AN_MEM_PWR_MAGT_STAT (0x95)
|
||||
#define CY_AN_MEM_PWR_MAGT_STAT_WAKEUP (0x0001)
|
||||
|
||||
#define CY_AN_MEM_P0_RSE_ALLOCATE (0x98)
|
||||
#define CY_AN_MEM_P0_RSE_ALLOCATE_SDIOAVI (0x0001)
|
||||
#define CY_AN_MEM_P0_RSE_ALLOCATE_SDIOALLO (0x0002)
|
||||
#define CY_AN_MEM_P0_RSE_ALLOCATE_NANDAVI (0x0004)
|
||||
#define CY_AN_MEM_P0_RSE_ALLOCATE_NANDALLO (0x0008)
|
||||
#define CY_AN_MEM_P0_RSE_ALLOCATE_USBAVI (0x0010)
|
||||
#define CY_AN_MEM_P0_RSE_ALLOCATE_USBALLO (0x0020)
|
||||
|
||||
#define CY_AN_MEM_P0_RSE_MASK (0x9A)
|
||||
#define CY_AN_MEM_P0_RSE_MASK_MSDIOBUS_RW (0x0003)
|
||||
#define CY_AN_MEM_P0_RSE_MASK_MNANDBUS_RW (0x00C0)
|
||||
#define CY_AN_MEM_P0_RSE_MASK_MUSBBUS_RW (0x0030)
|
||||
|
||||
#define CY_AN_MEM_P0_DRQ (0xA0)
|
||||
#define CY_AN_MEM_P0_DRQ_EP2DRQ (0x0004)
|
||||
#define CY_AN_MEM_P0_DRQ_EP3DRQ (0x0008)
|
||||
#define CY_AN_MEM_P0_DRQ_EP4DRQ (0x0010)
|
||||
#define CY_AN_MEM_P0_DRQ_EP5DRQ (0x0020)
|
||||
#define CY_AN_MEM_P0_DRQ_EP6DRQ (0x0040)
|
||||
#define CY_AN_MEM_P0_DRQ_EP7DRQ (0x0080)
|
||||
#define CY_AN_MEM_P0_DRQ_EP8DRQ (0x0100)
|
||||
#define CY_AN_MEM_P0_DRQ_EP9DRQ (0x0200)
|
||||
#define CY_AN_MEM_P0_DRQ_EP10DRQ (0x0400)
|
||||
#define CY_AN_MEM_P0_DRQ_EP11DRQ (0x0800)
|
||||
#define CY_AN_MEM_P0_DRQ_EP12DRQ (0x1000)
|
||||
#define CY_AN_MEM_P0_DRQ_EP13DRQ (0x2000)
|
||||
#define CY_AN_MEM_P0_DRQ_EP14DRQ (0x4000)
|
||||
#define CY_AN_MEM_P0_DRQ_EP15DRQ (0x8000)
|
||||
|
||||
#define CY_AN_MEM_P0_DRQ_MASK (0xA1)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP2DRQ (0x0004)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP3DRQ (0x0008)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP4DRQ (0x0010)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP5DRQ (0x0020)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP6DRQ (0x0040)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP7DRQ (0x0080)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP8DRQ (0x0100)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP9DRQ (0x0200)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP10DRQ (0x0400)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP11DRQ (0x0800)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP12DRQ (0x1000)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP13DRQ (0x2000)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP14DRQ (0x4000)
|
||||
#define CY_AN_MEM_P0_DRQ_MASK_MEP15DRQ (0x8000)
|
||||
|
||||
#define CY_AN_MEM_P0_EP2_DMA_REG (0xA2)
|
||||
#define CY_AN_MEM_P0_E_pn_DMA_REG_COUNT_MASK (0x7FF)
|
||||
#define CY_AN_MEM_P0_E_pn_DMA_REG_DMAVAL (1 << 12)
|
||||
#define CY_AN_MEM_P0_EP3_DMA_REG (0xA3)
|
||||
#define CY_AN_MEM_P0_EP4_DMA_REG (0xA4)
|
||||
#define CY_AN_MEM_P0_EP5_DMA_REG (0xA5)
|
||||
#define CY_AN_MEM_P0_EP6_DMA_REG (0xA6)
|
||||
#define CY_AN_MEM_P0_EP7_DMA_REG (0xA7)
|
||||
#define CY_AN_MEM_P0_EP8_DMA_REG (0xA8)
|
||||
#define CY_AN_MEM_P0_EP9_DMA_REG (0xA9)
|
||||
#define CY_AN_MEM_P0_EP10_DMA_REG (0xAA)
|
||||
#define CY_AN_MEM_P0_EP11_DMA_REG (0xAB)
|
||||
#define CY_AN_MEM_P0_EP12_DMA_REG (0xAC)
|
||||
#define CY_AN_MEM_P0_EP13_DMA_REG (0xAD)
|
||||
#define CY_AN_MEM_P0_EP14_DMA_REG (0xAE)
|
||||
#define CY_AN_MEM_P0_EP15_DMA_REG (0xAF)
|
||||
|
||||
#define CY_AN_MEM_IROS_IO_CFG (0xC1)
|
||||
#define CY_AN_MEM_IROS_IO_CFG_GPIODRVST_MASK (0x0003)
|
||||
#define CY_AN_MEM_IROS_IO_CFG_GPIOSLEW_MASK (0x0004)
|
||||
#define CY_AN_MEM_IROS_IO_CFG_PPIODRVST_MASK (0x0018)
|
||||
#define CY_AN_MEM_IROS_IO_CFG_PPIOSLEW_MASK (0x0020)
|
||||
#define CY_AN_MEM_IROS_IO_CFG_SSIODRVST_MASK (0x0300)
|
||||
#define CY_AN_MEM_IROS_IO_CFG_SSIOSLEW_MASK (0x0400)
|
||||
#define CY_AN_MEM_IROS_IO_CFG_SNIODRVST_MASK (0x1800)
|
||||
#define CY_AN_MEM_IROS_IO_CFG_SNIOSLEW_MASK (0x2000)
|
||||
|
||||
#define CY_AN_MEM_PLL_LOCK_LOSS_STAT (0xC4)
|
||||
#define CY_AN_MEM_PLL_LOCK_LOSS_STAT_PLLSTAT (0x0800)
|
||||
|
||||
#define CY_AN_MEM_P0_MAILBOX0 (0xF0)
|
||||
#define CY_AN_MEM_P0_MAILBOX1 (0xF1)
|
||||
#define CY_AN_MEM_P0_MAILBOX2 (0xF2)
|
||||
#define CY_AN_MEM_P0_MAILBOX3 (0xF3)
|
||||
|
||||
#define CY_AN_MEM_MCU_MAILBOX0 (0xF8)
|
||||
#define CY_AN_MEM_MCU_MAILBOX1 (0xF9)
|
||||
#define CY_AN_MEM_MCU_MAILBOX2 (0xFA)
|
||||
#define CY_AN_MEM_MCU_MAILBOX3 (0xFB)
|
||||
|
||||
#endif /* !defined(__doxygen__) */
|
||||
|
||||
#endif /* _INCLUDED_CYANREG_H_ */
|
|
@ -1,30 +0,0 @@
|
|||
/* Cypress Antioch Sdk Version file (cyansdkversion.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANSDK_VERSION_H_
|
||||
#define _INCLUDED_CYANSDK_VERSION_H_
|
||||
|
||||
/* Antioch SDK version 1.3.2 */
|
||||
#define CYAN_MAJOR_VERSION (1)
|
||||
#define CYAN_MINOR_VERSION (3)
|
||||
#define CYAN_BUILD_NUMBER (473)
|
||||
|
||||
#endif /*_INCLUDED_CYANSDK_VERSION_H_*/
|
|
@ -1,419 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyanstorage.h)
|
||||
## Header for backward compatibility with previous releases of Antioch SDK.
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANSTORAGE_H_
|
||||
#define _INCLUDED_CYANSTORAGE_H_
|
||||
#ifndef __doxygen__
|
||||
|
||||
#include "cyanmedia.h"
|
||||
#include "cyanmisc.h"
|
||||
#include "cyasstorage.h"
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
#define CY_AN_LUN_PHYSICAL_DEVICE (CY_AS_LUN_PHYSICAL_DEVICE)
|
||||
#define CY_AN_STORAGE_EP_SIZE (CY_AS_STORAGE_EP_SIZE)
|
||||
|
||||
#define cy_an_storage_antioch cy_as_storage_antioch
|
||||
#define cy_an_storage_processor cy_as_storage_processor
|
||||
#define cy_an_storage_removed cy_as_storage_removed
|
||||
#define cy_an_storage_inserted cy_as_storage_inserted
|
||||
#define cy_an_sdio_interrupt cy_as_sdio_interrupt
|
||||
typedef cy_as_storage_event cy_an_storage_event;
|
||||
|
||||
#define cy_an_op_read cy_as_op_read
|
||||
#define cy_an_op_write cy_as_op_write
|
||||
typedef cy_as_oper_type cy_an_oper_type;
|
||||
|
||||
typedef cy_as_device_desc cy_an_device_desc;
|
||||
|
||||
typedef cy_as_unit_desc cy_an_unit_desc;
|
||||
|
||||
typedef cy_as_storage_callback_dep \
|
||||
cy_an_storage_callback;
|
||||
|
||||
typedef cy_as_storage_event_callback_dep \
|
||||
cy_an_storage_event_callback;
|
||||
|
||||
#define cy_an_sd_reg_OCR cy_as_sd_reg_OCR
|
||||
#define cy_an_sd_reg_CID cy_as_sd_reg_CID
|
||||
#define cy_an_sd_reg_CSD cy_as_sd_reg_CSD
|
||||
typedef cy_as_sd_card_reg_type \
|
||||
cy_an_sd_card_reg_type;
|
||||
|
||||
typedef cy_as_storage_query_device_data_dep \
|
||||
cy_an_storage_query_device_data;
|
||||
|
||||
typedef cy_as_storage_query_unit_data_dep \
|
||||
cy_an_storage_query_unit_data;
|
||||
|
||||
typedef cy_as_storage_sd_reg_read_data \
|
||||
cy_an_storage_sd_reg_read_data;
|
||||
|
||||
#define CY_AN_SD_REG_OCR_LENGTH (CY_AS_SD_REG_OCR_LENGTH)
|
||||
#define CY_AN_SD_REG_CID_LENGTH (CY_AS_SD_REG_CID_LENGTH)
|
||||
#define CY_AN_SD_REG_CSD_LENGTH (CY_AS_SD_REG_CSD_LENGTH)
|
||||
#define CY_AN_SD_REG_MAX_RESP_LENGTH \
|
||||
(CY_AS_SD_REG_MAX_RESP_LENGTH)
|
||||
|
||||
/**** API Functions ******/
|
||||
|
||||
/* Sync version of Storage Start */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_start(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_storage_start(handle) \
|
||||
cy_as_storage_start((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/* Async version of Storage Start */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_start_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_start_e_x(h, cb, client) \
|
||||
cy_as_storage_start((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Storage Stop */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_stop(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_storage_stop(handle) \
|
||||
cy_as_storage_stop((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/* Async version of Storage Stop */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_stop_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_stop_e_x(h, cb, client) \
|
||||
cy_as_storage_stop((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Register Call back api */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_register_callback(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_storage_event_callback callback
|
||||
);
|
||||
#define cy_an_storage_register_callback(h, cb) \
|
||||
cy_as_storage_register_callback_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_storage_event_callback_dep)(cb))
|
||||
|
||||
/* Sync version of Storage Claim */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_claim(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type
|
||||
);
|
||||
#define cy_an_storage_claim(h, type) \
|
||||
cy_as_storage_claim_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type))
|
||||
|
||||
/* Async version of Storage Claim */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_claim_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type *type,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_claim_e_x(h, type_p, cb, client) \
|
||||
cy_as_storage_claim_dep_EX((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type *)(type_p), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync Version of Storage Release */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_release(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type
|
||||
);
|
||||
#define cy_an_storage_release(h, type) \
|
||||
cy_as_storage_release_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type))
|
||||
|
||||
/* Async Version of Storage Release */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_release_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type *type,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_release_e_x(h, type_p, cb, client) \
|
||||
cy_as_storage_release_dep_EX((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type *)(type_p), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Query Media */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_query_media(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint32_t *count
|
||||
);
|
||||
#define cy_an_storage_query_media(handle, type, count) \
|
||||
cy_as_storage_query_media((cy_as_device_handle)(handle), \
|
||||
(cy_as_media_type)(type), (count), 0, 0)
|
||||
|
||||
/* Async version of Query Media */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_query_media_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint32_t *count,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_query_media_e_x(h, type, count, cb, client) \
|
||||
cy_as_storage_query_media((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (count), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Query device */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_query_device(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint32_t device,
|
||||
cy_an_device_desc *desc_p
|
||||
);
|
||||
#define cy_an_storage_query_device(h, type, device, desc_p) \
|
||||
cy_as_storage_query_device_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (device), (cy_as_device_desc *)(desc_p))
|
||||
|
||||
/* Async version of Query device */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_query_device_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_storage_query_device_data *data,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_query_device_e_x(h, data, cb, client) \
|
||||
cy_as_storage_query_device_dep_EX((cy_as_device_handle)(h), \
|
||||
(cy_as_storage_query_device_data_dep *)(data), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Query Unit */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_query_unit(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint32_t device,
|
||||
uint32_t unit,
|
||||
cy_an_unit_desc *desc_p
|
||||
);
|
||||
#define cy_an_storage_query_unit(h, type, device, unit, desc_p) \
|
||||
cy_as_storage_query_unit_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (device), \
|
||||
(unit), (cy_as_unit_desc *)(desc_p))
|
||||
|
||||
/* Async version of Query Unit */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_query_unit_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_storage_query_unit_data *data_p,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_query_unit_e_x(h, data_p, cb, client) \
|
||||
cy_as_storage_query_unit_dep_EX((cy_as_device_handle)(h), \
|
||||
(cy_as_storage_query_unit_data_dep *)(data_p), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of device control */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_device_control(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool card_detect_en,
|
||||
cy_bool write_prot_en
|
||||
);
|
||||
#define cy_an_storage_device_control(handle, \
|
||||
card_detect_en, write_prot_en) \
|
||||
cy_as_storage_device_control_dep((cy_as_device_handle)(handle), \
|
||||
(card_detect_en), (write_prot_en), 0, 0)
|
||||
|
||||
/* Async version of device control */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_device_control_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_bool card_detect_en,
|
||||
cy_bool write_prot_en,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_device_control_e_x(h, det_en, prot_en, cb, client) \
|
||||
cy_as_storage_device_control_dep((cy_as_device_handle)(h), (det_en), \
|
||||
(prot_en), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync Read */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_read(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint32_t device,
|
||||
uint32_t unit,
|
||||
uint32_t block,
|
||||
void *data_p,
|
||||
uint16_t num_blocks
|
||||
);
|
||||
#define cy_an_storage_read(h, type, device, unit, block, data_p, nblks) \
|
||||
cy_as_storage_read_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (device), (unit), \
|
||||
(block), (data_p), (nblks))
|
||||
|
||||
/* Async Read */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_read_async(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint32_t device,
|
||||
uint32_t unit,
|
||||
uint32_t block,
|
||||
void *data_p,
|
||||
uint16_t num_blocks,
|
||||
cy_an_storage_callback callback
|
||||
);
|
||||
#define cy_an_storage_read_async(h, type, device, unit, \
|
||||
block, data_p, nblks, cb) \
|
||||
cy_as_storage_read_async_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (device), (unit), (block), \
|
||||
(data_p), (nblks), (cy_as_storage_callback_dep)(cb))
|
||||
|
||||
/* Sync Write */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_write(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint32_t device,
|
||||
uint32_t unit,
|
||||
uint32_t block,
|
||||
void *data_p,
|
||||
uint16_t num_blocks
|
||||
);
|
||||
#define cy_an_storage_write(h, type, device, unit, \
|
||||
block, data_p, nblks) \
|
||||
cy_as_storage_write_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (device), (unit), \
|
||||
(block), (data_p), (nblks))
|
||||
|
||||
/* Async Write */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_write_async(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint32_t device,
|
||||
uint32_t unit,
|
||||
uint32_t block,
|
||||
void *data_p,
|
||||
uint16_t num_blocks,
|
||||
cy_an_storage_callback callback
|
||||
);
|
||||
#define cy_an_storage_write_async(h, type, device, unit, \
|
||||
block, data_p, nblks, cb) \
|
||||
cy_as_storage_write_async_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (device), (unit), (block), \
|
||||
(data_p), (nblks), (cy_as_storage_callback_dep)(cb))
|
||||
|
||||
/* Cancel Async */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_cancel_async(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_storage_cancel_async(h) \
|
||||
cy_as_storage_cancel_async((cy_as_device_handle)(h))
|
||||
|
||||
/* Sync SD Register Read*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_sd_register_read(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint8_t device,
|
||||
cy_an_sd_card_reg_type reg_type,
|
||||
uint8_t read_len,
|
||||
uint8_t *data_p
|
||||
);
|
||||
#define cy_an_storage_sd_register_read(h, type, device, \
|
||||
reg_type, len, data_p) \
|
||||
cy_as_storage_sd_register_read_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (device), \
|
||||
(cy_as_sd_card_reg_type)(reg_type), (len), (data_p))
|
||||
|
||||
/*Async SD Register Read*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_sd_register_read_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type type,
|
||||
uint8_t device,
|
||||
cy_an_sd_card_reg_type reg_type,
|
||||
cy_an_storage_sd_reg_read_data *data_p,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_storage_sd_register_read_e_x(h, type, device, \
|
||||
reg_type, data_p, cb, client) \
|
||||
cy_as_storage_sd_register_read_dep_EX((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(type), (device), \
|
||||
(cy_as_sd_card_reg_type)(reg_type), \
|
||||
(cy_as_storage_sd_reg_read_data *)(data_p), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Create partition on storage device */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_create_p_partition(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type media,
|
||||
uint32_t device,
|
||||
uint32_t size,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client);
|
||||
#define cy_an_storage_create_p_partition(h, media, dev, \
|
||||
size, cb, client) \
|
||||
cy_as_storage_create_p_partition_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(media), (dev), \
|
||||
(size), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Remove partition on storage device */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_storage_remove_p_partition(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type media,
|
||||
uint32_t device,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client);
|
||||
#define cy_an_storage_remove_p_partition\
|
||||
(h, media, dev, cb, client) \
|
||||
cy_as_storage_remove_p_partition_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(media), (dev), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
#endif /*__doxygen__ */
|
||||
|
||||
#endif
|
|
@ -1,35 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyastioch.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANTIOCH_H_
|
||||
#define _INCLUDED_CYANTIOCH_H_
|
||||
|
||||
#if !defined(__doxygen__)
|
||||
|
||||
#include "cyanerr.h"
|
||||
#include "cyanmisc.h"
|
||||
#include "cyanstorage.h"
|
||||
#include "cyanusb.h"
|
||||
#include "cyanch9.h"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,31 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyantypes.h)
|
||||
## Type definitions for backward compatibility with previous
|
||||
## Antioch SDK releases.
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANTYPES_H_
|
||||
#define _INCLUDED_CYANTYPES_H_
|
||||
|
||||
#include "cyastypes.h"
|
||||
typedef cy_as_end_point_number_t cy_an_end_point_number_t;
|
||||
typedef cy_as_return_status_t cy_an_return_status_t;
|
||||
typedef cy_as_bus_number_t cy_an_bus_number_t;
|
||||
#endif
|
|
@ -1,619 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyanusb.h)
|
||||
## Header for backward compatibility with previous Antioch SDK releases.
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYANUSB_H_
|
||||
#define _INCLUDED_CYANUSB_H_
|
||||
|
||||
#if !defined(__doxygen__)
|
||||
|
||||
#include "cyanmisc.h"
|
||||
#include "cyasusb.h"
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
#define CY_AN_MAX_USB_DESCRIPTOR_SIZE (CY_AS_MAX_USB_DESCRIPTOR_SIZE)
|
||||
|
||||
typedef cy_as_usb_inquiry_data_dep cy_an_usb_inquiry_data;
|
||||
typedef cy_as_usb_unknown_command_data_dep \
|
||||
cy_an_usb_unknown_command_data;
|
||||
typedef cy_as_usb_start_stop_data_dep cy_an_usb_start_stop_data;
|
||||
typedef cy_as_m_s_c_progress_data cy_an_m_s_c_progress_data;
|
||||
|
||||
#define cy_an_usb_nand_enum cy_as_usb_nand_enum
|
||||
#define cy_an_usb_sd_enum cy_as_usb_sd_enum
|
||||
#define cy_an_usb_mmc_enum cy_as_usb_mmc_enum
|
||||
#define cy_an_usb_ce_ata_enum cy_as_usb_ce_ata_enum
|
||||
typedef cy_as_usb_mass_storage_enum cy_an_usb_mass_storage_enum;
|
||||
|
||||
#define cy_an_usb_desc_device cy_as_usb_desc_device
|
||||
#define cy_an_usb_desc_device_qual cy_as_usb_desc_device_qual
|
||||
#define cy_an_usb_desc_f_s_configuration \
|
||||
cy_as_usb_desc_f_s_configuration
|
||||
#define cy_an_usb_desc_h_s_configuration \
|
||||
cy_as_usb_desc_h_s_configuration
|
||||
#define cy_an_usb_desc_string cy_as_usb_desc_string
|
||||
typedef cy_as_usb_desc_type cy_an_usb_desc_type;
|
||||
|
||||
#define cy_an_usb_in cy_as_usb_in
|
||||
#define cy_an_usb_out cy_as_usb_out
|
||||
#define cy_an_usb_in_out cy_as_usb_in_out
|
||||
typedef cy_as_usb_end_point_dir cy_an_usb_end_point_dir;
|
||||
|
||||
|
||||
#define cy_an_usb_control cy_as_usb_control
|
||||
#define cy_an_usb_iso cy_as_usb_iso
|
||||
#define cy_an_usb_bulk cy_as_usb_bulk
|
||||
#define cy_an_usb_int cy_as_usb_int
|
||||
typedef cy_as_usb_end_point_type cy_an_usb_end_point_type;
|
||||
|
||||
|
||||
typedef cy_as_usb_enum_control_dep cy_an_usb_enum_control;
|
||||
typedef cy_as_usb_end_point_config cy_an_usb_end_point_config;
|
||||
|
||||
#define cy_an_usb_m_s_unit0 cy_as_usb_m_s_unit0
|
||||
#define cy_an_usb_m_s_unit1 cy_as_usb_m_s_unit1
|
||||
#define cy_an_usb_m_s_both cy_as_usb_m_s_both
|
||||
typedef cy_as_usb_m_s_type_t cy_an_usb_m_s_type_t;
|
||||
|
||||
#define cy_an_event_usb_suspend cy_as_event_usb_suspend
|
||||
#define cy_an_event_usb_resume cy_as_event_usb_resume
|
||||
#define cy_an_event_usb_reset cy_as_event_usb_reset
|
||||
#define cy_an_event_usb_set_config cy_as_event_usb_set_config
|
||||
#define cy_an_event_usb_speed_change cy_as_event_usb_speed_change
|
||||
#define cy_an_event_usb_setup_packet cy_as_event_usb_setup_packet
|
||||
#define cy_an_event_usb_status_packet cy_as_event_usb_status_packet
|
||||
#define cy_an_event_usb_inquiry_before cy_as_event_usb_inquiry_before
|
||||
#define cy_an_event_usb_inquiry_after cy_as_event_usb_inquiry_after
|
||||
#define cy_an_event_usb_start_stop cy_as_event_usb_start_stop
|
||||
#define cy_an_event_usb_unknown_storage cy_as_event_usb_unknown_storage
|
||||
#define cy_an_event_usb_m_s_c_progress cy_as_event_usb_m_s_c_progress
|
||||
typedef cy_as_usb_event cy_an_usb_event;
|
||||
|
||||
typedef cy_as_usb_event_callback_dep cy_an_usb_event_callback;
|
||||
|
||||
typedef cy_as_usb_io_callback cy_an_usb_io_callback;
|
||||
typedef cy_as_usb_function_callback cy_an_usb_function_callback;
|
||||
|
||||
/******* USB Functions ********************/
|
||||
|
||||
/* Sync Usb Start */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_start(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_usb_start(handle) \
|
||||
cy_as_usb_start((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/*Async Usb Start */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_start_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_start_e_x(h, cb, client) \
|
||||
cy_as_usb_start((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync Usb Stop */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_stop(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_usb_stop(handle) \
|
||||
cy_as_usb_stop((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/*Async Usb Stop */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_stop_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_stop_e_x(h, cb, client) \
|
||||
cy_as_usb_stop((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Register USB event callback */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_register_callback(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_event_callback callback
|
||||
);
|
||||
#define cy_an_usb_register_callback(h, cb) \
|
||||
cy_as_usb_register_callback_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_usb_event_callback_dep)(cb))
|
||||
|
||||
/*Sync Usb connect */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_connect(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_usb_connect(handle) \
|
||||
cy_as_usb_connect((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/*Async Usb connect */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_connect_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_connect_e_x(h, cb, client) \
|
||||
cy_as_usb_connect((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/*Sync Usb disconnect */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_disconnect(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_usb_disconnect(handle) \
|
||||
cy_as_usb_disconnect((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/*Async Usb disconnect */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_disconnect_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_disconnect_e_x(h, cb, client) \
|
||||
cy_as_usb_disconnect((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of set enum config */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_set_enum_config(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_enum_control *config_p
|
||||
);
|
||||
#define cy_an_usb_set_enum_config(handle, config_p) \
|
||||
cy_as_usb_set_enum_config_dep((cy_as_device_handle)(handle), \
|
||||
(cy_as_usb_enum_control_dep *)(config_p), 0, 0)
|
||||
|
||||
/* Async version of set enum config */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_set_enum_config_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_enum_control *config_p,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_set_enum_config_e_x(h, config_p, cb, client) \
|
||||
cy_as_usb_set_enum_config_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_usb_enum_control_dep *)(config_p), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of get enum config */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_get_enum_config(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_enum_control *config_p
|
||||
);
|
||||
#define cy_an_usb_get_enum_config(handle, config_p) \
|
||||
cy_as_usb_get_enum_config_dep((cy_as_device_handle)(handle), \
|
||||
(cy_as_usb_enum_control_dep *)(config_p), 0, 0)
|
||||
|
||||
/* Async version of get enum config */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_get_enum_config_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_enum_control *config_p,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_get_enum_config_e_x(h, config_p, cb, client) \
|
||||
cy_as_usb_get_enum_config_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_usb_enum_control_dep *)(config_p), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync Version of Set descriptor */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_set_descriptor(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_desc_type type,
|
||||
uint8_t index,
|
||||
void *desc_p,
|
||||
uint16_t length
|
||||
);
|
||||
#define cy_an_usb_set_descriptor(handle, type, index, desc_p, length) \
|
||||
cy_as_usb_set_descriptor((cy_as_device_handle)(handle), \
|
||||
(cy_as_usb_desc_type)(type), (index), (desc_p), (length), 0, 0)
|
||||
|
||||
/* Async Version of Set descriptor */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_set_descriptor_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_desc_type type,
|
||||
uint8_t index,
|
||||
void *desc_p,
|
||||
uint16_t length,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_set_descriptor_e_x\
|
||||
(h, type, index, desc_p, length, cb, client) \
|
||||
cy_as_usb_set_descriptor((cy_as_device_handle)(h), \
|
||||
(cy_as_usb_desc_type)(type), (index), (desc_p), (length), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Only version of clear descriptors */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_clear_descriptors(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_clear_descriptors(h, cb, client) \
|
||||
cy_as_usb_clear_descriptors((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of get descriptor*/
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_get_descriptor(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_desc_type type,
|
||||
uint8_t index,
|
||||
void *desc_p,
|
||||
uint32_t *length_p
|
||||
);
|
||||
#define cy_an_usb_get_descriptor(h, type, index, desc_p, length_p) \
|
||||
cy_as_usb_get_descriptor_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_usb_desc_type)(type), (index), (desc_p), (length_p))
|
||||
|
||||
typedef cy_as_get_descriptor_data cy_an_get_descriptor_data;
|
||||
|
||||
/* Async version of get descriptor */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_get_descriptor_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_usb_desc_type type,
|
||||
uint8_t index,
|
||||
cy_an_get_descriptor_data *data,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_get_descriptor_e_x\
|
||||
(h, type, index, data, cb, client) \
|
||||
cy_as_usb_get_descriptor((cy_as_device_handle)(h), \
|
||||
(cy_as_usb_desc_type)(type), (index), \
|
||||
(cy_as_get_descriptor_data *)(data), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_set_physical_configuration(
|
||||
cy_an_device_handle handle,
|
||||
uint8_t config
|
||||
);
|
||||
#define cy_an_usb_set_physical_configuration(h, config) \
|
||||
cy_as_usb_set_physical_configuration\
|
||||
((cy_as_device_handle)(h), (config))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_set_end_point_config(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_usb_end_point_config *config_p
|
||||
);
|
||||
#define cy_an_usb_set_end_point_config(h, ep, config_p) \
|
||||
cy_as_usb_set_end_point_config((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_usb_end_point_config *)(config_p))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_get_end_point_config(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_usb_end_point_config *config_p
|
||||
);
|
||||
#define cy_an_usb_get_end_point_config(h, ep, config_p) \
|
||||
cy_as_usb_get_end_point_config((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_usb_end_point_config *)(config_p))
|
||||
|
||||
/* Sync version of commit */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_commit_config(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_usb_commit_config(handle) \
|
||||
cy_as_usb_commit_config((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/* Async version of commit */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_commit_config_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_commit_config_e_x(h, cb, client) \
|
||||
cy_as_usb_commit_config((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_read_data(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_bool pktread,
|
||||
uint32_t dsize,
|
||||
uint32_t *dataread,
|
||||
void *data
|
||||
);
|
||||
#define cy_an_usb_read_data(h, ep, pkt, dsize, dataread, data_p) \
|
||||
cy_as_usb_read_data((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), (pkt), (dsize), \
|
||||
(dataread), (data_p))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_read_data_async(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_bool pktread,
|
||||
uint32_t dsize,
|
||||
void *data,
|
||||
cy_an_usb_io_callback callback
|
||||
);
|
||||
#define cy_an_usb_read_data_async(h, ep, pkt, dsize, data_p, cb) \
|
||||
cy_as_usb_read_data_async((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), (pkt), (dsize), (data_p), \
|
||||
(cy_as_usb_io_callback)(cb))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_write_data(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
uint32_t dsize,
|
||||
void *data
|
||||
);
|
||||
#define cy_an_usb_write_data(h, ep, dsize, data_p) \
|
||||
cy_as_usb_write_data((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), (dsize), (data_p))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_write_data_async(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
uint32_t dsize,
|
||||
void *data,
|
||||
cy_bool spacket,
|
||||
cy_an_usb_io_callback callback
|
||||
);
|
||||
#define cy_an_usb_write_data_async(h, ep, dsize, data_p, spacket, cb) \
|
||||
cy_as_usb_write_data_async((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), (dsize), (data_p), (spacket), \
|
||||
(cy_as_usb_io_callback)(cb))
|
||||
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_cancel_async(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep
|
||||
);
|
||||
#define cy_an_usb_cancel_async(h, ep) \
|
||||
cy_as_usb_cancel_async((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep))
|
||||
|
||||
/* Sync version of set stall */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_set_stall(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_usb_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_set_stall(h, ep, cb, client) \
|
||||
cy_as_usb_set_stall_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_usb_function_callback)(cb), (client))
|
||||
|
||||
/* Async version of set stall */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_set_stall_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_set_stall_e_x(h, ep, cb, client) \
|
||||
cy_as_usb_set_stall((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/*Sync version of clear stall */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_clear_stall(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_usb_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_clear_stall(h, ep, cb, client) \
|
||||
cy_as_usb_clear_stall_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_usb_function_callback)(cb), (client))
|
||||
|
||||
/*Sync version of clear stall */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_clear_stall_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_clear_stall_e_x(h, ep, cb, client) \
|
||||
cy_as_usb_clear_stall((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync get stall */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_get_stall(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_bool *stall_p
|
||||
);
|
||||
#define cy_an_usb_get_stall(handle, ep, stall_p) \
|
||||
cy_as_usb_get_stall((cy_as_device_handle)(handle), \
|
||||
(cy_as_end_point_number_t)(ep), (stall_p), 0, 0)
|
||||
|
||||
/* Async get stall */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_get_stall_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_bool *stall_p,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_get_stall_e_x(h, ep, stall_p, cb, client) \
|
||||
cy_as_usb_get_stall((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), (stall_p), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of Set Nak */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_set_nak(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_usb_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
#define cy_an_usb_set_nak(h, ep, cb, client) \
|
||||
cy_as_usb_set_nak_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_usb_function_callback)(cb), (client))
|
||||
|
||||
/* Async version of Set Nak */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_set_nak_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_set_nak_e_x(h, ep, cb, client) \
|
||||
cy_as_usb_set_nak((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of clear nak */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_clear_nak(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_usb_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_clear_nak(h, ep, cb, client) \
|
||||
cy_as_usb_clear_nak_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_usb_function_callback)(cb), (client))
|
||||
|
||||
/* Sync version of clear nak */
|
||||
extern cy_an_return_status_t
|
||||
cy_an_usb_clear_nak_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_clear_nak_e_x(h, ep, cb, client) \
|
||||
cy_as_usb_clear_nak((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync Get NAK */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_get_nak(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_bool *nak_p
|
||||
);
|
||||
#define cy_an_usb_get_nak(handle, ep, nak_p) \
|
||||
cy_as_usb_get_nak((cy_as_device_handle)(handle), \
|
||||
(cy_as_end_point_number_t)(ep), (nak_p), 0, 0)
|
||||
|
||||
/* Async Get NAK */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_get_nak_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_end_point_number_t ep,
|
||||
cy_bool *nak_p,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_get_nak_e_x(h, ep, nak_p, cb, client) \
|
||||
cy_as_usb_get_nak((cy_as_device_handle)(h), \
|
||||
(cy_as_end_point_number_t)(ep), (nak_p), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Sync remote wakup */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_signal_remote_wakeup(
|
||||
cy_an_device_handle handle
|
||||
);
|
||||
#define cy_an_usb_signal_remote_wakeup(handle) \
|
||||
cy_as_usb_signal_remote_wakeup((cy_as_device_handle)(handle), 0, 0)
|
||||
|
||||
/* Async remote wakup */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_signal_remote_wakeup_e_x(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_signal_remote_wakeup_e_x(h, cb, client) \
|
||||
cy_as_usb_signal_remote_wakeup((cy_as_device_handle)(h), \
|
||||
(cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Only version of SetMSReportThreshold */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_set_m_s_report_threshold(
|
||||
cy_an_device_handle handle,
|
||||
uint32_t wr_sectors,
|
||||
uint32_t rd_sectors,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_set_m_s_report_threshold\
|
||||
(h, wr_cnt, rd_cnt, cb, client) \
|
||||
cy_as_usb_set_m_s_report_threshold((cy_as_device_handle)(h), \
|
||||
wr_cnt, rd_cnt, (cy_as_function_callback)(cb), (client))
|
||||
|
||||
/* Select storage partitions to be enumerated. */
|
||||
EXTERN cy_an_return_status_t
|
||||
cy_an_usb_select_m_s_partitions(
|
||||
cy_an_device_handle handle,
|
||||
cy_an_media_type media,
|
||||
uint32_t device,
|
||||
cy_an_usb_m_s_type_t type,
|
||||
cy_an_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
#define cy_an_usb_select_m_s_partitions(h, media, dev, type, cb, client) \
|
||||
cy_as_usb_select_m_s_partitions_dep((cy_as_device_handle)(h), \
|
||||
(cy_as_media_type)(media), (dev), \
|
||||
(cy_as_usb_m_s_type_t)(type), (cy_as_function_callback)(cb), (client))
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
#endif /*__doxygen__*/
|
||||
#endif /*_INCLUDED_CYANUSB_H_*/
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* This file is included at the end of other include files.
|
||||
* It basically turns off the C++ specific code words that
|
||||
* insure this code is seen as C code even within
|
||||
* a C++ compiler.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* This file is included after all other headers files, but before any other
|
||||
* definitions in the file. It basically insures that the definitions within
|
||||
* the file are seen as C defintions even when compiled by a C++ compiler.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif
|
|
@ -1,35 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyascast.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASCAST_H_
|
||||
#define _INCLUDED_CYASCAST_H_
|
||||
|
||||
#ifndef __doxygen__
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define cy_cast_int2U_int16(v) \
|
||||
(cy_as_hal_assert(v < 65536), (uint16_t)(v))
|
||||
#else /* _DEBUG */
|
||||
#define cy_cast_int2U_int16(v) ((uint16_t)(v))
|
||||
#endif /* _DEBUG */
|
||||
|
||||
#endif /* __doxygen__ */
|
||||
#endif /* _INCLUDED_CYASCAST_H_ */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,375 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyasdma.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASDMA_H_
|
||||
#define _INCLUDED_CYASDMA_H_
|
||||
|
||||
#include "cyashal.h"
|
||||
#include "cyasdevice.h"
|
||||
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
|
||||
/*@@DMA Overview
|
||||
This module manages the DMA operations to/from the West Bridge
|
||||
device. The DMA module maintains a DMA queue for each endpoint
|
||||
so multiple DMA requests may be queued and they will complete
|
||||
at some future time.
|
||||
|
||||
The DMA module must be started before it can be used. It is
|
||||
started by calling CyAsDmaStart(). This function initializes
|
||||
all of the endpoint data structures.
|
||||
|
||||
In order to perform DMA on a particular endpoint, the endpoint
|
||||
must be enabled by calling CyAsDmaEnableEndPoint(). In addition
|
||||
to enabling or disabling the endpoint, this function also sets
|
||||
the direction for a given endpoint. Direction is given in USB
|
||||
terms. For P port to West Bridge traffic, the endpoint is a
|
||||
CyAsDirectionIn endpoint. For West Bridge to P port traffic,
|
||||
the endpoint is a CyAsDirectionOut endpoint.
|
||||
|
||||
Once DMA is started and an endpoint is enabled, DMA requests
|
||||
are issued by calling CyAsDmaQueueRequest(). This function
|
||||
queue either a DMA read or DMA write request. The callback
|
||||
associated with the request is called once the request has been
|
||||
fulfilled.
|
||||
|
||||
See Also
|
||||
* CyAsDmaStart
|
||||
* CyAsDmaEnableEndPoint
|
||||
* CyAsDmaDirection
|
||||
* CyAsDmaQueueRequest
|
||||
*/
|
||||
|
||||
/************************
|
||||
* West Bridge Constants
|
||||
************************/
|
||||
#define CY_AS_DMA_MAX_SIZE_HW_SIZE (0xffffffff)
|
||||
|
||||
/************************
|
||||
* West Bridge Data Structures
|
||||
************************/
|
||||
|
||||
/* Summary
|
||||
This type specifies the direction of an endpoint to the
|
||||
CyAsDmaEnableEndPoint function.
|
||||
|
||||
Description
|
||||
When an endpoint is enabled, the direction of the endpoint
|
||||
can also be set. This type is used to specify the endpoint
|
||||
type. Note that the direction is specified in USB terms.
|
||||
Therefore, if the DMA is from the P port to West Bridge,
|
||||
the direction is IN.
|
||||
|
||||
See Also
|
||||
* CyAsDmaEnableEndPoint
|
||||
*/
|
||||
typedef enum cy_as_dma_direction {
|
||||
/* Set the endpoint to type IN (P -> West Bridge) */
|
||||
cy_as_direction_in = 0,
|
||||
/* Set the endpoint to type OUT (West Bridge -> P) */
|
||||
cy_as_direction_out = 1,
|
||||
/* Only valid for EP 0 */
|
||||
cy_as_direction_in_out = 2,
|
||||
/* Do no change the endpoint type */
|
||||
cy_as_direction_dont_change = 3
|
||||
} cy_as_dma_direction;
|
||||
|
||||
/*********************************
|
||||
* West Bridge Functions
|
||||
*********************************/
|
||||
|
||||
/* Summary
|
||||
Initialize the DMA module and ready the module for receiving data
|
||||
|
||||
Description
|
||||
This function initializes the DMA module by initializing all of
|
||||
the endpoint data structures associated with the device given.
|
||||
This function also register a DMA complete callback with the HAL
|
||||
DMA code. This callback is called whenever the HAL DMA subsystem
|
||||
completes a requested DMA operation.
|
||||
|
||||
Returns
|
||||
CY_AS_ERROR_SUCCESS - the module initialized successfully
|
||||
CY_AS_ERROR_OUT_OF_MEMORY - memory allocation failed during
|
||||
initialization
|
||||
CY_AS_ERROR_ALREADY_RUNNING - the DMA module was already running
|
||||
|
||||
See Also
|
||||
* CyAsDmaStop
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_start(
|
||||
/* The device to start */
|
||||
cy_as_device *dev_p
|
||||
);
|
||||
|
||||
/* Summary
|
||||
Shutdown the DMA module
|
||||
|
||||
Description
|
||||
This function shuts down the DMA module for this device by
|
||||
canceling any DMA requests associated with each endpoint and
|
||||
then freeing the resources associated with each DMA endpoint.
|
||||
|
||||
Returns
|
||||
CY_AS_ERROR_SUCCESS - the module shutdown successfully
|
||||
CY_AS_ERROR_NOT_RUNNING - the DMA module was not running
|
||||
|
||||
See Also
|
||||
* CyAsDmaStart
|
||||
* CyAsDmaCancel
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_stop(
|
||||
/* The device to stop */
|
||||
cy_as_device *dev_p
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function cancels all outstanding DMA requests on a given endpoint
|
||||
|
||||
Description
|
||||
This function cancels any DMA requests outstanding on a given endpoint
|
||||
by disabling the transfer of DMA requests from the queue to the HAL
|
||||
layer and then removing any pending DMA requests from the queue. The
|
||||
callback associated with any DMA requests that are being removed is
|
||||
called with an error code of CY_AS_ERROR_CANCELED.
|
||||
|
||||
Notes
|
||||
If a request has already been sent to the HAL layer it will be
|
||||
completed and not canceled. Only requests that have not been sent to
|
||||
the HAL layer will be cancelled.
|
||||
|
||||
Returns
|
||||
CY_AS_ERROR_SUCCESS - the traffic on the endpoint is canceled
|
||||
successfully
|
||||
|
||||
See Also
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_cancel(
|
||||
/* The device of interest */
|
||||
cy_as_device *dev_p,
|
||||
/* The endpoint to cancel */
|
||||
cy_as_end_point_number_t ep,
|
||||
cy_as_return_status_t err
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function enables a single endpoint for DMA operations
|
||||
|
||||
Description
|
||||
In order to enable the queuing of DMA requests on a given
|
||||
endpoint, the endpoint must be enabled for DMA. This function
|
||||
enables a given endpoint. In addition, this function sets the
|
||||
direction of the DMA operation.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_INVALID_ENDPOINT - invalid endpoint number
|
||||
* CY_AS_ERROR_SUCCESS - endpoint was enabled or disabled
|
||||
* successfully
|
||||
|
||||
See Also
|
||||
* CyAsDmaQueueRequest
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_enable_end_point(
|
||||
/* The device of interest */
|
||||
cy_as_device *dev_p,
|
||||
/* The endpoint to enable or disable */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* CyTrue to enable, CyFalse to disable */
|
||||
cy_bool enable,
|
||||
/* The direction of the endpoint */
|
||||
cy_as_dma_direction dir
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function queue a DMA request for a given endpoint
|
||||
|
||||
Description
|
||||
When an West Bridge API module wishes to do a DMA operation,
|
||||
this function is called on the associated endpoint to queue
|
||||
a DMA request. When the DMA request has been fulfilled, the
|
||||
callback associated with the DMA operation is called.
|
||||
|
||||
Notes
|
||||
The buffer associated with the DMA request, must remain valid
|
||||
until after the callback function is calld.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS - the DMA operation was queued successfully
|
||||
* CY_AS_ERROR_INVALID_ENDPOINT - the endpoint number was invalid
|
||||
* CY_AS_ERROR_ENDPOINT_DISABLED - the endpoint was disabled
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY - out of memory processing the request
|
||||
|
||||
See Also
|
||||
* CyAsDmaEnableEndPoint
|
||||
* CyAsDmaCancel
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_queue_request(
|
||||
/* The device of interest */
|
||||
cy_as_device *dev_p,
|
||||
/* The endpoint to receive a new request */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The memory buffer for the DMA request -
|
||||
* must be valid until after the callback has been called */
|
||||
void *mem_p,
|
||||
/* The size of the DMA request in bytes */
|
||||
uint32_t size,
|
||||
/* If true and a DMA read request, return the next packet
|
||||
* regardless of size */
|
||||
cy_bool packet,
|
||||
/* If true, this is a read request,
|
||||
* otherwise it is a write request */
|
||||
cy_bool readreq,
|
||||
/* The callback to call when the DMA request is complete,
|
||||
* either successfully or via an error */
|
||||
cy_as_dma_callback cb
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function waits until all DMA requests on a given endpoint
|
||||
have been processed and then return
|
||||
|
||||
Description
|
||||
There are times when a module in the West Bridge API needs to
|
||||
wait until the DMA operations have been queued. This function
|
||||
sleeps until all DMA requests have been fulfilled and only then
|
||||
returns to the caller.
|
||||
|
||||
Notes
|
||||
I don't think we will need a list of sleeping clients to support
|
||||
multiple parallel client modules sleeping on a single endpoint,
|
||||
but if we do instead of having a single sleep channel in the
|
||||
endpoint, each client will have to supply a sleep channel and we
|
||||
will have to maintain a list of sleep channels to wake.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS - the queue has drained successfully
|
||||
* CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given is not valid
|
||||
* CY_AS_ERROR_NESTED_SLEEP - CyAsDmaQueueRequest() was requested
|
||||
* on an endpoint where CyAsDmaQueueRequest was already called
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_drain_queue(
|
||||
/* The device of interest */
|
||||
cy_as_device *dev_p,
|
||||
/* The endpoint to drain */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* If CyTrue, call kickstart to start the DMA process,
|
||||
if cy_false, west bridge will start the DMA process */
|
||||
cy_bool kickstart
|
||||
);
|
||||
|
||||
/* Summary
|
||||
Sets the maximum amount of data West Bridge can accept in a single
|
||||
DMA Operation for the given endpoint
|
||||
|
||||
Description
|
||||
Depending on the configuration of the West Bridge device endpoint,
|
||||
the amount of data that can be accepted varies. This function
|
||||
sets the maximum amount of data West Bridge can accept in a single
|
||||
DMA operation. The value is stored with the endpoint and passed
|
||||
to the HAL layer in the CyAsHalDmaSetupWrite() and
|
||||
CyAsHalDmaSetupRead() functoins.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS - the value was set successfully
|
||||
* CY_AS_ERROR_INVALID_SIZE - the size value was not valid
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_set_max_dma_size(
|
||||
/* The device of interest */
|
||||
cy_as_device *dev_p,
|
||||
/* The endpoint to change */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The max size of this endpoint in bytes */
|
||||
uint32_t size
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function starts the DMA process on a given channel.
|
||||
|
||||
Description
|
||||
When transferring data from the P port processor to West
|
||||
Bridge, the DMA operation must be initiated P Port software
|
||||
for the first transfer. Subsequent transferrs will be
|
||||
handled at the interrupt level.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_kick_start(
|
||||
/* The device of interest */
|
||||
cy_as_device *dev_p,
|
||||
/* The endpoint to change */
|
||||
cy_as_end_point_number_t ep
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function receives endpoint data from a request.
|
||||
|
||||
Description
|
||||
For endpoint 0 and 1 the endpoint data is transferred from
|
||||
the West Bridge device to the DMA via a lowlevel
|
||||
requests (via the mailbox registers).
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_dma_received_data(
|
||||
/* The device of interest */
|
||||
cy_as_device *dev_p,
|
||||
/* The endpoint that received data */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The data size */
|
||||
uint32_t dsize,
|
||||
/* The data buffer */
|
||||
void *data
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function is called when the DMA operation on
|
||||
an endpoint has been completed.
|
||||
|
||||
Returns
|
||||
* void
|
||||
*/
|
||||
extern void
|
||||
cy_as_dma_completed_callback(
|
||||
/* Tag to HAL completing the DMA operation. */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* Endpoint on which DMA has been completed. */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* Length of data received. */
|
||||
uint32_t length,
|
||||
/* Status of DMA operation. */
|
||||
cy_as_return_status_t status
|
||||
);
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
|
||||
#endif /* _INCLUDED_CYASDMA_H_ */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,108 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyashal.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASHAL_H_
|
||||
#define _INCLUDED_CYASHAL_H_
|
||||
|
||||
#if !defined(__doxygen__)
|
||||
|
||||
/* The possible HAL layers defined and implemented by Cypress */
|
||||
|
||||
#ifdef __CY_ASTORIA_FPGA_HAL__
|
||||
#ifdef CY_HAL_DEFINED
|
||||
#error only one HAL layer can be defined
|
||||
#endif
|
||||
|
||||
#define CY_HAL_DEFINED
|
||||
|
||||
#include "cyashalfpga.h"
|
||||
#endif
|
||||
|
||||
/***** SCM User space HAL ****/
|
||||
#ifdef __CY_ASTORIA_SCM_HAL__
|
||||
#ifdef CY_HAL_DEFINED
|
||||
#error only one HAL layer can be defined
|
||||
#endif
|
||||
|
||||
#define CY_HAL_DEFINEDŚŚ
|
||||
|
||||
#include "cyanhalscm.h"
|
||||
#endif
|
||||
/***** SCM User space HAL ****/
|
||||
|
||||
/***** SCM Kernel HAL ****/
|
||||
#ifdef __CY_ASTORIA_SCM_KERNEL_HAL__
|
||||
#ifdef CY_HAL_DEFINED
|
||||
#error only one HAL layer can be defined
|
||||
#endif
|
||||
|
||||
#define CY_HAL_DEFINEDŚ
|
||||
|
||||
#include "cyanhalscm_kernel.h"
|
||||
#endif
|
||||
/***** SCM Kernel HAL ****/
|
||||
|
||||
/***** OMAP5912 Kernel HAL ****/
|
||||
#ifdef __CY_ASTORIA_OMAP_5912_KERNEL_HAL__
|
||||
#ifdef CY_HAL_DEFINED
|
||||
#error only one HAL layer can be defined
|
||||
#endif
|
||||
|
||||
#define CY_HAL_DEFINED
|
||||
|
||||
#include "cyanhalomap_kernel.h"
|
||||
#endif
|
||||
/***** eof OMAP5912 Kernel HAL ****/
|
||||
|
||||
|
||||
|
||||
/***** OMAP3430 Kernel HAL ****/
|
||||
#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
|
||||
|
||||
#ifdef CY_HAL_DEFINED
|
||||
#error only one HAL layer can be defined
|
||||
#endif
|
||||
|
||||
#define CY_HAL_DEFINED
|
||||
/* moved to staging location, eventual implementation
|
||||
* considered is here
|
||||
* #include mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h>
|
||||
*/
|
||||
#include "../../../arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h"
|
||||
|
||||
#endif
|
||||
/*****************************/
|
||||
|
||||
|
||||
/******/
|
||||
#ifdef __CY_ASTORIA_CUSTOMER_HAL__
|
||||
#ifdef CY_HAL_DEFINED
|
||||
#error only one HAL layer can be defined
|
||||
#endif
|
||||
br
|
||||
#define CY_HAL_DEFINED
|
||||
#include "cyashal_customer.h"
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __doxygen__ */
|
||||
|
||||
#endif /* _INCLUDED_CYASHAL_H_ */
|
|
@ -1,44 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyashalcb.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASHALCB_H_
|
||||
#define _INCLUDED_CYASHALCB_H_
|
||||
|
||||
/* Summary
|
||||
This type defines a callback function type called when a
|
||||
DMA operation has completed.
|
||||
|
||||
Description
|
||||
|
||||
See Also
|
||||
* CyAsHalDmaRegisterCallback
|
||||
* CyAsHalDmaSetupWrite
|
||||
* CyAsHalDmaSetupRead
|
||||
*/
|
||||
typedef void (*cy_as_hal_dma_complete_callback)(
|
||||
cy_as_hal_device_tag tag,
|
||||
cy_as_end_point_number_t ep,
|
||||
uint32_t cnt,
|
||||
cy_as_return_status_t ret);
|
||||
|
||||
typedef cy_as_hal_dma_complete_callback \
|
||||
cy_an_hal_dma_complete_callback;
|
||||
#endif
|
|
@ -1,800 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyashaldoc.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASHALDOC_H_
|
||||
#define _INCLUDED_CYASHALDOC_H_
|
||||
|
||||
#include "cyashaldef.h"
|
||||
|
||||
/*@@Hardware Abstraction Layer (HAL)
|
||||
Summary
|
||||
This software module is supplied by the user of the West Bridge
|
||||
API. This module contains the software that is specific to the
|
||||
hardware implementation or operating system of the client
|
||||
system.
|
||||
|
||||
* Sleep Channels *
|
||||
A sleep channel is a operating system object that provides that
|
||||
capability for one thread or process to sleep while waiting on
|
||||
the completion of some hardware event. The hardware event is
|
||||
usually processed by a hardware interrupt and the interrupt
|
||||
handler then wakes the thread or process that is sleeping.
|
||||
|
||||
A sleep channel provides the mechanism for this operation. A
|
||||
sleep channel is created and initialized during the API
|
||||
initialization. When the API needs to wait for the hardware,
|
||||
the API performs a SleepOn() operation on the sleep channel.
|
||||
When hardware event occurs, an interrupt handler processes the
|
||||
event and then performs a Wake() operation on the sleep channel
|
||||
to wake the sleeping process or thread.
|
||||
|
||||
* DMA Model *
|
||||
When the West Bridge API needs to transfer USB or storage data
|
||||
to/from the West Bridge device, this is done using a "DMA"
|
||||
operation. In this context the term DMA is used loosely as the
|
||||
West Bridge API does not really care if the data is transferred
|
||||
using a burst read or write operation, or if the data is
|
||||
transferred using programmed I/O operations. When a "DMA"
|
||||
operation is needed, the West Bridge API calls either
|
||||
CyAsHalDmaSetupRead() or CyAsHalDmaSetupWrite() depending on the
|
||||
direction of the data flow. The West Bridge API expects the
|
||||
"DMA" operation requested in the call to be completed and the
|
||||
registered "DMA complete" callback to be called.
|
||||
|
||||
The West Bridge API looks at several factors to determine the
|
||||
size of the "DMA" request to pass to the HAL layer. First the
|
||||
West Bridge API calls CyAsHalDmaMaxRequestSize() to determine
|
||||
the maximum amount of data the HAL layer can accept for a "DMA"
|
||||
operation on the requested endpoint. The West Bridge API will
|
||||
never exceed this value in a "DMA" request to the HAL layer.
|
||||
The West Bridge API also sends the maximum amount of data the
|
||||
West Bridge device can accept as part of the "DMA" request. If
|
||||
the amount of data in the "DMA" request to the HAL layer
|
||||
exceeds the amount of data the West Bridge device can accept,
|
||||
it is expected that the HAL layer has the ability to break the
|
||||
request into multiple operations.
|
||||
|
||||
If the HAL implementation requires the API to handle the size
|
||||
of the "DMA" requests for one or more endpoints, the value
|
||||
CY_AS_DMA_MAX_SIZE_HW_SIZE can be returned from the
|
||||
CyAsHalDmaMaxRequestSize() call. In this case, the API assumes
|
||||
that the maximum size of each "DMA" request should be limited
|
||||
to the maximum that can be accepted by the endpoint in question.
|
||||
|
||||
Notes
|
||||
See the <install>/api/hal/scm_kernel/cyashalscm_kernel.c file
|
||||
for an example of how the DMA request size can be managed by
|
||||
the HAL implementation.
|
||||
|
||||
* Interrupt Handling *
|
||||
The HAL implementation is required to handle interrupts arriving
|
||||
from the West Bridge device, and call the appropriate handlers.
|
||||
If the interrupt arriving is one of PLLLOCKINT, PMINT, MBINT or
|
||||
MCUINT, the CyAsIntrServiceInterrupt API should be called to
|
||||
service the interrupt. If the interrupt arriving is DRQINT, the
|
||||
HAL should identify the endpoint corresponding to which the DRQ
|
||||
is being generated and perform the read/write transfer from the
|
||||
West Bridge. See the <install>/api/hal/scm_kernel/
|
||||
cyashalscm_kernel.c or <install>/api/hal/fpga/cyashalfpga.c
|
||||
reference HAL implementations for examples.
|
||||
|
||||
The HAL implementation can choose to poll the West Bridge
|
||||
interrupt status register instead of using interrupts. In this
|
||||
case, the polling has to be performed from a different thread/
|
||||
task than the one running the APIs. This is required because
|
||||
there are API calls that block on the reception of data from the
|
||||
West Bridge, which is delivered only through the interrupt
|
||||
handlers.
|
||||
|
||||
* Required Functions *
|
||||
This section defines the types and functions that must be
|
||||
supplied in order to provide a complete HAL layer for the
|
||||
West Bridge API.
|
||||
|
||||
Types that must be supplied:
|
||||
* CyAsHalSleepChannel
|
||||
|
||||
Hardware functions that must be supplied:
|
||||
* CyAsHalWriteRegister
|
||||
* CyAsHalReadRegister
|
||||
* CyAsHalDmaSetupWrite
|
||||
* CyAsHalDmaSetupRead
|
||||
* CyAsHalDmaCancelRequest
|
||||
* CyAsHalDmaRegisterCallback
|
||||
* CyAsHalDmaMaxRequestSize
|
||||
* CyAsHalSetWakeupPin
|
||||
* CyAsHalSyncDeviceClocks
|
||||
* CyAsHalInitDevRegisters
|
||||
* CyAsHalReadRegsBeforeStandby
|
||||
* CyAsHalRestoreRegsAfterStandby
|
||||
|
||||
Operating system functions that must be supplied:
|
||||
* CyAsHalAlloc
|
||||
* CyAsHalFree
|
||||
* CyAsHalCBAlloc
|
||||
* CyAsHalCBFree
|
||||
* CyAsHalMemSet
|
||||
* CyAsHalCreateSleepChannel
|
||||
* CyAsHalDestroySleepChannel
|
||||
* CyAsHalSleepOn
|
||||
* CyAsHalWake
|
||||
* CyAsHalDisableInterrupts
|
||||
* CyAsHalEnableInterrupts
|
||||
* CyAsHalSleep150
|
||||
* CyAsHalSleep
|
||||
* CyAsHalAssert
|
||||
* CyAsHalPrintMessage
|
||||
* CyAsHalIsPolling
|
||||
*/
|
||||
|
||||
/* Summary
|
||||
This is the type that represents a sleep channel
|
||||
|
||||
Description
|
||||
A sleep channel is an operating system object that, when a
|
||||
thread of control waits on the sleep channel, the thread
|
||||
sleeps until another thread signals the sleep object. This
|
||||
object is generally used when a high level API is called
|
||||
and must wait for a response that is supplied in an interrupt
|
||||
handler. The thread calling the API is put into a sleep
|
||||
state and when the reply arrives via the interrupt handler,
|
||||
the interrupt handler wakes the sleeping thread to indicate
|
||||
that the expect reply is available.
|
||||
*/
|
||||
typedef struct cy_as_hal_sleep_channel {
|
||||
/* This structure is filled in with OS specific information
|
||||
to implementat a sleep channel */
|
||||
int m_channel;
|
||||
} cy_as_hal_sleep_channel;
|
||||
|
||||
/* Summary
|
||||
This function is called to write a register value
|
||||
|
||||
Description
|
||||
This function is called to write a specific register to a
|
||||
specific value. The tag identifies the device of interest.
|
||||
The address is relative to the base address of the West
|
||||
Bridge device.
|
||||
|
||||
Returns
|
||||
Nothing
|
||||
|
||||
See Also
|
||||
* CyAsHalDeviceTag
|
||||
* CyAsHalReadRegister
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_write_register(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* The address we are writing to */
|
||||
uint16_t addr,
|
||||
/* The value to write to the register */
|
||||
uint16_t value
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function is called to read a register value
|
||||
|
||||
Description
|
||||
This function is called to read the contents of a specific
|
||||
register. The tag identifies the device of interest. The
|
||||
address is relative to the base address of the West Bridge
|
||||
device.
|
||||
|
||||
Returns
|
||||
Contents of the register
|
||||
|
||||
See Also
|
||||
* CyAsHalDeviceTag
|
||||
* CyAsHalWriteRegister
|
||||
*/
|
||||
EXTERN uint16_t
|
||||
cy_as_hal_read_register(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* The address we are writing to */
|
||||
uint16_t addr
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function initiates a DMA write operation to write
|
||||
to West Bridge
|
||||
|
||||
Description
|
||||
This function initiates a DMA write operation. The request
|
||||
size will not exceed the value the HAL layer returned via
|
||||
CyAsHalDmaMaxRequestSize(). This request size may exceed
|
||||
the size of what the West Bridge device will accept as on
|
||||
packet and the HAL layer may need to divide the request
|
||||
into multiple hardware DMA operations.
|
||||
|
||||
Returns
|
||||
None
|
||||
|
||||
See Also
|
||||
* CyAsHalDmaSetupRead
|
||||
* CyAsHalDmaMaxRequestSize
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_dma_setup_write(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* The endpoint we are writing to */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The data to write via DMA */
|
||||
void *buf_p,
|
||||
/* The size of the data at buf_p */
|
||||
uint32_t size,
|
||||
/* The maximum amount of data that the endpoint
|
||||
* can accept as one packet */
|
||||
uint16_t maxsize
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function initiates a DMA read operation from West Bridge
|
||||
|
||||
Description
|
||||
This function initiates a DMA read operation. The request
|
||||
size will not exceed the value the HAL layer returned via
|
||||
CyAsHalDmaMaxRequestSize(). This request size may exceed
|
||||
the size of what the Anitoch will accept as one packet and
|
||||
the HAL layer may need to divide the request into multiple
|
||||
hardware DMA operations.
|
||||
|
||||
Returns
|
||||
None
|
||||
|
||||
See Also
|
||||
* CyAsHalDmaSetupRead
|
||||
* CyAsHalDmaMaxRequestSize
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_dma_setup_read(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* The endpoint we are reading from */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The buffer to read data into */
|
||||
void *buf_p,
|
||||
/* The amount of data to read */
|
||||
uint32_t size,
|
||||
/* The maximum amount of data that the endpoint
|
||||
* can provide in one DMA operation */
|
||||
uint16_t maxsize
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function cancels a pending DMA request
|
||||
|
||||
Description
|
||||
This function cancels a pending DMA request that has been
|
||||
passed down to the hardware. The HAL layer can elect to
|
||||
physically cancel the request if possible, or just ignore
|
||||
the results of the request if it is not possible.
|
||||
|
||||
Returns
|
||||
None
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_dma_cancel_request(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* The endpoint we are reading from */
|
||||
cy_as_end_point_number_t ep
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function registers a callback function to be called when
|
||||
a DMA request is completed
|
||||
|
||||
Description
|
||||
This function registers a callback that is called when a request
|
||||
issued via CyAsHalDmaSetupWrite() or CyAsHalDmaSetupRead() has
|
||||
completed.
|
||||
|
||||
Returns
|
||||
None
|
||||
|
||||
See Also
|
||||
* CyAsHalDmaSetupWrite
|
||||
* CyAsHalDmaSetupRead
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_dma_register_callback(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* The callback to call when a request has completed */
|
||||
cy_as_hal_dma_complete_callback cb
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function returns the maximum size of a DMA request that can
|
||||
be handled by the HAL.
|
||||
|
||||
Description
|
||||
When DMA requests are passed to the HAL layer for processing,
|
||||
the HAL layer may have a limit on the size of the request that
|
||||
can be handled. This function is called by the DMA manager for
|
||||
an endpoint when DMA is enabled to get the maximum size of data
|
||||
the HAL layer can handle. The DMA manager insures that a request
|
||||
is never sent to the HAL layer that exceeds the size returned by
|
||||
this function.
|
||||
|
||||
Returns
|
||||
the maximum size of DMA request the HAL layer can handle
|
||||
*/
|
||||
EXTERN uint32_t
|
||||
cy_as_hal_dma_max_request_size(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* The endpoint of interest */
|
||||
cy_as_end_point_number_t ep
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function sets the WAKEUP pin to a specific state on the
|
||||
West Bridge device.
|
||||
|
||||
Description
|
||||
In order to enter the standby mode, the WAKEUP pin must be
|
||||
de-asserted. In order to resume from standby mode, the WAKEUP
|
||||
pin must be asserted. This function provides the mechanism to
|
||||
do this.
|
||||
|
||||
Returns
|
||||
1 if the pin was changed, 0 if the HAL layer does not support
|
||||
changing this pin
|
||||
*/
|
||||
EXTERN uint32_t
|
||||
cy_as_hal_set_wakeup_pin(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* The desired state of the wakeup pin */
|
||||
cy_bool state
|
||||
);
|
||||
|
||||
/* Summary
|
||||
Synchronise the West Bridge device clocks to re-establish device
|
||||
connectivity.
|
||||
|
||||
Description
|
||||
When the Astoria bridge device is working in SPI mode, a long
|
||||
period of inactivity can cause a loss of serial synchronisation
|
||||
between the processor and Astoria. This function is called by
|
||||
the API when it detects such a condition, and is expected to take
|
||||
the action required to re-establish clock synchronisation between
|
||||
the devices.
|
||||
|
||||
Returns
|
||||
CyTrue if the attempt to re-synchronise is successful,
|
||||
CyFalse if not.
|
||||
*/
|
||||
EXTERN cy_bool
|
||||
cy_as_hal_sync_device_clocks(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
);
|
||||
|
||||
/* Summary
|
||||
Initialize West Bridge device registers that may have been
|
||||
modified while the device was in standby.
|
||||
|
||||
Description
|
||||
The content of some West Bridge registers may be lost when
|
||||
the device is placed in standby mode. This function restores
|
||||
these register contents so that the device can continue to
|
||||
function normally after it wakes up from standby mode.
|
||||
|
||||
This function is required to perform operations only when the
|
||||
API is being used with the Astoria device in one of the PNAND
|
||||
modes or in the PSPI mode. It can be a no-operation in all
|
||||
other cases.
|
||||
|
||||
Returns
|
||||
None
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_init_dev_registers(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag,
|
||||
/* Indicates whether this is a wake-up from standby. */
|
||||
cy_bool is_standby_wakeup
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function reads a set of P-port accessible device registers and
|
||||
stores their value for later use.
|
||||
|
||||
Description
|
||||
The West Bridge Astoria device silicon has a known problem when
|
||||
operating in SPI mode on the P-port, where some of the device
|
||||
registers lose their value when the device goes in and out of
|
||||
standby mode. The suggested work-around is to reset the Astoria
|
||||
device as part of the wakeup procedure from standby.
|
||||
|
||||
This requires that the values of some of the P-port accessible
|
||||
registers be restored to their pre-standby values after it has
|
||||
been reset. This HAL function can be used to read and store
|
||||
the values of these registers at the point where the device is
|
||||
being placed in standby mode.
|
||||
|
||||
Returns
|
||||
None
|
||||
|
||||
See Also
|
||||
* CyAsHalRestoreRegsAfterStandby
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_read_regs_before_standby(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function restores the old values to a set of P-port
|
||||
accessible device registers.
|
||||
|
||||
Description
|
||||
This function is part of the work-around to a known West
|
||||
Bridge Astoria device error when operating in SPI mode on
|
||||
the P-port. This function is used to restore a set of
|
||||
P-port accessible registers to the values they had before
|
||||
the device was placed in standby mode.
|
||||
|
||||
Returns
|
||||
None
|
||||
|
||||
See Also
|
||||
* CyAsHalRestoreRegsAfterStandby
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_restore_regs_after_standby(
|
||||
/* The tag to ID a specific West Bridge device */
|
||||
cy_as_hal_device_tag tag
|
||||
);
|
||||
|
||||
/*
|
||||
* The functions below this comment are part of the HAL layer,
|
||||
* as the HAL layer consists of the abstraction to both the
|
||||
* hardware platform and the operating system. However; the
|
||||
* functions below this comment all relate to the operating
|
||||
* environment and not specifically to the hardware platform
|
||||
* or specific device.
|
||||
*/
|
||||
|
||||
/* Summary
|
||||
This function allocates a block of memory
|
||||
|
||||
Description
|
||||
This is the HAL layer equivalent of the malloc() function.
|
||||
|
||||
Returns
|
||||
a pointer to a block of memory
|
||||
|
||||
See Also
|
||||
* CyAsHalFree
|
||||
*/
|
||||
EXTERN void *
|
||||
cy_as_hal_alloc(
|
||||
/* The size of the memory block to allocate */
|
||||
uint32_t size
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function frees a previously allocated block of memory
|
||||
|
||||
Description
|
||||
This is the HAL layer equivalent of the free() function.
|
||||
|
||||
Returns
|
||||
None
|
||||
|
||||
See Also
|
||||
* CyAsHalAlloc
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_free(
|
||||
/* Pointer to a memory block to free */
|
||||
void *ptr
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function is a malloc equivalent that can be used from an
|
||||
interrupt context.
|
||||
|
||||
Description
|
||||
This function is a malloc equivalent that will be called from the
|
||||
API in callbacks. This function is required to be able to provide
|
||||
memory in interrupt context.
|
||||
|
||||
Notes
|
||||
For platforms where it is not possible to allocate memory in interrupt
|
||||
context, we provide a reference allocator that takes memory during
|
||||
initialization and implements malloc/free using this memory.
|
||||
See the <install>/api/hal/fpga/cyashalblkalloc.[ch] files for the
|
||||
implementation, and the <install>/api/hal/fpga/cyashalfpga.c file
|
||||
for an example of the use of this allocator.
|
||||
|
||||
Returns
|
||||
A pointer to the allocated block of memory
|
||||
|
||||
See Also
|
||||
* CyAsHalCBFree
|
||||
* CyAsHalAlloc
|
||||
*/
|
||||
EXTERN void *
|
||||
cy_as_hal_c_b_alloc(
|
||||
/* The size of the memory block to allocate */
|
||||
uint32_t size
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function frees the memory allocated through the CyAsHalCBAlloc
|
||||
call.
|
||||
|
||||
Description
|
||||
This function frees memory allocated through the CyAsHalCBAlloc
|
||||
call, and is also required to support calls from interrupt
|
||||
context.
|
||||
|
||||
Returns
|
||||
None
|
||||
|
||||
See Also
|
||||
* CyAsHalCBAlloc
|
||||
* CyAsHalFree
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_c_b_free(
|
||||
/* Pointer to the memory block to be freed */
|
||||
void *ptr
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function sets a block of memory to a specific value
|
||||
|
||||
Description
|
||||
This function is the HAL layer equivalent of the memset() function.
|
||||
|
||||
Returns
|
||||
None
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_mem_set(
|
||||
/* A pointer to a block of memory to set */
|
||||
void *ptr,
|
||||
/* The value to set the memory to */
|
||||
uint8_t value,
|
||||
/* The number of bytes to set */
|
||||
uint32_t cnt
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function creates or initializes a sleep channel
|
||||
|
||||
Description
|
||||
This function creates or initializes a sleep channel. The
|
||||
sleep channel defined using the HAL data structure
|
||||
CyAsHalSleepChannel.
|
||||
|
||||
Returns
|
||||
CyTrue is the initialization was successful, and CyFalse otherwise
|
||||
|
||||
See Also
|
||||
* CyAsHalSleepChannel
|
||||
* CyAsHalDestroySleepChannel
|
||||
* CyAsHalSleepOn
|
||||
* CyAsHalWake
|
||||
*/
|
||||
EXTERN cy_bool
|
||||
cy_as_hal_create_sleep_channel(
|
||||
/* Pointer to the sleep channel to create/initialize */
|
||||
cy_as_hal_sleep_channel *chan
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function destroys an existing sleep channel
|
||||
|
||||
Description
|
||||
This function destroys an existing sleep channel. The sleep channel
|
||||
is of type CyAsHalSleepChannel.
|
||||
|
||||
Returns
|
||||
CyTrue if the channel was destroyed, and CyFalse otherwise
|
||||
|
||||
See Also
|
||||
* CyAsHalSleepChannel
|
||||
* CyAsHalCreateSleepChannel
|
||||
* CyAsHalSleepOn
|
||||
* CyAsHalWake
|
||||
*/
|
||||
EXTERN cy_bool
|
||||
cy_as_hal_destroy_sleep_channel(
|
||||
/* The sleep channel to destroy */
|
||||
cy_as_hal_sleep_channel chan
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function causes the calling process or thread to sleep until
|
||||
CyAsHalWake() is called
|
||||
|
||||
Description
|
||||
This function causes the calling process or threadvto sleep.
|
||||
When CyAsHalWake() is called on the same sleep channel, this
|
||||
processes or thread is then wakened and allowed to run
|
||||
|
||||
Returns
|
||||
CyTrue if the thread or process is asleep, and CyFalse otherwise
|
||||
|
||||
See Also
|
||||
* CyAsHalSleepChannel
|
||||
* CyAsHalWake
|
||||
*/
|
||||
EXTERN cy_bool
|
||||
cy_as_hal_sleep_on(
|
||||
/* The sleep channel to sleep on */
|
||||
cy_as_hal_sleep_channel chan,
|
||||
/* The maximum time to sleep in milli-seconds */
|
||||
uint32_t ms
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function casues the process or thread sleeping on the given
|
||||
sleep channel to wake
|
||||
|
||||
Description
|
||||
This function causes the process or thread sleeping on the given
|
||||
sleep channel to wake. The channel
|
||||
|
||||
Returns
|
||||
CyTrue if the thread or process is awake, and CyFalse otherwise
|
||||
|
||||
See Also
|
||||
* CyAsHalSleepChannel
|
||||
* CyAsHalSleepOn
|
||||
*/
|
||||
EXTERN cy_bool
|
||||
cy_as_hal_wake(
|
||||
/* The sleep channel to wake */
|
||||
cy_as_hal_sleep_channel chan
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function disables interrupts, insuring that short bursts
|
||||
of code can be run without danger of interrupt handlers running.
|
||||
|
||||
Description
|
||||
There are cases within the API when lists must be manipulated by
|
||||
both the API and the associated interrupt handlers. In these
|
||||
cases, interrupts must be disabled to insure the integrity of the
|
||||
list during the modification. This function is used to disable
|
||||
interrupts during the short intervals where these lists are being
|
||||
changed.
|
||||
|
||||
The HAL must have the ability to nest calls to
|
||||
CyAsHalDisableInterrupts and CyAsHalEnableInterrupts.
|
||||
|
||||
Returns
|
||||
Any interrupt related state value which will be passed back into
|
||||
the subsequent CyAsHalEnableInterrupts call.
|
||||
|
||||
See Also
|
||||
* CyAsHalEnableInterrupts
|
||||
*/
|
||||
EXTERN uint32_t
|
||||
cy_as_hal_disable_interrupts();
|
||||
|
||||
/* Summary
|
||||
This function re-enables interrupts after a critical section of
|
||||
code in the API has been completed.
|
||||
|
||||
Description
|
||||
There are cases within the API when lists must be manipulated by
|
||||
both the API and the associated interrupt handlers. In these
|
||||
cases, interrupts must be disabled to insure the integrity of the
|
||||
list during the modification. This function is used to enable
|
||||
interrupts after the short intervals where these lists are being
|
||||
changed.
|
||||
|
||||
See Also
|
||||
* CyAsHalDisableInterrupts
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_enable_interrupts(
|
||||
/* Value returned by the previous CyAsHalDisableInterrupts call. */
|
||||
uint32_t value
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function sleeps for 150 ns.
|
||||
|
||||
Description
|
||||
This function sleeps for 150 ns before allowing the calling function
|
||||
to continue. This function is used for a specific purpose and the
|
||||
sleep required is at least 150 ns.
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_sleep150(
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function sleeps for the given number of milliseconds
|
||||
|
||||
Description
|
||||
This function sleeps for at least the given number of milliseonds
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_sleep(
|
||||
uint32_t ms
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function asserts when the condition evaluates to zero
|
||||
|
||||
Description
|
||||
Within the API there are conditions which are checked to insure
|
||||
the integrity of the code. These conditions are checked only
|
||||
within a DEBUG build. This function is used to check the condition
|
||||
and if the result evaluates to zero, it should be considered a
|
||||
fatal error that should be reported to Cypress.
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_assert(
|
||||
/* The condition to evaluate */
|
||||
cy_bool cond
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function prints a message from the API to a human readable device
|
||||
|
||||
Description
|
||||
There are places within the West Bridge API where printing a message
|
||||
is useful to the debug process. This function provides the mechanism
|
||||
to print a message.
|
||||
|
||||
Returns
|
||||
NONE
|
||||
*/
|
||||
EXTERN void
|
||||
cy_as_hal_print_message(
|
||||
/* The message to print */
|
||||
const char *fmt_p,
|
||||
... /* Variable arguments */
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function reports whether the HAL implementation uses
|
||||
polling to service data coming from the West Bridge.
|
||||
|
||||
Description
|
||||
This function reports whether the HAL implementation uses
|
||||
polling to service data coming from the West Bridge.
|
||||
|
||||
Returns
|
||||
CyTrue if the HAL polls the West Bridge Interrupt Status registers
|
||||
to complete operations, CyFalse if the HAL is interrupt driven.
|
||||
*/
|
||||
EXTERN cy_bool
|
||||
cy_as_hal_is_polling(
|
||||
void);
|
||||
|
||||
#endif
|
|
@ -1,104 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyasintr.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASINTR_H_
|
||||
#define _INCLUDED_CYASINTR_H_
|
||||
|
||||
#include "cyasdevice.h"
|
||||
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
/* Summary
|
||||
Initialize the interrupt manager module
|
||||
|
||||
Description
|
||||
This function is called to initialize the interrupt module.
|
||||
This module enables interrupts as well as servies West Bridge
|
||||
related interrupts by determining the source of the interrupt
|
||||
and calling the appropriate handler function.
|
||||
|
||||
Notes
|
||||
If the dmaintr parameter is TRUE, the initialization code
|
||||
initializes the interrupt mask to have the DMA related interrupt
|
||||
enabled via the general purpose interrupt. However, the interrupt
|
||||
service function assumes that the DMA interrupt is handled by the
|
||||
HAL layer before the interrupt module handler function is called.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS - the interrupt module was initialized
|
||||
* correctly
|
||||
* CY_AS_ERROR_ALREADY_RUNNING - the interrupt module was already
|
||||
* started
|
||||
|
||||
See Also
|
||||
* CyAsIntrStop
|
||||
* CyAsServiceInterrupt
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_intr_start(
|
||||
/* Device being initialized */
|
||||
cy_as_device *dev_p,
|
||||
/* If true, enable the DMA interrupt through the INT signal */
|
||||
cy_bool dmaintr
|
||||
);
|
||||
|
||||
/* Summary
|
||||
Stop the interrupt manager module
|
||||
|
||||
Description
|
||||
This function stops the interrupt module and masks all interrupts
|
||||
from the West Bridge device.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS - the interrupt module was stopped
|
||||
* successfully
|
||||
* CY_AS_ERROR_NOT_RUNNING - the interrupt module was not
|
||||
* running
|
||||
|
||||
See Also
|
||||
* CyAsIntrStart
|
||||
* CyAsServiceInterrupt
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_intr_stop(
|
||||
/* Device bein stopped */
|
||||
cy_as_device *dev_p
|
||||
);
|
||||
|
||||
|
||||
/* Summary
|
||||
The interrupt service routine for West Bridge
|
||||
|
||||
Description
|
||||
When an interrupt is detected, this function is called to
|
||||
service the West Bridge interrupt. It is safe and efficient
|
||||
for this function to be called when no West Bridge interrupt
|
||||
has occurred. This function will determine it is not an West
|
||||
Bridge interrupt quickly and return.
|
||||
*/
|
||||
void cy_as_intr_service_interrupt(
|
||||
/* The USER supplied tag for this device */
|
||||
cy_as_hal_device_tag tag
|
||||
);
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
|
||||
#endif /* _INCLUDED_CYASINTR_H_ */
|
|
@ -1,36 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyaslep2pep.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASLEP2PEP_H_
|
||||
#define _INCLUDED_CYASLEP2PEP_H_
|
||||
|
||||
#include "cyasdevice.h"
|
||||
|
||||
extern cy_as_return_status_t
|
||||
cy_as_usb_map_logical2_physical(cy_as_device *dev_p);
|
||||
|
||||
extern cy_as_return_status_t
|
||||
cy_as_usb_setup_dma(cy_as_device *dev_p);
|
||||
|
||||
extern cy_as_return_status_t
|
||||
cy_as_usb_set_dma_sizes(cy_as_device *dev_p);
|
||||
|
||||
#endif
|
|
@ -1,366 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyaslowlevel.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASLOWLEVEL_H_
|
||||
#define _INCLUDED_CYASLOWLEVEL_H_
|
||||
|
||||
/*@@Low Level Communications
|
||||
|
||||
Summary
|
||||
The low level communications module is responsible for
|
||||
communications between the West Bridge device and the P
|
||||
port processor. Communications is organized as a series
|
||||
of requests and subsequent responses. For each request
|
||||
there is a one and only one response. Requests may go
|
||||
from the West Bridge device to the P port processor, or
|
||||
from the P Port processor to the West Bridge device.
|
||||
|
||||
Description
|
||||
Requests are issued across what is called a context. A
|
||||
context is a single channel of communications from one
|
||||
processor to another processor. There can be only a single
|
||||
request outstanding on a context at a given time. Contexts
|
||||
are used to identify subsystems that can only process a
|
||||
single request at a time, but are independent of other
|
||||
contexts in the system. For instance, there is a context
|
||||
for communicating storage commands from the P port processor
|
||||
to the West Bridge device. There is also a context for
|
||||
communicating USB commands from the P port processor to the
|
||||
West Bridge device.
|
||||
|
||||
Requests and responses are identical with the exception of
|
||||
the type bit in the request/response header. If the type
|
||||
bit is one, the packet is a request. If this bit is zero,
|
||||
the packet is a response. Also encoded within the header of
|
||||
the request/response is the code. The code is a command
|
||||
code for a request, or a response code for a response. For
|
||||
a request, the code is a function of the context. The code
|
||||
0 has one meaning for the storage context and a different
|
||||
meaning for the USB context. The code is treated differently
|
||||
in the response. If the code in the response is less than 16,
|
||||
then the meaning of the response is global across all
|
||||
contexts. If the response is greater than or equal to 16,
|
||||
then the response is specific to the associated context.
|
||||
|
||||
Requests and responses are transferred between processors
|
||||
through the mailbox registers. It may take one or more cycles
|
||||
to transmit a complete request or response. The context is
|
||||
encoded into each cycle of the transfer to insure the
|
||||
receiving processor can route the data to the appropriate
|
||||
context for processing. In this way, the traffic from multiple
|
||||
contexts can be multiplexed into a single data stream through
|
||||
the mailbox registers by the sending processor, and
|
||||
demultiplexed from the mailbox registers by the receiving
|
||||
processor.
|
||||
|
||||
* Firmware Assumptions *
|
||||
The firmware assumes that mailbox contents will be consumed
|
||||
immediately. Therefore for multi-cycle packets, the data is
|
||||
sent in a tight polling loop from the firmware. This implies
|
||||
that the data must be read from the mailbox register on the P
|
||||
port side and processed immediately or performance of the
|
||||
firmware will suffer. In order to insure this is the case,
|
||||
the data from the mailboxes is read and stored immediately
|
||||
in a per context buffer. This occurs until the entire packet
|
||||
is received at which time the request packet is processed.
|
||||
Since the protocol is designed to allow for only one
|
||||
outstanding packet at a time, the firmware can never be in a
|
||||
position of waiting on the mailbox registers while the P port
|
||||
is processing a request. Only after the response to the
|
||||
previous request is sent will another request be sent.
|
||||
*/
|
||||
|
||||
#include "cyashal.h"
|
||||
#include "cyasdevice.h"
|
||||
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
#define CY_AS_REQUEST_RESPONSE_CODE_MASK (0x00ff)
|
||||
#define CY_AS_REQUEST_RESPONSE_CONTEXT_MASK (0x0F00)
|
||||
#define CY_AS_REQUEST_RESPONSE_CONTEXT_SHIFT (8)
|
||||
#define CY_AS_REQUEST_RESPONSE_TYPE_MASK (0x4000)
|
||||
#define CY_AS_REQUEST_RESPONSE_LAST_MASK (0x8000)
|
||||
#define CY_AS_REQUEST_RESPONSE_CLEAR_STR_FLAG (0x1000)
|
||||
|
||||
/*
|
||||
* These macros extract the data from a 16 bit value
|
||||
*/
|
||||
#define cy_as_mbox_get_code(c) \
|
||||
((uint8_t)((c) & CY_AS_REQUEST_RESPONSE_CODE_MASK))
|
||||
#define cy_as_mbox_get_context(c) \
|
||||
((uint8_t)(((c) & CY_AS_REQUEST_RESPONSE_CONTEXT_MASK) \
|
||||
>> CY_AS_REQUEST_RESPONSE_CONTEXT_SHIFT))
|
||||
#define cy_as_mbox_is_last(c) \
|
||||
((c) & CY_AS_REQUEST_RESPONSE_LAST_MASK)
|
||||
#define cy_as_mbox_is_request(c) \
|
||||
(((c) & CY_AS_REQUEST_RESPONSE_TYPE_MASK) != 0)
|
||||
#define cy_as_mbox_is_response(c) \
|
||||
(((c) & CY_AS_REQUEST_RESPONSE_TYPE_MASK) == 0)
|
||||
|
||||
/*
|
||||
* These macros (not yet written) pack data into or extract data
|
||||
* from the m_box0 field of the request or response
|
||||
*/
|
||||
#define cy_as_ll_request_response__set_code(req, code) \
|
||||
((req)->box0 = \
|
||||
((req)->box0 & ~CY_AS_REQUEST_RESPONSE_CODE_MASK) | \
|
||||
(code & CY_AS_REQUEST_RESPONSE_CODE_MASK))
|
||||
|
||||
#define cy_as_ll_request_response__get_code(req) \
|
||||
cy_as_mbox_get_code((req)->box0)
|
||||
|
||||
#define cy_as_ll_request_response__set_context(req, context) \
|
||||
((req)->box0 |= ((context) << \
|
||||
CY_AS_REQUEST_RESPONSE_CONTEXT_SHIFT))
|
||||
|
||||
#define cy_as_ll_request_response__set_clear_storage_flag(req) \
|
||||
((req)->box0 |= CY_AS_REQUEST_RESPONSE_CLEAR_STR_FLAG)
|
||||
|
||||
#define cy_as_ll_request_response__get_context(req) \
|
||||
cy_as_mbox_get_context((req)->box0)
|
||||
|
||||
#define cy_as_ll_request_response__is_last(req) \
|
||||
cy_as_mbox_is_last((req)->box0)
|
||||
|
||||
#define CY_an_ll_request_response___set_last(req) \
|
||||
((req)->box0 |= CY_AS_REQUEST_RESPONSE_LAST_MASK)
|
||||
|
||||
#define cy_as_ll_request_response__is_request(req) \
|
||||
cy_as_mbox_is_request((req)->box0)
|
||||
|
||||
#define cy_as_ll_request_response__set_request(req) \
|
||||
((req)->box0 |= CY_AS_REQUEST_RESPONSE_TYPE_MASK)
|
||||
|
||||
#define cy_as_ll_request_response__set_response(req) \
|
||||
((req)->box0 &= ~CY_AS_REQUEST_RESPONSE_TYPE_MASK)
|
||||
|
||||
#define cy_as_ll_request_response__is_response(req) \
|
||||
cy_as_mbox_is_response((req)->box0)
|
||||
|
||||
#define cy_as_ll_request_response__get_word(req, offset) \
|
||||
((req)->data[(offset)])
|
||||
|
||||
#define cy_as_ll_request_response__set_word(req, offset, \
|
||||
value) ((req)->data[(offset)] = value)
|
||||
|
||||
typedef enum cy_as_remove_request_result_t {
|
||||
cy_as_remove_request_sucessful,
|
||||
cy_as_remove_request_in_transit,
|
||||
cy_as_remove_request_not_found
|
||||
} cy_as_remove_request_result_t;
|
||||
|
||||
/* Summary
|
||||
Start the low level communications module
|
||||
|
||||
Description
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_ll_start(
|
||||
cy_as_device *dev_p
|
||||
);
|
||||
|
||||
cy_as_return_status_t
|
||||
cy_as_ll_stop(
|
||||
cy_as_device *dev_p
|
||||
);
|
||||
|
||||
|
||||
cy_as_ll_request_response *
|
||||
cy_as_ll_create_request(
|
||||
cy_as_device *dev_p,
|
||||
uint16_t code,
|
||||
uint8_t context,
|
||||
/* Length of the request in 16 bit words */
|
||||
uint16_t length
|
||||
);
|
||||
|
||||
void
|
||||
cy_as_ll_init_request(
|
||||
cy_as_ll_request_response *req_p,
|
||||
uint16_t code,
|
||||
uint16_t context,
|
||||
uint16_t length);
|
||||
|
||||
void
|
||||
cy_as_ll_init_response(
|
||||
cy_as_ll_request_response *req_p,
|
||||
uint16_t length);
|
||||
|
||||
void
|
||||
cy_as_ll_destroy_request(
|
||||
cy_as_device *dev_p,
|
||||
cy_as_ll_request_response *);
|
||||
|
||||
cy_as_ll_request_response *
|
||||
cy_as_ll_create_response(
|
||||
cy_as_device *dev_p,
|
||||
/* Length of the request in 16 bit words */
|
||||
uint16_t length
|
||||
);
|
||||
|
||||
cy_as_remove_request_result_t
|
||||
cy_as_ll_remove_request(
|
||||
cy_as_device *dev_p,
|
||||
cy_as_context *ctxt_p,
|
||||
cy_as_ll_request_response *req_p,
|
||||
cy_bool force
|
||||
);
|
||||
void
|
||||
cy_as_ll_remove_all_requests(cy_as_device *dev_p,
|
||||
cy_as_context *ctxt_p);
|
||||
|
||||
void
|
||||
cy_as_ll_destroy_response(
|
||||
cy_as_device *dev_p,
|
||||
cy_as_ll_request_response *);
|
||||
|
||||
cy_as_return_status_t
|
||||
cy_as_ll_send_request(
|
||||
/* The West Bridge device */
|
||||
cy_as_device *dev_p,
|
||||
/* The request to send */
|
||||
cy_as_ll_request_response *req,
|
||||
/* Storage for a reply, must be sure it is of sufficient size */
|
||||
cy_as_ll_request_response *resp,
|
||||
/* If true, this is a sync request */
|
||||
cy_bool sync,
|
||||
/* Callback to call when reply is received */
|
||||
cy_as_response_callback cb
|
||||
);
|
||||
|
||||
cy_as_return_status_t
|
||||
cy_as_ll_send_request_wait_reply(
|
||||
/* The West Bridge device */
|
||||
cy_as_device *dev_p,
|
||||
/* The request to send */
|
||||
cy_as_ll_request_response *req,
|
||||
/* Storage for a reply, must be sure it is of sufficient size */
|
||||
cy_as_ll_request_response *resp
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function registers a callback function to be called when a
|
||||
request arrives on a given context.
|
||||
|
||||
Description
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_ll_register_request_callback(
|
||||
cy_as_device *dev_p,
|
||||
uint8_t context,
|
||||
cy_as_response_callback cb
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function packs a set of bytes given by the data_p pointer
|
||||
into a request, reply structure.
|
||||
*/
|
||||
extern void
|
||||
cy_as_ll_request_response__pack(
|
||||
/* The destintation request or response */
|
||||
cy_as_ll_request_response *req,
|
||||
/* The offset of where to pack the data */
|
||||
uint32_t offset,
|
||||
/* The length of the data to pack in bytes */
|
||||
uint32_t length,
|
||||
/* The data to pack */
|
||||
void *data_p
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function unpacks a set of bytes from a request/reply
|
||||
structure into a segment of memory given by the data_p pointer.
|
||||
*/
|
||||
extern void
|
||||
cy_as_ll_request_response__unpack(
|
||||
/* The source of the data to unpack */
|
||||
cy_as_ll_request_response *req,
|
||||
/* The offset of the data to unpack */
|
||||
uint32_t offset,
|
||||
/* The length of the data to unpack in bytes */
|
||||
uint32_t length,
|
||||
/* The destination of the unpack operation */
|
||||
void *data_p
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function sends a status response back to the West Bridge
|
||||
device in response to a previously send request
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_ll_send_status_response(
|
||||
/* The West Bridge device */
|
||||
cy_as_device *dev_p,
|
||||
/* The context to send the response on */
|
||||
uint8_t context,
|
||||
/* The success/failure code to send */
|
||||
uint16_t code,
|
||||
/* Flag to clear wait on storage context */
|
||||
uint8_t clear_storage);
|
||||
|
||||
/* Summary
|
||||
This function sends a response back to the West Bridge device.
|
||||
|
||||
Description
|
||||
This function sends a response back to the West Bridge device.
|
||||
The response is sent on the context given by the 'context'
|
||||
variable. The code for the response is given by the 'code'
|
||||
argument. The data for the response is given by the data and
|
||||
length arguments.
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_ll_send_data_response(
|
||||
/* The West Bridge device */
|
||||
cy_as_device *dev_p,
|
||||
/* The context to send the response on */
|
||||
uint8_t context,
|
||||
/* The response code to use */
|
||||
uint16_t code,
|
||||
/* The length of the data for the response */
|
||||
uint16_t length,
|
||||
/* The data for the response */
|
||||
void *data
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function removes any requests of the given type
|
||||
from the given context.
|
||||
|
||||
Description
|
||||
This function removes requests of a given type from the
|
||||
context given via the context number.
|
||||
*/
|
||||
extern cy_as_return_status_t
|
||||
cy_as_ll_remove_ep_data_requests(
|
||||
/* The West Bridge device */
|
||||
cy_as_device *dev_p,
|
||||
cy_as_end_point_number_t ep
|
||||
);
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
|
||||
#endif /* _INCLUDED_CYASLOWLEVEL_H_ */
|
|
@ -1,54 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyasmedia.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASMEDIA_H_
|
||||
#define _INCLUDED_CYASMEDIA_H_
|
||||
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
|
||||
/* Summary
|
||||
Specifies a specific type of media supported by West Bridge
|
||||
|
||||
Description
|
||||
The West Bridge device supports five specific types of media
|
||||
as storage/IO devices attached to it's S-Port. This type is
|
||||
used to indicate the type of media being referenced in any
|
||||
API call.
|
||||
*/
|
||||
typedef enum cy_as_media_type {
|
||||
/* Flash NAND memory (may be SLC or MLC) */
|
||||
cy_as_media_nand = 0x00,
|
||||
/* An SD flash memory device */
|
||||
cy_as_media_sd_flash = 0x01,
|
||||
/* An MMC flash memory device */
|
||||
cy_as_media_mmc_flash = 0x02,
|
||||
/* A CE-ATA disk drive */
|
||||
cy_as_media_ce_ata = 0x03,
|
||||
/* SDIO device. */
|
||||
cy_as_media_sdio = 0x04,
|
||||
cy_as_media_max_media_value = 0x05
|
||||
|
||||
} cy_as_media_type;
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
|
||||
#endif /* _INCLUDED_CYASMEDIA_H_ */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,53 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyasmisc_dep.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
/* This header will contain Antioch specific declaration
|
||||
* of the APIs that are deprecated in Astoria SDK. This is
|
||||
* for maintaining backward compatibility with prior releases
|
||||
* of the Antioch SDK.
|
||||
*/
|
||||
#ifndef __INCLUDED_CYASMISC_DEP_H__
|
||||
#define __INCLUDED_CYASMISC_DEP_H__
|
||||
|
||||
#ifndef __doxygen__
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_misc_acquire_resource_dep(cy_as_device_handle handle,
|
||||
cy_as_resource_type resource,
|
||||
cy_bool force);
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_misc_get_firmware_version_dep(cy_as_device_handle handle,
|
||||
uint16_t *major,
|
||||
uint16_t *minor,
|
||||
uint16_t *build,
|
||||
uint8_t *media_type,
|
||||
cy_bool *is_debug_mode);
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_misc_set_trace_level_dep(cy_as_device_handle handle,
|
||||
uint8_t level,
|
||||
cy_as_media_type media,
|
||||
uint32_t device,
|
||||
uint32_t unit,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client);
|
||||
#endif /*__doxygen*/
|
||||
|
||||
#endif /*__INCLUDED_CYANSTORAGE_DEP_H__*/
|
|
@ -1,646 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyasmtp.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASMTP_H_
|
||||
#define _INCLUDED_CYASMTP_H_
|
||||
|
||||
#include "cyasmisc.h"
|
||||
|
||||
#include "cyas_cplus_start.h"
|
||||
|
||||
/*@@Media Transfer Protocol (MTP) Overview
|
||||
Summary
|
||||
The MTP API has been designed to allow MTP enabled West Bridge
|
||||
devices to implement the MTP protocol while maintaining high
|
||||
performance. West Bridge has the capability to enter into a
|
||||
Turbo mode during a MTP SendObject or GetObject operation
|
||||
enabling it to directly stream the data into or out of the
|
||||
attached SD card with minimal involvement from the Processor.
|
||||
|
||||
Description
|
||||
The MTP API is designed to act as a pass through implementation
|
||||
of the MTP protocol for all operations. Each MTP transaction
|
||||
received from the Host is passed through West Bridge and along
|
||||
to the Processor. The Processor can then respond to the
|
||||
transaction and pass data and/or responses back to the Host
|
||||
through West Bridge.
|
||||
|
||||
The MTP API also allows for a high speed handling of MTP
|
||||
SendObject and GetObject operations, referred to as Turbo MTP.
|
||||
During a Turbo MTP operation West Bridge is responsible for
|
||||
reading or writing the data for the MTP operation directly from
|
||||
or to the SD card with minimal interaction from the Processor.
|
||||
The is done by having the Processor transfer a Block Table
|
||||
to West Bridge which contains the locations on the SD card that
|
||||
need to be read or written. During the handling of a Turbo
|
||||
Operation the Processor will then only periodically need to
|
||||
send a new Block Table to West Bridge when the first is used up.
|
||||
See the CyAsMTPInitSendObject and CyAsMTPInitGetObject functions
|
||||
for more details.
|
||||
|
||||
In order to enable the MTP API you must first have a MTP enabled
|
||||
West Bridge loaded with MTP firmware. You then must start the USB
|
||||
and Storage APIs before starting the MTP API. See CyAsMTPStart
|
||||
for more details.
|
||||
*/
|
||||
|
||||
/*@@Endpoints
|
||||
Summary
|
||||
When using MTP firmware endpoints 2 and 6 are dedicated
|
||||
to bulk MTP traffic and endpoint 1 is available for MTP
|
||||
events.
|
||||
|
||||
Description
|
||||
When using a MTP enabled West Brdige device endpoints 2 and
|
||||
6 are made available for use to implement the MTP protocol.
|
||||
These endpoints have a few special restrictions noted below
|
||||
but otherwise the existing USB APIs can be used normally with
|
||||
these endpoints.
|
||||
|
||||
1. CyAsUsbSetNak, CyAsUsbClearNak, and CyAsUsbGetNak are
|
||||
disabled for these endpoints
|
||||
2. During a turbo operation CyAsUsbSetStall, CyAsUsbClearStall,
|
||||
and CyAsUsbGetStall are disabled.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* Summary
|
||||
This constants defines the maximum number of
|
||||
entries in the Block Table used to describe
|
||||
the locations for Send/GetObject operations.
|
||||
|
||||
See Also
|
||||
* CyAsMtpSendObject
|
||||
* CyAsMtpGetObject
|
||||
*/
|
||||
#define CY_AS_MAX_BLOCK_TABLE_ENTRIES 64
|
||||
|
||||
/* Summary
|
||||
Endpoint to be used for MTP reads from the USB host.
|
||||
*/
|
||||
#define CY_AS_MTP_READ_ENDPOINT (2)
|
||||
|
||||
/* Summary
|
||||
Endpoint to be used fro MTP writes to the USB host.
|
||||
*/
|
||||
#define CY_AS_MTP_WRITE_ENDPOINT (6)
|
||||
|
||||
/******************************************
|
||||
* MTP Types
|
||||
******************************************/
|
||||
|
||||
/* Summary
|
||||
The BlockTable used for turbo operations.
|
||||
|
||||
Description
|
||||
This struct is used to specify the blocks
|
||||
to be used for both read/write and send/getObject
|
||||
operations.
|
||||
|
||||
The start block is a starting Logical Block Address
|
||||
and num block is the number of blocks in that contiguous
|
||||
region.
|
||||
|
||||
start_blocks[i]->[-------] <- start_blocks[i] + num_blocks[i]
|
||||
|
||||
If you need fewer than CY_AS_MAX_BLOCK_TABLE_ENTRIES
|
||||
the remainder should be left empty. Empty is defined
|
||||
as num_blocks equal to 0.
|
||||
|
||||
See Also
|
||||
* CyAsMTPInitSendObject
|
||||
* CyAsMTPInitGetObject
|
||||
|
||||
*/
|
||||
typedef struct cy_as_mtp_block_table {
|
||||
uint32_t start_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES];
|
||||
uint16_t num_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES];
|
||||
} cy_as_mtp_block_table;
|
||||
|
||||
/* Summary
|
||||
This type specifies the type of MTP event that has occurred.
|
||||
|
||||
Description
|
||||
MTP events are used to communicate that West Bridge has
|
||||
either finished the handling of the given operation, or
|
||||
that it requires additional data to complete the operation.
|
||||
|
||||
In no case does West Bridge send any MTP protocol responses,
|
||||
this always remain the responsibility of the client.
|
||||
|
||||
See Also
|
||||
* CyAsMTPInitSendObject
|
||||
* CyAsMTPInitGetObject
|
||||
* CyAsMTPSendBlockTable
|
||||
|
||||
*/
|
||||
typedef enum cy_as_mtp_event {
|
||||
/* This event is sent when West Bridge
|
||||
has finished writing the data from a
|
||||
send_object. west bridge will -not- send
|
||||
the MTP response. */
|
||||
cy_as_mtp_send_object_complete,
|
||||
|
||||
/* This event is sent when West Bridge
|
||||
has finished sending the data for a
|
||||
get_object operation. west bridge will
|
||||
-not- send the MTP response. */
|
||||
cy_as_mtp_get_object_complete,
|
||||
|
||||
/* This event is called when West Bridge
|
||||
needs a new block_table. this is only a
|
||||
notification, to transfer a block_table
|
||||
to west bridge the cy_as_mtp_send_block_table
|
||||
use the function. while west bridge is waiting
|
||||
for a block_table during a send_object it
|
||||
may need to NAK the endpoint. it is important
|
||||
that the cy_as_mtp_send_block_table call is made
|
||||
in a timely manner as eventually a delay
|
||||
will result in an USB reset. this event has
|
||||
no data */
|
||||
cy_as_mtp_block_table_needed
|
||||
} cy_as_mtp_event;
|
||||
|
||||
/* Summary
|
||||
Data for the CyAsMTPSendObjectComplete event.
|
||||
|
||||
Description
|
||||
Notification that a SendObject operation has been
|
||||
completed. The status of the operation is given
|
||||
(to distinguish between a cancelled and a success
|
||||
for example) as well as the block count. The blocks
|
||||
are used in order based on the current block table.
|
||||
If more than one block table was used for a given
|
||||
SendObject the count will include the total number
|
||||
of blocks written.
|
||||
|
||||
This callback will be made only once per SendObject
|
||||
operation and it will only be called after all of
|
||||
the data has been committed to the SD card.
|
||||
|
||||
See Also
|
||||
* CyAsMTPEvent
|
||||
|
||||
*/
|
||||
typedef struct cy_as_mtp_send_object_complete_data {
|
||||
cy_as_return_status_t status;
|
||||
uint32_t byte_count;
|
||||
uint32_t transaction_id;
|
||||
} cy_as_mtp_send_object_complete_data;
|
||||
|
||||
/* Summary
|
||||
Data for the CyAsMTPGetObjectComplete event.
|
||||
|
||||
Description
|
||||
Notification that a GetObject has finished. This
|
||||
event allows the P side to know when to send the MTP
|
||||
response for the GetObject operation.
|
||||
|
||||
See Also
|
||||
* CyAsMTPEvent
|
||||
|
||||
*/
|
||||
typedef struct cy_as_mtp_get_object_complete_data {
|
||||
cy_as_return_status_t status;
|
||||
uint32_t byte_count;
|
||||
} cy_as_mtp_get_object_complete_data;
|
||||
|
||||
/* Summary
|
||||
MTP Event callback.
|
||||
|
||||
Description
|
||||
Callback used to communicate that a SendObject
|
||||
operation has finished.
|
||||
|
||||
See Also
|
||||
* CyAsMTPEvent
|
||||
*/
|
||||
typedef void (*cy_as_mtp_event_callback)(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_mtp_event evtype,
|
||||
void *evdata
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This is the callback function called after asynchronous API
|
||||
functions have completed.
|
||||
|
||||
Description
|
||||
When calling API functions from callback routines (interrupt
|
||||
handlers usually) the async version of these functions must
|
||||
be used. This callback is called when an asynchronous API
|
||||
function has completed.
|
||||
*/
|
||||
typedef void (*cy_as_mtp_function_callback)(
|
||||
/* Handle to the device to configure */
|
||||
cy_as_device_handle handle,
|
||||
/* The error status of the operation */
|
||||
cy_as_return_status_t status,
|
||||
/* A client supplied 32 bit tag */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
/**************************************
|
||||
* MTP Functions
|
||||
**************************************/
|
||||
|
||||
/* Summary
|
||||
This function starts the MTP stack.
|
||||
|
||||
Description
|
||||
Initializes West Bridge for MTP activity and registers the MTP
|
||||
event callback.
|
||||
|
||||
Before calling CyAsMTPStart, CyAsUsbStart and CyAsStorageStart must be
|
||||
called (in either order).
|
||||
|
||||
MTPStart must be called before the device is enumerated. Please
|
||||
see the documentation for CyAsUsbSetEnumConfig and CyAsUsbEnumControl
|
||||
for details on enumerating a device for MTP.
|
||||
|
||||
Calling MTPStart will not affect any ongoing P<->S traffic.
|
||||
|
||||
This requires a MTP firmware image to be loaded on West Bridge.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
* CY_AS_ERROR_INVALID_HANDLE
|
||||
* CY_AS_ERROR_NOT_CONFIGURED
|
||||
* CY_AS_ERROR_NO_FIRMWARE
|
||||
* CY_AS_ERROR_IN_SUSPEND
|
||||
* CY_AS_ERROR_INVALID_IN_CALLBACK
|
||||
* CY_AS_ERROR_STARTSTOP_PENDING
|
||||
* CY_AS_ERROR_NOT_RUNNING - CyAsUsbStart or CyAsStorageStart
|
||||
* have not been called
|
||||
* CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
|
||||
* firmware with MTP support
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY
|
||||
* CY_AS_ERROR_INVALID_RESPONSE
|
||||
|
||||
|
||||
See Also
|
||||
* CyAsMTPStop
|
||||
* CyAsUsbStart
|
||||
* CyAsStorageStart
|
||||
* CyAsUsbSetEnumConfig
|
||||
* CyAsUsbEnumControl
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_start(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_mtp_event_callback event_c_b,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
|
||||
/* Summary
|
||||
This function stops the MTP stack.
|
||||
|
||||
Description
|
||||
Stops all MTP activity. Any ongoing transfers are
|
||||
canceled.
|
||||
|
||||
This will not cause a UsbDisconnect but all
|
||||
MTP activity (both pass through and turbo) will
|
||||
stop.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
* CY_AS_ERROR_INVALID_HANDLE
|
||||
* CY_AS_ERROR_NOT_CONFIGURED
|
||||
* CY_AS_ERROR_NO_FIRMWARE
|
||||
* CY_AS_ERROR_NOT_RUNNING
|
||||
* CY_AS_ERROR_IN_SUSPEND
|
||||
* CY_AS_ERROR_INVALID_IN_CALLBACK
|
||||
* CY_AS_ERROR_STARTSTOP_PENDING
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY
|
||||
* CY_AS_ERROR_INVALID_RESPONSE
|
||||
|
||||
|
||||
See Also
|
||||
* CyAsMTPStart
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_stop(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function sets up a Turbo SendObject operation.
|
||||
|
||||
Description
|
||||
Calling this function will setup West Bridge to
|
||||
enable Tubo handling of the next SendObject
|
||||
operation received. This will pass down the initial
|
||||
block table to the firmware and setup a direct u->s
|
||||
write for the SendObject operation.
|
||||
|
||||
If this function is not called before a SendObject
|
||||
operation is seen the SendObject operation and data
|
||||
will be passed along to the P port like any other MTP
|
||||
command. It would then be the responsibility of the
|
||||
client to perform a normal StorageWrite call to
|
||||
store the data on the SD card. N.B. This will be
|
||||
very slow compared with the Turbo handling.
|
||||
|
||||
The completion of this function only signals that
|
||||
West Bridge has been set up to receive the next SendObject
|
||||
operation. When the SendObject operation has been fully
|
||||
handled and the data written to the SD card a separate
|
||||
event will be triggered.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
* CY_AS_ERROR_INVALID_HANDLE
|
||||
* CY_AS_ERROR_NOT_CONFIGURED
|
||||
* CY_AS_ERROR_NO_FIRMWARE
|
||||
* CY_AS_ERROR_IN_SUSPEND
|
||||
* CY_AS_ERROR_NOT_RUNNING
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY
|
||||
* CY_AS_ERROR_ASYNC_PENDING
|
||||
* CY_AS_ERROR_INVALID_RESPONSE
|
||||
* CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
|
||||
* firmware with MTP support
|
||||
|
||||
See Also
|
||||
* CyAsMTPCancelSendObject
|
||||
* CyAsMTPInitGetObject
|
||||
* CyAsMTPEvent
|
||||
* CyAsMTPSendBlockTable
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_init_send_object(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_mtp_block_table *blk_table,
|
||||
uint32_t num_bytes,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function cancels an ongoing MTP operation.
|
||||
|
||||
Description
|
||||
Causes West Bridge to cancel an ongoing SendObject
|
||||
operation. Note this is only a cancel to West Bridge,
|
||||
the MTP operation still needs to be canceled by
|
||||
sending a response.
|
||||
|
||||
West Bridge will automatically set a Stall on the endpoint
|
||||
when the cancel is received.
|
||||
|
||||
This function is only valid after CyAsMTPInitSendObject
|
||||
has been called, but before the CyAsMTPSendObjectComplete
|
||||
event has been sent.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
* CY_AS_ERROR_INVALID_HANDLE
|
||||
* CY_AS_ERROR_NOT_RUNNING
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY
|
||||
* CY_AS_ERROR_INVALID_RESPONSE
|
||||
* CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
|
||||
* firmware with MTP support
|
||||
* CY_AS_ERROR_NO_OPERATION_PENDING
|
||||
|
||||
See Also
|
||||
* CyAsMTPInitSendObject
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_cancel_send_object(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function sets up a turbo GetObject operation.
|
||||
|
||||
Description
|
||||
Called by the P in response to a GetObject
|
||||
operation. This provides West Bridge with the block
|
||||
addresses for the Object data that needs to be
|
||||
transferred.
|
||||
|
||||
It is the responsibility of the Processor to send the MTP
|
||||
operation before calling CyAsMTPInitGetObject. West Bridge
|
||||
will then send the data phase of the transaction,
|
||||
automatically creating the required container for Data.
|
||||
Once all of the Data has been transferred a callback will
|
||||
be issued to inform the Processor that the Data phase has
|
||||
completed allowing it to send the required MTP response.
|
||||
|
||||
If an entire Block Table is used then after the
|
||||
last block is transferred the CyAsMTPBtCallback
|
||||
will be called to allow an additional Block Table(s)
|
||||
to be specified.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
* CY_AS_ERROR_INVALID_HANDLE
|
||||
* CY_AS_ERROR_NOT_CONFIGURED
|
||||
* CY_AS_ERROR_NO_FIRMWARE
|
||||
* CY_AS_ERROR_NOT_RUNNING
|
||||
* CY_AS_ERROR_IN_SUSPEND
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY
|
||||
* CY_AS_ERROR_ASYNC_PENDING
|
||||
* CY_AS_ERROR_INVALID_RESPONSE
|
||||
* CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
|
||||
* firmware with MTP support
|
||||
|
||||
See Also
|
||||
* CyAsMTPInitSendObject
|
||||
* CyAsMTPCancelGetObject
|
||||
* CyAsMTPEvent
|
||||
* CyAsMTPSendBlockTable
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_init_get_object(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_mtp_block_table *table_p,
|
||||
uint32_t num_bytes,
|
||||
uint32_t transaction_id,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function cancels an ongoing turbo GetObject
|
||||
operation.
|
||||
|
||||
Description
|
||||
Causes West Bridge to cancel an ongoing GetObject
|
||||
operation. Note this is only a cancel to West Bridge,
|
||||
the MTP operation still needs to be canceled by
|
||||
sending a response.
|
||||
|
||||
This function is only valid after CyAsMTPGetSendObject
|
||||
has been called, but before the CyAsMTPGetObjectComplete
|
||||
event has been sent.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
* CY_AS_ERROR_INVALID_HANDLE
|
||||
* CY_AS_ERROR_NOT_RUNNING
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY
|
||||
* CY_AS_ERROR_INVALID_RESPONSE
|
||||
* CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
|
||||
* firmware with MTP support
|
||||
* CY_AS_ERROR_NO_OPERATION_PENDING
|
||||
|
||||
See Also
|
||||
* CyAsMTPInitGetObject
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_cancel_get_object(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function is used to transfer a BlockTable as part of
|
||||
an ongoing MTP operation.
|
||||
|
||||
Description
|
||||
This function is called in response to the
|
||||
CyAsMTPBlockTableNeeded event. This allows the client to
|
||||
pass in a BlockTable structure to West Bridge.
|
||||
|
||||
The memory associated with the table will be copied and
|
||||
can be safely disposed of when the function returns if
|
||||
called synchronously, or when the callback is made if
|
||||
called asynchronously.
|
||||
|
||||
This function is used for both SendObject and GetObject
|
||||
as both can generate the CyAsMTPBlockTableNeeded event.
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_SUCCESS
|
||||
* CY_AS_ERROR_INVALID_HANDLE
|
||||
* CY_AS_ERROR_NOT_CONFIGURED
|
||||
* CY_AS_ERROR_NO_FIRMWARE
|
||||
* CY_AS_ERROR_NOT_RUNNING
|
||||
* CY_AS_ERROR_IN_SUSPEND
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY
|
||||
* CY_AS_ERROR_ASYNC_PENDING
|
||||
* CY_AS_ERROR_INVALID_RESPONSE
|
||||
* CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
|
||||
* firmware with MTP support
|
||||
|
||||
See Also
|
||||
* CyAsMTPInitSendObject
|
||||
* CyAsMTPInitGetObject
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_send_block_table(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_mtp_block_table *table,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function is used to mark the start of a storage
|
||||
read/write burst from the P port processor.
|
||||
|
||||
Description
|
||||
This function is used to mark the start of a storage
|
||||
read/write burst from the processor. All USB host access
|
||||
into the mass storage / MTP endpoints will be blocked
|
||||
while the read/write burst is ongoing, and will be allowed
|
||||
to resume only after CyAsMTPStorageOnlyStop is called.
|
||||
The burst mode is used to reduce the firmware overhead
|
||||
due to configuring the internal data paths repeatedly,
|
||||
and can help improve performance when a sequence of
|
||||
read/writes is performed in a burst.
|
||||
|
||||
This function will not generate a special mailbox request,
|
||||
it will only set a flag on the next Storage Read/Write
|
||||
operation. Until such a call is made West Bridge will
|
||||
continue to accept incoming packets from the Host.
|
||||
|
||||
* Valid in Asynchronous Callback: YES
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_INVALID_HANDLE - Invalid West Bridge device
|
||||
* handle was passed in.
|
||||
* CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not
|
||||
* been configured.
|
||||
* CY_AS_ERROR_NO_FIRMWARE - Firmware is not active on West
|
||||
* Bridge device.
|
||||
* CY_AS_ERROR_NOT_RUNNING - Storage stack is not running.
|
||||
* CY_AS_ERROR_SUCCESS - Burst mode has been started.
|
||||
|
||||
See Also
|
||||
* CyAsStorageReadWriteBurstStop
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_storage_only_start(
|
||||
/* Handle to the West Bridge device. */
|
||||
cy_as_device_handle handle
|
||||
);
|
||||
|
||||
/* Summary
|
||||
This function is used to mark the end of a storage read/write
|
||||
burst from the P port processor.
|
||||
|
||||
Description
|
||||
This function is used to mark the end of a storage read/write
|
||||
burst from the processor. At this point, USB access to the
|
||||
mass storage / MTP endpoints on the West Bridge device will be
|
||||
re-enabled.
|
||||
|
||||
* Valid in Asynchronous Callback: NO
|
||||
|
||||
Returns
|
||||
* CY_AS_ERROR_INVALID_HANDLE - Invalid West Bridge device handle
|
||||
* was passed in.
|
||||
* CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not been
|
||||
* configured.
|
||||
* CY_AS_ERROR_NO_FIRMWARE - Firmware is not active on West Bridge
|
||||
* device.
|
||||
* CY_AS_ERROR_NOT_RUNNING - Storage stack is not running.
|
||||
* CY_AS_ERROR_INVALID_IN_CALLBACK - This API cannot be called
|
||||
* from a callback.
|
||||
* CY_AS_ERROR_OUT_OF_MEMORY - Failed to allocate memory to
|
||||
* process the request.
|
||||
* CY_AS_ERROR_TIMEOUT - Failed to send request to firmware.
|
||||
* CY_AS_ERROR_SUCCESS - Burst mode has been stopped.
|
||||
|
||||
See Also
|
||||
* CyAsStorageReadWriteBurstStart
|
||||
*/
|
||||
cy_as_return_status_t
|
||||
cy_as_mtp_storage_only_stop(
|
||||
/* Handle to the West Bridge device. */
|
||||
cy_as_device_handle handle,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
#include "cyas_cplus_end.h"
|
||||
|
||||
#endif
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,201 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyasregs.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASREG_H_
|
||||
#define _INCLUDED_CYASREG_H_
|
||||
|
||||
#if !defined(__doxygen__)
|
||||
|
||||
#define CY_AS_MEM_CM_WB_CFG_ID (0x80)
|
||||
#define CY_AS_MEM_CM_WB_CFG_ID_VER_MASK (0x000F)
|
||||
#define CY_AS_MEM_CM_WB_CFG_ID_HDID_MASK (0xFFF0)
|
||||
#define CY_AS_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE (0xA100)
|
||||
#define CY_AS_MEM_CM_WB_CFG_ID_HDID_ASTORIA_FPGA_VALUE (0x6800)
|
||||
#define CY_AS_MEM_CM_WB_CFG_ID_HDID_ASTORIA_VALUE (0xA200)
|
||||
|
||||
|
||||
#define CY_AS_MEM_RST_CTRL_REG (0x81)
|
||||
#define CY_AS_MEM_RST_CTRL_REG_HARD (0x0003)
|
||||
#define CY_AS_MEM_RST_CTRL_REG_SOFT (0x0001)
|
||||
#define CY_AS_MEM_RST_RSTCMPT (0x0004)
|
||||
|
||||
#define CY_AS_MEM_P0_ENDIAN (0x82)
|
||||
#define CY_AS_LITTLE_ENDIAN (0x0000)
|
||||
#define CY_AS_BIG_ENDIAN (0x0101)
|
||||
|
||||
#define CY_AS_MEM_P0_VM_SET (0x83)
|
||||
#define CY_AS_MEM_P0_VM_SET_VMTYPE_MASK (0x0007)
|
||||
#define CY_AS_MEM_P0_VM_SET_VMTYPE_RAM (0x0005)
|
||||
#define CY_AS_MEM_P0_VM_SET_VMTYPE_SRAM (0x0007)
|
||||
#define CY_AS_MEM_P0_VM_SET_VMTYPE_VMWIDTH (0x0008)
|
||||
#define CY_AS_MEM_P0_VM_SET_VMTYPE_FLOWCTRL (0x0010)
|
||||
#define CY_AS_MEM_P0_VM_SET_IFMODE (0x0020)
|
||||
#define CY_AS_MEM_P0_VM_SET_CFGMODE (0x0040)
|
||||
#define CY_AS_MEM_P0_VM_SET_DACKEOB (0x0080)
|
||||
#define CY_AS_MEM_P0_VM_SET_OVERRIDE (0x0100)
|
||||
#define CY_AS_MEM_P0_VM_SET_INTOVERD (0x0200)
|
||||
#define CY_AS_MEM_P0_VM_SET_DRQOVERD (0x0400)
|
||||
#define CY_AS_MEM_P0_VM_SET_DRQPOL (0x0800)
|
||||
#define CY_AS_MEM_P0_VM_SET_DACKPOL (0x1000)
|
||||
|
||||
|
||||
#define CY_AS_MEM_P0_NV_SET (0x84)
|
||||
#define CY_AS_MEM_P0_NV_SET_WPSWEN (0x0001)
|
||||
#define CY_AS_MEM_P0_NV_SET_WPPOLAR (0x0002)
|
||||
|
||||
#define CY_AS_MEM_PMU_UPDATE (0x85)
|
||||
#define CY_AS_MEM_PMU_UPDATE_UVALID (0x0001)
|
||||
#define CY_AS_MEM_PMU_UPDATE_USBUPDATE (0x0002)
|
||||
#define CY_AS_MEM_PMU_UPDATE_SDIOUPDATE (0x0004)
|
||||
|
||||
#define CY_AS_MEM_P0_INTR_REG (0x90)
|
||||
#define CY_AS_MEM_P0_INTR_REG_MCUINT (0x0020)
|
||||
#define CY_AS_MEM_P0_INTR_REG_DRQINT (0x0800)
|
||||
#define CY_AS_MEM_P0_INTR_REG_MBINT (0x1000)
|
||||
#define CY_AS_MEM_P0_INTR_REG_PMINT (0x2000)
|
||||
#define CY_AS_MEM_P0_INTR_REG_PLLLOCKINT (0x4000)
|
||||
|
||||
#define CY_AS_MEM_P0_INT_MASK_REG (0x91)
|
||||
#define CY_AS_MEM_P0_INT_MASK_REG_MMCUINT (0x0020)
|
||||
#define CY_AS_MEM_P0_INT_MASK_REG_MDRQINT (0x0800)
|
||||
#define CY_AS_MEM_P0_INT_MASK_REG_MMBINT (0x1000)
|
||||
#define CY_AS_MEM_P0_INT_MASK_REG_MPMINT (0x2000)
|
||||
#define CY_AS_MEM_P0_INT_MASK_REG_MPLLLOCKINT (0x4000)
|
||||
|
||||
#define CY_AS_MEM_MCU_MB_STAT (0x92)
|
||||
#define CY_AS_MEM_P0_MCU_MBNOTRD (0x0001)
|
||||
|
||||
#define CY_AS_MEM_P0_MCU_STAT (0x94)
|
||||
#define CY_AS_MEM_P0_MCU_STAT_CARDINS (0x0001)
|
||||
#define CY_AS_MEM_P0_MCU_STAT_CARDREM (0x0002)
|
||||
|
||||
#define CY_AS_MEM_PWR_MAGT_STAT (0x95)
|
||||
#define CY_AS_MEM_PWR_MAGT_STAT_WAKEUP (0x0001)
|
||||
|
||||
#define CY_AS_MEM_P0_RSE_ALLOCATE (0x98)
|
||||
#define CY_AS_MEM_P0_RSE_ALLOCATE_SDIOAVI (0x0001)
|
||||
#define CY_AS_MEM_P0_RSE_ALLOCATE_SDIOALLO (0x0002)
|
||||
#define CY_AS_MEM_P0_RSE_ALLOCATE_NANDAVI (0x0004)
|
||||
#define CY_AS_MEM_P0_RSE_ALLOCATE_NANDALLO (0x0008)
|
||||
#define CY_AS_MEM_P0_RSE_ALLOCATE_USBAVI (0x0010)
|
||||
#define CY_AS_MEM_P0_RSE_ALLOCATE_USBALLO (0x0020)
|
||||
|
||||
#define CY_AS_MEM_P0_RSE_MASK (0x9A)
|
||||
#define CY_AS_MEM_P0_RSE_MASK_MSDIOBUS_RW (0x0003)
|
||||
#define CY_AS_MEM_P0_RSE_MASK_MNANDBUS_RW (0x00C0)
|
||||
#define CY_AS_MEM_P0_RSE_MASK_MUSBBUS_RW (0x0030)
|
||||
|
||||
#define CY_AS_MEM_P0_DRQ (0xA0)
|
||||
#define CY_AS_MEM_P0_DRQ_EP2DRQ (0x0004)
|
||||
#define CY_AS_MEM_P0_DRQ_EP3DRQ (0x0008)
|
||||
#define CY_AS_MEM_P0_DRQ_EP4DRQ (0x0010)
|
||||
#define CY_AS_MEM_P0_DRQ_EP5DRQ (0x0020)
|
||||
#define CY_AS_MEM_P0_DRQ_EP6DRQ (0x0040)
|
||||
#define CY_AS_MEM_P0_DRQ_EP7DRQ (0x0080)
|
||||
#define CY_AS_MEM_P0_DRQ_EP8DRQ (0x0100)
|
||||
#define CY_AS_MEM_P0_DRQ_EP9DRQ (0x0200)
|
||||
#define CY_AS_MEM_P0_DRQ_EP10DRQ (0x0400)
|
||||
#define CY_AS_MEM_P0_DRQ_EP11DRQ (0x0800)
|
||||
#define CY_AS_MEM_P0_DRQ_EP12DRQ (0x1000)
|
||||
#define CY_AS_MEM_P0_DRQ_EP13DRQ (0x2000)
|
||||
#define CY_AS_MEM_P0_DRQ_EP14DRQ (0x4000)
|
||||
#define CY_AS_MEM_P0_DRQ_EP15DRQ (0x8000)
|
||||
|
||||
#define CY_AS_MEM_P0_DRQ_MASK (0xA1)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP2DRQ (0x0004)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP3DRQ (0x0008)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP4DRQ (0x0010)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP5DRQ (0x0020)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP6DRQ (0x0040)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP7DRQ (0x0080)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP8DRQ (0x0100)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP9DRQ (0x0200)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP10DRQ (0x0400)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP11DRQ (0x0800)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP12DRQ (0x1000)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP13DRQ (0x2000)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP14DRQ (0x4000)
|
||||
#define CY_AS_MEM_P0_DRQ_MASK_MEP15DRQ (0x8000)
|
||||
|
||||
#define CY_AS_MEM_P0_EP2_DMA_REG (0xA2)
|
||||
#define CY_AS_MEM_P0_E_pn_DMA_REG_COUNT_MASK (0x7FF)
|
||||
#define CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL (1 << 12)
|
||||
#define CY_AS_MEM_P0_EP3_DMA_REG (0xA3)
|
||||
#define CY_AS_MEM_P0_EP4_DMA_REG (0xA4)
|
||||
#define CY_AS_MEM_P0_EP5_DMA_REG (0xA5)
|
||||
#define CY_AS_MEM_P0_EP6_DMA_REG (0xA6)
|
||||
#define CY_AS_MEM_P0_EP7_DMA_REG (0xA7)
|
||||
#define CY_AS_MEM_P0_EP8_DMA_REG (0xA8)
|
||||
#define CY_AS_MEM_P0_EP9_DMA_REG (0xA9)
|
||||
#define CY_AS_MEM_P0_EP10_DMA_REG (0xAA)
|
||||
#define CY_AS_MEM_P0_EP11_DMA_REG (0xAB)
|
||||
#define CY_AS_MEM_P0_EP12_DMA_REG (0xAC)
|
||||
#define CY_AS_MEM_P0_EP13_DMA_REG (0xAD)
|
||||
#define CY_AS_MEM_P0_EP14_DMA_REG (0xAE)
|
||||
#define CY_AS_MEM_P0_EP15_DMA_REG (0xAF)
|
||||
|
||||
#define CY_AS_MEM_IROS_SLB_DATARET (0xC0)
|
||||
|
||||
#define CY_AS_MEM_IROS_IO_CFG (0xC1)
|
||||
#define CY_AS_MEM_IROS_IO_CFG_GPIODRVST_MASK (0x0003)
|
||||
#define CY_AS_MEM_IROS_IO_CFG_GPIOSLEW_MASK (0x0004)
|
||||
#define CY_AS_MEM_IROS_IO_CFG_PPIODRVST_MASK (0x0018)
|
||||
#define CY_AS_MEM_IROS_IO_CFG_PPIOSLEW_MASK (0x0020)
|
||||
#define CY_AS_MEM_IROS_IO_CFG_SSIODRVST_MASK (0x0300)
|
||||
#define CY_AS_MEM_IROS_IO_CFG_SSIOSLEW_MASK (0x0400)
|
||||
#define CY_AS_MEM_IROS_IO_CFG_SNIODRVST_MASK (0x1800)
|
||||
#define CY_AS_MEM_IROS_IO_CFG_SNIOSLEW_MASK (0x2000)
|
||||
|
||||
#define CY_AS_MEM_IROS_PLL_CFG (0xC2)
|
||||
|
||||
#define CY_AS_MEM_IROS_PXB_DATARET (0xC3)
|
||||
|
||||
#define CY_AS_MEM_PLL_LOCK_LOSS_STAT (0xC4)
|
||||
#define CY_AS_MEM_PLL_LOCK_LOSS_STAT_PLLSTAT (0x0800)
|
||||
|
||||
#define CY_AS_MEM_IROS_SLEEP_CFG (0xC5)
|
||||
|
||||
#define CY_AS_MEM_PNAND_CFG (0xDA)
|
||||
#define CY_AS_MEM_PNAND_CFG_IOWIDTH_MASK (0x0001)
|
||||
#define CY_AS_MEM_PNAND_CFG_IOWIDTH_8BIT (0x0000)
|
||||
#define CY_AS_MEM_PNAND_CFG_IOWIDTH_16BIT (0x0001)
|
||||
#define CY_AS_MEM_PNAND_CFG_BLKTYPE_MASK (0x0002)
|
||||
#define CY_AS_MEM_PNAND_CFG_BLKTYPE_SMALL (0x0002)
|
||||
#define CY_AS_MEM_PNAND_CFG_BLKTYPE_LARGE (0x0000)
|
||||
#define CY_AS_MEM_PNAND_CFG_EPABYTE_POS (4)
|
||||
#define CY_AS_MEM_PNAND_CFG_EPABYTE_MASK (0x0030)
|
||||
#define CY_AS_MEM_PNAND_CFG_EPABIT_POS (6)
|
||||
#define CY_AS_MEM_PNAND_CFG_EPABIT_MASK (0x00C0)
|
||||
#define CY_AS_MEM_PNAND_CFG_LNAEN_MASK (0x0100)
|
||||
|
||||
#define CY_AS_MEM_P0_MAILBOX0 (0xF0)
|
||||
#define CY_AS_MEM_P0_MAILBOX1 (0xF1)
|
||||
#define CY_AS_MEM_P0_MAILBOX2 (0xF2)
|
||||
#define CY_AS_MEM_P0_MAILBOX3 (0xF3)
|
||||
|
||||
#define CY_AS_MEM_MCU_MAILBOX0 (0xF8)
|
||||
#define CY_AS_MEM_MCU_MAILBOX1 (0xF9)
|
||||
#define CY_AS_MEM_MCU_MAILBOX2 (0xFA)
|
||||
#define CY_AS_MEM_MCU_MAILBOX3 (0xFB)
|
||||
|
||||
#endif /* !defined(__doxygen__) */
|
||||
|
||||
#endif /* _INCLUDED_CYASREG_H_ */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,309 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyanstorage_dep.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
/* This header will contain Antioch specific declaration
|
||||
* of the APIs that are deprecated in Astoria SDK. This is
|
||||
* for maintaining backward compatibility
|
||||
*/
|
||||
#ifndef __INCLUDED_CYANSTORAGE_DEP_H__
|
||||
#define __INCLUDED_CYANSTORAGE_DEP_H__
|
||||
|
||||
#ifndef __doxygen__
|
||||
|
||||
typedef void (*cy_as_storage_callback_dep)(
|
||||
/* Handle to the device completing the storage operation */
|
||||
cy_as_device_handle handle,
|
||||
/* The media type completing the operation */
|
||||
cy_as_media_type type,
|
||||
/* The device completing the operation */
|
||||
uint32_t device,
|
||||
/* The unit completing the operation */
|
||||
uint32_t unit,
|
||||
/* The block number of the completed operation */
|
||||
uint32_t block_number,
|
||||
/* The type of operation */
|
||||
cy_as_oper_type op,
|
||||
/* The error status */
|
||||
cy_as_return_status_t status
|
||||
);
|
||||
|
||||
typedef void (*cy_as_storage_event_callback_dep)(
|
||||
/* Handle to the device sending the event notification */
|
||||
cy_as_device_handle handle,
|
||||
/* The media type */
|
||||
cy_as_media_type type,
|
||||
/* The event type */
|
||||
cy_as_storage_event evtype,
|
||||
/* Event related data */
|
||||
void *evdata
|
||||
);
|
||||
|
||||
typedef struct cy_as_storage_query_device_data_dep {
|
||||
/* The type of media to query */
|
||||
cy_as_media_type type;
|
||||
/* The logical device number to query */
|
||||
uint32_t device;
|
||||
/* The return value for the device descriptor */
|
||||
cy_as_device_desc desc_p;
|
||||
} cy_as_storage_query_device_data_dep;
|
||||
|
||||
typedef struct cy_as_storage_query_unit_data_dep {
|
||||
/* The type of media to query */
|
||||
cy_as_media_type type;
|
||||
/* The logical device number to query */
|
||||
uint32_t device;
|
||||
/* The unit to query on the device */
|
||||
uint32_t unit;
|
||||
/* The return value for the unit descriptor */
|
||||
cy_as_unit_desc desc_p;
|
||||
} cy_as_storage_query_unit_data_dep;
|
||||
|
||||
|
||||
/************ FUNCTIONS *********************/
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_register_callback_dep(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* The callback function to call for async storage events */
|
||||
cy_as_storage_event_callback_dep callback
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_claim_dep(cy_as_device_handle handle,
|
||||
cy_as_media_type type
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_claim_dep_EX(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* The type of media to claim */
|
||||
cy_as_media_type *type,
|
||||
/* Callback to be called when the operation is complete */
|
||||
cy_as_function_callback cb,
|
||||
/* Client data to be passed to the callback */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_release_dep(cy_as_device_handle handle,
|
||||
cy_as_media_type type
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_release_dep_EX(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* Handle to the device of interest */
|
||||
cy_as_media_type *type,
|
||||
/* Callback to be called when the operation is complete */
|
||||
cy_as_function_callback cb,
|
||||
/* Client data to be passed to the callback */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_query_device_dep(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_media_type media,
|
||||
uint32_t device,
|
||||
cy_as_device_desc *desc_p
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_query_device_dep_EX(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* Parameters and return value for the query call */
|
||||
cy_as_storage_query_device_data_dep *data,
|
||||
/* Callback to be called when the operation is complete */
|
||||
cy_as_function_callback cb,
|
||||
/* Client data to be passed to the callback */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_query_unit_dep(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* The type of media to query */
|
||||
cy_as_media_type type,
|
||||
/* The logical device number to query */
|
||||
uint32_t device,
|
||||
/* The unit to query on the device */
|
||||
uint32_t unit,
|
||||
/* The return value for the unit descriptor */
|
||||
cy_as_unit_desc *unit_p
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_query_unit_dep_EX(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* Parameters and return value for the query call */
|
||||
cy_as_storage_query_unit_data_dep *data_p,
|
||||
/* Callback to be called when the operation is complete */
|
||||
cy_as_function_callback cb,
|
||||
/* Client data to be passed to the callback */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_device_control_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* Enable/disable control for card detection */
|
||||
cy_bool card_detect_en,
|
||||
/* Enable/disable control for write protect handling */
|
||||
cy_bool write_prot_en,
|
||||
/* Callback to be called when the operation is complete */
|
||||
cy_as_function_callback cb,
|
||||
/* Client data to be passed to the callback */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_read_dep(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* The type of media to access */
|
||||
cy_as_media_type type,
|
||||
/* The device to access */
|
||||
uint32_t device,
|
||||
/* The unit to access */
|
||||
uint32_t unit,
|
||||
/* The first block to access */
|
||||
uint32_t block,
|
||||
/* The buffer where data will be placed */
|
||||
void *data_p,
|
||||
/* The number of blocks to be read */
|
||||
uint16_t num_blocks
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_read_async_dep(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* The type of media to access */
|
||||
cy_as_media_type type,
|
||||
/* The device to access */
|
||||
uint32_t device,
|
||||
/* The unit to access */
|
||||
uint32_t unit,
|
||||
/* The first block to access */
|
||||
uint32_t block,
|
||||
/* The buffer where data will be placed */
|
||||
void *data_p,
|
||||
/* The number of blocks to be read */
|
||||
uint16_t num_blocks,
|
||||
/* The function to call when the read is complete
|
||||
or an error occurs */
|
||||
cy_as_storage_callback_dep callback
|
||||
);
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_write_dep(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* The type of media to access */
|
||||
cy_as_media_type type,
|
||||
/* The device to access */
|
||||
uint32_t device,
|
||||
/* The unit to access */
|
||||
uint32_t unit,
|
||||
/* The first block to access */
|
||||
uint32_t block,
|
||||
/* The buffer containing the data to be written */
|
||||
void *data_p,
|
||||
/* The number of blocks to be written */
|
||||
uint16_t num_blocks
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_write_async_dep(
|
||||
/* Handle to the device of interest */
|
||||
cy_as_device_handle handle,
|
||||
/* The type of media to access */
|
||||
cy_as_media_type type,
|
||||
/* The device to access */
|
||||
uint32_t device,
|
||||
/* The unit to access */
|
||||
uint32_t unit,
|
||||
/* The first block to access */
|
||||
uint32_t block,
|
||||
/* The buffer where the data to be written is stored */
|
||||
void *data_p,
|
||||
/* The number of blocks to be written */
|
||||
uint16_t num_blocks,
|
||||
/* The function to call when the write is complete
|
||||
or an error occurs */
|
||||
cy_as_storage_callback_dep callback
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_sd_register_read_dep(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_media_type type,
|
||||
uint8_t device,
|
||||
cy_as_sd_card_reg_type reg_type,
|
||||
uint8_t read_len,
|
||||
uint8_t *data_p
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_sd_register_read_dep_EX(
|
||||
/* Handle to the West Bridge device. */
|
||||
cy_as_device_handle handle,
|
||||
/* The type of media to query */
|
||||
cy_as_media_type type,
|
||||
/* The device to query */
|
||||
uint8_t device,
|
||||
/* The type of register to read. */
|
||||
cy_as_sd_card_reg_type reg_type,
|
||||
/* Output data buffer and length. */
|
||||
cy_as_storage_sd_reg_read_data *data_p,
|
||||
/* Callback function to call when done. */
|
||||
cy_as_function_callback cb,
|
||||
/* Call context to send to the cb function. */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_create_p_partition_dep(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_media_type media,
|
||||
uint32_t device,
|
||||
uint32_t size,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_storage_remove_p_partition_dep(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_media_type media,
|
||||
uint32_t device,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client);
|
||||
|
||||
#endif /*__doxygen*/
|
||||
|
||||
#endif /*__INCLUDED_CYANSTORAGE_DEP_H__*/
|
|
@ -1,36 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyastioch.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASTORIA_H_
|
||||
#define _INCLUDED_CYASTORIA_H_
|
||||
|
||||
#if !defined(__doxygen__)
|
||||
|
||||
#include "cyaserr.h"
|
||||
#include "cyasmisc.h"
|
||||
#include "cyasstorage.h"
|
||||
#include "cyasusb.h"
|
||||
#include "cyasmtp.h"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/* Cypress Astoria Sdk Version file (cyastsdkversion.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor
|
||||
## Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASTSDK_VERSION_H_
|
||||
#define _INCLUDED_CYASTSDK_VERSION_H_
|
||||
|
||||
/* Astoria SDK version 1.2.1 */
|
||||
#define CYAS_MAJOR_VERSION (1)
|
||||
#define CYAS_MINOR_VERSION (2)
|
||||
#define CYAS_BUILD_NUMBER (197)
|
||||
|
||||
#endif /*_INCLUDED_CYASTSDK_VERSION_H_*/
|
|
@ -1,71 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyastypes.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CYASTYPES_H_
|
||||
#define _INCLUDED_CYASTYPES_H_
|
||||
/* moved to staging location, eventual implementation
|
||||
* considered is here
|
||||
#include <mach/westbridge/cyashaldef.h>
|
||||
*/
|
||||
#include "../../../arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h"
|
||||
|
||||
/* Types that are not available on specific platforms.
|
||||
* These are used only in the reference HAL implementations and
|
||||
* are not required for using the API.
|
||||
*/
|
||||
#ifdef __unix__
|
||||
typedef unsigned long DWORD;
|
||||
typedef void *LPVOID;
|
||||
#define WINAPI
|
||||
#define INFINITE (0xFFFFFFFF)
|
||||
#define ptr_to_uint(ptr) ((unsigned int)(ptr))
|
||||
#endif
|
||||
|
||||
/* Basic types used by the entire API */
|
||||
|
||||
/* Summary
|
||||
This type represents an endpoint number
|
||||
*/
|
||||
typedef uint8_t cy_as_end_point_number_t;
|
||||
|
||||
/* Summary
|
||||
This type is used to return status information from
|
||||
an API call.
|
||||
*/
|
||||
typedef uint16_t cy_as_return_status_t;
|
||||
|
||||
/* Summary
|
||||
This type represents a bus number
|
||||
*/
|
||||
typedef uint32_t cy_as_bus_number_t;
|
||||
|
||||
/* Summary
|
||||
All APIs provided with this release are marked extern
|
||||
through this definition. This definition can be changed
|
||||
to meet the scope changes required in the user build
|
||||
environment.
|
||||
|
||||
For example, this can be changed to __declspec(exportdll)
|
||||
to enable exporting the API from a DLL.
|
||||
*/
|
||||
#define EXTERN extern
|
||||
|
||||
#endif
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,224 +0,0 @@
|
|||
/* Cypress West Bridge API header file (cyasusb_dep.h)
|
||||
## ===========================
|
||||
## Copyright (C) 2010 Cypress Semiconductor
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; either version 2
|
||||
## of the License, or (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street
|
||||
## Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
## ===========================
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header will contain Antioch specific declaration
|
||||
* of the APIs that are deprecated in Astoria SDK. This is
|
||||
* for maintaining backward compatibility.
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDED_CYASUSB_DEP_H__
|
||||
#define __INCLUDED_CYASUSB_DEP_H__
|
||||
|
||||
#ifndef __doxygen__
|
||||
|
||||
/*
|
||||
This data structure is the data passed via the evdata
|
||||
paramater on a usb event callback for the inquiry request.
|
||||
*/
|
||||
|
||||
typedef struct cy_as_usb_inquiry_data_dep {
|
||||
/* The media for the event */
|
||||
cy_as_media_type media;
|
||||
/* The EVPD bit from the SCSI INQUIRY request */
|
||||
uint8_t evpd;
|
||||
/* The codepage in the inquiry request */
|
||||
uint8_t codepage;
|
||||
/* This bool must be set to CyTrue indicate
|
||||
* that the inquiry data was changed */
|
||||
cy_bool updated;
|
||||
/* The length of the data */
|
||||
uint16_t length;
|
||||
/* The inquiry data */
|
||||
void *data;
|
||||
} cy_as_usb_inquiry_data_dep;
|
||||
|
||||
|
||||
typedef struct cy_as_usb_unknown_command_data_dep {
|
||||
/* The media for the event */
|
||||
cy_as_media_type media;
|
||||
/* The length of the requst (should be 16 bytes) */
|
||||
uint16_t reqlen;
|
||||
/* The request */
|
||||
void *request;
|
||||
/* The returned status value for the command */
|
||||
uint8_t status;
|
||||
/* If status is failed, the sense key */
|
||||
uint8_t key;
|
||||
/* If status is failed, the additional sense code */
|
||||
uint8_t asc;
|
||||
/* If status if failed, the additional sense code qualifier */
|
||||
uint8_t ascq;
|
||||
} cy_as_usb_unknown_command_data_dep;
|
||||
|
||||
|
||||
typedef struct cy_as_usb_start_stop_data_dep {
|
||||
/* The media type for the event */
|
||||
cy_as_media_type media;
|
||||
/* CyTrue means start request, CyFalse means stop request */
|
||||
cy_bool start;
|
||||
/* CyTrue means LoEj bit set, otherwise false */
|
||||
cy_bool loej;
|
||||
} cy_as_usb_start_stop_data_dep;
|
||||
|
||||
|
||||
typedef struct cy_as_usb_enum_control_dep {
|
||||
/* The bits in this member determine which mass storage devices
|
||||
are enumerated. see cy_as_usb_mass_storage_enum for more details. */
|
||||
uint8_t enum_mass_storage;
|
||||
/* If true, West Bridge will control enumeration. If this is false the
|
||||
pport controls enumeration. if the P port is controlling
|
||||
enumeration, traffic will be received via endpoint zero. */
|
||||
cy_bool antioch_enumeration;
|
||||
/* This is the interface # to use for the mass storage interface,
|
||||
if mass storage is enumerated. if mass storage is not enumerated
|
||||
this value should be zero. */
|
||||
uint8_t mass_storage_interface;
|
||||
/* If true, Inquiry, START/STOP, and unknown mass storage
|
||||
requests cause a callback to occur for handling by the
|
||||
baseband processor. */
|
||||
cy_bool mass_storage_callbacks;
|
||||
} cy_as_usb_enum_control_dep;
|
||||
|
||||
|
||||
typedef void (*cy_as_usb_event_callback_dep)(
|
||||
/* Handle to the device to configure */
|
||||
cy_as_device_handle handle,
|
||||
/* The event type being reported */
|
||||
cy_as_usb_event ev,
|
||||
/* The data assocaited with the event being reported */
|
||||
void *evdata
|
||||
);
|
||||
|
||||
|
||||
|
||||
/* Register Callback api */
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_usb_register_callback_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* The function to call */
|
||||
cy_as_usb_event_callback_dep callback
|
||||
);
|
||||
|
||||
|
||||
extern cy_as_return_status_t
|
||||
cy_as_usb_set_enum_config_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* The USB configuration information */
|
||||
cy_as_usb_enum_control_dep *config_p,
|
||||
/* The callback if async call */
|
||||
cy_as_function_callback cb,
|
||||
/* Client supplied data */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
|
||||
extern cy_as_return_status_t
|
||||
cy_as_usb_get_enum_config_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* The return value for USB congifuration information */
|
||||
cy_as_usb_enum_control_dep *config_p,
|
||||
/* The callback if async call */
|
||||
cy_as_function_callback cb,
|
||||
/* Client supplied data */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
extern cy_as_return_status_t
|
||||
cy_as_usb_get_descriptor_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* The type of descriptor */
|
||||
cy_as_usb_desc_type type,
|
||||
/* Index for string descriptor */
|
||||
uint8_t index,
|
||||
/* The buffer to hold the returned descriptor */
|
||||
void *desc_p,
|
||||
/* This is an input and output parameter. Before the code this pointer
|
||||
points to a uint32_t that contains the length of the buffer. after
|
||||
the call, this value contains the amount of data actually returned. */
|
||||
uint32_t *length_p
|
||||
);
|
||||
|
||||
extern cy_as_return_status_t
|
||||
cy_as_usb_set_stall_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* The endpoint of interest */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The callback if async call */
|
||||
cy_as_usb_function_callback cb,
|
||||
/* Client supplied data */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_usb_clear_stall_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* The endpoint of interest */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The callback if async call */
|
||||
cy_as_usb_function_callback cb,
|
||||
/* Client supplied data */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_usb_set_nak_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* The endpoint of interest */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The callback if async call */
|
||||
cy_as_usb_function_callback cb,
|
||||
/* Client supplied data */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_usb_clear_nak_dep(
|
||||
/* Handle to the West Bridge device */
|
||||
cy_as_device_handle handle,
|
||||
/* The endpoint of interest */
|
||||
cy_as_end_point_number_t ep,
|
||||
/* The callback if async call */
|
||||
cy_as_usb_function_callback cb,
|
||||
/* Client supplied data */
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
EXTERN cy_as_return_status_t
|
||||
cy_as_usb_select_m_s_partitions_dep(
|
||||
cy_as_device_handle handle,
|
||||
cy_as_media_type media,
|
||||
uint32_t device,
|
||||
cy_as_usb_m_s_type_t type,
|
||||
cy_as_function_callback cb,
|
||||
uint32_t client
|
||||
);
|
||||
|
||||
#endif /*__doxygen*/
|
||||
|
||||
#endif /*__INCLUDED_CYANSTORAGE_DEP_H__*/
|
Загрузка…
Ссылка в новой задаче