예제 #1
0
파일: screen.c 프로젝트: johnSerrano/johnOS
int get_cursor(){

  out_b(REG_SCREEN_CTRL, 14); // cursor offset high byte
  int offset = in_b(REG_SCREEN_DATA) << 8; //set offset high byte
  out_b(REG_SCREEN_CTRL, 15); // cursor offset low byte
  offset += in_b(REG_SCREEN_DATA); //set offset low byte

  return offset * 2;
}
예제 #2
0
파일: 8259.c 프로젝트: jimlar/bonk
void disable_8259_irq (int irq)
{
  
  if (irq > -1 && irq < 8)
  {
    __asm__ ("pushf");
    out_b (MASTER_CTLMASK, (in_b (MASTER_CTLMASK) | (1 << irq)));
    __asm__ ("popf");
  } else if (irq > 7 && irq < 16)
  {
    __asm__ ("pushf");
    out_b (SLAVE_CTLMASK, (in_b (SLAVE_CTLMASK) | (1 << (irq - 8))));
    __asm__ ("popf");
  }
}
예제 #3
0
//TODO
char handleKBD(int currLinePosition){
  /*return char if key pressed, 0 if no key press*/
  
  char flag;
  char mychar = 0;



  /*read keyboard status*/
  flag = in_b(0x64);

  
  /*if there is data to read, read data*/
  if (flag & 0x1){
    mychar = getChar();

    //if at line cap, don't write
    if((mychar != '\b' && mychar != '\n') && currLinePosition == 99){
      mychar = 0;
    }
    
    if (mychar != 0){ //mychar returns 0 on keyup, deal with this differently, current is crutch
      if (!(mychar == '\b' && currLinePosition == 0)){ //DON'T BACKSPACE OVER PROMPT
	//print char to screen
	print_char(mychar, -1, -1, WHIT_BLK);
      }
      else {
	mychar = 0;
      }
    }
  }
  
  return mychar;
}
예제 #4
0
파일: ostron.c 프로젝트: Ninals-GitHub/TRON
ACPI_STATUS
AcpiOsReadPort (
    ACPI_IO_ADDRESS         Address,
    UINT32                  *Value,
    UINT32                  Width)
{

	switch (Width) {
	case 8:
		*Value = in_b((uint16_t)Address);
	break;
	
	case 16:
		*Value = in_h((uint16_t)Address);
	break;
	
	case 32:
		*Value = in_w((uint16_t)Address);
	break;
	
	default:
		return (AE_BAD_PARAMETER);
	}
	
	return (AE_OK);
}
예제 #5
0
파일: io.c 프로젝트: Ninals-GitHub/TRON
/*
 *	Memory block inputs (8 bit)	cnt : number of bytes
 */
EXPORT	void	InMemB(UW iob, W ix, UB *buf, W cnt)
{
	UW	port = iob + (ix * IOSTEP);

	while (--cnt >= 0) {
		*buf++ = in_b(port);
	}
}
예제 #6
0
void main()
{
	while(1)
	{
		if(in_b(4)==0)
		{
			toggle_d(7);
			sleep(200);
		}
	}
}
예제 #7
0
파일: memory.c 프로젝트: imgtec/t-kernel
/*
        I/O read
*/
EXPORT	W	readIO(UW addr, UW *data, W unit)
{
	W	n;
	UW	pa;

        /* address misalignment is reported as error */
	if (addr & (unit - 1)) return 0;

        /* I/O address check & conversion to physical address */
	n = chkIOAddr(addr, &pa, unit);
	if (n < unit) return 0;

	switch(unit) {
	case 4:		*data = in_w(pa);	break;
	case 2:		*data = in_h(pa);	break;
	default:	*data = in_b(pa);
	}
	return unit;
}
예제 #8
0
파일: pit.c 프로젝트: Ninals-GitHub/TRON
/*
==================================================================================
 Funtion	:recvCounter2
 Input		:void
 Output		:void
 Return		:uint8_t
 		 < received a value of counter 2 >
 Description	:receive a value of counter 2 from a pit
==================================================================================
*/
LOCAL INLINE uint8_t recvCounter2(void)
{
	return(in_b(PIT_REG_COUNTER2));
}
예제 #9
0
파일: pit.c 프로젝트: Ninals-GitHub/TRON
/*
==================================================================================
 Funtion	:recvData
 Input		:void
 Output		:void
 Return		:uint8_t
 		 < received data >
 Description	:receive a data from a pit
==================================================================================
*/
LOCAL INLINE uint8_t recvData(void)
{
	return(in_b(PIT_REG_CONTROL));
}
예제 #10
0
파일: pic.c 프로젝트: Ninals-GitHub/TRON
/*
==================================================================================
 Funtion	:recvDataSlave
 Input		:void
 Output		:void
 Return		:uint8_t
 		 < received data >
 Description	:receive data from a pic slave
==================================================================================
*/
LOCAL INLINE uint8_t recvDataSlave(void)
{
	return(in_b(PIC_SLV_DAT_REG));
}
예제 #11
0
파일: pic.c 프로젝트: Ninals-GitHub/TRON
/*
==================================================================================
 Funtion	:recvIrqMaskSlave
 Input		:void
 Output		:void
 Return		:uint8_t
 		 < received data >
 Description	:receive mask data from a pic slave
==================================================================================
*/
LOCAL INLINE uint8_t recvIrqMaskSlave(void)
{
	return(in_b(PIC_SLV_IMR_REG));
}
예제 #12
0
파일: pic.c 프로젝트: Ninals-GitHub/TRON
/*
==================================================================================
 Funtion	:recvStatusSlave
 Input		:void
 Output		:void
 Return		:uint8_t
 		 < received status >
 Description	:receive a status from a pic slave
==================================================================================
*/
LOCAL INLINE uint8_t recvStatusSlave(void)
{
	return(in_b(PIC_SLV_STS_REG));
}
예제 #13
0
파일: pic.c 프로젝트: Ninals-GitHub/TRON
/*
==================================================================================
 Funtion	:recvDataMaster
 Input		:void
 Output		:void
 Return		:uint8_t
 		 < received data >
 Description	:receive data from a pic master
==================================================================================
*/
LOCAL INLINE uint8_t recvDataMaster(void)
{
	return(in_b(PIC_MST_DAT_REG));
}
예제 #14
0
파일: pic.c 프로젝트: Ninals-GitHub/TRON
/*
==================================================================================
 Funtion	:recvIrqMaskMaster
 Input		:void
 Output		:void
 Return		:uint8_t
 		 < received data >
 Description	:receive mask data from a pic master
==================================================================================
*/
LOCAL INLINE uint8_t recvIrqMaskMaster(void)
{
	return(in_b(PIC_MST_IMR_REG));
}
예제 #15
0
파일: pic.c 프로젝트: Ninals-GitHub/TRON
/*
==================================================================================
 Funtion	:recvStatusMaster
 Input		:void
 Output		:void
 Return		:uint8_t
 		 < received status >
 Description	:receive a status from a pic master
==================================================================================
*/
LOCAL INLINE uint8_t recvStatusMaster(void)
{
	return(in_b(PIC_MST_STS_REG));
}
예제 #16
0
int getScancode(){
  int result;
  result = in_b(REGISTER_KEYBOARD_DATA);
  return result;
}