From: Oleksij Rempel Date: Mon, 28 Apr 2014 16:36:33 +0000 (+0200) Subject: remove some identical usb related headers X-Git-Tag: 1.4.0~8^2 X-Git-Url: https://jxself.org/git/?p=open-ath9k-htc-firmware.git;a=commitdiff_plain;h=36255ed229020810203c7482a70ba2c0d6b2ea99 remove some identical usb related headers k2 and magpie have lots of identical header. remove some of them. Signed-off-by: Oleksij Rempel --- diff --git a/target_firmware/magpie_fw_dev/target/inc/k2/usb_api.h b/target_firmware/magpie_fw_dev/target/inc/k2/usb_api.h deleted file mode 100755 index c3ca296..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/k2/usb_api.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef USB_API_H -#define USB_API_H - -#include "dt_defs.h" - -/******** hardware API table structure (API descriptions below) *************/ -struct usb_api { - void (*_usb_init)(void); - void (*_usb_rom_task)(void); - void (*_usb_fw_task)(void); - void (*_usb_init_phy)(void); - - // ep0 operation - void (*_usb_ep0_setup)(void); - - void (*_usb_ep0_tx)(void); - void (*_usb_ep0_rx)(void); - - // get/set interface - BOOLEAN (*_usb_get_interface)(void); - BOOLEAN (*_usb_set_interface)(void); - - // get/set configuration - BOOLEAN (*_usb_get_configuration)(void); - BOOLEAN (*_usb_set_configuration)(void); - - // standard/vendor command - BOOLEAN (*_usb_standard_cmd)(void); - void (*_usb_vendor_cmd)(void); - - void (*_usb_power_off)(void); - void (*_usb_reset_fifo)(void); - void (*_usb_gen_wdt)(void); - void (*_usb_jump_boot)(void); - - BOOLEAN (*_usb_clr_feature)(void); - BOOLEAN (*_usb_set_feature)(void); - BOOLEAN (*_usb_set_address)(void); - BOOLEAN (*_usb_get_descriptor)(void); - - BOOLEAN (*_usb_get_status)(void); - void (*_usb_setup_desc)(void); - void (*_usb_reg_out)(void); - void (*_usb_status_in)(void); - - void (*_usb_ep0_tx_data)(void); - void (*_usb_ep0_rx_data)(void); - - void (*_usb_clk_init)(void); -}; - -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/k2/usb_extr.h b/target_firmware/magpie_fw_dev/target/inc/k2/usb_extr.h deleted file mode 100755 index aa12bcc..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/k2/usb_extr.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef USB_EXTR_H -#define USB_EXTR_H - -#if 0 -#include "dt_defs.h" -#include "usb_type.h" - -/* Variable for USB EP0 pipe (USB.c) */ -uint16_t *pu8DescriptorEX; -uint16_t u16TxRxCounter; -uint16_t *u8ConfigDescriptorEX; -//extern BOOLEAN bUsbEP0HaltSt; -Action eUsbCxFinishAction; -CommandType eUsbCxCommand; -BOOLEAN UsbChirpFinish; -uint16_t u8UsbConfigValue; -uint16_t u8UsbInterfaceValue; -uint16_t u8UsbInterfaceAlternateSetting; -uint16_t u16FirmwareComplete; - -uint16_t *UsbDeviceDescriptor; -uint16_t *String00Descriptor; -uint16_t *String10Descriptor; -uint16_t *String20Descriptor; -uint16_t *String30Descriptor; -uint16_t *u8DeviceQualifierDescriptorEX; -uint16_t *u8OtherSpeedConfigDescriptorEX; -uint16_t *u8UsbDeviceDescriptor; -uint16_t *u8String00Descriptor; -uint16_t *u8String10Descriptor; -uint16_t *u8String20Descriptor; -uint16_t *u8String30Descriptor; -#endif -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/k2/usb_pre.h b/target_firmware/magpie_fw_dev/target/inc/k2/usb_pre.h deleted file mode 100755 index d3ae42b..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/k2/usb_pre.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef __USB_USER_PRE_H -#define __USB_USER_PRE_H - -#define FUSB200_MAX_EP 10 // 1..10 -#define FUSB200_MAX_FIFO 10 // 0.. 9 -#define EP0MAXPACKETSIZE 0x40 -// #define EP0FIFOSIZE 64 // EP0_FIFO -//JWEI 2003/04/29 -//#define EP0MAXPACKETSIZE 0x08 - -// Max. Packet Size define -#define MX_PA_SZ_8 8 -#define MX_PA_SZ_16 16 -#define MX_PA_SZ_32 32 -#define MX_PA_SZ_64 64 -#define MX_PA_SZ_128 128 -#define MX_PA_SZ_256 256 -#define MX_PA_SZ_512 512 -#define MX_PA_SZ_1024 1024 - -#define MASK_F0 0xF0 - -// Block Size define -#define BLK512BYTE 1 -#define BLK1024BYTE 2 - -#define BLK64BYTE 1 -#define BLK128BYTE 2 - -// Block toggle number define -#define SINGLE_BLK 1 -#define DOUBLE_BLK 2 -#define TRIBLE_BLK 3 - -// Endpoint transfer type -#define TF_TYPE_ISOCHRONOUS 1 -#define TF_TYPE_BULK 2 -#define TF_TYPE_INTERRUPT 3 - -// Endpoint or FIFO direction define -#define DIRECTION_IN 0 -#define DIRECTION_OUT 1 - -// FIFO number define -#define FIFO0 0x0 -#define FIFO1 0x1 -#define FIFO2 0x2 -#define FIFO3 0x3 -#define FIFO4 0x4 -#define FIFO5 0x5 -#define FIFO6 0x6 -#define FIFO7 0x7 -#define FIFO8 0x8 -#define FIFO9 0x9 -#define FIFO10 10 -#define FIFO11 11 -#define FIFO12 12 -#define FIFO13 13 -#define FIFO14 14 -#define FIFO15 15 - -// Descriptor Table uses the following parameters : fixed -#define DEVICE_LENGTH 0x12 -#define CONFIG_LENGTH 0x09 -#define INTERFACE_LENGTH 0x09 -#define EP_LENGTH 0x07 -#define DEVICE_QUALIFIER_LENGTH 0x0A - -//JWEI 2003/04/29 -// Endpoint number define -#define EP0 0 -#define EP1 1 -#define EP2 2 -#define EP3 3 -#define EP4 4 -#define EP5 5 -#define EP6 6 -#define EP7 7 -#define EP8 8 -#define EP9 9 -#define EP10 10 -#define EP11 11 -#define EP12 12 -#define EP13 13 -#define EP14 14 -#define EP15 15 - -#define STRING_00_LENGTH 0x04 -#define STRING_10_LENGTH 0x0c -#define STRING_20_LENGTH 0x18 -#define STRING_30_LENGTH 0x18 -#define STRING_40_LENGTH 0x04 -#define STRING_50_LENGTH 0x04 -#define STRING_60_LENGTH 0x04 -#define STRING_70_LENGTH 0x04 -#define STRING_80_LENGTH 0x04 -#define STRING_90_LENGTH 0x00 - -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/k2/usb_std.h b/target_firmware/magpie_fw_dev/target/inc/k2/usb_std.h deleted file mode 100755 index 06cc3f8..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/k2/usb_std.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef USB_STD_H -#define USB_STD_H - -#define mDEV_REQ_REQ_DIR() (ControlCmd.Direction) -#define mDEV_REQ_REQ_TYPE() (ControlCmd.Type) -#define mDEV_REQ_REQ_RECI() (ControlCmd.Object) -#define mDEV_REQ_REQ() (ControlCmd.Request) -#define mDEV_REQ_VALUE() (ControlCmd.Value) -#define mDEV_REQ_VALUE_LOW() (mLOW_BYTE(mDEV_REQ_VALUE())) -#define mDEV_REQ_VALUE_HIGH() (mHIGH_BYTE(mDEV_REQ_VALUE())) -#define mDEV_REQ_INDEX() (ControlCmd.Index) -#define mDEV_REQ_LENGTH() (ControlCmd.Length) - -/******************** USB Protocol Definition *************************/ -/* Standard Request Code (Table 9-4) */ -#define USB_GET_STATUS 0 -#define USB_CLEAR_FEATURE 1 -#define USB_SET_FEATURE 3 -#define USB_SET_ADDRESS 5 -#define USB_GET_DESCRIPTOR 6 -#define USB_SET_DESCRIPTOR 7 -#define USB_GET_CONFIGURATION 8 -#define USB_SET_CONFIGURATION 9 -#define USB_GET_INTERFACE 10 -#define USB_SET_INTERFACE 11 -#define USB_SYNCH_FRAME 12 - -/* Descriptor Type (Table 9-5) */ -#define USB_DESC_TYPE_DEVICE 1 -#define USB_DESC_TYPE_CONFIG 2 -#define USB_DESC_TYPE_STRING 3 -#define USB_DESC_TYPE_INTERFACE 4 -#define USB_DESC_TYPE_ENDPOINT 5 - -/* Endpoint Attribute (Table 9-10) */ -#define USB_EP_ATTR_CTRL 0 -#define USB_EP_ATTR_ISOCH 1 -#define USB_EP_ATTR_BULK 2 -#define USB_EP_ATTR_INTRPT 3 - -/*********************** for USB 2.0 **********************************/ -// Table 9-5. Descriptor Types -#define DT_DEVICE 1 -#define DT_CONFIGURATION 2 -#define DT_STRING 3 -#define DT_INTERFACE 4 -#define DT_ENDPOINT 5 -#define DT_DEVICE_QUALIFIER 6 -#define DT_OTHER_SPEED_CONFIGURATION 7 -#define DT_INTERFACE_POWER 8 - -/**********************************************************************/ -// Values for bmAttributes Field in USB_CONFIGURATION_DESCRIPTOR -#define USB_BUS_POWERED 0x80 -#define USB_SELF_POWERED 0x40 -#define USB_REMOTE_WAKEUP 0x20 - -#define cUSB_REQTYPE_DIR_POS 7 -#define cUSB_REQTYPE_DIR_LEN 1 -#define cUSB_REQTYPE_TYPE_POS 5 -#define cUSB_REQTYPE_TYPE_LEN 2 -#define cUSB_REQTYPE_RX_POS 0 -#define cUSB_REQTYPE_RX_LEN 5 - -/* for USB State */ -#define cUSB_DEFAULT_STATE 0 -#define cUSB_ADDRESS_STATE 1 -#define cUSB_CONFIG_STATE 2 - -/* for Data transfer direction */ -#define bmUSB_HOST_DIR 7 /* Bit 7 */ -#define cUSB_DIR_HOST_OUT 0 -#define cUSB_DIR_HOST_IN 1 - -/* for Type */ -#define cUSB_REQTYPE_STD 0 -#define cUSB_REQTYPE_CLASS 1 -#define cUSB_REQTYPE_VENDOR 2 - -/* for Recipient */ -#define cUSB_REQTYPE_DEVICE 0 -#define cUSB_REQTYPE_INTERFACE 1 -#define cUSB_REQTYPE_ENDPOINT 2 -#define cUSB_REQTYPE_OTHER 3 - -/* for Descriptor Type */ -#define cUSB_DESTYPE_DEVICE 1 -#define cUSB_DESTYPE_CONFIG 2 -#define cUSB_DESTYPE_STRING 3 -#define cUSB_DESTYPE_INTERFACE 4 -#define cUSB_DESTYPE_ENDPOINT 5 -#define cUSB_DESTYPE_END cUSB_DESTYPE_ENDPOINT // for range check - -/* for Feature selector */ -#define cUSB_FEATSEL_RMWAKEUP 0 -#define cUSB_FEATSEL_EPHAL 1 -#define cUSB_FEATSEL_END cUSB_FEATSEL_EPHAL // for range check - -#define bmREQ_RECI 0 -#define bmwREQ_RECI 5 // mMASKS(bmwREQ_RECI, bmREQ_RECI) -#define bmREQ_TYPE 5 -#define bmwREQ_TYPE 2 // mMASKS(bmwREQ_TYPE, bmREQ_TYPE) -#define bmREQ_DIR 7 -#define bmwREQ_DIR 1 - -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/k2/usb_type.h b/target_firmware/magpie_fw_dev/target/inc/k2/usb_type.h deleted file mode 100755 index c1bee0e..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/k2/usb_type.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef USB_TYPE_H -#define USB_TYPE_H - -#include "dt_defs.h" - -/*********************** for Faraday USB controller *******************/ -typedef enum -{ - CMD_VOID, // No command - CMD_GET_DESCRIPTOR, // Get_Descriptor command - CMD_SET_DESCRIPTOR // Set_Descriptor command -} CommandType; - -typedef enum -{ - ACT_IDLE, - ACT_DONE, - ACT_STALL -} Action; - -typedef struct Setup_Packet -{ - uint8_t Direction; /* Data transfer direction: IN, OUT */ - uint8_t Type; /* Request Type: Standard, Class, Vendor */ - uint8_t Object; /* Recipient: Device, Interface, Endpoint,other */ - uint16_t Request; /* Refer to Table 9-3 */ - uint16_t Value; - uint16_t Index; - uint16_t Length; -} SetupPacket; - -#define mBIT(b) (1 << (b)) -#define mMASK(w) (mBIT(w) - 1) - -#define mWORD_IDX(bsize) ((bsize) >> 1) -#define mWORD_SIZE(bsize) (((bsize) + 1) >> 1) - -#define mTABLE_WID mWORD_SIZE -#define mTABLE_IDX mWORD_IDX -#define mTABLE_LEN mLOW_BYTE - -#define mLOW_MASK(u16) ((uint8_t) ((u16) & mMASK(8))) -#define mHIGH_MASK(u16) ((uint8_t) ((u16) & ~mMASK(8))) -#define mLOW2HIGH(u16) (((uint8_t) (u16)) << 8) - -/* (1234) -> 0034 */ -//#define mLOW_BYTE(u16) ((U_8)(u16)) -#define mLOW_BYTE(u16) mLOW_MASK(u16) -/* (1234) -> 0012 */ -#define mHIGH_BYTE(u16) ((uint8_t) (((uint16_t) (u16)) >> 8)) - -#define mGET_REG1(var0, reg0) { var0 = reg0; } - -/* (1234, 5678) -> 7834 */ -#define m2BYTE(ch1L, ch2H) (mLOW_MASK(ch1L) | mLOW2HIGH(ch2H)) - -#define mREAD_WORD(var0, reg0, reg1) \ - { var0 = reg0; var0 += mLOW2HIGH(reg1); } - -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/k2/usbfifo_api.h b/target_firmware/magpie_fw_dev/target/inc/k2/usbfifo_api.h deleted file mode 100755 index 9ec5398..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/k2/usbfifo_api.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * @File: HIF_api.h - * - * @Abstract: Host Interface api - * - * @Notes: - */ - -#ifndef _USB_FIFO_API_H -#define _USB_FIFO_API_H - -#include "vbuf_api.h" - -typedef struct _USB_FIFO_CONFIG { - /* callback to get the buf for receiving commands from USB FIFO */ - VBUF* (*get_command_buf)(void); - /* callback when receiving a command */ - void (*recv_command)(VBUF *cmd); - /* callback to get the buf for event to send to the host */ - VBUF* (*get_event_buf)(void); - /* callback to indicate the event has been sent to the host */ - void (*send_event_done)(VBUF *buf); - - /* context used for all callbacks */ - //void *context; -} USB_FIFO_CONFIG; - -/* hardware API table structure (API descriptions below) */ -struct usbfifo_api { - void (*_init)(USB_FIFO_CONFIG *pConfig); - void (*_enable_event_isr)(void); - - /* room to expand this table by another table */ - void *pReserved; -}; - -extern void usbfifo_module_install(struct usbfifo_api *apis); - -#endif /* #ifndef _USB_FIFO_API_H */ diff --git a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_api.h b/target_firmware/magpie_fw_dev/target/inc/magpie/usb_api.h deleted file mode 100755 index c3ca296..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_api.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef USB_API_H -#define USB_API_H - -#include "dt_defs.h" - -/******** hardware API table structure (API descriptions below) *************/ -struct usb_api { - void (*_usb_init)(void); - void (*_usb_rom_task)(void); - void (*_usb_fw_task)(void); - void (*_usb_init_phy)(void); - - // ep0 operation - void (*_usb_ep0_setup)(void); - - void (*_usb_ep0_tx)(void); - void (*_usb_ep0_rx)(void); - - // get/set interface - BOOLEAN (*_usb_get_interface)(void); - BOOLEAN (*_usb_set_interface)(void); - - // get/set configuration - BOOLEAN (*_usb_get_configuration)(void); - BOOLEAN (*_usb_set_configuration)(void); - - // standard/vendor command - BOOLEAN (*_usb_standard_cmd)(void); - void (*_usb_vendor_cmd)(void); - - void (*_usb_power_off)(void); - void (*_usb_reset_fifo)(void); - void (*_usb_gen_wdt)(void); - void (*_usb_jump_boot)(void); - - BOOLEAN (*_usb_clr_feature)(void); - BOOLEAN (*_usb_set_feature)(void); - BOOLEAN (*_usb_set_address)(void); - BOOLEAN (*_usb_get_descriptor)(void); - - BOOLEAN (*_usb_get_status)(void); - void (*_usb_setup_desc)(void); - void (*_usb_reg_out)(void); - void (*_usb_status_in)(void); - - void (*_usb_ep0_tx_data)(void); - void (*_usb_ep0_rx_data)(void); - - void (*_usb_clk_init)(void); -}; - -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_extr.h b/target_firmware/magpie_fw_dev/target/inc/magpie/usb_extr.h deleted file mode 100755 index aa12bcc..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_extr.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef USB_EXTR_H -#define USB_EXTR_H - -#if 0 -#include "dt_defs.h" -#include "usb_type.h" - -/* Variable for USB EP0 pipe (USB.c) */ -uint16_t *pu8DescriptorEX; -uint16_t u16TxRxCounter; -uint16_t *u8ConfigDescriptorEX; -//extern BOOLEAN bUsbEP0HaltSt; -Action eUsbCxFinishAction; -CommandType eUsbCxCommand; -BOOLEAN UsbChirpFinish; -uint16_t u8UsbConfigValue; -uint16_t u8UsbInterfaceValue; -uint16_t u8UsbInterfaceAlternateSetting; -uint16_t u16FirmwareComplete; - -uint16_t *UsbDeviceDescriptor; -uint16_t *String00Descriptor; -uint16_t *String10Descriptor; -uint16_t *String20Descriptor; -uint16_t *String30Descriptor; -uint16_t *u8DeviceQualifierDescriptorEX; -uint16_t *u8OtherSpeedConfigDescriptorEX; -uint16_t *u8UsbDeviceDescriptor; -uint16_t *u8String00Descriptor; -uint16_t *u8String10Descriptor; -uint16_t *u8String20Descriptor; -uint16_t *u8String30Descriptor; -#endif -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_pre.h b/target_firmware/magpie_fw_dev/target/inc/magpie/usb_pre.h deleted file mode 100755 index d3ae42b..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_pre.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef __USB_USER_PRE_H -#define __USB_USER_PRE_H - -#define FUSB200_MAX_EP 10 // 1..10 -#define FUSB200_MAX_FIFO 10 // 0.. 9 -#define EP0MAXPACKETSIZE 0x40 -// #define EP0FIFOSIZE 64 // EP0_FIFO -//JWEI 2003/04/29 -//#define EP0MAXPACKETSIZE 0x08 - -// Max. Packet Size define -#define MX_PA_SZ_8 8 -#define MX_PA_SZ_16 16 -#define MX_PA_SZ_32 32 -#define MX_PA_SZ_64 64 -#define MX_PA_SZ_128 128 -#define MX_PA_SZ_256 256 -#define MX_PA_SZ_512 512 -#define MX_PA_SZ_1024 1024 - -#define MASK_F0 0xF0 - -// Block Size define -#define BLK512BYTE 1 -#define BLK1024BYTE 2 - -#define BLK64BYTE 1 -#define BLK128BYTE 2 - -// Block toggle number define -#define SINGLE_BLK 1 -#define DOUBLE_BLK 2 -#define TRIBLE_BLK 3 - -// Endpoint transfer type -#define TF_TYPE_ISOCHRONOUS 1 -#define TF_TYPE_BULK 2 -#define TF_TYPE_INTERRUPT 3 - -// Endpoint or FIFO direction define -#define DIRECTION_IN 0 -#define DIRECTION_OUT 1 - -// FIFO number define -#define FIFO0 0x0 -#define FIFO1 0x1 -#define FIFO2 0x2 -#define FIFO3 0x3 -#define FIFO4 0x4 -#define FIFO5 0x5 -#define FIFO6 0x6 -#define FIFO7 0x7 -#define FIFO8 0x8 -#define FIFO9 0x9 -#define FIFO10 10 -#define FIFO11 11 -#define FIFO12 12 -#define FIFO13 13 -#define FIFO14 14 -#define FIFO15 15 - -// Descriptor Table uses the following parameters : fixed -#define DEVICE_LENGTH 0x12 -#define CONFIG_LENGTH 0x09 -#define INTERFACE_LENGTH 0x09 -#define EP_LENGTH 0x07 -#define DEVICE_QUALIFIER_LENGTH 0x0A - -//JWEI 2003/04/29 -// Endpoint number define -#define EP0 0 -#define EP1 1 -#define EP2 2 -#define EP3 3 -#define EP4 4 -#define EP5 5 -#define EP6 6 -#define EP7 7 -#define EP8 8 -#define EP9 9 -#define EP10 10 -#define EP11 11 -#define EP12 12 -#define EP13 13 -#define EP14 14 -#define EP15 15 - -#define STRING_00_LENGTH 0x04 -#define STRING_10_LENGTH 0x0c -#define STRING_20_LENGTH 0x18 -#define STRING_30_LENGTH 0x18 -#define STRING_40_LENGTH 0x04 -#define STRING_50_LENGTH 0x04 -#define STRING_60_LENGTH 0x04 -#define STRING_70_LENGTH 0x04 -#define STRING_80_LENGTH 0x04 -#define STRING_90_LENGTH 0x00 - -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_std.h b/target_firmware/magpie_fw_dev/target/inc/magpie/usb_std.h deleted file mode 100755 index 06cc3f8..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_std.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef USB_STD_H -#define USB_STD_H - -#define mDEV_REQ_REQ_DIR() (ControlCmd.Direction) -#define mDEV_REQ_REQ_TYPE() (ControlCmd.Type) -#define mDEV_REQ_REQ_RECI() (ControlCmd.Object) -#define mDEV_REQ_REQ() (ControlCmd.Request) -#define mDEV_REQ_VALUE() (ControlCmd.Value) -#define mDEV_REQ_VALUE_LOW() (mLOW_BYTE(mDEV_REQ_VALUE())) -#define mDEV_REQ_VALUE_HIGH() (mHIGH_BYTE(mDEV_REQ_VALUE())) -#define mDEV_REQ_INDEX() (ControlCmd.Index) -#define mDEV_REQ_LENGTH() (ControlCmd.Length) - -/******************** USB Protocol Definition *************************/ -/* Standard Request Code (Table 9-4) */ -#define USB_GET_STATUS 0 -#define USB_CLEAR_FEATURE 1 -#define USB_SET_FEATURE 3 -#define USB_SET_ADDRESS 5 -#define USB_GET_DESCRIPTOR 6 -#define USB_SET_DESCRIPTOR 7 -#define USB_GET_CONFIGURATION 8 -#define USB_SET_CONFIGURATION 9 -#define USB_GET_INTERFACE 10 -#define USB_SET_INTERFACE 11 -#define USB_SYNCH_FRAME 12 - -/* Descriptor Type (Table 9-5) */ -#define USB_DESC_TYPE_DEVICE 1 -#define USB_DESC_TYPE_CONFIG 2 -#define USB_DESC_TYPE_STRING 3 -#define USB_DESC_TYPE_INTERFACE 4 -#define USB_DESC_TYPE_ENDPOINT 5 - -/* Endpoint Attribute (Table 9-10) */ -#define USB_EP_ATTR_CTRL 0 -#define USB_EP_ATTR_ISOCH 1 -#define USB_EP_ATTR_BULK 2 -#define USB_EP_ATTR_INTRPT 3 - -/*********************** for USB 2.0 **********************************/ -// Table 9-5. Descriptor Types -#define DT_DEVICE 1 -#define DT_CONFIGURATION 2 -#define DT_STRING 3 -#define DT_INTERFACE 4 -#define DT_ENDPOINT 5 -#define DT_DEVICE_QUALIFIER 6 -#define DT_OTHER_SPEED_CONFIGURATION 7 -#define DT_INTERFACE_POWER 8 - -/**********************************************************************/ -// Values for bmAttributes Field in USB_CONFIGURATION_DESCRIPTOR -#define USB_BUS_POWERED 0x80 -#define USB_SELF_POWERED 0x40 -#define USB_REMOTE_WAKEUP 0x20 - -#define cUSB_REQTYPE_DIR_POS 7 -#define cUSB_REQTYPE_DIR_LEN 1 -#define cUSB_REQTYPE_TYPE_POS 5 -#define cUSB_REQTYPE_TYPE_LEN 2 -#define cUSB_REQTYPE_RX_POS 0 -#define cUSB_REQTYPE_RX_LEN 5 - -/* for USB State */ -#define cUSB_DEFAULT_STATE 0 -#define cUSB_ADDRESS_STATE 1 -#define cUSB_CONFIG_STATE 2 - -/* for Data transfer direction */ -#define bmUSB_HOST_DIR 7 /* Bit 7 */ -#define cUSB_DIR_HOST_OUT 0 -#define cUSB_DIR_HOST_IN 1 - -/* for Type */ -#define cUSB_REQTYPE_STD 0 -#define cUSB_REQTYPE_CLASS 1 -#define cUSB_REQTYPE_VENDOR 2 - -/* for Recipient */ -#define cUSB_REQTYPE_DEVICE 0 -#define cUSB_REQTYPE_INTERFACE 1 -#define cUSB_REQTYPE_ENDPOINT 2 -#define cUSB_REQTYPE_OTHER 3 - -/* for Descriptor Type */ -#define cUSB_DESTYPE_DEVICE 1 -#define cUSB_DESTYPE_CONFIG 2 -#define cUSB_DESTYPE_STRING 3 -#define cUSB_DESTYPE_INTERFACE 4 -#define cUSB_DESTYPE_ENDPOINT 5 -#define cUSB_DESTYPE_END cUSB_DESTYPE_ENDPOINT // for range check - -/* for Feature selector */ -#define cUSB_FEATSEL_RMWAKEUP 0 -#define cUSB_FEATSEL_EPHAL 1 -#define cUSB_FEATSEL_END cUSB_FEATSEL_EPHAL // for range check - -#define bmREQ_RECI 0 -#define bmwREQ_RECI 5 // mMASKS(bmwREQ_RECI, bmREQ_RECI) -#define bmREQ_TYPE 5 -#define bmwREQ_TYPE 2 // mMASKS(bmwREQ_TYPE, bmREQ_TYPE) -#define bmREQ_DIR 7 -#define bmwREQ_DIR 1 - -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_type.h b/target_firmware/magpie_fw_dev/target/inc/magpie/usb_type.h deleted file mode 100755 index c1bee0e..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/magpie/usb_type.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef USB_TYPE_H -#define USB_TYPE_H - -#include "dt_defs.h" - -/*********************** for Faraday USB controller *******************/ -typedef enum -{ - CMD_VOID, // No command - CMD_GET_DESCRIPTOR, // Get_Descriptor command - CMD_SET_DESCRIPTOR // Set_Descriptor command -} CommandType; - -typedef enum -{ - ACT_IDLE, - ACT_DONE, - ACT_STALL -} Action; - -typedef struct Setup_Packet -{ - uint8_t Direction; /* Data transfer direction: IN, OUT */ - uint8_t Type; /* Request Type: Standard, Class, Vendor */ - uint8_t Object; /* Recipient: Device, Interface, Endpoint,other */ - uint16_t Request; /* Refer to Table 9-3 */ - uint16_t Value; - uint16_t Index; - uint16_t Length; -} SetupPacket; - -#define mBIT(b) (1 << (b)) -#define mMASK(w) (mBIT(w) - 1) - -#define mWORD_IDX(bsize) ((bsize) >> 1) -#define mWORD_SIZE(bsize) (((bsize) + 1) >> 1) - -#define mTABLE_WID mWORD_SIZE -#define mTABLE_IDX mWORD_IDX -#define mTABLE_LEN mLOW_BYTE - -#define mLOW_MASK(u16) ((uint8_t) ((u16) & mMASK(8))) -#define mHIGH_MASK(u16) ((uint8_t) ((u16) & ~mMASK(8))) -#define mLOW2HIGH(u16) (((uint8_t) (u16)) << 8) - -/* (1234) -> 0034 */ -//#define mLOW_BYTE(u16) ((U_8)(u16)) -#define mLOW_BYTE(u16) mLOW_MASK(u16) -/* (1234) -> 0012 */ -#define mHIGH_BYTE(u16) ((uint8_t) (((uint16_t) (u16)) >> 8)) - -#define mGET_REG1(var0, reg0) { var0 = reg0; } - -/* (1234, 5678) -> 7834 */ -#define m2BYTE(ch1L, ch2H) (mLOW_MASK(ch1L) | mLOW2HIGH(ch2H)) - -#define mREAD_WORD(var0, reg0, reg1) \ - { var0 = reg0; var0 += mLOW2HIGH(reg1); } - -#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/magpie/usbfifo_api.h b/target_firmware/magpie_fw_dev/target/inc/magpie/usbfifo_api.h deleted file mode 100755 index 9ec5398..0000000 --- a/target_firmware/magpie_fw_dev/target/inc/magpie/usbfifo_api.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted (subject to the limitations in the - * disclaimer below) provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT - * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * @File: HIF_api.h - * - * @Abstract: Host Interface api - * - * @Notes: - */ - -#ifndef _USB_FIFO_API_H -#define _USB_FIFO_API_H - -#include "vbuf_api.h" - -typedef struct _USB_FIFO_CONFIG { - /* callback to get the buf for receiving commands from USB FIFO */ - VBUF* (*get_command_buf)(void); - /* callback when receiving a command */ - void (*recv_command)(VBUF *cmd); - /* callback to get the buf for event to send to the host */ - VBUF* (*get_event_buf)(void); - /* callback to indicate the event has been sent to the host */ - void (*send_event_done)(VBUF *buf); - - /* context used for all callbacks */ - //void *context; -} USB_FIFO_CONFIG; - -/* hardware API table structure (API descriptions below) */ -struct usbfifo_api { - void (*_init)(USB_FIFO_CONFIG *pConfig); - void (*_enable_event_isr)(void); - - /* room to expand this table by another table */ - void *pReserved; -}; - -extern void usbfifo_module_install(struct usbfifo_api *apis); - -#endif /* #ifndef _USB_FIFO_API_H */ diff --git a/target_firmware/magpie_fw_dev/target/inc/usb_api.h b/target_firmware/magpie_fw_dev/target/inc/usb_api.h new file mode 100755 index 0000000..c3ca296 --- /dev/null +++ b/target_firmware/magpie_fw_dev/target/inc/usb_api.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2013 Qualcomm Atheros, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Qualcomm Atheros nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef USB_API_H +#define USB_API_H + +#include "dt_defs.h" + +/******** hardware API table structure (API descriptions below) *************/ +struct usb_api { + void (*_usb_init)(void); + void (*_usb_rom_task)(void); + void (*_usb_fw_task)(void); + void (*_usb_init_phy)(void); + + // ep0 operation + void (*_usb_ep0_setup)(void); + + void (*_usb_ep0_tx)(void); + void (*_usb_ep0_rx)(void); + + // get/set interface + BOOLEAN (*_usb_get_interface)(void); + BOOLEAN (*_usb_set_interface)(void); + + // get/set configuration + BOOLEAN (*_usb_get_configuration)(void); + BOOLEAN (*_usb_set_configuration)(void); + + // standard/vendor command + BOOLEAN (*_usb_standard_cmd)(void); + void (*_usb_vendor_cmd)(void); + + void (*_usb_power_off)(void); + void (*_usb_reset_fifo)(void); + void (*_usb_gen_wdt)(void); + void (*_usb_jump_boot)(void); + + BOOLEAN (*_usb_clr_feature)(void); + BOOLEAN (*_usb_set_feature)(void); + BOOLEAN (*_usb_set_address)(void); + BOOLEAN (*_usb_get_descriptor)(void); + + BOOLEAN (*_usb_get_status)(void); + void (*_usb_setup_desc)(void); + void (*_usb_reg_out)(void); + void (*_usb_status_in)(void); + + void (*_usb_ep0_tx_data)(void); + void (*_usb_ep0_rx_data)(void); + + void (*_usb_clk_init)(void); +}; + +#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/usb_extr.h b/target_firmware/magpie_fw_dev/target/inc/usb_extr.h new file mode 100755 index 0000000..aa12bcc --- /dev/null +++ b/target_firmware/magpie_fw_dev/target/inc/usb_extr.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2013 Qualcomm Atheros, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Qualcomm Atheros nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef USB_EXTR_H +#define USB_EXTR_H + +#if 0 +#include "dt_defs.h" +#include "usb_type.h" + +/* Variable for USB EP0 pipe (USB.c) */ +uint16_t *pu8DescriptorEX; +uint16_t u16TxRxCounter; +uint16_t *u8ConfigDescriptorEX; +//extern BOOLEAN bUsbEP0HaltSt; +Action eUsbCxFinishAction; +CommandType eUsbCxCommand; +BOOLEAN UsbChirpFinish; +uint16_t u8UsbConfigValue; +uint16_t u8UsbInterfaceValue; +uint16_t u8UsbInterfaceAlternateSetting; +uint16_t u16FirmwareComplete; + +uint16_t *UsbDeviceDescriptor; +uint16_t *String00Descriptor; +uint16_t *String10Descriptor; +uint16_t *String20Descriptor; +uint16_t *String30Descriptor; +uint16_t *u8DeviceQualifierDescriptorEX; +uint16_t *u8OtherSpeedConfigDescriptorEX; +uint16_t *u8UsbDeviceDescriptor; +uint16_t *u8String00Descriptor; +uint16_t *u8String10Descriptor; +uint16_t *u8String20Descriptor; +uint16_t *u8String30Descriptor; +#endif +#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/usb_pre.h b/target_firmware/magpie_fw_dev/target/inc/usb_pre.h new file mode 100755 index 0000000..d3ae42b --- /dev/null +++ b/target_firmware/magpie_fw_dev/target/inc/usb_pre.h @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2013 Qualcomm Atheros, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Qualcomm Atheros nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __USB_USER_PRE_H +#define __USB_USER_PRE_H + +#define FUSB200_MAX_EP 10 // 1..10 +#define FUSB200_MAX_FIFO 10 // 0.. 9 +#define EP0MAXPACKETSIZE 0x40 +// #define EP0FIFOSIZE 64 // EP0_FIFO +//JWEI 2003/04/29 +//#define EP0MAXPACKETSIZE 0x08 + +// Max. Packet Size define +#define MX_PA_SZ_8 8 +#define MX_PA_SZ_16 16 +#define MX_PA_SZ_32 32 +#define MX_PA_SZ_64 64 +#define MX_PA_SZ_128 128 +#define MX_PA_SZ_256 256 +#define MX_PA_SZ_512 512 +#define MX_PA_SZ_1024 1024 + +#define MASK_F0 0xF0 + +// Block Size define +#define BLK512BYTE 1 +#define BLK1024BYTE 2 + +#define BLK64BYTE 1 +#define BLK128BYTE 2 + +// Block toggle number define +#define SINGLE_BLK 1 +#define DOUBLE_BLK 2 +#define TRIBLE_BLK 3 + +// Endpoint transfer type +#define TF_TYPE_ISOCHRONOUS 1 +#define TF_TYPE_BULK 2 +#define TF_TYPE_INTERRUPT 3 + +// Endpoint or FIFO direction define +#define DIRECTION_IN 0 +#define DIRECTION_OUT 1 + +// FIFO number define +#define FIFO0 0x0 +#define FIFO1 0x1 +#define FIFO2 0x2 +#define FIFO3 0x3 +#define FIFO4 0x4 +#define FIFO5 0x5 +#define FIFO6 0x6 +#define FIFO7 0x7 +#define FIFO8 0x8 +#define FIFO9 0x9 +#define FIFO10 10 +#define FIFO11 11 +#define FIFO12 12 +#define FIFO13 13 +#define FIFO14 14 +#define FIFO15 15 + +// Descriptor Table uses the following parameters : fixed +#define DEVICE_LENGTH 0x12 +#define CONFIG_LENGTH 0x09 +#define INTERFACE_LENGTH 0x09 +#define EP_LENGTH 0x07 +#define DEVICE_QUALIFIER_LENGTH 0x0A + +//JWEI 2003/04/29 +// Endpoint number define +#define EP0 0 +#define EP1 1 +#define EP2 2 +#define EP3 3 +#define EP4 4 +#define EP5 5 +#define EP6 6 +#define EP7 7 +#define EP8 8 +#define EP9 9 +#define EP10 10 +#define EP11 11 +#define EP12 12 +#define EP13 13 +#define EP14 14 +#define EP15 15 + +#define STRING_00_LENGTH 0x04 +#define STRING_10_LENGTH 0x0c +#define STRING_20_LENGTH 0x18 +#define STRING_30_LENGTH 0x18 +#define STRING_40_LENGTH 0x04 +#define STRING_50_LENGTH 0x04 +#define STRING_60_LENGTH 0x04 +#define STRING_70_LENGTH 0x04 +#define STRING_80_LENGTH 0x04 +#define STRING_90_LENGTH 0x00 + +#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/usb_std.h b/target_firmware/magpie_fw_dev/target/inc/usb_std.h new file mode 100755 index 0000000..06cc3f8 --- /dev/null +++ b/target_firmware/magpie_fw_dev/target/inc/usb_std.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2013 Qualcomm Atheros, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Qualcomm Atheros nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef USB_STD_H +#define USB_STD_H + +#define mDEV_REQ_REQ_DIR() (ControlCmd.Direction) +#define mDEV_REQ_REQ_TYPE() (ControlCmd.Type) +#define mDEV_REQ_REQ_RECI() (ControlCmd.Object) +#define mDEV_REQ_REQ() (ControlCmd.Request) +#define mDEV_REQ_VALUE() (ControlCmd.Value) +#define mDEV_REQ_VALUE_LOW() (mLOW_BYTE(mDEV_REQ_VALUE())) +#define mDEV_REQ_VALUE_HIGH() (mHIGH_BYTE(mDEV_REQ_VALUE())) +#define mDEV_REQ_INDEX() (ControlCmd.Index) +#define mDEV_REQ_LENGTH() (ControlCmd.Length) + +/******************** USB Protocol Definition *************************/ +/* Standard Request Code (Table 9-4) */ +#define USB_GET_STATUS 0 +#define USB_CLEAR_FEATURE 1 +#define USB_SET_FEATURE 3 +#define USB_SET_ADDRESS 5 +#define USB_GET_DESCRIPTOR 6 +#define USB_SET_DESCRIPTOR 7 +#define USB_GET_CONFIGURATION 8 +#define USB_SET_CONFIGURATION 9 +#define USB_GET_INTERFACE 10 +#define USB_SET_INTERFACE 11 +#define USB_SYNCH_FRAME 12 + +/* Descriptor Type (Table 9-5) */ +#define USB_DESC_TYPE_DEVICE 1 +#define USB_DESC_TYPE_CONFIG 2 +#define USB_DESC_TYPE_STRING 3 +#define USB_DESC_TYPE_INTERFACE 4 +#define USB_DESC_TYPE_ENDPOINT 5 + +/* Endpoint Attribute (Table 9-10) */ +#define USB_EP_ATTR_CTRL 0 +#define USB_EP_ATTR_ISOCH 1 +#define USB_EP_ATTR_BULK 2 +#define USB_EP_ATTR_INTRPT 3 + +/*********************** for USB 2.0 **********************************/ +// Table 9-5. Descriptor Types +#define DT_DEVICE 1 +#define DT_CONFIGURATION 2 +#define DT_STRING 3 +#define DT_INTERFACE 4 +#define DT_ENDPOINT 5 +#define DT_DEVICE_QUALIFIER 6 +#define DT_OTHER_SPEED_CONFIGURATION 7 +#define DT_INTERFACE_POWER 8 + +/**********************************************************************/ +// Values for bmAttributes Field in USB_CONFIGURATION_DESCRIPTOR +#define USB_BUS_POWERED 0x80 +#define USB_SELF_POWERED 0x40 +#define USB_REMOTE_WAKEUP 0x20 + +#define cUSB_REQTYPE_DIR_POS 7 +#define cUSB_REQTYPE_DIR_LEN 1 +#define cUSB_REQTYPE_TYPE_POS 5 +#define cUSB_REQTYPE_TYPE_LEN 2 +#define cUSB_REQTYPE_RX_POS 0 +#define cUSB_REQTYPE_RX_LEN 5 + +/* for USB State */ +#define cUSB_DEFAULT_STATE 0 +#define cUSB_ADDRESS_STATE 1 +#define cUSB_CONFIG_STATE 2 + +/* for Data transfer direction */ +#define bmUSB_HOST_DIR 7 /* Bit 7 */ +#define cUSB_DIR_HOST_OUT 0 +#define cUSB_DIR_HOST_IN 1 + +/* for Type */ +#define cUSB_REQTYPE_STD 0 +#define cUSB_REQTYPE_CLASS 1 +#define cUSB_REQTYPE_VENDOR 2 + +/* for Recipient */ +#define cUSB_REQTYPE_DEVICE 0 +#define cUSB_REQTYPE_INTERFACE 1 +#define cUSB_REQTYPE_ENDPOINT 2 +#define cUSB_REQTYPE_OTHER 3 + +/* for Descriptor Type */ +#define cUSB_DESTYPE_DEVICE 1 +#define cUSB_DESTYPE_CONFIG 2 +#define cUSB_DESTYPE_STRING 3 +#define cUSB_DESTYPE_INTERFACE 4 +#define cUSB_DESTYPE_ENDPOINT 5 +#define cUSB_DESTYPE_END cUSB_DESTYPE_ENDPOINT // for range check + +/* for Feature selector */ +#define cUSB_FEATSEL_RMWAKEUP 0 +#define cUSB_FEATSEL_EPHAL 1 +#define cUSB_FEATSEL_END cUSB_FEATSEL_EPHAL // for range check + +#define bmREQ_RECI 0 +#define bmwREQ_RECI 5 // mMASKS(bmwREQ_RECI, bmREQ_RECI) +#define bmREQ_TYPE 5 +#define bmwREQ_TYPE 2 // mMASKS(bmwREQ_TYPE, bmREQ_TYPE) +#define bmREQ_DIR 7 +#define bmwREQ_DIR 1 + +#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/usb_type.h b/target_firmware/magpie_fw_dev/target/inc/usb_type.h new file mode 100755 index 0000000..c1bee0e --- /dev/null +++ b/target_firmware/magpie_fw_dev/target/inc/usb_type.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2013 Qualcomm Atheros, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Qualcomm Atheros nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef USB_TYPE_H +#define USB_TYPE_H + +#include "dt_defs.h" + +/*********************** for Faraday USB controller *******************/ +typedef enum +{ + CMD_VOID, // No command + CMD_GET_DESCRIPTOR, // Get_Descriptor command + CMD_SET_DESCRIPTOR // Set_Descriptor command +} CommandType; + +typedef enum +{ + ACT_IDLE, + ACT_DONE, + ACT_STALL +} Action; + +typedef struct Setup_Packet +{ + uint8_t Direction; /* Data transfer direction: IN, OUT */ + uint8_t Type; /* Request Type: Standard, Class, Vendor */ + uint8_t Object; /* Recipient: Device, Interface, Endpoint,other */ + uint16_t Request; /* Refer to Table 9-3 */ + uint16_t Value; + uint16_t Index; + uint16_t Length; +} SetupPacket; + +#define mBIT(b) (1 << (b)) +#define mMASK(w) (mBIT(w) - 1) + +#define mWORD_IDX(bsize) ((bsize) >> 1) +#define mWORD_SIZE(bsize) (((bsize) + 1) >> 1) + +#define mTABLE_WID mWORD_SIZE +#define mTABLE_IDX mWORD_IDX +#define mTABLE_LEN mLOW_BYTE + +#define mLOW_MASK(u16) ((uint8_t) ((u16) & mMASK(8))) +#define mHIGH_MASK(u16) ((uint8_t) ((u16) & ~mMASK(8))) +#define mLOW2HIGH(u16) (((uint8_t) (u16)) << 8) + +/* (1234) -> 0034 */ +//#define mLOW_BYTE(u16) ((U_8)(u16)) +#define mLOW_BYTE(u16) mLOW_MASK(u16) +/* (1234) -> 0012 */ +#define mHIGH_BYTE(u16) ((uint8_t) (((uint16_t) (u16)) >> 8)) + +#define mGET_REG1(var0, reg0) { var0 = reg0; } + +/* (1234, 5678) -> 7834 */ +#define m2BYTE(ch1L, ch2H) (mLOW_MASK(ch1L) | mLOW2HIGH(ch2H)) + +#define mREAD_WORD(var0, reg0, reg1) \ + { var0 = reg0; var0 += mLOW2HIGH(reg1); } + +#endif diff --git a/target_firmware/magpie_fw_dev/target/inc/usbfifo_api.h b/target_firmware/magpie_fw_dev/target/inc/usbfifo_api.h new file mode 100755 index 0000000..9ec5398 --- /dev/null +++ b/target_firmware/magpie_fw_dev/target/inc/usbfifo_api.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2013 Qualcomm Atheros, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Qualcomm Atheros nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * @File: HIF_api.h + * + * @Abstract: Host Interface api + * + * @Notes: + */ + +#ifndef _USB_FIFO_API_H +#define _USB_FIFO_API_H + +#include "vbuf_api.h" + +typedef struct _USB_FIFO_CONFIG { + /* callback to get the buf for receiving commands from USB FIFO */ + VBUF* (*get_command_buf)(void); + /* callback when receiving a command */ + void (*recv_command)(VBUF *cmd); + /* callback to get the buf for event to send to the host */ + VBUF* (*get_event_buf)(void); + /* callback to indicate the event has been sent to the host */ + void (*send_event_done)(VBUF *buf); + + /* context used for all callbacks */ + //void *context; +} USB_FIFO_CONFIG; + +/* hardware API table structure (API descriptions below) */ +struct usbfifo_api { + void (*_init)(USB_FIFO_CONFIG *pConfig); + void (*_enable_event_isr)(void); + + /* room to expand this table by another table */ + void *pReserved; +}; + +extern void usbfifo_module_install(struct usbfifo_api *apis); + +#endif /* #ifndef _USB_FIFO_API_H */