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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* K) @' q7 H" X- w
  1. [code]EDMA sample test application
    . @6 t9 }6 S% J% F' x- f
  2. /*3 P2 Z2 Y1 h& u/ a5 U9 I
  3. * edma_test.c2 Y! q# {# b4 V
  4. *: y9 ?) W1 [+ z: y0 F
  5. * brief  EDMA3 Test Application
    : h+ \; h" L% R/ Q
  6. *
    4 l0 [2 ?0 H! y& T- |- i/ v% b
  7. *   This file contains EDMA3 Test code.
    % A7 o. v" I: q0 |
  8. *1 C; ]! w1 J% h2 ~1 P$ L/ H/ p- z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# ^! ^" I" K+ F6 y* V4 M- \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 x8 d4 ^% N$ z: p; B  _! P- q
  11. *         TO CHANGE./ D0 ~- L7 \; s$ G
  12. *: B: U2 b* H4 x& r1 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& H% G& N! p  p, p
  14. *% ?' o6 M% U: p4 M1 }  G
  15. * This program is free software; you can redistribute it and/or
    / u: a, \8 a; T9 [$ _
  16. * modify it under the terms of the GNU General Public License as* P2 Q" b# U8 S% \& s
  17. * published by the Free Software Foundation version 2.
    & F8 s, h+ V/ o
  18. *9 D. i( W* ?7 F& g0 Q4 d& _( Y7 P1 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 y/ B8 v1 a% E$ j
  20. * kind, whether express or implied; without even the implied warranty
    ( @4 O, L, b$ _2 m9 p* w9 A; N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      r' l9 g  s( U+ y9 W6 `& v
  22. * GNU General Public License for more details.: u5 T2 o' U: |- s5 H
  23. */
    3 `# t9 l; o3 z0 C

  24. & Q6 q6 A; @5 Y) u( w8 I: E* L; @
  25. #include <linux/module.h># y6 i$ W1 S/ F  c7 q% @7 c! |
  26. #include <linux/init.h>% n, S, A  g8 T; e/ g4 r) [; e9 R$ B/ H
  27. #include <linux/errno.h>( q! A- Z# i) h  t
  28. #include <linux/types.h>
    8 q# {0 U0 i5 z8 i
  29. #include <linux/interrupt.h>! h$ P* ~( x; l2 ~# p3 @$ D9 p
  30. #include <asm/io.h>6 {7 i, G( _$ @+ L
  31. #include <linux/moduleparam.h>
    ( n0 R6 {0 O6 D" J4 B1 i
  32. #include <linux/sysctl.h>
    ' w' O' i/ c; D% {5 [2 ^) A
  33. #include <linux/mm.h>
    ' }/ w0 k& W8 Z1 n- n+ X
  34. #include <linux/dma-mapping.h>3 h3 I+ L$ ^# F
  35. ' S* _' q7 e  r+ ^5 M3 E5 \  X
  36. #include <mach/memory.h>
    0 }" h* x7 J# L/ F; b& E
  37. #include <mach/hardware.h>9 \  I  z1 i! e% w$ [
  38. #include <mach/irqs.h>
    + f" a4 }( K7 n6 S/ n
  39. #include <asm/hardware/edma.h>8 z5 T9 F# f. Y4 K- r8 S3 ^
  40. 6 ~0 L9 i8 Y7 ^2 C
  41. #undef EDMA3_DEBUG
    * {( E- l. y* _
  42. /*#define EDMA3_DEBUG*/7 M; p' e' h# G, ^
  43. : X# a2 y+ h% l
  44. #ifdef EDMA3_DEBUG0 x) F" }4 E, k9 k' U0 O7 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! K+ y& W" {; f  @+ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ R; S( T; F" Q1 R0 A, B' o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 ~0 m1 n7 y/ g9 W! k- S; E
  48. #else; U- v# |, R; v4 \$ ]' ~( h
  49. #define DMA_PRINTK( x... )% f7 d: f; F( b4 b. ?: p/ g  o2 A
  50. #define DMA_FN_IN$ `' F* g. j. I/ K0 |1 a- Q0 K2 I
  51. #define DMA_FN_OUT& C0 _: ?% a- I9 j  }; a: Q7 [
  52. #endif  q' m* ^% M4 |* e3 j! \

  53. # I8 D5 I6 D# [- c% }! r0 O; V0 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 f8 G0 ^! S. P( e4 j/ N3 W' z9 `) `
  55. #define STATIC_SHIFT                35 Q! R# j" z. _. o/ c" C
  56. #define TCINTEN_SHIFT               20
    2 M% ?; |! w0 a" U
  57. #define ITCINTEN_SHIFT              21' }  w4 h  I; p2 p6 c
  58. #define TCCHEN_SHIFT                223 i2 w! {  Y/ z5 H1 B1 ~" Y
  59. #define ITCCHEN_SHIFT               234 [8 I& t! ?* X& K* q' g
  60. , p3 N/ n) K- G5 v$ j% E2 y' i
  61. static volatile int irqraised1 = 0;
    * V: K' Y- @( x1 o9 v
  62. static volatile int irqraised2 = 0;
    8 r2 e0 v* d* F# F

  63. 7 d. s1 Y( m/ _- f+ u& t! V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & N5 [7 ^& Y! ]" Z( \& O, p, j* H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! V% N. P& f5 F, y) n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . K: k, |+ J& b! P! w: B5 ?

  67. # ]0 f  M' C# U; I) b6 C! R& t
  68. dma_addr_t dmaphyssrc1 = 0;" R6 C/ z2 y- s; p) j& W
  69. dma_addr_t dmaphyssrc2 = 0;
    8 d" B  N& `1 p* j: V
  70. dma_addr_t dmaphysdest1 = 0;' i3 O" m+ A( A# ?
  71. dma_addr_t dmaphysdest2 = 0;1 u* _2 _" d$ i- A- B- I) J
  72. % t1 h3 g$ j: e7 C! O
  73. char *dmabufsrc1 = NULL;
    8 d! _3 }& J2 u( j- M/ b" _% d
  74. char *dmabufsrc2 = NULL;- g$ d/ M) |" E7 ?
  75. char *dmabufdest1 = NULL;! d! ~! Y% `2 X0 @* o% H# D
  76. char *dmabufdest2 = NULL;9 i- i; C5 K" g( y0 i

  77. 9 B. Z) _2 a' p9 u( p$ {: W
  78. static int acnt = 512;
    , H* h9 P8 q5 E7 {& X  H, W( z
  79. static int bcnt = 8;  `: h% I" {: L, m1 A
  80. static int ccnt = 8;8 R5 k, x4 }+ f6 U7 q

  81. ; {& W0 k: O  Q/ S* P
  82. module_param(acnt, int, S_IRUGO);# N6 D3 b' z, R5 x) r
  83. module_param(bcnt, int, S_IRUGO);+ J( g) J  ]* B! |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" p4 D- e# E0 k* s" L# {
! V8 U( A* ]' C' B& a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 b- o8 W  b9 d6 [0 ]- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ a* `; M) [$ K& B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 I0 _- ]) M1 r  U: Y5 Z+ F9 q& Q! R. k
0 T5 D- _# O: E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-25 20:12 , Processed in 0.037902 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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