⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skyeye_mach_pxa250.c

📁 这是Skyeye 0.9 版本的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
    case OSMR1:
      data = pxa250_io.osmr1;
      break;
    case OSMR2:
      data = pxa250_io.osmr2;
      break;
    case OSMR3:
      data = pxa250_io.osmr3;
      break;
    case OWER:
      data = pxa250_io.ower;
      break;
    case OSSR:
      data = pxa250_io.ossr;
      break;
    case OIER:
      data = pxa250_io.oier;
      break;

      /*interrupt controler */
    case ICPR:
      data = pxa250_io.icpr;
      break;
    case ICIP:
      data = (pxa250_io.icmr & pxa250_io.icpr) & ~pxa250_io.iclr;
      break;
    case ICFP:
      data = (pxa250_io.icmr & pxa250_io.icpr) & pxa250_io.iclr;
      break;
    case ICMR:
      data = pxa250_io.icmr;
      break;
    case ICLR:
      data = pxa250_io.iclr;
      break;

      /* ffuart control */
    case FFRBR:		//chy: 2003-08-24 have some question, maybe skyeye will be locked here ????
      {
	//unsigned char c;
	//read(skyeye_config.uart.fd_in, &c, 1);
	//data = c;
	data = pxa250_io.ffrbr & 0xff;
	pxa250_io.icpr &= ~FFUART_IRQ;
	pxa250_io.icip &= ~FFUART_IRQ;
	pxa250_io.ffiir &= ~0x4;
	/*chy 2004-07-21 from lzt, afte read char, should set this bit */
	pxa250_io.ffiir |= 0x1;

	//printf("SKYEYE: read FFRBR, but set ffiir  and ~04, now %x\n",pxa250_io.ffiir);
	pxa250_io.fflsr &= ~0x1;

      };
      break;
    case FFIER:
      data = pxa250_io.ffier;
      break;
    case FFIIR:		//read only
      data = pxa250_io.ffiir & 0xcf;
      pxa250_io.icpr &= ~FFUART_IRQ;
      pxa250_io.icip &= ~FFUART_IRQ;
      //printf("SKYEYE: read FFIIR  %x\n",data);
      break;
    case FFLCR:
      data = pxa250_io.fflcr;
      break;
    case FFLSR:		//read only 
      //chy 2003-08-24  NOTICE!
      //fixed by ksh 2004-05-09,for FFUART can input char,I am not sure?
      //pxa250_io.fflsr=1<<5; // LSR's TDRQ =1 , then the cpu can write char again
      pxa250_io.fflsr |= 0x60;	// chy 2003-09-02 for LSR_TEMT|LSR_THRE 0x40|0x20
      data = pxa250_io.fflsr & 0xff;
      break;

      // core clock 
    case CCCR:
      data = pxa250_io.cccr;
      break;
    case CKEN:
      data = pxa250_io.cken;
      break;
    case OSCC:
      data = pxa250_io.oscc;
      break;
      //ywc,2004-11-30,add for pxa's LCD simulation
#if 0
    case LCCR0:
      data = pxa250_io.lccr0;
      break;
    case LCCR1:
      data = pxa250_io.lccr1;
      break;
    case LCCR2:
      data = pxa250_io.lccr2;
      break;
    case LCCR3:
      data = pxa250_io.lccr3;
      break;
    case FDADR0:
      data = pxa250_io.fdadr0;
      break;
    case FDADR1:
      data = pxa250_io.fdadr1;
      break;
    case FSADR0:
      data = pxa250_io.fsadr0;
      break;
    case FSADR1:
      data = pxa250_io.fsadr1;
      break;
#endif
      //ywc,2004-11-30,add for pxa's LCD simulation,end
#if 0
    case FFFCR:		//write only
    case FFMCR:		//no use                   
    case FFMSR:		//read only no use
    case FFSPR:		// no use
    case FFISR:		// no use
