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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ?7 r* b- M$ j: r4 z, B/ q
  1. [code]EDMA sample test application  ]2 T8 `) m# A" C4 {6 t
  2. /*
    % z6 i- ^" l. Z% d% h/ I/ ]
  3. * edma_test.c0 H5 U5 a& \- C8 n7 {8 ?; j
  4. *
    0 K) X- J: R; ?7 s) P* ?+ w
  5. * brief  EDMA3 Test Application
    5 |3 D9 m7 O! ?  |- t& S# y% W& A1 g
  6. *
    8 l' R1 s+ H. p
  7. *   This file contains EDMA3 Test code.
    # O: S6 Z9 o" Z$ K+ k6 h5 `1 Q/ c: I
  8. *
    7 w' v9 Z2 o1 I" S, c+ B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) K$ W5 ]0 U% s( \. Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 t7 s1 u  [8 v7 Z6 {$ U* c
  11. *         TO CHANGE.6 R" K" p+ |5 p2 `8 O1 d4 a
  12. *
    1 _3 c% k+ v7 ~3 _% K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % O7 @+ w. D& J3 f
  14. *
    ! m+ d( F8 C! G* E  E  g8 p( O! m. G
  15. * This program is free software; you can redistribute it and/or
    " @4 N$ V& B# G$ {" [
  16. * modify it under the terms of the GNU General Public License as- r! B% U5 M) B/ ]! q
  17. * published by the Free Software Foundation version 2.; t9 F+ a( F6 G# k. @
  18. *" e& w# I5 {/ e, f3 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % U0 X9 R& n) G: z: a  b7 R
  20. * kind, whether express or implied; without even the implied warranty
    - U4 A% j4 M6 m' {' z5 \. A2 g9 v7 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 C- D2 b1 p" \
  22. * GNU General Public License for more details.
    - k' D2 }; q  o+ I6 c9 E" [+ ?5 m
  23. */
    9 W6 }* R$ T! f9 E0 q% }) ]2 L$ i' O

  24. - H7 L1 C. X" s+ E3 F0 l8 Y: q
  25. #include <linux/module.h>
    / Q0 `1 O( A: u8 o& l. f9 D
  26. #include <linux/init.h>
    8 `# |/ U% H4 k
  27. #include <linux/errno.h>
    + \# b; ]6 I; z, j9 M* Q* d
  28. #include <linux/types.h>
    , C% G, O/ v- k
  29. #include <linux/interrupt.h>
    + R. P; x$ X- k& N; ~: g  J
  30. #include <asm/io.h>* O9 u6 q6 g% U4 g
  31. #include <linux/moduleparam.h>
    " \) }: y* l% [$ N3 c
  32. #include <linux/sysctl.h>
    1 d. ]4 w6 o# p; D$ a. E7 R
  33. #include <linux/mm.h>) ~2 |* g/ C& q& q6 F  Z. @2 l
  34. #include <linux/dma-mapping.h>. y0 I$ g3 c, V! Y
  35. + S+ p. Z% L: @9 R4 _6 F% f
  36. #include <mach/memory.h>+ W- z% E0 c) y. _
  37. #include <mach/hardware.h>
    2 r. r* i, x* y! h+ k, f, a9 X
  38. #include <mach/irqs.h>- O( Q# I9 r5 h* U& B& E
  39. #include <asm/hardware/edma.h>& D6 N8 I2 C4 j9 W

  40.   T+ W* z/ K6 A9 M) D' t, y+ v" w
  41. #undef EDMA3_DEBUG
    6 H% U# H% N: m- E3 M! m: n
  42. /*#define EDMA3_DEBUG*/7 i' U1 i2 {+ F8 Q- ?

  43. + d$ h$ v0 l6 X1 }  r
  44. #ifdef EDMA3_DEBUG
    + P% m7 X* c) E9 D3 l" g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 e& I5 o- u% p# X6 S5 M* ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! w( I* A# e: I& X" n# E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  {" s1 m9 n% B/ _. Z7 T
  48. #else+ A* t& I1 q9 J# ?
  49. #define DMA_PRINTK( x... )( p$ Z6 D6 k4 x& X8 _
  50. #define DMA_FN_IN' C6 d1 p4 w: X$ q/ Z
  51. #define DMA_FN_OUT
    1 Q+ B: y2 A9 C: O3 w3 c, ?# G
  52. #endif
    1 k# C/ Y$ R. J5 l6 b

  53. $ x- A8 {  R$ g. z" Y+ a+ K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- |) b! h2 t' a+ \/ \+ T& j, X8 q
  55. #define STATIC_SHIFT                3
    2 C( \" w2 ~7 D3 G0 _/ f" ^4 z8 V
  56. #define TCINTEN_SHIFT               20. g/ E$ A! Z: A  J* ]* G
  57. #define ITCINTEN_SHIFT              21
    4 X& ~" |1 P) P: m$ C: d* N
  58. #define TCCHEN_SHIFT                224 S* L1 s3 y  g5 {( ]* V  ^7 Z
  59. #define ITCCHEN_SHIFT               23
    * d8 V% o4 F; E0 ?  `( C0 J

  60. 5 ?4 @: v: I* m
  61. static volatile int irqraised1 = 0;1 N8 a/ Q' B  k. M" ?
  62. static volatile int irqraised2 = 0;
    - J4 E' A: N' L# x, q. A

  63. ; H) X/ w4 Q9 a2 B! X( \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Y8 o* u# q, ^" S* T. u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r7 t& H1 x) n5 \5 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N5 m. Y! V, s7 Y

  67. * `, s" z; R( Y( ]4 d; B- D& V
  68. dma_addr_t dmaphyssrc1 = 0;
    & w8 W! |5 P; U1 t* t
  69. dma_addr_t dmaphyssrc2 = 0;+ z1 f/ |% C: y7 h4 l' b
  70. dma_addr_t dmaphysdest1 = 0;1 E9 ^  G' U' S3 M
  71. dma_addr_t dmaphysdest2 = 0;
    + U  j' \, U. |& p. \- i2 W
  72.   {5 N. s6 n( C# i4 n2 W" w+ ]
  73. char *dmabufsrc1 = NULL;5 V# I2 P- S) q+ ]/ K, [4 n
  74. char *dmabufsrc2 = NULL;
    / I; R" q2 H& D* d, r% {) Z' r/ O
  75. char *dmabufdest1 = NULL;9 s0 Y( N8 B$ O4 w1 Z& n  C. {7 v
  76. char *dmabufdest2 = NULL;7 c& O# [8 c" e1 B  n

  77. + {" J- ^) p  y7 X9 r
  78. static int acnt = 512;/ w$ U; o, ]- G* j# f
  79. static int bcnt = 8;. p" m3 }1 k0 K2 Z7 Z* k
  80. static int ccnt = 8;" k+ E& Y5 X$ n0 K( C$ E
  81. 3 m9 p0 }+ g+ b8 F
  82. module_param(acnt, int, S_IRUGO);
    ! f' u" w+ c& K: j
  83. module_param(bcnt, int, S_IRUGO);
      A* j$ h9 `, e" y- @# M* [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 A3 e# l1 \$ [; B# ~1 \
/ o! y7 c6 D. H* T3 f0 n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 f6 X5 W' F" Y% O. ]7 Z% e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- \# J7 T' ?2 X( z' @( J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, U0 w# \  P( X

  D2 b+ u$ Y1 W( @9 l
- d3 B3 Q5 ]: P( Y( p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 05:21 , Processed in 0.039073 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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