void CPdd2440Uart::PostInit()
{
DWORD dwCount=0;
m_HardwareLock.Lock();
m_pReg2440Uart->Write_UCON(0); // Set to Default;
DisableInterrupt(S2440UART_INT_RXD|S2440UART_INT_TXD|S2440UART_INT_ERR);
// Mask all interrupt.
while ((GetInterruptStatus() & (S2440UART_INT_RXD|S2440UART_INT_TXD|S2440UART_INT_ERR))!=0 &&
dwCount <MAX_RETRY) { // Interrupt.
InitReceive(TRUE);
InitLine(TRUE);
ClearInterrupt(S2440UART_INT_RXD|S2440UART_INT_TXD|S2440UART_INT_ERR);
dwCount++;
}
ASSERT((GetInterruptStatus() & (S2440UART_INT_RXD|S2440UART_INT_TXD|S2440UART_INT_ERR))==0);
// IST Start to Run.
m_HardwareLock.Unlock();
CSerialPDD::PostInit();
//CeSetPriority(m_dwPriority256);
CeSetPriority(97); ------------在这里这样,也没有句柄帮顶,到底设置了哪个现成的优先级?
#ifdef DEBUG
if ( ZONE_INIT )
m_pReg2440Uart->DumpRegister();
#endif
ThreadStart(); // Start IST.
}
----------------------------------------------------------------
//CeSetPriority(m_dwPriority256);
CeSetPriority(97);------------在这里这样,也没有句柄帮顶,到底设置了哪个现成的优先级?
不过我把它改成CeSetPriority(97)
串口的性能有很大提升。
但是不懂CeSetPriority指向了哪个线程。
我查了PB帮助,压根没有这个函数的说明
Google也没有什么帮助,所以特来这个求助
请知道的给点提示。嘿嘿。
6 个解决方案
#1
估计是这个类自身的主线程的句柄,默认的。
#2
CPdd2440Uart继承CMiniThread。。
构造函数创建了CMiniThread::ThreadProc线程,CMiniThread::CeSetPriority 即设置这个线程的优先级,而ThreadProc()调用了CPdd2440Uart::ThreadRun()虚函数,即IST.
构造函数创建了CMiniThread::ThreadProc线程,CMiniThread::CeSetPriority 即设置这个线程的优先级,而ThreadProc()调用了CPdd2440Uart::ThreadRun()虚函数,即IST.
#3
牛,学习了
#4
CeSetPriority 是自己写的,难怪我在PB帮助找不到。
#5
找到了
C:\WINCE500\PUBLIC\COMMON\OAK\INC\cmthread.h(74): BOOL CeSetPriority( int nPriority )
C:\WINCE500\PUBLIC\COMMON\OAK\INC\cmthread.h(74): BOOL CeSetPriority( int nPriority )
BOOL CeSetPriority( int nPriority )
{
if( m_hThreadHandle )
{
return CeSetThreadPriority( m_hThreadHandle, nPriority );
}
return FALSE;
}
#6
Effective with version 3.0, Windows CE offers 256 priority levels, with zero being the highest priority and 255 being the lowest priority.
The original eight priority levels for Windows CE 2.12 and previous versions are mapped to levels 255 through 248, which are defined for application threads.
Many higher priority levels (247 through zero) are assigned to real-time applications, drivers, and system processes.
To prevent random applications from degrading the performance of the system, an OEM can restrict all priority levels between 247 and zero to OEM-specified applications. (For information on your target device's available priority levels, consult the OEM.)
Applications and device drivers should use the CeGetThreadPriority and CeSetThreadPriority functions, instead of the legacy functions GetThreadPriority and SetThreadPriority. The legacy functions are still available with the same interfaces but the functions have access only to the original 8 priority levels.
Use CeSetThreadPriority and SetThreadPriority to assign a priority level to a thread.
Use CeGetThreadPriority and GetThreadPriority to retrieve the priority level of a thread.
The priority level system has four ranges, shown in the following table.
Range Description
0 through 96 Reserved for real-time above drivers.
97 through 152 Used by the default Windows CE-based device drivers.
153 through 247 Reserved for real-time below drivers.
248 through 255 Maps to non-real-time priorities.
For more information about the default priority levels associated with device drivers, see Real-Time Priority System Levels.
The original eight priority levels for Windows CE 2.12 and previous versions are mapped to levels 255 through 248, which are defined for application threads.
Many higher priority levels (247 through zero) are assigned to real-time applications, drivers, and system processes.
To prevent random applications from degrading the performance of the system, an OEM can restrict all priority levels between 247 and zero to OEM-specified applications. (For information on your target device's available priority levels, consult the OEM.)
Applications and device drivers should use the CeGetThreadPriority and CeSetThreadPriority functions, instead of the legacy functions GetThreadPriority and SetThreadPriority. The legacy functions are still available with the same interfaces but the functions have access only to the original 8 priority levels.
Use CeSetThreadPriority and SetThreadPriority to assign a priority level to a thread.
Use CeGetThreadPriority and GetThreadPriority to retrieve the priority level of a thread.
The priority level system has four ranges, shown in the following table.
Range Description
0 through 96 Reserved for real-time above drivers.
97 through 152 Used by the default Windows CE-based device drivers.
153 through 247 Reserved for real-time below drivers.
248 through 255 Maps to non-real-time priorities.
For more information about the default priority levels associated with device drivers, see Real-Time Priority System Levels.
#1
估计是这个类自身的主线程的句柄,默认的。
#2
CPdd2440Uart继承CMiniThread。。
构造函数创建了CMiniThread::ThreadProc线程,CMiniThread::CeSetPriority 即设置这个线程的优先级,而ThreadProc()调用了CPdd2440Uart::ThreadRun()虚函数,即IST.
构造函数创建了CMiniThread::ThreadProc线程,CMiniThread::CeSetPriority 即设置这个线程的优先级,而ThreadProc()调用了CPdd2440Uart::ThreadRun()虚函数,即IST.
#3
牛,学习了
#4
CeSetPriority 是自己写的,难怪我在PB帮助找不到。
#5
找到了
C:\WINCE500\PUBLIC\COMMON\OAK\INC\cmthread.h(74): BOOL CeSetPriority( int nPriority )
C:\WINCE500\PUBLIC\COMMON\OAK\INC\cmthread.h(74): BOOL CeSetPriority( int nPriority )
BOOL CeSetPriority( int nPriority )
{
if( m_hThreadHandle )
{
return CeSetThreadPriority( m_hThreadHandle, nPriority );
}
return FALSE;
}
#6
Effective with version 3.0, Windows CE offers 256 priority levels, with zero being the highest priority and 255 being the lowest priority.
The original eight priority levels for Windows CE 2.12 and previous versions are mapped to levels 255 through 248, which are defined for application threads.
Many higher priority levels (247 through zero) are assigned to real-time applications, drivers, and system processes.
To prevent random applications from degrading the performance of the system, an OEM can restrict all priority levels between 247 and zero to OEM-specified applications. (For information on your target device's available priority levels, consult the OEM.)
Applications and device drivers should use the CeGetThreadPriority and CeSetThreadPriority functions, instead of the legacy functions GetThreadPriority and SetThreadPriority. The legacy functions are still available with the same interfaces but the functions have access only to the original 8 priority levels.
Use CeSetThreadPriority and SetThreadPriority to assign a priority level to a thread.
Use CeGetThreadPriority and GetThreadPriority to retrieve the priority level of a thread.
The priority level system has four ranges, shown in the following table.
Range Description
0 through 96 Reserved for real-time above drivers.
97 through 152 Used by the default Windows CE-based device drivers.
153 through 247 Reserved for real-time below drivers.
248 through 255 Maps to non-real-time priorities.
For more information about the default priority levels associated with device drivers, see Real-Time Priority System Levels.
The original eight priority levels for Windows CE 2.12 and previous versions are mapped to levels 255 through 248, which are defined for application threads.
Many higher priority levels (247 through zero) are assigned to real-time applications, drivers, and system processes.
To prevent random applications from degrading the performance of the system, an OEM can restrict all priority levels between 247 and zero to OEM-specified applications. (For information on your target device's available priority levels, consult the OEM.)
Applications and device drivers should use the CeGetThreadPriority and CeSetThreadPriority functions, instead of the legacy functions GetThreadPriority and SetThreadPriority. The legacy functions are still available with the same interfaces but the functions have access only to the original 8 priority levels.
Use CeSetThreadPriority and SetThreadPriority to assign a priority level to a thread.
Use CeGetThreadPriority and GetThreadPriority to retrieve the priority level of a thread.
The priority level system has four ranges, shown in the following table.
Range Description
0 through 96 Reserved for real-time above drivers.
97 through 152 Used by the default Windows CE-based device drivers.
153 through 247 Reserved for real-time below drivers.
248 through 255 Maps to non-real-time priorities.
For more information about the default priority levels associated with device drivers, see Real-Time Priority System Levels.