#endif

    default:
      data = 0;
      //chy 2003-09-03 if debug, uncommit it
      //log_msg("SKYEYE: pxa250_io_read_word: unknown addr 0x%x, reg15 0x%x \n", addr,state->Reg[15]);
    };

  return data;
};

static void
pxa250_io_do_cycle (ARMul_State * state)
{
   /*RTC*/ if (++pxa250_io.rt_scale >= RT_SCALE)
    {
      pxa250_io.rt_scale = 0;
      if (pxa250_io.rt_count++ == (pxa250_io.rttr & 0xffff))
	{
	  pxa250_io.rt_count = 0;

	  if (pxa250_io.rcnr++ == pxa250_io.rtar)
	    {
	      if (pxa250_io.rtsr & 0x4)
		{
		  pxa250_io.rtsr |= 0x1;
		};
	    }
	  if (pxa250_io.rtsr & 0x8)
	    {
	      pxa250_io.rtsr |= 0x2;
	    }
	}
    }

  /*OS timer */
  if (++pxa250_io.os_scale >= OS_SCALE)
    {
      u32 mask = 0;
      u32 count;

      pxa250_io.os_scale = 0;
      count = pxa250_io.oscr++;

      if (count == pxa250_io.osmr0)
	mask = 1;
      if (count == pxa250_io.osmr1)
	mask |= 0x2;
      if (count == pxa250_io.osmr2)
	mask |= 0x4;
      if (count == pxa250_io.osmr3)
	{
	  mask |= 0x8;
	  if (pxa250_io.ower & 1)
	    {
	      state->NresetSig = LOW;
	      printf
		("************SKYEYE: WatchDog reset!!!!!!!**************\n");
	    }
	}
      pxa250_io.ossr |= mask;
    }

  /*FF UART */
  //pxa250_io.utsr0 = 1; /*always TFS, no others*/
  //pxa250_io.utsr1 = 0x4; /*TNF*/
  if (++pxa250_io.ff_scale >= FF_SCALE)
    {
      pxa250_io.ff_scale = 0;
      if (!(FFUART_IRQ & pxa250_io.icpr))
	{
	  fd_set rset;
	  struct timeval tv;

	  FD_ZERO (&rset);
	  FD_SET (0, &rset);
	  tv.tv_sec = 0;
	  tv.tv_usec = 0;
	  if (select (1, &rset, NULL, NULL, &tv) == 1)
	    {
	      //pxa250_io.utsr1 |= 0x2;  //RNE
	      //pxa250_io.utsr0 |= 0x4; //Rx idle
	      //added by ksh,2004-4-25,get uart data and  set the interrupt
	      unsigned char c;
	      read (skyeye_config.uart.fd_in, &c, 1);
	      pxa250_io.ffrbr = (int) c;
	      pxa250_io.ffiir |= 0x4;	//Rx idle
	      //printf("SKYEYE: io_do_cycle  set ffiir  or 04, now %x\n",pxa250_io.ffiir);
	      pxa250_io.fflsr |= 0x01;	//Data ready

	    }
	}
      //ywc,2004-11-30,check and get the mouse event
#ifndef NO_LCD
      if (!(pxa250_io.icpr & pxa250_io.ts_int))
	{			//if now has no ts interrupt,then query 
	  if (Pen_buffer[6] == 1)
	    {			//should trigger a interrupt
	      *(pxa250_io.ts_buffer + 0) = Pen_buffer[0];
	      *(pxa250_io.ts_buffer + 1) = Pen_buffer[1];
	      *(pxa250_io.ts_buffer + 4) = Pen_buffer[4];
	      *(pxa250_io.ts_buffer + 6) = Pen_buffer[6];
	      //set EINT2 bit to trigger a interrupt,ts driver will clear it
	      pxa250_io.icpr |= pxa250_io.ts_int;
	      Pen_buffer[6] = 0;
	    }
	}
#endif
      //ywc,2004-11-30,check and get the mouse event,end
    }


  /*reset interrupt pin status */
  refresh_irq (state);
};

