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

Subversion Repositories usb_fpga_1_15

[/] [usb_fpga_1_15/] [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 37... Line 37...
   ***** include the basic functions ***********************************
   ***** include the basic functions ***********************************
   ********************************************************************* */
   ********************************************************************* */
#include[ztex-utils.h]
#include[ztex-utils.h]
 
 
/* *********************************************************************
/* *********************************************************************
   ***** EEPROM support and some I2C helper functions ******************
   ***** I2C helper functions, EEPROM and MAC EEPROM support ***********
   ********************************************************************* */
   ********************************************************************* */
#ifneq[EEPROM_DISABLED][1]
#ifneq[EEPROM_DISABLED][1]
 
 
#ifneq[EEPROM_MAC_DISABLED][1]
#ifneq[EEPROM_MAC_DISABLED][1]
#ifeq[PRODUCT_IS][UFM-1_15]
#ifeq[PRODUCT_IS][UFM-1_15]
#define[MAC_EEPROM_ENABLED]
#define[MAC_EEPROM_ENABLED]
#endif // PRODUCT_IS=UFM-1_15
#endif // PRODUCT_IS=UFM-1_15
#ifeq[PRODUCT_IS][UFM-1_15Y]
#ifeq[PRODUCT_IS][UFM-1_15Y]
#define[MAC_EEPROM_ENABLED]
#define[MAC_EEPROM_ENABLED]
#endif // PRODUCT_IS=UFM-1_15Y
#endif // PRODUCT_IS=UFM-1_15Y
 
#ifeq[PRODUCT_IS][UFM-2_16]
 
#define[MAC_EEPROM_ENABLED]
 
#endif // PRODUCT_IS=UFM-2_16
 
#ifeq[PRODUCT_IS][UFM-2_13]
 
#define[MAC_EEPROM_ENABLED]
 
#endif // PRODUCT_IS=UFM-2_13
#endif // EEPROM_MAC_DISABLED
#endif // EEPROM_MAC_DISABLED
 
 
#include[ztex-eeprom.h]
#include[ztex-eeprom.h]
 
 
#endif // EEPROM_DISABLED
#endif // EEPROM_DISABLED
Line 84... Line 90...
#define[MMC_BIT_DI][6]
#define[MMC_BIT_DI][6]
#define[MMC_BIT_DO][4]
#define[MMC_BIT_DO][4]
#define[MMC_BIT_CLK][5]
#define[MMC_BIT_CLK][5]
#include[ztex-flash1.h]
#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]
 
 
 
#elifeq[PRODUCT_IS][UFM-1_10]
#elifeq[PRODUCT_IS][UFM-1_10]
#define[MMC_PORT][A]
#define[MMC_PORT][A]
#define[MMC__PORT_DO][D]
#define[MMC__PORT_DO][D]
#define[MMC_BIT_DO][0]
#define[MMC_BIT_DO][0]
#define[MMC_BIT_CS][5]
#define[MMC_BIT_CS][5]
Line 126... Line 124...
#define[MMC_BIT_DI][6]
#define[MMC_BIT_DI][6]
#define[MMC_BIT_DO][4]
#define[MMC_BIT_DO][4]
#define[MMC_BIT_CLK][5]
#define[MMC_BIT_CLK][5]
#include[ztex-flash1.h]
#include[ztex-flash1.h]
 
 
 
#elifeq[PRODUCT_IS][UFM-2_16]
 
#define[SPI_PORT][C]
 
#define[SPI_BIT_DO][4]
 
#define[SPI_BIT_CS][5]
 
#define[SPI_BIT_CLK][6]
 
#define[SPI_BIT_DI][7]
 
#include[ztex-flash2.h]
 
 
 
#elifeq[PRODUCT_IS][UFM-2_13]
 
#define[SPI_PORT][C]
 
#define[SPI_BIT_DO][4]
 
#define[SPI_BIT_CS][5]
 
#define[SPI_BIT_CLK][6]
 
#define[SPI_BIT_DI][7]
 
#include[ztex-flash2.h]
 
 
#else
#else
#warning[Flash memory access is not supported by this product]
#warning[Flash memory access is not supported by this product]
#define[FLASH_ENABLED][0]
#define[FLASH_ENABLED][0]
#endif
#endif
#endif
#endif
Line 149... Line 163...
#include[ztex-fpga3.h]
#include[ztex-fpga3.h]
#elifeq[PRODUCT_IS][UFM-1_15]
#elifeq[PRODUCT_IS][UFM-1_15]
#include[ztex-fpga4.h]
#include[ztex-fpga4.h]
#elifeq[PRODUCT_IS][UFM-1_15Y]
#elifeq[PRODUCT_IS][UFM-1_15Y]
#include[ztex-fpga5.h]
#include[ztex-fpga5.h]
 
#elifeq[PRODUCT_IS][UFM-2_16]
 
#include[ztex-fpga6.h]
 
#elifeq[PRODUCT_IS][UFM-2_13]
 
#include[ztex-fpga6.h]
#endif
#endif
 
 
 
 
/* *********************************************************************
/* *********************************************************************
   ***** DEBUG helper functions ****************************************
   ***** DEBUG helper functions ****************************************
Line 190... Line 208...
#endif
#endif
 
 
#endif
#endif
 
 
/* *********************************************************************
/* *********************************************************************
   ***** define the descriptors and the interrupt routines *************
   ***** define the descriptors ****************************************
   ********************************************************************* */
   ********************************************************************* */
#include[ztex-descriptors.h]
#include[ztex-descriptors.h]
 
 
 
 
 
/* *********************************************************************
 
   ***** Temperature sensor support ************************************
 
   ********************************************************************* */
 
#ifneq[EEPROM_DISABLED][1]
 
#ifneq[TEMP_SENSOR_DISABLED][1]
 
#ifeq[PRODUCT_IS][UFM-1_15Y]
 
#include[ztex-temp1.h]
 
#endif
 
 
 
#endif // TEMP_SENSOR_DISABLED
 
#endif // EEPROM_DISABLED
 
 
 
 
 
/* *********************************************************************
 
   ***** interrupt routines ********************************************
 
   ********************************************************************* */
#include[ztex-isr.h]
#include[ztex-isr.h]
 
 
 
 
#ifdef[@CAPABILITY_MAC_EEPROM;]
 
/* *********************************************************************
/* *********************************************************************
   ***** mac_eeprom_init ***********************************************
   ***** mac_eeprom_init ***********************************************
   ********************************************************************* */
   ********************************************************************* */
 
#ifdef[@CAPABILITY_MAC_EEPROM;]
void mac_eeprom_init ( ) {
void mac_eeprom_init ( ) {
    BYTE b,c,d;
    BYTE b,c,d;
    __xdata BYTE buf[5];
    __xdata BYTE buf[5];
    __code char hexdigits[] = "0123456789ABCDEF";
    __code char hexdigits[] = "0123456789ABCDEF";
 
 
 
    mac_eeprom_read ( buf, 0, 3 );       // read signature
 
    if ( buf[0]==67 && buf[1]==68 && buf[2]==48 ) {
 
        config_data_valid = 1;
 
        mac_eeprom_read ( SN_STRING, 16, 10 );  // copy serial number
 
    }
 
    else {
 
        config_data_valid = 0;
 
    }
 
 
    for (b=0; b<10; b++) {       // abort if SN != "0000000000"
    for (b=0; b<10; b++) {       // abort if SN != "0000000000"
        if ( SN_STRING[b] != 48 )
        if ( SN_STRING[b] != 48 )
            return;
            return;
    }
    }
 
 
Line 295... Line 340...
#elifeq[PRODUCT_IS][UFM-1_15]
#elifeq[PRODUCT_IS][UFM-1_15]
    IOA1 = 1;
    IOA1 = 1;
    OEA |= bmBIT1;
    OEA |= bmBIT1;
#elifeq[PRODUCT_IS][UFM-1_15Y]
#elifeq[PRODUCT_IS][UFM-1_15Y]
    init_fpga();
    init_fpga();
 
#elifeq[PRODUCT_IS][UFM-2_16]
 
    init_fpga();
 
#elifeq[PRODUCT_IS][UFM-2_13]
 
    init_fpga();
#endif
#endif
 
 
    INIT_CMDS;
    INIT_CMDS;
 
 
    EA = 0;
    EA = 0;
Line 350... Line 399...
#endif    
#endif    
 
 
#ifeq[FLASH_ENABLED][1]
#ifeq[FLASH_ENABLED][1]
    flash_init();
    flash_init();
#endif
#endif
#ifeq[FLASH_BITSTREAM_ENABLED][1]
 
    fpga_configure_from_flash_init();
 
#endif
 
#ifeq[DEBUG_ENABLED][1]
#ifeq[DEBUG_ENABLED][1]
    debug_init();
    debug_init();
#endif
#endif
#ifeq[XMEGA_ENABLED][1]
#ifeq[XMEGA_ENABLED][1]
    xmega_init();
    xmega_init();
#endif
#endif
#ifdef[@CAPABILITY_MAC_EEPROM;]
#ifdef[@CAPABILITY_MAC_EEPROM;]
    mac_eeprom_init();
    mac_eeprom_init();
#endif
#endif
 
#ifeq[TEMP1_ENABLED][1]
 
    temp1_init();
 
#endif
 
#ifeq[FLASH_BITSTREAM_ENABLED][1]
 
    fpga_configure_from_flash_init();
 
#endif
 
 
    USBCS |= bmBIT7 | bmBIT1;
    USBCS |= bmBIT7 | bmBIT1;
    wait(10);
    wait(10);
//    wait(250);
//    wait(250);
    USBCS &= ~bmBIT3;
    USBCS &= ~bmBIT3;

powered by: WebSVN 2.1.0

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