emWin使用外部SRAM的方法


轉載請注明地址:http://blog.csdn.net/zsy2020314/article/details/9313093

     我用的是stm32,加了1MB的外部SRAM,在使用emWin的時候,將一部分內存分配給emWin使用。其實方法很簡單,傳入SRAM數據總線地址即可,數據位寬我采用16bit,因為使用的SRAM是16bit的,這樣做比較合適。如果是在ARM9及以上的平台上使用,依葫蘆畫瓢的把DDRAM的物理地址傳入emWin即可,不過地址位寬一般是32位的,大小由自己決定。

 

[cpp]  view plain copy
 
  1. /********************************************************************* 
  2. *                SEGGER Microcontroller GmbH & Co. KG                * 
  3. *        Solutions for real time microcontroller applications        * 
  4. ********************************************************************** 
  5. *                                                                    * 
  6. *        (c) 1996 - 2013  SEGGER Microcontroller GmbH & Co. KG       * 
  7. *                                                                    * 
  8. *        Internet: www.segger.com    Support:  support@segger.com    * 
  9. *                                                                    * 
  10. ********************************************************************** 
  11.  
  12.  
  13. ** emWin V5.18 - Graphical user interface for embedded applications ** 
  14. All  Intellectual Property rights  in the Software belongs to  SEGGER. 
  15. emWin is protected by  international copyright laws.  Knowledge of the 
  16. source code may not be used to write a similar product.  This file may 
  17. only be used in accordance with the following terms: 
  18.  
  19.  
  20. The software has been licensed to  NXP Semiconductors USA, Inc.  whose 
  21. registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose, 
  22. CA 95134, USA  solely for  the  purposes  of  creating  libraries  for 
  23. NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and 
  24. distributed under the terms and conditions of the NXP End User License 
  25. Agreement. 
  26. Full source code is available at: www.segger.com 
  27.  
  28.  
  29. We appreciate your understanding and fairness. 
  30. ---------------------------------------------------------------------- 
  31. File        : GUIConf.c 
  32. Purpose     : Display controller initialization 
  33. ---------------------------END-OF-HEADER------------------------------ 
  34. */  
  35.   
  36.   
  37. #include "GUI.h"  
  38. #include "SRAM_Driver.h"  
  39. /********************************************************************* 
  40. * 
  41. *       Defines 
  42. * 
  43. ********************************************************************** 
  44. */  
  45. //  
  46. // Define the available number of bytes available for the GUI  
  47. //  
[cpp]  view plain copy
 
  1. #define Bank1_SRAM3_ADDR    ((u32)0x68000000)  
[cpp]  view plain copy
 
  1. #define GUI_NUMBYTES  (1024*700)  
  2. //  
  3. // Define the average block size  
  4. //  
  5. #define GUI_BLOCKSIZE 0x80  
  6.   
  7.   
  8. /********************************************************************* 
  9. * 
  10. *       Public code 
  11. * 
  12. ********************************************************************** 
  13. */  
  14. /********************************************************************* 
  15. * 
  16. *       GUI_X_Config 
  17. * 
  18. * Purpose: 
  19. *   Called during the initialization process in order to set up the 
  20. *   available memory for the GUI. 
  21. */  
  22. void GUI_X_Config(void) {  
  23.   //  
  24.   // 16 bit aligned memory area  
  25.   //  
  26.    volatile U16* aMemory = (volatile U16*)(Bank1_SRAM3_ADDR);  
  27.   //  
  28.   // Assign memory to emWin  
  29.   //  
  30.   GUI_ALLOC_AssignMemory((void*)aMemory, GUI_NUMBYTES);  
  31.   GUI_ALLOC_SetAvBlockSize(GUI_BLOCKSIZE);  
  32.   //  
  33.   // Set default font  
  34.   //  
  35.   GUI_SetDefaultFont(GUI_FONT_6X8);  
  36. }  
  37.   
  38.   
  39. /*************************** End of file ****************************/  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM