Ejemplo n.º 1
0
void LOCAL_CHECK_TIMEOUT(unsigned short timeout)	   
{
	if (timeout == 0)
	{
		#ifdef __DEBUG
		LED_SET(LED_MAGENTA);
		while(1);
		#endif
		DebugReset(I2C_ERR);
	}
}
Ejemplo n.º 2
0
void VGA_deinit()
{
	memcpyTF((char*)VGA_address, vidmem, 256*1024);
	write_registers(mode_80_25_text);
	restorePalette(savedPalette);
	_isVGA = false;
	DebugReset();
	//restorefont((char*)g_8x8_font);
	//write_font(g_8x8_font, 8);
	//memset((char*)0xB8000, 0, 64*1024);
	DebugClrScr(0x17);
}
Ejemplo n.º 3
0
void VGA_init(int width, int height, int bpp){
	//savefont();
	savePalette(savedPalette);
	//read_registers(mode_80_25_text);
	/*outport(0x3C4, 0x02);
	char in = inport(0x3C5);
	DebugPrintf("\n0x3c4.0x02=0x%x", in);
	for(;;);*/
   //setup the vga struct
   VGA_width=(unsigned int)width;
   VGA_height=(unsigned int)height;
   VGA_bpp=bpp;
   VGA_address = (unsigned char*)0xA0000;

   //enables the mode 13 state
   //write_registers(mode_320_200_256);
   write_registers(mode_640_480_16);
   VGA_width = 640;
   VGA_height = 480;
   mode.address = (char*)VGA_address;
   mode.bpp = bpp;
   mode.height = VGA_height;
   mode.width = VGA_width;
   mode.id = 0x12;
   mode.putpixel = (PIXEL_WRITER)write_pixel4p;
   //save videomemory
   vidmem = (char*)malloc(256*1024);
   memcpy((char*)VGA_address, vidmem, 256*1024);
   _isVGA = true;
   DebugReset();

   //clears the screen
   VGA_clear_screen();

   //write_pixel4p(16, 16, 0x3d);
  // for(;;);

  // VGA_put_pixel(16, 16, 11);
   VGA_map_color(0x3D, 0xFF, 0x00, 0x00);
   VGA_map_color(0x00, 0xFF, 0xFF, 0xFF);
	/*_put_char(16, 16, 'l');
	_put_char(24, 16, 'e');
	_put_char(32, 16, 'v');
	_put_char(40, 16, 'e');
	_put_char(48, 16, 'x');*/
   //VGA_put_string(16,16, "levex");
   //mehgfor(;;);

 //  VGA_put_image(10, 10, "test.bmp");

}
Ejemplo n.º 4
0
// Exceptions and un-handled interrupts
void __attribute__((interrupt,auto_psv)) _DefaultInterrupt(void)
{
	// Set reset reason and call reset function
	SwResetReason_t reason = OTHER_INT;
	if		(INTCON1bits.STKERR)	reason = STACK_ERR;
	else if	(INTCON1bits.ADDRERR)	reason = ADDR_ERR;
	else if	(INTCON1bits.MATHERR)	reason = MATH_ERR;	
	INTCON1 = 0;
#ifndef __DEBUG
    DebugReset(reason);
#else
	{
		uint8_t usb_entry, usb_now;
		usb_entry = usb_now = USB_BUS_SENSE;
		// Magenta LED
		LED_SET(LED_MAGENTA);
		// Wait till usb changes state
		while(usb_now == usb_entry){usb_now = USB_BUS_SENSE;}
		// Break here, (dis)connect usb and step into the faulty code
		Nop();	Nop(); 	Nop();	
	}
#endif
}
Ejemplo n.º 5
0
// Called every second
inline void __attribute__((always_inline)) SwwdtTasks(void){if(--swwdtCount == 0)DebugReset(SW_WDT);}