OpenCores
URL https://opencores.org/ocsvn/usb_fpga_1_2/usb_fpga_1_2/trunk

Subversion Repositories usb_fpga_1_2

[/] [usb_fpga_1_2/] [trunk/] [include/] [ztex.h] - Diff between revs 2 and 3

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 15... Line 15...
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, see http://www.gnu.org/licenses/.
   along with this program; if not, see http://www.gnu.org/licenses/.
!*/
!*/
 
 
/*
/*
   Puts everything in the right order together.
   Puts everything together.
*/
*/
 
 
#ifndef[ZTEX_H]
#ifndef[ZTEX_H]
#define[ZTEX_H]
#define[ZTEX_H]
 
 
Line 28... Line 28...
   ********************************************************************* */
   ********************************************************************* */
#include[ztex-utils.h]
#include[ztex-utils.h]
 
 
 
 
/* *********************************************************************
/* *********************************************************************
 
   ***** EEPROM support and some I2c helper functions ******************
 
   ********************************************************************* */
 
#ifneq[EEPROM_DISABLED][1]
 
#include[ztex-eeprom.h]
 
#endif
 
 
 
/* *********************************************************************
   ***** Flash memory support ******************************************
   ***** Flash memory support ******************************************
   ********************************************************************* */
   ********************************************************************* */
#ifeq[FLASH_ENABLED][1]
#ifeq[FLASH_ENABLED][1]
 
 
#ifeq[PRODUCT_IS][UFM-1_1]
#ifeq[PRODUCT_IS][UFM-1_1]
 
#define[MMC_PORT][E]
 
#define[MMC_BIT_CS][7]
 
#define[MMC_BIT_DI][6]
 
#define[MMC_BIT_DO][4]
 
#define[MMC_BIT_CLK][5]
#include[ztex-flash1.h]
#include[ztex-flash1.h]
 
 
#elifeq[PRODUCT_IS][UFM-1_2]
#elifeq[PRODUCT_IS][UFM-1_2]
 
#define[MMC_PORT][E]
 
#define[MMC_BIT_CS][7]
 
#define[MMC_BIT_DI][6]
 
#define[MMC_BIT_DO][4]
 
#define[MMC_BIT_CLK][5]
 
#include[ztex-flash1.h]
 
 
 
#elifeq[PRODUCT_IS][UM-1_0]
 
#define[MMC_PORT][C]
 
#define[MMC_BIT_CS][7]
 
#define[MMC_BIT_DI][6]
 
#define[MMC_BIT_DO][4]
 
#define[MMC_BIT_CLK][5]
#include[ztex-flash1.h]
#include[ztex-flash1.h]
 
 
 
#elifeq[PRODUCT_IS][UM-1_10]
 
#define[MMC_PORT][C]
 
#define[MMC_BIT_CS][4]
 
#define[MMC_BIT_DI][5]
 
#define[MMC_BIT_DO][7]
 
#define[MMC_BIT_CLK][6]
 
#include[ztex-flash1.h]
 
 
#else
#else
#warning[FLASH option is not supported by this product]
#warning[FLASH option is not supported by this product]
#define[FLASH_ENABLED][0]
#define[FLASH_ENABLED][0]
#endif
#endif
#endif
#endif
 
 
 
 
/* *********************************************************************
 
   ***** EEPROM support and some I2c helper functions ******************
 
   ********************************************************************* */
 
#ifneq[EEPROM_DISABLED][1]
 
#include[ztex-eeprom.h]
 
#endif
 
 
 
/* *********************************************************************
/* *********************************************************************
   ***** FPGA configuration support ************************************
   ***** FPGA configuration support ************************************
   ********************************************************************* */
   ********************************************************************* */
#ifeq[PRODUCT_IS][UFM-1_0]
#ifeq[PRODUCT_IS][UFM-1_0]
#include[ztex-fpga.h]
#include[ztex-fpga.h]
Line 111... Line 139...
        SYNCDELAY;
        SYNCDELAY;
]
]
 
 
void init_USB ()
void init_USB ()
{
{
 
    USBCS |= 0x08;
 
 
    CPUCS = bmBIT4 | bmBIT1;
    CPUCS = bmBIT4 | bmBIT1;
    CKCON &= ~7;
    CKCON &= ~7;
 
 
 
#ifeq[PRODUCT_IS][UFM-1_0]
 
    IOA1 = 1;
 
    OEA |= bmBIT1;
 
#elifeq[PRODUCT_IS][UFM-1_1]
    IOA1 = 1;
    IOA1 = 1;
    OEA |= bmBIT1;
    OEA |= bmBIT1;
 
#elifeq[PRODUCT_IS][UFM-1_2]
 
    IOA1 = 1;
 
    OEA |= bmBIT1;
 
#endif
 
 
    EA = 0;
    EA = 0;
 
    EUSB = 0;
 
 
    ENABLE_AVUSB;
    ENABLE_AVUSB;
 
 
    INIT_INTERRUPT_VECTOR(INTVEC_SUDAV, SUDAV_ISR);
    INIT_INTERRUPT_VECTOR(INTVEC_SUDAV, SUDAV_ISR);
    INIT_INTERRUPT_VECTOR(INTVEC_SOF, SOF_ISR);
    INIT_INTERRUPT_VECTOR(INTVEC_SOF, SOF_ISR);
Line 148... Line 186...
    EPIE = 0xff;
    EPIE = 0xff;
 
 
    EUSB = 1;
    EUSB = 1;
    EA = 1;
    EA = 1;
 
 
    USBCS |= 0x08;
 
    USBCS |= bmBIT7 | bmBIT1;
 
    wait(500);
 
    USBCS &= ~0x08;
 
    wait(500);
 
 
 
    EP1XCFG(1IN);
    EP1XCFG(1IN);
    EP1XCFG(1OUT);
    EP1XCFG(1OUT);
    EPXCFG(2);
    EPXCFG(2);
    EPXCFG(4);
    EPXCFG(4);
    EPXCFG(6);
    EPXCFG(6);
    EPXCFG(8);
    EPXCFG(8);
 
 
 
#ifeq[FLASH_ENABLED][1]
 
    flash_init();
 
#endif
 
#ifeq[FLASH_BITSTREAM_ENABLED][1]
 
    fpga_configure_from_flash_init();
 
#endif
 
 
 
    USBCS |= bmBIT7 | bmBIT1;
 
    wait(250);
 
    USBCS &= ~0x08;
}
}
 
 
 
 
#endif   /* ZTEX_H */
#endif   /* ZTEX_H */
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.