6729|6

1

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

关于wince线程优先级设置问题 [复制链接]

我在串口驱动中看到如下代码
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         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也没有什么帮助,所以特来这个求助

请知道的给点提示。嘿嘿。
此帖出自WindowsCE论坛

最新回复

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.   详情 回复 发表于 2010-5-13 08:45
点赞 关注
 

回复
举报

1

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
估计是这个类自身的主线程的句柄,默认的。
此帖出自WindowsCE论坛
 
 
 

回复

1

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
CPdd2440Uart继承CMiniThread。。
构造函数创建了CMiniThread::ThreadProc线程,CMiniThread::CeSetPriority 即设置这个线程的优先级,而ThreadProc()调用了CPdd2440Uart::ThreadRun()虚函数,即IST.
此帖出自WindowsCE论坛
 
 
 

回复

1

帖子

0

TA的资源

一粒金砂(初级)

4
 
引用 2 楼 aaa_tnt 的回复:
CPdd2440Uart继承CMiniThread。。
构造函数创建了CMiniThread::ThreadProc线程,CMiniThread::CeSetPriority 即设置这个线程的优先级,而ThreadProc()调用了CPdd2440Uart::ThreadRun()虚函数,即IST.


牛,学习了
此帖出自WindowsCE论坛
 
 
 

回复

1

帖子

0

TA的资源

一粒金砂(初级)

5
 
引用 2 楼 aaa_tnt 的回复:
CPdd2440Uart继承CMiniThread。。
构造函数创建了CMiniThread::ThreadProc线程,CMiniThread::CeSetPriority 即设置这个线程的优先级,而ThreadProc()调用了CPdd2440Uart::ThreadRun()虚函数,即IST.


CeSetPriority  是自己写的,难怪我在PB帮助找不到。
此帖出自WindowsCE论坛
 
 
 

回复

21

帖子

0

TA的资源

纯净的硅(初级)

6
 
找到了
C:\WINCE500\PUBLIC\COMMON\OAK\INC\cmthread.h(74):    BOOL    CeSetPriority( int nPriority )
  1. BOOL    CeSetPriority( int nPriority )
  2.     {
  3.         if( m_hThreadHandle )
  4.         {
  5.             return CeSetThreadPriority( m_hThreadHandle, nPriority );
  6.         }
  7.         return FALSE;
  8.     }
复制代码
此帖出自WindowsCE论坛
 
 
 

回复

1

帖子

0

TA的资源

一粒金砂(初级)

7
 
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.

此帖出自WindowsCE论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表