void CPdd6410Uart::PostInit() { DWORD dwCount=0; m_HardwareLock.Lock(); m_pReg6410Uart->Write_UCON(0); // Set to Default; DisableInterrupt(S6410UART_INT_RXD | S6410UART_INT_TXD | S6410UART_INT_ERR | S6410UART_INT_MODEM); // Mask all interrupt. while ((GetInterruptStatus() & (S6410UART_INT_RXD | S6410UART_INT_TXD | S6410UART_INT_ERR | S6410UART_INT_MODEM))!=0 && dwCount <MAX_RETRY) { InitReceive(TRUE); InitLine(TRUE); ClearInterrupt(S6410UART_INT_RXD | S6410UART_INT_TXD | S6410UART_INT_ERR | S6410UART_INT_MODEM); dwCount++; } ASSERT((GetInterruptStatus() & (S6410UART_INT_RXD | S6410UART_INT_TXD | S6410UART_INT_ERR | S6410UART_INT_MODEM))==0); m_HardwareLock.Unlock(); CSerialPDD::PostInit(); CeSetPriority(m_dwPriority256); #ifdef DEBUG if ( ZONE_INIT ) { m_pReg6410Uart->DumpRegister(); } #endif ThreadStart(); // Start IST. }
BOOL CSerialPDD::Open() { PHYSICAL_ADDRESS ioPhysicalBase = { S3C6410_BASE_REG_PA_GPIO, 0}; ULONG inIoSpace = 0; if (InterlockedExchange(&m_lOpenCount,1) !=0) return FALSE; PREFAST_ASSERT(m_PowerHelperHandle!=INVALID_HANDLE_VALUE); ASSERT(m_hPowerLock==NULL); m_hPowerLock= DDKPwr_RequestLevel( m_PowerHelperHandle, D0 ); ASSERT(m_hPowerLock!=NULL); SetDefaultConfiguration(); InitLine(TRUE); InitReceive(TRUE); InitXmit(TRUE); if(cUart_Index==3) { if (TranslateBusAddr(m_hParent,Internal,0, ioPhysicalBase,&inIoSpace,&ioPhysicalBase)) { // Map it if it is Memeory Mapped IO. g_pIOPregs = (S3C6410_GPIO_REG *)DrvLib_MapIoSpace(ioPhysicalBase.LowPart , sizeof(S3C6410_GPIO_REG),FALSE); g_pIOPregs->GPCCON &= ~(0xf<<28); ///< Clear Bit g_pIOPregs->GPCCON |= (0x1<<28); ///< Select UART IP g_pIOPregs->GPCPUD &= ~(0x3<<14); ///< Pull-Up/Down Disable //g_pIOPregs->GPCDAT |=1<<7; } } return TRUE; }
void CSerialPDD::Reset() { InitialPower(TRUE); InitModem(TRUE); InitLine(TRUE); InitReceive(TRUE); InitXmit(TRUE); InitialEnableInterrupt(TRUE); }
BOOL CSerialPDD::Close() { if (InterlockedExchange(&m_lOpenCount,0) !=1) return FALSE; InitXmit(FALSE); InitReceive(FALSE); InitLine(FALSE); PREFAST_ASSERT(m_PowerHelperHandle!=INVALID_HANDLE_VALUE); ASSERT(m_hPowerLock!=NULL); DDKPwr_ReleaseLevel(m_PowerHelperHandle, m_hPowerLock); m_hPowerLock=NULL; if(cUart_Index==3) { //g_pIOPregs->GPCDAT &=~(1<<7); if (g_pIOPregs!=NULL) { DrvLib_UnmapIoSpace((PVOID)g_pIOPregs); } } return TRUE; }