OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 7818|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 l; H' I% Z" ~, C  R& {2 q7 U
  1. [code]EDMA sample test application
    6 J2 v, I9 q6 m, S" _& D
  2. /*$ D* ]2 @9 ~5 I: t. q8 T' w
  3. * edma_test.c
    ' }, U) c" R, _  Z3 H7 x
  4. *$ A: B# C( [$ [' c" b( `: q
  5. * brief  EDMA3 Test Application& ^: v! y6 f; M) @+ |9 L
  6. *( R% P; m4 l/ X2 e: [5 C0 Q
  7. *   This file contains EDMA3 Test code.
    ) j7 P: ?9 D: v, W! d  d% k
  8. *
    ; B: f' F* u0 G' p& I* P% u0 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 I- U$ O+ i1 ?6 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Q9 E. _$ d+ e- c' p: h9 r
  11. *         TO CHANGE.
    . _# i% P) j6 {1 B. d7 M6 |
  12. *9 K4 j& n/ |! V4 |, Z  g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// f* I+ [1 J9 q
  14. *! w' a* }% P' T3 x/ p- G4 l1 r1 G+ L5 J
  15. * This program is free software; you can redistribute it and/or& A* O/ C& p+ j" l  z
  16. * modify it under the terms of the GNU General Public License as
    / Y" u  Q) z' e# [+ l
  17. * published by the Free Software Foundation version 2." t! e) D5 b( ]1 v7 T9 \
  18. *+ M. W0 C! F  [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 Y9 I& W6 j! A9 T" ?0 r/ |
  20. * kind, whether express or implied; without even the implied warranty& s  O) X( r; a: N* i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * M0 I' w# y8 \# q5 K
  22. * GNU General Public License for more details.) Z) k0 {3 I( D0 Q: O& F0 T9 [
  23. */9 x5 Q4 l* n; S7 ~: [; y
  24. / h. j5 g! }2 I! G) ?8 k/ ~
  25. #include <linux/module.h>2 i6 ^8 f4 q: W
  26. #include <linux/init.h>& o5 u- ~/ }# T5 D5 d% r
  27. #include <linux/errno.h>- x! _# _0 [. U1 @$ b
  28. #include <linux/types.h>1 z+ F! C* y0 r! H$ q, z
  29. #include <linux/interrupt.h>* m0 N! X2 I. q/ K( I  l/ X9 l
  30. #include <asm/io.h>4 t* `# H8 l) A: F6 v" m3 W, E
  31. #include <linux/moduleparam.h>
    ' H# F' M) w$ j+ A/ g3 C& q
  32. #include <linux/sysctl.h>- z$ R3 K9 y! M$ {
  33. #include <linux/mm.h>
    8 U' P4 C/ N: W' ]& q3 D
  34. #include <linux/dma-mapping.h>/ c# k" ^7 I6 e% o1 k, b: @& o5 m+ E
  35. 2 f1 F/ w& C; j( m) a
  36. #include <mach/memory.h>0 Q1 X* ^6 C* W( m: G
  37. #include <mach/hardware.h>
    ) ~0 J/ \* N& K( y6 t+ R: ]; {
  38. #include <mach/irqs.h>
      l  J( X% m5 j1 N3 U: Y; r: \
  39. #include <asm/hardware/edma.h>
    ) S) F3 t3 D7 M- ?/ ]9 I

  40. 9 E9 w3 [3 X. v1 C) p
  41. #undef EDMA3_DEBUG
    ; W3 b* M# h' D) I/ Z1 g4 U6 e/ |5 W
  42. /*#define EDMA3_DEBUG*/
    9 m! H; K3 y+ I. G, r
  43. . J+ Q; H5 |+ E* o; ^
  44. #ifdef EDMA3_DEBUG+ N7 _, I6 G7 F4 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 J7 ]1 X' N+ t2 I4 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & W) D1 w# [! X& l0 n* B+ G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), F$ q4 O4 H( P# R: x6 }8 w) \& x
  48. #else% F8 o6 k& Q: G0 _+ n/ M( h6 E
  49. #define DMA_PRINTK( x... )
    + v0 w1 p" L9 F
  50. #define DMA_FN_IN
      {9 Q8 X% _3 A4 ~( z' c# j
  51. #define DMA_FN_OUT1 Q/ k. m7 K$ Z4 h' `
  52. #endif
    1 n' S+ A+ _) w
  53. ; \# k( z! ~% d3 ?' j# M0 I9 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  s' Y$ I4 N+ B, Y7 F
  55. #define STATIC_SHIFT                3
    6 F9 K7 o0 }1 M, Q2 \2 B
  56. #define TCINTEN_SHIFT               20
    9 k5 T* r+ T4 ?4 d
  57. #define ITCINTEN_SHIFT              21
    3 @& ^2 _% ?( Z8 ~
  58. #define TCCHEN_SHIFT                22
    $ \9 a' {$ N1 s9 U9 _" L
  59. #define ITCCHEN_SHIFT               23
    ; n3 C# F: ~' F# b

  60. $ w4 W# r: h& K$ T  h5 n  S; B5 e5 ^
  61. static volatile int irqraised1 = 0;
    ( A; C# \9 G! I9 a
  62. static volatile int irqraised2 = 0;
    , f! K9 V0 k, N) d( F; c
  63. + G8 ^8 u  V# [2 B& A0 M5 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) s5 Y4 y5 X$ _0 o# }1 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & H4 s& g  m. g% T( M2 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a4 `7 l  o& K% J0 j

  67. ' ?0 u5 a: P; \4 E
  68. dma_addr_t dmaphyssrc1 = 0;) I0 ?3 ~& D, s/ I1 E6 t( @
  69. dma_addr_t dmaphyssrc2 = 0;
    + P' O. _+ _7 s
  70. dma_addr_t dmaphysdest1 = 0;* ?+ r& f) u5 r
  71. dma_addr_t dmaphysdest2 = 0;
    ! ]2 K' N3 D- b3 C7 a+ U

  72. ; s% W: {. z$ ?" R+ Y: r
  73. char *dmabufsrc1 = NULL;/ }/ ?/ U* V* B( n  J( R
  74. char *dmabufsrc2 = NULL;# c" d2 e0 D+ i
  75. char *dmabufdest1 = NULL;+ w/ c# j8 H1 M  e5 D( M! H' {
  76. char *dmabufdest2 = NULL;
    ) ]) r& X. ]# l% A6 j2 A* w
  77. 9 b6 a4 m: a  ~0 E6 G+ a2 t+ L, B
  78. static int acnt = 512;
    , U. O3 i& w" h7 H  ~
  79. static int bcnt = 8;
    : C; T: ~! y- ~
  80. static int ccnt = 8;
    9 O: M2 ^) o1 G- P0 R
  81. - h) J/ r* v2 g( I; z% j
  82. module_param(acnt, int, S_IRUGO);3 P7 U* i2 {( N0 i4 T
  83. module_param(bcnt, int, S_IRUGO);. _6 s& f1 V$ [% j5 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; k! ^0 l. A, N* {6 O( T% t

7 t5 q  E$ a" A3 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 P8 R% O% k( ]arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  J3 g& W6 V+ [' z" G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 y& m) H3 O, S* m5 u( T1 g

6 M" ]% F8 o, {8 @  F, M  m
# ]6 G. Q$ m8 Q! e& o" G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-9-13 21:52 , Processed in 0.038153 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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