static void
refresh_irq (ARMul_State * state)
{
  u32 irq = 0;
  u32 mask;

   /*RTC*/ if ((pxa250_io.rtsr & 0x1) && (pxa250_io.rtsr & 0x4))
    irq |= RTC_ALARM_IRQ;
  if ((pxa250_io.rtsr & 0x2) && (pxa250_io.rtsr & 0x8))
    irq |= RTC_HZ_IRQ;
  /*OS time */
  mask = pxa250_io.oier & pxa250_io.ossr;
  irq |= (mask << OS_IRQ_SHF);
#if 0
  /*UART3 */
  if ((pxa250_io.utcr3 & 0x8) && (pxa250_io.utsr0 & 0x6))
    irq |= UART3_IRQ;
  if (pxa250_io.utsr0 & 0x38)
    irq |= UART3_IRQ;

  if ((pxa250_io.utcr3 & 0x10) && (pxa250_io.utsr0 & 0x1))
    irq |= UART3_IRQ;
#endif
   /*FFUART*/
    //chy 2004-07-19 luzetao find a solution: if (pxa250_io.ffier&0x2){ irq |= FFUART_IRQ; }
    //chy 2004-07-19 then linux-2.6.x can run correctly!
    //chy 2004-06-23  FFIER    TIE or RAVIE, so shoud be 3, FFIIR 0x4 or 0x2=0x6   
    /* chy 2004-07-21 from luzhetao
       if((pxa250_io.ffier&0x02)||((pxa250_io.ffier&0x3) && (pxa250_io.ffiir&0x6))){
       irq |= FFUART_IRQ;
       }
     */
    /*chy 2004-07-21 from luzhetao: produce a IRQ */
    if ((pxa250_io.ffier & 0x1) && (pxa250_io.ffiir & 0x4))
    {
      irq |= FFUART_IRQ;
      pxa250_io.ffiir &= ~0x1;
    }
  /*chy 2004-07-21 from luzhetao: produce a IRQ and ox2 should clean by OS driver */
  if (pxa250_io.ffier & 0x2)
    {
      irq |= FFUART_IRQ;
      pxa250_io.ffiir |= 0x2;
      pxa250_io.ffiir &= ~0x1;
      pxa250_io.fflsr |= 0x60;
    }

  //ywc,2004-11-30,produce a touchsreen IRQ
  if (pxa250_io.icpr & pxa250_io.ts_int)
    {
      irq |= pxa250_io.ts_int;
    }
  //ywc,2004-11-30,produce a touchsreen IRQ,end

  pxa250_io.icpr = irq;
  pxa250_io.icip = (pxa250_io.icmr & pxa250_io.icpr) & ~pxa250_io.iclr;
  pxa250_io.icfp = (pxa250_io.icmr & pxa250_io.icpr) & pxa250_io.iclr;
  state->NirqSig = pxa250_io.icip ? LOW : HIGH;
  state->NfiqSig = pxa250_io.icfp ? LOW : HIGH;
}

void
pxa250_mach_init (ARMul_State * state, machine_config_t * mc)
{
  //chy 2003-08-19, setprocessor
  ARMul_SelectProcessor (state, ARM_XScale_Prop | ARM_v5_Prop | ARM_v5e_Prop);
  //chy 2004-05-09, set lateabtSig
  state->lateabtSig = LOW;

  state->Reg[1] = 89;		/*lubbock machine id. */
  pxa250_io_reset ();
  /*added by ksh for energy estimation in 2004-11-26 */
  state->energy.cccr = pxa250_io.cccr;

  mc->mach_io_do_cycle = pxa250_io_do_cycle;
  mc->mach_io_reset = pxa250_io_reset;
  mc->mach_io_read_byte = pxa250_io_read_byte;
  mc->mach_io_write_byte = pxa250_io_write_byte;
  mc->mach_io_read_halfword = pxa250_io_read_halfword;
  mc->mach_io_write_halfword = pxa250_io_write_halfword;
  mc->mach_io_read_word = pxa250_io_read_word;
  mc->mach_io_write_word = pxa250_io_write_word;

  mc->state = (void *) state;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -