OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ {2 z/ A, Z3 |5 H" u2 t, {8 Y
  1. [code]EDMA sample test application( ^% {* Y5 G$ v+ M; ^# T
  2. /*
    1 S+ [* Z/ k. G8 A
  3. * edma_test.c5 g( x/ n% P7 h5 N* l4 n
  4. *
    $ @" b4 Z. x- v7 q8 o6 ^
  5. * brief  EDMA3 Test Application: G0 y. L; F$ X( Z8 `
  6. *8 }; U# I' w8 v
  7. *   This file contains EDMA3 Test code.$ b; y. l' X1 T& {) a, {
  8. *" l: `- O( ~$ R& X* U8 V4 i1 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; E1 Q: J& C5 w" T" Z" p; x4 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + _+ J3 `/ ^8 V7 Q1 l' ^) I; ^' S3 V
  11. *         TO CHANGE.; |; \7 q. u$ Y$ ?- ^( u- q6 U
  12. *
    , |$ q) \  b6 k2 ]' ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) R/ G; B8 x6 T1 k) a2 `: k
  14. *
    ! Q* n/ y# w; w+ f7 K7 a
  15. * This program is free software; you can redistribute it and/or% f: e! ?  L& v! P5 Q5 e4 a
  16. * modify it under the terms of the GNU General Public License as# G8 M9 P  R3 O1 i9 ~$ r7 ~9 a; ~
  17. * published by the Free Software Foundation version 2.# y$ `" G$ W" b
  18. *, V/ r& Z+ v1 E3 \6 r( c5 p6 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 s  F8 P- U1 E0 t9 c+ i
  20. * kind, whether express or implied; without even the implied warranty; b# q, }5 v5 z) |8 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * [1 |+ v" ]; K. H- K
  22. * GNU General Public License for more details.
    6 d1 ]6 l% Q6 s" H
  23. */
    % X2 ?0 i8 a1 W. C* Q

  24. 5 Q- u+ K# b' C
  25. #include <linux/module.h># Z. d5 K, c( J/ i
  26. #include <linux/init.h>
    ( U8 \$ u1 I. h" u
  27. #include <linux/errno.h>
    : B" j9 G* [# a" u2 ?* M- ^
  28. #include <linux/types.h>
    7 E" ^& n( W- v1 J1 ^9 ]) y% W* J2 l
  29. #include <linux/interrupt.h>$ g9 L/ b8 E) O8 h3 ]
  30. #include <asm/io.h>7 P! g+ _( C( y
  31. #include <linux/moduleparam.h>
    . p9 T# m2 \' U5 L. ?
  32. #include <linux/sysctl.h>5 e; z% e( T; p! w& {/ @/ }- H$ B& X
  33. #include <linux/mm.h>
      \7 m/ r4 q) t" _. X2 a8 p. p
  34. #include <linux/dma-mapping.h>
    5 b/ {7 `" T7 c# W; T$ A+ |
  35. ' H6 \- U6 @: K' F
  36. #include <mach/memory.h>
    / `& j. L- u: J: l
  37. #include <mach/hardware.h>
    3 D, m6 P) ^9 o5 k$ G4 _. N
  38. #include <mach/irqs.h>1 r0 \: R* Z. }" {( l
  39. #include <asm/hardware/edma.h>( g- x4 ~" J+ y" O, k8 s
  40. 3 s  t% b1 r7 F. [
  41. #undef EDMA3_DEBUG# V/ k) E& _: ~2 y4 ?
  42. /*#define EDMA3_DEBUG*/
    8 Y3 [2 J5 B" i, U. `" z" A

  43. 6 ~2 {! J4 R% j4 O
  44. #ifdef EDMA3_DEBUG
    - r' o' n2 v& ]" u  a; H9 Q0 j" T# H0 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . P/ i( x) w1 w9 j8 c/ d- k& S$ Z5 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 l' x  H8 l( o  A4 N% k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 j! e9 C1 u& Z4 y0 y4 C- `
  48. #else% z5 I! w9 _. p( y( R, K9 ]- V
  49. #define DMA_PRINTK( x... )* g0 v8 K4 |1 R. X2 ^% Y' c/ j% t  ~
  50. #define DMA_FN_IN
      _) g# a+ h- c" e
  51. #define DMA_FN_OUT9 h! E9 }! h7 s, ?
  52. #endif
    ( f3 G* {* ?  C# Z: F
  53. ; X" y9 v0 x$ W9 ]' z5 |8 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ w- C/ \7 j8 {# Y* w8 N
  55. #define STATIC_SHIFT                3
    + J+ g; h: D% @& k5 y6 I+ ^
  56. #define TCINTEN_SHIFT               20! j( g1 r6 L  }* W7 C6 a* B: F
  57. #define ITCINTEN_SHIFT              211 ?" `1 R, B& Z. c2 |7 C
  58. #define TCCHEN_SHIFT                22
    2 }' J& Z5 v6 P6 V3 q  f8 X% W6 k
  59. #define ITCCHEN_SHIFT               23
    ) s# k* W$ D4 `$ v# Q

  60. 6 _+ Y0 q3 V0 C
  61. static volatile int irqraised1 = 0;
    5 J$ W/ g: y" {* b1 R/ @8 t5 \
  62. static volatile int irqraised2 = 0;
    7 z: {- b2 V5 I% l5 W( c% p

  63. . N, @& C, A  l4 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 d  \1 _9 ?5 Q" N3 h! q( p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) k1 ~% E, J( V5 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 |7 z3 ?* X/ a7 ?, I

  67. / E7 z5 z! i* O
  68. dma_addr_t dmaphyssrc1 = 0;
    & U& S4 P. P( k" q, _/ k8 x
  69. dma_addr_t dmaphyssrc2 = 0;
    ' S8 D3 a7 l! P( A# m
  70. dma_addr_t dmaphysdest1 = 0;
    : b7 c+ p0 R3 k& C3 G* t. C, u) V
  71. dma_addr_t dmaphysdest2 = 0;
    4 [5 g- H) r' g9 g! ~
  72.   |4 B! w+ Z; k9 X
  73. char *dmabufsrc1 = NULL;) [% I  p$ x! w- ~  a& \  F
  74. char *dmabufsrc2 = NULL;
    . ?5 H( u( j- q' L5 U& c9 C0 `
  75. char *dmabufdest1 = NULL;; s( M/ S% ~( l$ q/ f
  76. char *dmabufdest2 = NULL;$ U3 x+ W, _/ b3 J  D5 S1 H0 Y

  77. ! D' [/ c" r' o8 J
  78. static int acnt = 512;
    2 R! P  [( Y; B' r* @/ S" @8 f
  79. static int bcnt = 8;
    ; y; Y7 Q/ l7 z
  80. static int ccnt = 8;
    ) d, H8 p  X. [
  81. # @' c6 m* l/ m# Q
  82. module_param(acnt, int, S_IRUGO);" k9 w7 n5 w9 [( S8 q( y; f
  83. module_param(bcnt, int, S_IRUGO);/ Y4 D+ Z' Z. H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' w# Z* h/ H3 q* r4 t1 K) T
/ y9 K% |4 \+ @' ?9 d" O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' v8 Z; b8 N( f% p( M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 i% v$ E4 `9 z6 [+ H! U; x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( f1 j! A  p1 p/ V9 _( t6 ?, ^

8 j7 ^% ]. Q& k$ g' h" J
1 a5 K) v# N9 p. [* D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-30 10:20 , Processed in 0.041685 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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