新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > S3C2410的WINCE BSP添加串口支持

S3C2410的WINCE BSP添加串口支持

作者: 時間:2016-10-08 來源:網(wǎng)絡 收藏

v_pIOPregs->rGPHCON |= (0x28 | 0x210 /*| 0x112 | 0x014*/);

v_pIOPregs->rGPHCON |= (0x20 | 0x22 );

v_pIOPregs->rGPHUP |= 0x03;

pHWHead->rDTRport = (volatile unsigned int *)(v_pIOPregs->rGPHDAT);

pHWHead->rDSRport = (volatile unsigned int *)(v_pIOPregs->rGPHDAT);

pHWHead->DtrPortNum = 0;

pHWHead->DsrPortNum = 1;

#else

volatile IOPreg *s2410IOP;

s2410IOP = (volatile IOPreg *)IOP_BASE;

EnterCriticalSection((pHWHead->RegCritSec));

s2410IOP->rGPHCON = ~(0x38 | 0x310/* | 0x312 | 0x314*/); // clear uart 1 - rx, tx

s2410IOP->rGPHCON |= (0x28 | 0x210 /*| 0x112 | 0x014*/);

s2410IOP->rGPHCON |= (0x20 | 0x22 );

s2410IOP->rGPHUP |= 0x03;

pHWHead->rDTRport = (volatile unsigned int *)(IOP_BASE+0x74); //s2410IOP->rGPHDAT

pHWHead->rDSRport = (volatile unsigned int *)(IOP_BASE+0x74);

pHWHead->DtrPortNum = 0;

pHWHead->DsrPortNum = 1;

#endif

}

else if(pHWHead1->dwIOBase == 0x50008000)

{

#if USEVIRTUAL

EnterCriticalSection((pHWHead->RegCritSec));

v_pIOPregs->rGPHCON = ~( 0x312 | 0x314); // clear uart 2 - rx, tx

v_pIOPregs->rGPHCON |= ( 0x212 | 0x214);

v_pIOPregs->rGPHCON |= (0x20 | 0x22 );

v_pIOPregs->rGPHUP = ~0xc0;

pHWHead->rDTRport = (volatile unsigned int *)(v_pIOPregs->rGPHDAT);

pHWHead->rDSRport = (volatile unsigned int *)(v_pIOPregs->rGPHDAT);

pHWHead->DtrPortNum = 0;

pHWHead->DsrPortNum = 1;

#else

volatile IOPreg *s2410IOP;

s2410IOP = (volatile IOPreg *)IOP_BASE;

EnterCriticalSection((pHWHead->RegCritSec));

s2410IOP->rGPHCON = ~(0x312 | 0x314); // clear uart 2 - rx, tx

s2410IOP->rGPHCON |= ( 0x0212 | 0x0214);

s2410IOP->rGPHCON |= (0x20 | 0x22 );

s2410IOP->rGPHUP = ~0xc0;

pHWHead->rDTRport = (volatile unsigned int *)(IOP_BASE+0x74); //s2410IOP->rGPHDAT

pHWHead->rDSRport = (volatile unsigned int *)(IOP_BASE+0x74);

pHWHead->DtrPortNum = 0;

pHWHead->DsrPortNum = 1;

#endif

}

else

{

#if USEVIRTUAL

EnterCriticalSection((pHWHead->RegCritSec));

v_pIOPregs->rGPHCON = ~(0x30 | 0x32 | 0x34 | 0x36/* | 0x312 | 0x314*/); // clear uart 0 - rx, tx

v_pIOPregs->rGPHCON |= (0x24 | 0x26/* | 0x112 | 0x014*/);

v_pIOPregs->rGPHCON |= (0x20 | 0x22 );

v_pIOPregs->rGPHUP |= 0x03;

pHWHead->rDTRport = (volatile unsigned int *)(v_pIOPregs->rGPHDAT);

pHWHead->rDSRport = (volatile unsigned int *)(v_pIOPregs->rGPHDAT);

pHWHead->DtrPortNum = 0;

pHWHead->DsrPortNum = 1;

#else

volatile IOPreg *s2410IOP;

s2410IOP = (volatile IOPreg *)IOP_BASE;

EnterCriticalSection((pHWHead->RegCritSec));

s2410IOP->rGPHCON = ~(0x30 | 0x32 | 0x34 | 0x36 /*| 0x312 | 0x314*/); // clear uart 0 - rx, tx

s2410IOP->rGPHCON |= (0x24 | 0x26 /*| 0x112 | 0x014*/);

s2410IOP->rGPHCON |= (0x20 | 0x22 );

s2410IOP->rGPHUP |= 0x03;

pHWHead->rDTRport = (volatile unsigned int *)(IOP_BASE+0x74); //s2410IOP->rGPHDAT

pHWHead->rDSRport = (volatile unsigned int *)(IOP_BASE+0x74);

pHWHead->DtrPortNum = 0;

pHWHead->DsrPortNum =1;

#endif

}

LeaveCriticalSection((pHWHead->RegCritSec));

}

接著搜索:

SL_Init(

PVOID pHead, // @parm points to device head

PUCHAR pRegBase, // Pointer to 16550 register base

UINT8 RegStride, // Stride amongst the 16550 registers

EVENT_FUNC EventCallback, // This callback exists in MDD

PVOID pMddHead, // This is the first parm to callback

PLOOKUP_TBL pBaudTable // BaudRate Table

)

在PS2410_UART_INFO pHWHead = (PS2410_UART_INFO)pHead;這一句后面添加:

PSER_INFO pHWHead1 = (PSER_INFO)pHead;

再搜索:

if ( pHWHead->UseIrDA )

{

pHWHead->bINT = BIT_UART2;

pHWHead->bTxINT = INTSUB_TXD2;

pHWHead->bRxINT = INTSUB_RXD2;

pHWHead->bErrINT = INTSUB_ERR2;

#if USEVIRTUAL

pHWHead->s2410SerReg = (S2410_UART_REG *)v_pUART2regs;



關鍵詞:

評論


相關推薦

技術專區(qū)

關閉