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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / l* {; M' ^$ k  W
  1. [code]EDMA sample test application
    / r; L( H. j8 H- s# j4 l5 L
  2. /*7 k: a+ w& j& r" t1 F
  3. * edma_test.c1 |8 ]+ h* o1 W1 W  i0 u3 Z: G6 m
  4. *
    2 c8 X- {+ T6 \5 D2 k3 u
  5. * brief  EDMA3 Test Application3 t7 v7 m' r( @
  6. *) M' E, ?& l4 P" O/ ~% K
  7. *   This file contains EDMA3 Test code.
    & P! L2 @7 ]1 s, C2 a* F; q
  8. *8 W3 `8 v2 T( y6 Y* {. x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# U% ~* Y5 o. Q' n2 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 o* R2 h* w+ r3 }  f
  11. *         TO CHANGE.2 c5 v! Z+ s5 v9 S, O  p' C
  12. *. J& ~7 Z0 m# o$ g" A4 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 {8 h" f, B$ j# j$ L
  14. *
    9 N- d7 Z0 Q8 s$ B1 Q+ A
  15. * This program is free software; you can redistribute it and/or4 l1 @, F7 x7 j, ]; G2 m
  16. * modify it under the terms of the GNU General Public License as
    ! |- ~7 }5 O1 D& r' t( C
  17. * published by the Free Software Foundation version 2.
    - k& Y' h& p/ b; g" N, N6 F+ x1 H3 b
  18. *) y9 M) q$ h9 S* ?5 E+ X5 F8 _  H& M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ {* p- _, R( Y6 A" H3 C
  20. * kind, whether express or implied; without even the implied warranty
    3 s% A4 j* L, F4 b  `: {8 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' C. M+ F3 g: O" Z  @+ m
  22. * GNU General Public License for more details.
    ( ^: ^7 K/ o* w0 T
  23. */
    : Z9 N5 y3 r) k
  24. 6 Y1 E: }, ^5 p8 Z! O: v7 w3 @
  25. #include <linux/module.h>: q; j) Y# q0 r3 Y. s- Q7 {: Q
  26. #include <linux/init.h>
    ( ~+ F4 I4 d! I: a
  27. #include <linux/errno.h>
    ' X# j( |8 B3 q, h2 B& |
  28. #include <linux/types.h>
    * ~" J  [% `) `1 O" Y( q
  29. #include <linux/interrupt.h>5 g1 |& \; d5 y
  30. #include <asm/io.h>  Q! [9 h0 D& U: P' y
  31. #include <linux/moduleparam.h>
    / r) E  T7 T  n* ?5 s( F
  32. #include <linux/sysctl.h>' `1 z: G& @( e6 F- V# U
  33. #include <linux/mm.h>$ B' v9 D1 e6 i% Q3 A# x& l
  34. #include <linux/dma-mapping.h>* d3 R3 A, t3 {9 _) l; r* S

  35. , v) `; h# `1 D$ ^: o) I
  36. #include <mach/memory.h>
    , ^0 I7 l: o6 O
  37. #include <mach/hardware.h>
    % h- ]4 \/ h6 ]& X) @, h, g
  38. #include <mach/irqs.h>
    ( S# ?  ^0 t; D  @( s
  39. #include <asm/hardware/edma.h>
    ( h8 n0 F% [$ i2 C0 u
  40. 5 |5 G* N; x' g' Q, i
  41. #undef EDMA3_DEBUG  f- Y0 k" J, g
  42. /*#define EDMA3_DEBUG*/: U( F, M: Y3 f; l4 z
  43. 5 M  g9 r3 w) ?% P
  44. #ifdef EDMA3_DEBUG; d" v# [; R! R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & I* `" e3 ?, U5 D# r4 E6 E7 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 z& {# c. A0 \! W2 a* Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % [! z, q5 S, e$ A0 D8 m# l
  48. #else5 C6 u! D( K# I. @+ f, J, G2 J
  49. #define DMA_PRINTK( x... )
    7 t2 R% x& h9 F- v6 E
  50. #define DMA_FN_IN. {& \1 A$ m! b& a9 i$ n
  51. #define DMA_FN_OUT
    ( N( r( ~* {+ Q% B+ o
  52. #endif
    " A4 l8 c- y9 l: N( U+ C

  53. ' r' P/ ^/ ~) {' {# q6 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" x$ q" o( t. q! ]0 a) [: {" P
  55. #define STATIC_SHIFT                3" T# {& y3 @2 |4 n
  56. #define TCINTEN_SHIFT               20* K6 S6 c( p4 ?# e
  57. #define ITCINTEN_SHIFT              21+ a+ B- t9 q# D8 y: {/ Z
  58. #define TCCHEN_SHIFT                22. l, S  b, E# }2 t; _9 q8 Z
  59. #define ITCCHEN_SHIFT               23+ x" Q0 L3 t0 Y5 s% b' M1 O

  60. " |& t" i& o2 V
  61. static volatile int irqraised1 = 0;
    8 D* t& M1 b% V) D7 h9 G
  62. static volatile int irqraised2 = 0;
    # p# c  O# p6 _3 F4 z% D0 a5 R: w
  63. ) d0 _# N9 p* ^! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . K! q, L. U5 h) M8 [% t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 s8 k. i( w- H+ L% V' _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P5 _" s* V7 S0 m) c4 b- O
  67. # a2 F! Y. Q% X9 U6 v& z
  68. dma_addr_t dmaphyssrc1 = 0;
    ' J$ s- _6 N/ O1 j* _5 g  y
  69. dma_addr_t dmaphyssrc2 = 0;# r& H& Q& r( }9 K9 Z5 I
  70. dma_addr_t dmaphysdest1 = 0;; g( \/ J9 F1 @0 I6 A" ^
  71. dma_addr_t dmaphysdest2 = 0;
    8 w6 e+ F- i% C" @+ ]4 V- B
  72. ! u: j2 w: p0 f" Z* ?8 f- ?
  73. char *dmabufsrc1 = NULL;, j8 p% l/ r0 X6 Q
  74. char *dmabufsrc2 = NULL;7 J/ e& c( m& K4 H3 U; L$ k2 g% v
  75. char *dmabufdest1 = NULL;' E7 |* {) B; k# j- ~( _
  76. char *dmabufdest2 = NULL;1 s: |' j. q- q+ W$ ^" Y+ f
  77. ! `. N) h- O" _. h. N+ \9 j7 T
  78. static int acnt = 512;/ [- C, u3 k; n  Z, G* A
  79. static int bcnt = 8;
    5 ~3 M8 s/ y3 W* b; j6 M6 {/ F
  80. static int ccnt = 8;
    ) M1 @1 p: L) m0 `! b
  81. 8 H' s$ F) n: d& r3 @
  82. module_param(acnt, int, S_IRUGO);: c: r& J, K3 U# ~5 |% N
  83. module_param(bcnt, int, S_IRUGO);( {5 l* x- P# W; k- h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& y" A+ ~+ w: ~. E
* \4 y; N6 @( B6 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  r6 f2 V( K1 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& \& m5 |/ c# Y! z; n  m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& C- ^2 }1 A  u
8 `' N( U& G) a8 `9 G, O
$ t( t: r% l: w! G6 |; d2 f9 Z$ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 14:45 , Processed in 0.050114 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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