示例#1
0
文件: pic.c 项目: tijuo/Silverbox-OS
void disableAllIRQ( void )
{
  outByte( (word)0x21u, 0xFFu );
  ioWait();
  outByte( (word)0xA1u, 0xFFu );
  ioWait();
}
示例#2
0
int scrollDown( void )
{
  byte high, low;
  word address;
  int ret = 0;

  outByte( 0x3D4u, 0x0Cu );
  high = inByte( 0x3D5u );
  outByte( 0x3D4u, 0x0Du );
  low = inByte( 0x3D5u );

  address = (high << 8 | low );
  address += 0x50u;

  if( address > 0x3e80u )
  {
    address = 0;
    ret = 1;
  }

  outByte( 0x3D4u, 0x0Cu );
  outByte( 0x3D5u, address >> 8 );
  outByte( 0x3D4u, 0x0Du );
  outByte( 0x3D5u, address & 0xFFu );

  return ret;
}
示例#3
0
void initTiming()
{
	outByte(PIT_CTRL, 0x34);
	outByte(PIT_CNT0, 0x9c);
	outByte(PIT_CNT0, 0x2e);
	return;
}
示例#4
0
文件: pic.c 项目: tijuo/Silverbox-OS
void enableAllIRQ( void )
{
  outByte( (word)0x21u, 0 );
  ioWait();
  outByte( (word)0xA1u, 0 );
  ioWait();
}
示例#5
0
static void handleAllMessages(midi::MidiMessage msg) {
  if (msg.type == midi::Start) {
    outByte(msg.type);
    instance->ResetTimer();
    return;
  }
  if (msg.type == midi::Stop) {
    outByte(msg.type);
    return;
  }

  if (msg.type < 0xf0) {
    randomize();
    Serial.write(msg.type + msg.channel-1);
    Serial.write(msg.data1);
    softSerial2.write(msg.type + msg.channel-1);
    softSerial2.write(msg.data1);
    softSerial.write(msg.type + msg.channel-1);
    softSerial.write(msg.data1);
    if (msg.type <= 0xf0 || msg.data2) {
      Serial.write(msg.data2);
      softSerial2.write(msg.data2);
      softSerial.write(msg.data2);
    }
  }
}
示例#6
0
文件: pic.c 项目: tijuo/Silverbox-OS
void sendEOI( void )
{
  outByte( (word)0x20u, (byte)0x20u );
  ioWait();
  outByte( (word)0xA0u, (byte)0x20u );
  ioWait();
}
示例#7
0
void initMouseData()
{
	waitKBCReady();
	outByte(PORT_KEYCMD, KEYCMD_SENDTO_MOUSE);
	waitKBCReady();
	outByte(PORT_KEYDATA, MOUSECMD_ENABLE);
	return;
}
示例#8
0
void initKeyboard()
{
	waitKBCReady();
	outByte(PORT_KEYCMD, KEYCMD_WRITE_MODE);
	waitKBCReady();
	outByte(PORT_KEYDATA, KBC_MODE);
	return;
}
示例#9
0
void intHandler2e()
{
	inByte(REG_STATUS);
	outByte(0x20, 0xA0);
	outByte(0x20, 0x20);
	isHardDiskReady = TRUE;
	return;
}
示例#10
0
void init_serial(void)
{
    outByte(combase + 3, inByte(combase + 3) | 0x80u); // Set DLAB for
                                                      // DLLB access
    outByte(combase, 0x03u);                           /* 38400 baud */
    outByte(combase + 1, 0u); // Disable interrupts
    outByte(combase + 3, inByte(combase + 3) & 0x7fu); // Clear DLAB
    outByte(combase + 3, 3u); // 8-N-1
}
示例#11
0
void resetScroll( void )
{
//  word address=0;

  outByte( 0x3D4u, 0x0Cu );
  outByte( 0x3D5u, 0 );
  outByte( 0x3D4u, 0x0Du );
  outByte( 0x3D5u, 0 );
}
示例#12
0
void intHandler2c()
{
	u32 data;
	outByte(PIC1_OCW2, 0x64);
	outByte(PIC0_OCW2, 0x62);
	data = inByte(PORT_KEYDATA) + 2048;
	putQueueBuffer(&systemBuffer, data);
	switchKernelProcess();
}
示例#13
0
int set_baudrate(int baud, word port)
{
  byte dll, dlh;

  switch(baud) {
    case S50BAUD:
      dll = 0x00;
      dlh = 0x09;
      break;
    case S300BAUD:
      dll = 0x80;
      dlh = 0x01;
      break;
    case S600BAUD:
      dll = 0xC0;
      dlh = 0x00;
      break;
    case S2400BAUD:
      dll = 0x30;
      dlh = 0x00;
      break;
    case S4800BAUD:
      dll = 0x18;
      dlh = 0x00;
      break;
    case S9600BAUD:
      dll = 0x0C;
      dlh = 0x00;
      break;
    case S19200BAUD:
      dll = 0x06;
      dlh = 0x00;
      break;
    case S39400BAUD:
      dll = 0x03;
      dlh = 0x00;
      break;
    case S57600BAUD:
      dll = 0x02;
      dlh = 0x00;
      break;
    case S115200BAUD:
      dll = 0x01;
      dlh = 0x00;
      break;
    default:
      return -1;
  }

  set_dlab(1, port);
  outByte(DLL_BYTE + port, dll);
  outByte(DLH_BYTE + port, dlh);
  return 0;
}
示例#14
0
void intHandler21()
{
	outByte(PIC0_OCW2, 0x61);
	u8 data = inByte(PORT_KEYDATA);
	putQueueBuffer(&systemBuffer, data+1024);
	return;
}
示例#15
0
void intHandler20()
{
	outByte(PIC0_OCW2, 0x60);
	timeManager.time++;

	if (timeManager.latest<timeManager.time) {
		timeManager.latest=0xffffffff;
		Timer *timer = timeManager.currentTimer;
		if (timer!=null && (*timer).timeout<timeManager.time) {
			if ((*timer).onTimer!=null) {
				(*timer).onTimer();	
			}
			(*timer).onTimer = null;
			(*timer).status = STATUS_TIMER_UNUSE;
			if ((*timer).next != null) {
				timer = (*timer).next;
				timeManager.currentTimer = timer;
				timeManager.latest = (*timer).timeout;
			} else {
				timeManager.currentTimer = null;
			}				
		}		
	}
	startSwitchProcess();
}
示例#16
0
void putDebugChar(int ch)
{
    while (!(inByte(combase + 5) & 0x20u));
    outByte(combase, (byte) ch);
/*
if( ch == '\r' )
{
 sx=0;
 sy++;
 if( sy >= SCREEN_HEIGHT )
   scrollDown();
}
else if( ch == '\t' )
{
 sx +=8;
}
else
{
  putChar(ch,sx,sy);
  sx++;
}

if( sx >= SCREEN_WIDTH )
{
  sx=0;
  sy++;
  if( sy >= SCREEN_HEIGHT )
    scrollDown();
}
*/
}
示例#17
0
void scrollUp( void )
{
  byte high, low;
  word address;

  outByte( 0x3D4u, 0x0Cu );
  high = inByte( 0x3D5u );
  outByte( 0x3D4u, 0x0Du );
  low = inByte( 0x3D5u );
  address = (high << 8 | low );

  if( address == 0 )
    address = 0x3fc0u;
  else
    address -= 0x50u;

  outByte( 0x3D4u, 0x0Cu );
  outByte( 0x3D5u, address >> 8 );
  outByte( 0x3D4u, 0x0Du );
  outByte( 0x3D5u, address & 0xFFu );
}
示例#18
0
文件: pic.c 项目: tijuo/Silverbox-OS
void disableIRQ( unsigned int irq )
{
  byte data;

  if( irq > 15 )
    return;

  if( irq < 8 )
  {
    data = inByte( (word)0x21 );
    ioWait();
    outByte( (word)0x21, data | (byte)(1u << irq));
    ioWait();
  }
  else
  {
    data = inByte( (word)0xA1 );
    ioWait();
    outByte( (word)0xA1, data | (byte)(1u << (irq-8)));
    ioWait();
  }
}
示例#19
0
文件: pic.c 项目: tijuo/Silverbox-OS
void enableIRQ( unsigned int irq )
{
  byte data;

  if( irq > 15 )
    return;

  if( irq < 8 )
  {
    data = inByte( (word)0x21u );
    ioWait();
    outByte( (word)0x21u, data & (byte)~(1u << irq));
    ioWait();
  }
  else
  {
    data = inByte( (word)0xA1u );
    ioWait();
    outByte( (word)0xA1u, data & (byte)~(1u << (irq-8)));
    ioWait();
  }
}
示例#20
0
bool sendHdCommand(HdCommand *command)
{
	if (waitForStatus(STATUS_BSY, 0, HD_TIMEOUT) == TRUE) {
		outByte(REG_DEV_CTRL, 0);
		outByte(REG_FEATURES, command->features);
		outByte(REG_NSECTOR, command->count);
		outByte(REG_LBA_LOW, command->lbaLow);
		outByte(REG_LBA_MID, command->lbaMid);
		outByte(REG_LBA_HIGH, command->lbaHigh);
		outByte(REG_DEVICE, command->device);

		outByte(REG_CMD, command->command);

		return TRUE;
	} else {
		return FALSE;	
	}
}
示例#21
0
void set_modem_ctl(byte data, word port)
{
  outByte( port + MODEM_CTRL, data );
}
示例#22
0
void ser_fifo_ctrl(byte data, word port)
{
  outByte(port + FIFO_CTRL, data);
}
示例#23
0
void ser_enable_int(byte data, word port)
{
  set_dlab(0, port);
  outByte(port + INT_ENABLE, data);
}
示例#24
0
void set_line_ctrl(byte data, word port)
{
  outByte(LINE_CTRL + port, data);
}
示例#25
0
void set_dlab(byte bit, word port)
{
  bit &= 1;
  outByte(LINE_CTRL + port, (inByte(LINE_CTRL + port) & 0x7F)
     | (bit << 7));
}
示例#26
0
void ser_write_buffer(byte data, word port)
{
  set_dlab(0, port);
  outByte(port + TRANS_BUFF, data);
}