硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2265|回复: 3
收起左侧

[emWin] emWin跟uCOS-II的接口文件GUI_X_OS.c有几个版本?

[复制链接]

68

主题

472

回帖

681

积分

金牌会员

积分
681
发表于 2018-11-4 11:30:50 | 显示全部楼层 |阅读模式
我现在在用uC/OS-II V2.92.12,因为不喜欢FreeRTOS的动态内存分配,虽然技术先进些,但运行时间长会出现内存碎片,越来越多,相对觉得OS-II的全静态方式很安全
在OS-II下移植emWin5.32的时候,我发现一个问题,网上基于OS-II和OS-III的开发板,emWin和OS之间的接口文件GUI_X用的都是同一个文件,都是emWin V5.16下跟OS-II
的接口文件,附图,难道真是这样的情况吗?
gui-x接口文件.jpg
回复

使用道具 举报

36

主题

2050

回帖

2158

积分

至尊会员

积分
2158
发表于 2018-11-4 11:40:06 | 显示全部楼层
uCOS-II的emWin接口文件没有升级过,仅仅是升级了下标题头

下面是emWin5.46带的

  1. /*********************************************************************
  2. *                SEGGER Microcontroller GmbH & Co. KG                *
  3. *        Solutions for real time microcontroller applications        *
  4. **********************************************************************
  5. *                                                                    *
  6. *        (c) 1996 - 2017  SEGGER Microcontroller GmbH & Co. KG       *
  7. *                                                                    *
  8. *        Internet: www.segger.com    Support:  support@segger.com    *
  9. *                                                                    *
  10. **********************************************************************

  11. ** emWin V5.46 - Graphical user interface for embedded applications **
  12. All  Intellectual Property rights  in the Software belongs to  SEGGER.
  13. emWin is protected by  international copyright laws.  Knowledge of the
  14. source code may not be used to write a similar product.  This file may
  15. only be used in accordance with the following terms:

  16. The software has been licensed to  ARM LIMITED whose registered office
  17. is situated at  110 Fulbourn Road,  Cambridge CB1 9NJ,  England solely
  18. for  the  purposes  of  creating  libraries  for  ARM7, ARM9, Cortex-M
  19. series,  and   Cortex-R4   processor-based  devices,  sublicensed  and
  20. distributed as part of the  MDK-ARM  Professional  under the terms and
  21. conditions  of  the   End  User  License  supplied  with  the  MDK-ARM
  22. Professional.
  23. Full source code is available at: www.segger.com

  24. We appreciate your understanding and fairness.
  25. ----------------------------------------------------------------------
  26. Licensing information
  27. Licensor:                 SEGGER Software GmbH
  28. Licensed to:              ARM Ltd, 110 Fulbourn Road, CB1 9NJ Cambridge, UK
  29. Licensed SEGGER software: emWin
  30. License number:           GUI-00181
  31. License model:            LES-SLA-20007, Agreement, effective since October 1st 2011
  32. Licensed product:         MDK-ARM Professional
  33. Licensed platform:        ARM7/9, Cortex-M/R4
  34. Licensed number of seats: -
  35. ---Author-Explanation
  36. *
  37. * 1.00.00 020519 JJL    First release of uC/GUI to uC/OS-II interface
  38. *
  39. *
  40. * Known problems or limitations with current version
  41. *
  42. *    None.
  43. *
  44. *
  45. * Open issues
  46. *
  47. *    None
  48. *********************************************************************************************************
  49. */

  50. #include <ucos_ii.h>
  51. #include "GUI_Private.H"
  52. #include "stdio.H"

  53. /*
  54. *********************************************************************************************************
  55. *                                         GLOBAL VARIABLES
  56. *********************************************************************************************************
  57. */

  58. static  OS_EVENT  *DispSem;
  59. static  OS_EVENT  *EventMbox;

  60. static  OS_EVENT  *KeySem;
  61. static  int        KeyPressed;
  62. static  char       KeyIsInited;


  63. /*
  64. *********************************************************************************************************
  65. *                                        TIMING FUNCTIONS
  66. *
  67. * Notes: Some timing dependent routines of uC/GUI require a GetTime and delay funtion.
  68. *        Default time unit (tick), normally is 1 ms.
  69. *********************************************************************************************************
  70. */

  71. GUI_TIMER_TIME  GUI_X_GetTime (void)
  72. {
  73.     return ((GUI_TIMER_TIME)OSTimeGet());
  74. }


  75. void  GUI_X_Delay (int period)
  76. {
  77.     INT32U  ticks;


  78.     ticks = (period * 1000) / OS_TICKS_PER_SEC;
  79.     OSTimeDly((INT16U)ticks);
  80. }


  81. /*
  82. *********************************************************************************************************
  83. *                                          GUI_X_ExecIdle()
  84. *********************************************************************************************************
  85. */
  86. void GUI_X_ExecIdle (void)
  87. {
  88.     GUI_X_Delay(1);
  89. }


  90. /*
  91. *********************************************************************************************************
  92. *                                    MULTITASKING INTERFACE FUNCTIONS
  93. *
  94. * Note(1): 1) The following routines are required only if uC/GUI is used in a true multi task environment,
  95. *             which means you have more than one thread using the uC/GUI API.  In this case the #define
  96. *             GUI_OS 1   needs to be in GUIConf.h
  97. *********************************************************************************************************
  98. */

  99. void  GUI_X_InitOS (void)
  100. {
  101.     DispSem   = OSSemCreate(1);
  102.     EventMbox = OSMboxCreate((void *)0);
  103. }


  104. void  GUI_X_Lock (void)
  105. {
  106.     INT8U  err;
  107.    
  108.    
  109.     OSSemPend(DispSem, 0, &err);
  110. }


  111. void  GUI_X_Unlock (void)
  112. {
  113.     OSSemPost(DispSem);
  114. }


  115. U32  GUI_X_GetTaskId (void)
  116. {
  117.     return ((U32)(OSTCBCur->OSTCBPrio));
  118. }

  119. /*
  120. *********************************************************************************************************
  121. *                                        GUI_X_WaitEvent()
  122. *                                        GUI_X_SignalEvent()
  123. *********************************************************************************************************
  124. */


  125. void GUI_X_WaitEvent (void)
  126. {
  127.     INT8U  err;


  128.     (void)OSMboxPend(EventMbox, 0, &err);
  129. }


  130. void GUI_X_SignalEvent (void)
  131. {
  132.     (void)OSMboxPost(EventMbox, (void *)1);
  133. }

  134. /*
  135. *********************************************************************************************************
  136. *                                      KEYBOARD INTERFACE FUNCTIONS
  137. *
  138. * Purpose: The keyboard routines are required only by some widgets.
  139. *          If widgets are not used, they may be eliminated.
  140. *
  141. * Note(s): If uC/OS-II is used, characters typed into the log window will be placed        in the keyboard buffer.
  142. *          This is a neat feature which allows you to operate your target system without having to use or
  143. *          even to have a keyboard connected to it. (useful for demos !)
  144. *********************************************************************************************************
  145. */

  146. static  void  CheckInit (void)
  147. {
  148.     if (KeyIsInited == FALSE) {
  149.         KeyIsInited = TRUE;
  150.         GUI_X_Init();
  151.     }
  152. }


  153. void GUI_X_Init (void)
  154. {
  155.     KeySem = OSSemCreate(0);
  156. }


  157. int  GUI_X_GetKey (void)
  158. {
  159.     int r;


  160.     r          = KeyPressed;
  161.     CheckInit();
  162.     KeyPressed = 0;
  163.     return (r);
  164. }


  165. int  GUI_X_WaitKey (void)
  166. {
  167.     int    r;
  168.     INT8U  err;


  169.     CheckInit();
  170.     if (KeyPressed == 0) {
  171.         OSSemPend(KeySem, 0, &err);
  172.     }
  173.     r          = KeyPressed;
  174.     KeyPressed = 0;
  175.     return (r);
  176. }


  177. void  GUI_X_StoreKey (int k)
  178. {
  179.     KeyPressed = k;
  180.     OSSemPost(KeySem);
  181. }
复制代码


Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better.
回复

使用道具 举报

68

主题

472

回帖

681

积分

金牌会员

积分
681
 楼主| 发表于 2018-11-4 12:14:22 | 显示全部楼层
主要是uC/OS-II已经不再升级了,内核永远就那样儿了,所以这个接口文件没必要升级,问题是II和III现在都在用这个文件,难道是真的?
回复

使用道具 举报

36

主题

2050

回帖

2158

积分

至尊会员

积分
2158
发表于 2018-11-4 14:14:02 | 显示全部楼层
taobaofarmer 发表于 2018-11-4 12:14
主要是uC/OS-II已经不再升级了,内核永远就那样儿了,所以这个接口文件没必要升级,问题是II和III现在都在 ...

不一样,这个是II,而III的话,官方没有做,可以参考硬汉搞的;
http://www.armbbs.cn/forum.php?m ... &extra=page%3D1
Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better.
回复

使用道具 举报

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

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-5-17 14:33 , Processed in 0.243001 second(s), 26 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表