Example #1
0
static bool interrupt_init(void) {
	if(used_irq != 0xff) return true;

    if(irq_InstallISR(GetMCIRQ(), user_int, (void*)name) == false)
	{
	    printf("irq_install fail\n"); return false;
	}

	used_irq = GetMCIRQ();
	return true;
}
Example #2
0
static bool interrupt_init(int mc) {
	if(used_irq != 0xff) return true;
    
    if(irq_InstallISR(GetMCIRQ(), user_int, (void*)name) == false)
	{
	    printf("irq_install fail\n"); return false;
	}
	
	// enable mcm general interrupt function
	mc_outp(MC_GENERAL, 0x38, mc_inp(MC_GENERAL, 0x38) & ~(1L << mc));
	used_irq = GetMCIRQ();
	return true;
}
DMPAPI(int) interrupt_init(void)
{
#if defined (DMP_LINUX)
    OSSPININIT(idc.spinlock);
    for(int i = 0; i < INTERRUPTS; i++)
        idc.intr[i].used = false;
    int err = pthread_create(&idc.thread, NULL, intrMain, NULL);
    if(err != 0)
        printf("failed to create the thread\n");
    return 0;
#elif defined (DMP_DOS_DJGPP)
    if(used_irq != 0xff) return 0;

    if(irq_InstallISR(GetMCIRQ(), user_int, (void*)name) == false)
    {
        printf("irq_install fail\n");
        return -1;
    }

    used_irq = GetMCIRQ();
    return 0;
#endif
}
Example #4
0
static bool interrupt_init(void) {
	if(used_irq != 0xff) return true;
	
	if(irq_Init() == false) 
    {
        printf("irq_init fail\n"); return false;
    }
    
    if(irq_Setting(GetMCIRQ(), IRQ_LEVEL_TRIGGER + IRQ_DISABLE_INTR) == false)
    {
        printf("%s\n", __FUNCTION__); return false;
    }
    
    if(irq_InstallISR(GetMCIRQ(), user_int, (void*)name) == false)
	{
	    printf("irq_install fail\n"); return false;
	}
	//printf("BaseAddr = %08lxh irq = %d\n\n", mc_setbaseaddr(), GetMCIRQ());
	//Master_DX2();
	
	used_irq = GetMCIRQ();
	Set_MCIRQ(used_irq);
	return true;
}
Example #5
0
bool init() {
	int i, crossbarBase, gpioBase;
	if(io_Init() == false) return false;
    timer_NowTime(); // initialize timer
    CLOCKS_PER_MICROSEC = vx86_CpuCLK();
    VORTEX86EX_CLOCKS_PER_MS = CLOCKS_PER_MICROSEC*1000UL;
    
    // Set IRQ4 as level-trigger
    io_outpb(0x4D0, io_inpb(0x4D0) | 0x10);
    
	//set corssbar Base Address
	crossbarBase = sb_Read16(SB_CROSSBASE) & 0xfffe;
	if(crossbarBase == 0 || crossbarBase == 0xfffe)
		sb_Write16(SB_CROSSBASE, CROSSBARBASE | 0x01);
	
	// Force set HIGH speed ISA on SB
	sb_Write(SB_FCREG, sb_Read(SB_FCREG) | 0x8000C000L);
	
	//set SB GPIO Base Address
	gpioBase = sb_Read16(SB_GPIOBASE) & 0xfffe;
	if(gpioBase == 0 || gpioBase == 0xfffe)
	{
		sb_Write16(SB_GPIOBASE, GPIOCTRLBASE | 0x01);
		gpioBase = GPIOCTRLBASE;
	}
	
	// Enable GPIO 0 ~ 7 
	io_outpdw(gpioBase, 0x00ff);
	
	// set GPIO Port 0~7 dircetion & data Address
	for(i=0;i<8;i++)
		io_outpdw(gpioBase + (i+1)*4,((GPIODIRBASE + i*4)<<16) + GPIODATABASE + i*4);
	  
	// set ADC Base Address
	sb_Write(0xbc, sb_Read(0xbc) & (~(1L<<28)));  // active adc
	sb1_Write16(0xde, sb1_Read16(0xde) | 0x02);   // not Available for 8051A Access ADC
	sb1_Write(0xe0, 0x0050fe00L); // baseaddr = 0xfe00, disable irq
	
	// set MCM Base Address
	set_MMIO();
	mc_setbaseaddr();
	for(i=0; i<4; i++)
		mc_SetMode(i, MCMODE_PWM_SIFB);
	
	if(Global_irq_Init == false)
	{
		// set MCM IRQ
		if(irq_Init() == false) 
	    {
	        printf("MCM IRQ init fail\n"); return false;
	    }
	    
	    if(irq_Setting(GetMCIRQ(), IRQ_LEVEL_TRIGGER + IRQ_DISABLE_INTR) == false)
	    {
	        printf("MCM IRQ Setting fail\n"); return false;
	    }
	    Set_MCIRQ(GetMCIRQ());
	    Global_irq_Init = true;
	}
    
	//CDC
	USBDEV = CreateUSBDevice();
	if(USBDEV == NULL)
	{
		printf("init error\n");
		return false;
	}
    
	usb_SetUSBPins(USBDEV, 7, 0, 7, 1);
	usb_SetTimeOut(USBDEV, 0L, 500L); // USB RX timerout is 0ms and TX timeout is 500ms
	if(usb_Init(USBDEV) == false)
	{
		printf("init2 error\n");
		return false;
	}
    
	//io_Close();
	return true;
}