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 8 and 9

Show entire file | Details | Blame | View Log

Rev 8 Rev 9
Line 23... Line 23...
#ifndef[ZTEX_H]
#ifndef[ZTEX_H]
#define[ZTEX_H]
#define[ZTEX_H]
 
 
#define[INIT_CMDS;][]
#define[INIT_CMDS;][]
 
 
 
#ifneq[PRODUCT_IS][UFM-1_15]
 
#define[UFM_1_15X_DETECTION_ENABLED][0]
 
#endif
 
 
 
#ifeq[UFM_1_15X_DETECTION_ENABLED][1]
 
__xdata BYTE is_ufm_1_15x;
 
#endif
 
 
/* *********************************************************************
/* *********************************************************************
   ***** include the basic functions ***********************************
   ***** include the basic functions ***********************************
   ********************************************************************* */
   ********************************************************************* */
#include[ztex-utils.h]
#include[ztex-utils.h]
 
 
Line 37... Line 45...
 
 
#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]
 
#define[MAC_EEPROM_ENABLED]
 
#endif // PRODUCT_IS=UFM-1_15Y
#endif // EEPROM_MAC_DISABLED
#endif // EEPROM_MAC_DISABLED
 
 
#include[ztex-eeprom.h]
#include[ztex-eeprom.h]
 
 
#endif // EEPROM_DISABLED
#endif // EEPROM_DISABLED
Line 136... Line 147...
#include[ztex-fpga2.h]
#include[ztex-fpga2.h]
#elifeq[PRODUCT_IS][UFM-1_11]
#elifeq[PRODUCT_IS][UFM-1_11]
#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]
 
#include[ztex-fpga5.h]
#endif
#endif
 
 
 
 
/* *********************************************************************
/* *********************************************************************
   ***** DEBUG helper functions ****************************************
   ***** DEBUG helper functions ****************************************
Line 189... Line 202...
/* *********************************************************************
/* *********************************************************************
   ***** mac_eeprom_init ***********************************************
   ***** mac_eeprom_init ***********************************************
   ********************************************************************* */
   ********************************************************************* */
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";
 
 
    for (b=0; b<10; b++) {       // abort if SN != "0000000000"
    for (b=0; b<10; b++) {       // abort if SN != "0000000000"
        if ( SN_STRING[b] != '0' )
        if ( SN_STRING[b] != 48 )
            return;
            return;
    }
    }
 
 
    mac_eeprom_read ( buf, 0xfb, 5 );   // read the last 5 MAC digits
    mac_eeprom_read ( buf, 0xfb, 5 );   // read the last 5 MAC digits
 
 
Line 253... Line 266...
        EP$0CFG = 0;
        EP$0CFG = 0;
#endif
#endif
        SYNCDELAY;
        SYNCDELAY;
]
]
 
 
 
 
void init_USB ()
void init_USB ()
{
{
    USBCS |= 0x08;
    USBCS |= bmBIT3;
 
 
    CPUCS = bmBIT4 | bmBIT1;
    CPUCS = bmBIT4 | bmBIT1;
    wait(2);
    wait(2);
    CKCON &= ~7;
    CKCON &= ~7;
 
 
Line 279... Line 293...
    IOA1 = 1;
    IOA1 = 1;
    OEA |= bmBIT1;
    OEA |= bmBIT1;
#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]
 
    init_fpga();
#endif
#endif
 
 
    INIT_CMDS;
    INIT_CMDS;
 
 
    EA = 0;
    EA = 0;
Line 321... Line 337...
    EPXCFG(2);
    EPXCFG(2);
    EPXCFG(4);
    EPXCFG(4);
    EPXCFG(6);
    EPXCFG(6);
    EPXCFG(8);
    EPXCFG(8);
 
 
 
#ifeq[UFM_1_15X_DETECTION_ENABLED][1]
 
    OEA &= ~bmBIT3;
 
    if ( IOA3 ) {
 
        is_ufm_1_15x = 0;
 
    } else {
 
        is_ufm_1_15x = 1;
 
//      INTERFACE_CAPABILITIES[0] &= ~32;
 
    }
 
#endif    
 
 
#ifeq[FLASH_ENABLED][1]
#ifeq[FLASH_ENABLED][1]
    flash_init();
    flash_init();
#endif
#endif
#ifeq[FLASH_BITSTREAM_ENABLED][1]
#ifeq[FLASH_BITSTREAM_ENABLED][1]
    fpga_configure_from_flash_init();
    fpga_configure_from_flash_init();
Line 337... Line 363...
#endif
#endif
#ifdef[@CAPABILITY_MAC_EEPROM;]
#ifdef[@CAPABILITY_MAC_EEPROM;]
    mac_eeprom_init();
    mac_eeprom_init();
#endif
#endif
 
 
 
 
    USBCS |= bmBIT7 | bmBIT1;
    USBCS |= bmBIT7 | bmBIT1;
    wait(10);
    wait(10);
//    wait(250);
//    wait(250);
    USBCS &= ~0x08;
    USBCS &= ~bmBIT3;
}
}
 
 
 
 
#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.