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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " T  \5 D4 P# p" r! u% h6 \& |
  1. [code]EDMA sample test application
    ' L+ d& t5 e2 R. a5 O
  2. /*
    7 Z+ |5 k3 r! o) B( w2 I6 N* `
  3. * edma_test.c
    8 i3 H8 \7 k. x1 U0 {; F! t
  4. *4 k0 `# W3 w, o' z( z/ F' X
  5. * brief  EDMA3 Test Application' _  H+ S* f7 g$ Q! \/ E  `
  6. *
    - R; B: B0 ^* c8 A+ z' J$ ~" m
  7. *   This file contains EDMA3 Test code.4 i" `+ ^+ @- N8 X' W
  8. *7 ^/ T2 D) j! t: ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( @  T: o2 N" F# l" o% e0 D, ?8 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 r3 z9 C# n" k9 ?" v! l7 ^
  11. *         TO CHANGE.
    % U  }+ |5 ^% V5 z/ A! V' F
  12. *
    " y. Z& f. y+ d: q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 i# t9 b3 T/ o# x* V
  14. *8 M8 o( T: z8 Z# C. S
  15. * This program is free software; you can redistribute it and/or
    # t9 b" W1 i( n: j* w$ {
  16. * modify it under the terms of the GNU General Public License as* M) U* H# @& ]( E
  17. * published by the Free Software Foundation version 2.
    3 S& O+ |. a* Z! r+ U! Q% J4 T
  18. *# |0 T5 Z4 R7 r3 \9 `6 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 {  I. p1 b7 b
  20. * kind, whether express or implied; without even the implied warranty2 K) R4 I5 A7 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % V8 @. B% _9 C
  22. * GNU General Public License for more details.
    ' {/ s3 K; }  k5 W/ F
  23. */+ a" y' `+ s% y- a9 g% ^9 [
  24. 3 A) A. V) x- a& l- ~( }
  25. #include <linux/module.h>
    $ L2 ?) |# k$ P3 m9 Q  L. M
  26. #include <linux/init.h>' y5 P. g2 S& r! B5 W; F( Y* r
  27. #include <linux/errno.h>) @9 J  Z" g# V3 X# O1 @( h% l
  28. #include <linux/types.h>
    ; d# z8 m5 ^) m: G
  29. #include <linux/interrupt.h>) Q2 \: p* C3 {, S" g7 Y
  30. #include <asm/io.h>
    . W3 o. T& o. U) `4 m/ z, w, ]- F
  31. #include <linux/moduleparam.h>6 ]1 h1 {/ m) b/ K) i# B% c5 Z
  32. #include <linux/sysctl.h>2 c- ~: s" j8 y
  33. #include <linux/mm.h>7 w7 C- q' i; M% U0 I9 r+ x7 ]
  34. #include <linux/dma-mapping.h>
    " X/ V' z; Q2 d

  35. $ ?8 R" B" T, w; r1 r
  36. #include <mach/memory.h>
    3 B$ {1 [8 ]/ Y1 K6 Y
  37. #include <mach/hardware.h># V+ ]+ `3 v" e9 K4 ^$ `+ s" n( g
  38. #include <mach/irqs.h>
    ; J, {% S! ?/ J
  39. #include <asm/hardware/edma.h>8 Z& i4 L7 Q  f: A5 C. R
  40. + y: c; Z" `* @4 H: c
  41. #undef EDMA3_DEBUG  k$ E8 o5 m" s5 C1 x7 Y" ^, D+ V
  42. /*#define EDMA3_DEBUG*/5 [4 [3 M7 Q$ Q( T; [& o" l

  43. + C8 ]* |8 T. b8 W* H6 Q7 _
  44. #ifdef EDMA3_DEBUG
    1 t8 Z; H- J! A( D) {6 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 ?& h9 z8 C) q4 r# v' `6 F/ T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 U5 ~% _% D+ Y$ l" C% _$ d* O8 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) s9 Q/ y, B2 V5 |0 i# Z
  48. #else9 I1 d" E% ?# D- w9 s3 J5 ~
  49. #define DMA_PRINTK( x... )
    / p! o: b4 a9 ]0 Y  k
  50. #define DMA_FN_IN
    & A& K) L1 q/ J: P9 @0 ?; F
  51. #define DMA_FN_OUT
    " ^2 p- E3 ~, w* o8 q+ U) y: ]
  52. #endif) ]( Z8 ]+ ~6 {7 d9 r/ K

  53. ' u' @2 O: U/ o* e1 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 }) ^" N/ I- Y8 j8 |3 `
  55. #define STATIC_SHIFT                39 \" K* [! d/ y/ s1 @' j2 Z# f
  56. #define TCINTEN_SHIFT               20
    $ x& k4 D+ o4 |
  57. #define ITCINTEN_SHIFT              21! M; ^9 }& t7 ~6 d. L" Z# w
  58. #define TCCHEN_SHIFT                22
    . I( m  c4 z6 ^5 Y1 n- u
  59. #define ITCCHEN_SHIFT               23
    & u9 b" @7 A# Q& u% M

  60. 0 O# w" E' w( _( o
  61. static volatile int irqraised1 = 0;# U" }0 P! j) f' u8 G
  62. static volatile int irqraised2 = 0;( A/ x: M5 M; v8 G7 X  y
  63. # P5 N% Y3 c3 W. d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 I% u) V$ Y1 g; D3 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' M4 l$ I8 ?+ z- B. v- z9 |& s$ ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t# `, \  z" ~5 [* ?  Z3 ^4 k$ {  @

  67.   C# }/ j& a) H4 @: q! f
  68. dma_addr_t dmaphyssrc1 = 0;  h# ~8 C+ C, N5 W
  69. dma_addr_t dmaphyssrc2 = 0;
    ) y4 z7 P0 f) {
  70. dma_addr_t dmaphysdest1 = 0;
    ( ]/ [0 `$ f5 ~) U% e3 h1 y) E+ J
  71. dma_addr_t dmaphysdest2 = 0;% D7 t3 R8 T* S8 v0 x# Q8 K) h( f

  72. & z! v! V5 u) q& k( F. A2 R
  73. char *dmabufsrc1 = NULL;
    1 U$ }8 B$ j; X& p: f* n7 j. P
  74. char *dmabufsrc2 = NULL;& w) Q9 O4 R$ _3 L: M
  75. char *dmabufdest1 = NULL;
    ! I. ^6 @7 [4 B& B. y9 \2 M* r
  76. char *dmabufdest2 = NULL;/ m& i- u) o/ f; r$ x
  77. + l9 L& M. L/ v4 S5 T
  78. static int acnt = 512;
    1 X# p* h1 ~7 r. o# L* @9 Q
  79. static int bcnt = 8;
    + C1 T& n. v0 g' H9 G' y1 l9 O
  80. static int ccnt = 8;
    " A1 s' d% o( g

  81. % S! R* J: }  f& e; _/ d9 O
  82. module_param(acnt, int, S_IRUGO);
    * d5 o* O9 l# B1 T* o0 A- O. t- W) L
  83. module_param(bcnt, int, S_IRUGO);- V: n6 e' r/ \. y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) N% W9 d; Z5 O& `/ n+ K
, F7 s* c2 e0 ]5 K. \; m  V4 R- e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' m2 W6 d, g9 o5 B  r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- d0 Q# T9 f7 m' n1 L! P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 f9 }- U1 b# g. I" d" k- P2 B) e
+ c" v5 y8 {; m7 r- Z3 s; D
9 Z' h+ F$ d0 E* M" e/ @4 Q4 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 07:01 , Processed in 0.041730 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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