Beispiel #1
0
	void _push(const LogPacket& data)
	{
		const u32 sprefix	= data.m_prefix.length();
		const u32 stext		= data.m_text.length();
		const u32 scolour	= data.m_colour.length();

		m_buffer.Reserve(
			sizeof(u32) + sprefix +
			sizeof(u32) + stext +
			sizeof(u32) + scolour);

		u32 c_put = m_put;

		memcpy(&m_buffer[c_put], &sprefix, sizeof(u32));
		c_put += sizeof(u32);
		memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix);
		c_put += sprefix;

		memcpy(&m_buffer[c_put], &stext, sizeof(u32));
		c_put += sizeof(u32);
		memcpy(&m_buffer[c_put], data.m_text.c_str(), stext);
		c_put += stext;

		memcpy(&m_buffer[c_put], &scolour, sizeof(u32));
		c_put += sizeof(u32);
		memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour);
		c_put += scolour;

		m_put = c_put;
		CheckBusy();
	}
Beispiel #2
0
VOID FAR _cdecl IRQTimer (USHORT TimerHandle, PACB pA)
{
  ADD_CancelTimer (TimerHandle);

  npA->IRQTimerHandle = 0;
  npA->TimerFlags    |= ACBT_IRQ;

#if PCITRACER
  outpw (TRPORT, 0xAF00 | (npA->State & ACBS_WAIT));
#endif
  if (npA->State & ACBS_WAIT) {
    // The device may be ready to transfer data but failed to interrupt.  If so
    // just continue.
    NPU npU = npA->npU;

    METHOD(npA).StopDMA (npA);	/* controller is locked, Clear Active bit */

    if (SERROR && InD (SERROR)) {
      IssueSATAReset (npU);
      npA->TimerFlags |= ACBT_SATACOMM;
      npA->State       = ACBS_ERROR;
      ReInitUnit (npU);

    } else if (npA->BM_CommandCode & BMICOM_START) {
      USHORT PCIStatus;

      PciGetReg (npA->PCIInfo.PCIAddr, PCIREG_STATUS, (PULONG)&PCIStatus, 2);
      if (PCIStatus & PCI_STATUS_MASTER_ABORT) {
	PciSetReg (npA->PCIInfo.PCIAddr, PCIREG_STATUS, PCI_STATUS_MASTER_ABORT, 2);
	npA->npU->Flags &= ~UCBF_BM_DMA;
	npA->State = ACBS_ERROR;
      } else if (CheckBusy (npA)) {
	npA->State = ACBS_ERROR;
      }
    } else {
      if (CheckBusy (npA)) {
	if (npA->ElapsedTime < IRQ_TIMEOUT_INTERVAL) {
	  ADD_StartTimerMS (&npA->IRQTimerHandle, npA->IRQTimeOut,
			   (PFN)IRQTimer, npA);
	  return;
	}
      }
    }
    StartSM (npA);
  }
}
void WriteData( unsigned char Dbyte )
{
     CS = 1;
     CheckBusy();
     SendByte(0xfa);            //11111,RW(0),RS(1),0
     SendByte(0xf0&Dbyte);      //高四位
     SendByte(0xf0&Dbyte<<4);//低四位(先执行<<)
     CS = 0;
}
void WriteCommand( unsigned char Cbyte )
{
     CS = 1;
     CheckBusy();
     SendByte(0xf8);            //11111,RW(0),RS(0),0
     SendByte(0xf0&Cbyte);      //高四位
     SendByte(0xf0&Cbyte<<4);//低四位(先执行<<)
     CS = 0;
}
Beispiel #5
0
static void LCD_WriteDataAuto(unsigned char nData)
{
	CheckBusy(0x08);
	
	GPIO_RESET(CD);
	LCD_WRITE_DATA(nData);		//向MCU写入数据,准备向LCD输出数据

	GPIO_RESET(WR);
	LCD_SET_DATA_OUT();
	LCD_Delay(NS100_DLY(2));	//延时	

	GPIO_SET(WR);
	LCD_Delay(NS100_DLY(4));
	LCD_SET_DATA_IN();
}
Beispiel #6
0
/****************************************************************************
* 名	称:	void LCD_WriteCommand(uint8 nCmd)
* 功	能:	写LCD命令
* 入口参数:u8	命令
* 出口参数:无
* 说	明:	无
****************************************************************************/
void LCD_WriteCommand(unsigned char nCmd)
{
	CheckBusy(0x03);
	
	GPIO_SET(CD);
	LCD_WRITE_DATA(nCmd);		//向MCU写入数据,准备向LCD输出数据
	
	GPIO_RESET(WR);
	LCD_SET_DATA_OUT();
	LCD_Delay(NS100_DLY(2));	//延时	

	GPIO_SET(WR);
	LCD_Delay(NS100_DLY(4));
	LCD_SET_DATA_IN();
}
Beispiel #7
0
uint8_t flash_write_word (uint32_t WAddr, uint16_t *buf, uint32_t WLength)
{
	uint32_t i;

	if (WLength == 0)
	{
		return 0;
	}
	if(WLength%2!=0)
	{
		return 0;
	}
	WLength/=2;
	
	EBSY();			
	WREN();
	SPI_FLASH_CS_LOW();			
	Send_Byte(SPI_FLASH_CMD_SST_AAI_WORD_PROGRAM);			/* send AAI command */
	Send_Byte(((WAddr & 0xFFFFFF) >> 16)); 	/* send 3 address bytes */
	Send_Byte(((WAddr & 0xFFFF) >> 8));
	Send_Byte(WAddr & 0xFF);
	for (i=0; i<WLength; i++)
	{
		APP_TRACE("%d ",i);
		Send_Byte(buf[i] & 0xFF);
		Send_Byte(((buf[i] & 0xFFFF) >> 8));
		SPI_FLASH_CS_HIGH();
		CheckBusy();
		if(i<WLength-1)
			{
				SPI_FLASH_CS_LOW();	
				Send_Byte(SPI_FLASH_CMD_SST_AAI_WORD_PROGRAM);			/* send AAI command */
			}
			
				
	}
	WRDI();
	DBSY();
	while (flash_read_status() & 0x01 != 0x00);	
	return 1;

}
unsigned char ReadData( void )
{
     CheckBusy();
     SendByte(0xfe);            //11111,RW(1),RS(1),0
     return ReceiveByte();
}