Exemplo n.º 1
0
void move_cursor() {
    u16 cursor_location = monitor->cursor_y * 80 + monitor->cursor_x;

    x86_outb(0x3D4, 14);
    x86_outb(0x3D5, cursor_location >> 8);
    x86_outb(0x3D4, 15);
    x86_outb(0x3D5, cursor_location);
}
Exemplo n.º 2
0
PUBLIC void serial_init(void)
{

  x86_outb(SERIAL_PORT + 1, 0x00);    /* No interrupt   */
  x86_outb(SERIAL_PORT + 3, 0x80);    /* DLAB (divisor) */
  x86_outb(SERIAL_PORT + 0, 0x03);    /* Divisor (3 == 38400 bauds) - MSB */
  x86_outb(SERIAL_PORT + 1, 0x00);    /* Divisor - LSB  */
  x86_outb(SERIAL_PORT + 3, 0x03);    /* 8 bits, no parity, 1 stop bit */

 return;
}
Exemplo n.º 3
0
PUBLIC u8_t pit_setup(void)
{
    u32_t ticks;

    /* Compute number of clock pulsations before triggering interrupt */
    ticks = PIT_MAX_FREQ/PIT_FREQ;

    /* counter are 16 bits values
       max value is 2^16=65535 and 65536 is in fact 0 */

    if (ticks <= 65536)
    {
        /* 65536 == 0 */
        ticks = (ticks==65536?0:ticks);

        /* Send control word to active Mode 2 (Rate Generator) */
        x86_outb(PIT_CWREG,PIT_MODE2);

        /* Send frequency for this mode */
        x86_outb(PIT_COUNTER0,(u8_t)ticks);        /* LSB first */
        x86_outb(PIT_COUNTER0,(u8_t)(ticks>>8));   /* MSB last */
    }
Exemplo n.º 4
0
PUBLIC void serial_putc(char c)
{
  u32_t i;
  u8_t buf;

  /* Wait for line release */
  for(i=0;i<12345;i++)
    {
      x86_inb(SERIAL_PORT+5,&buf);
      if (buf & 0x20)
  	{
  	  break;
  	}
    }

  /* Put character */
  x86_outb(SERIAL_PORT,c);
 
  return;
}