Esempio n. 1
0
void set_cursor(int offset){
  offset /= 2;
  
  out_b(REG_SCREEN_CTRL, 14); //see get cursor comments
  out_b(REG_SCREEN_DATA, (unsigned char)(offset >> 8));
  out_b(REG_SCREEN_CTRL, 15);
  out_b(REG_SCREEN_DATA, (unsigned char)(offset));
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
File: 8259.c Progetto: jimlar/bonk
void eoi_8259 (int irq)
{
  if (irq > -1 && irq < 8)
  {
    out_b (MASTER_CTL, ENABLE_INT);

  } else if (irq > 7 && irq < 16)
  {
    out_b (MASTER_CTL, ENABLE_INT);
    out_b (SLAVE_CTL, ENABLE_INT);
  }
}
Esempio n. 4
0
File: 8259.c Progetto: 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");
  }
}
Esempio n. 5
0
ACPI_STATUS
AcpiOsWritePort (
    ACPI_IO_ADDRESS         Address,
    UINT32                  Value,
    UINT32                  Width)
{
	switch (Width) {
	case 8:
		out_b((uint16_t)Address, (uint8_t)Value);
	break;
	
	case 16:
		out_h((uint16_t)Address, (uint16_t)Value);
	break;
	
	case 32:
		out_w((uint16_t)Address, (uint32_t)Value);
	break;
	
	default:
		return (AE_BAD_PARAMETER);
	}
	
	return (AE_OK);
}
Esempio n. 6
0
/*
 *	Memory block outputs (8 bit)	cnt : number of bytes
 */
EXPORT	void	OutMemB(UW iob, W ix, UB *buf, W cnt)
{
	UW	port = iob + (ix * IOSTEP);

	while (--cnt >= 0) {
		out_b(port, *buf++);
	}
}
Esempio n. 7
0
File: 8259.c Progetto: jimlar/bonk
void init_8259 (void)
{
  /* Start initialization */
  out_b (MASTER_CTL, ICW1);
  out_b (SLAVE_CTL,  ICW1);

  /* Set IRQ vectors */
  out_b (MASTER_CTLMASK, IRQ0_VECTOR);
  out_b (SLAVE_CTLMASK,  IRQ8_VECTOR);

  /* Connect master/slave */
  out_b (MASTER_CTLMASK, MASTER_ICW3);
  out_b (SLAVE_CTLMASK,  SLAVE_ICW3);

  /* finish initialization */
  out_b (MASTER_CTLMASK, ICW4);
  out_b (SLAVE_CTLMASK,  ICW4);

  /* mask off all interrupts, but the cascade */
  out_b (MASTER_CTLMASK, ~(1 << CASCADE_IRQ));
  out_b (SLAVE_CTLMASK, ~0);

  DEBUG_MSG("8259 initialized");
}
Esempio n. 8
0
}

void sched_init(void)
{
	/* 初始化进程控制块指针数组 */
	/* nothing.在bss段,已被清零 */
	
	proc[0] = &init_proc.proc;
	current = proc[0];
	ticks = 0;

	/* 设置进程0的ldt和tss描述符 */
	set_ldt_desc(0, V_KERNEL_ZONE_START+(unsigned long)&(proc[0]->ldt));
	set_tss_desc(0, V_KERNEL_ZONE_START+(unsigned long)&(proc[0]->tss));
	/* 装载进程0的ldt和tss选择符,第一次需我们来加载 */
	lldt(_LDT(0));
	ltr(_TSS(0));
	/* 挂载时钟中断处理程序 */
	set_idt(INT_R0, timer_int, NR_TIMER_INT);
	/* 设置8253定时器芯片 */
	out_b(0x43, 0x36);
	out_b(0x40, (LATCH & 0xff));
	out_b(0x40, ((LATCH>>8) & 0xff));
	/* 挂载系统调用处理程序 */
Esempio n. 9
0
/*
        I/O write
*/
EXPORT	W	writeIO(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:		out_w(pa, data);	break;
	case 2:		out_h(pa, data);	break;
	default:	out_b(pa, data);
	}
	return unit;
}
Esempio n. 10
0
/*
==================================================================================
 Funtion	:sendCommandSlave
 Input		:uint8_t command
 		 < command data to send to a pic >
 Output		:void
 Return		:void
 Description	:senda a command to a pic slave
==================================================================================
*/
LOCAL INLINE void sendCommandSlave(uint8_t command)
{
	out_b(PIC_SLV_COM_REG, command);
}
Esempio n. 11
0
/*
==================================================================================
 Funtion	:sendIrqMaskMaster
 Input		:uint8_t irqmask
 		 < irq mask flags to send to a pic >
 Output		:void
 Return		:void
 Description	:send a irq mask reques to a pic master
==================================================================================
*/
LOCAL INLINE void sendIrqMaskMaster(uint8_t irqmask)
{
	out_b(PIC_MST_IMR_REG, irqmask);
}
Esempio n. 12
0
/*
==================================================================================
 Funtion	:sendCommandMaster
 Input		:uint8_t command
 		 < command data to send to a pic >
 Output		:void
 Return		:void
 Description	:send a command to a pic master
==================================================================================
*/
LOCAL INLINE void sendCommandMaster(uint8_t command)
{
	out_b(PIC_MST_COM_REG, command);
}
Esempio n. 13
0
/*
==================================================================================
 Funtion	:sendDataMaster
 Input		:uint8_t data
 		 < data to send to a pic >
 Output		:void
 Return		:void
 Description	:send data to a pic master
==================================================================================
*/
LOCAL INLINE void sendDataMaster(uint8_t data)
{
	out_b(PIC_MST_DAT_REG, data);
}
Esempio n. 14
0
/*
==================================================================================
 Funtion	:sendCounter2
 Input		:uint8_t counter
 		 < counter to send to a pit >
 Output		:void
 Return		:void
 Description	:send value of counter 2 to a pit
==================================================================================
*/
LOCAL INLINE void sendCounter2(uint8_t counter)
{
	out_b(PIT_REG_COUNTER2, counter);
}
Esempio n. 15
0
/*
==================================================================================
 Funtion	:sendCommand
 Input		:uint8_t command
 		 < command to send to a pit >
 Output		:void
 Return		:void
 Description	:senda a command to a pit
==================================================================================
*/
LOCAL INLINE void sendCommand(uint8_t command)
{
	out_b(PIT_REG_CONTROL, command);
}
Esempio n. 16
0
/*
==================================================================================
 Funtion	:sendDataSlave
 Input		:uint8_t data
 		 < data to send to a pic >
 Output		:void
 Return		:void
 Description	:send data to a pic slave
==================================================================================
*/
LOCAL INLINE void sendDataSlave(uint8_t data)
{
	out_b(PIC_SLV_DAT_REG, data);
}
Esempio n. 17
0
/*
==================================================================================
 Funtion	:sendIrqMaskSlave
 Input		:uint8_t irqmask
 		 < irq mask flags to send to a pic >
 Output		:void
 Return		:void
 Description	:send a irq mask reques to a pic slave
==================================================================================
*/
LOCAL INLINE void sendIrqMaskSlave(uint8_t irqmask)
{
	out_b(PIC_SLV_IMR_REG, irqmask);
}