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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W, ~1 X1 |( Q+ u& C+ o$ F
  1. [code]EDMA sample test application  X3 S& o/ r% c
  2. /*
    5 J  i8 h' Y  F6 ~
  3. * edma_test.c
    + \4 `7 b( c1 o" D, r* w
  4. *+ b- \  p* Y& U6 {1 v% p# t/ m
  5. * brief  EDMA3 Test Application
    ' d0 @  w) J1 Q& v6 D6 o
  6. *7 _! i5 ?$ Z! }& a1 J# V
  7. *   This file contains EDMA3 Test code.: X* r' a) v; E: y9 n0 _5 g$ n
  8. *! d+ t" d6 i+ S6 l5 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# h5 d: K2 F' W- o( H- G8 B2 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( H, }9 \9 E& x$ K* C
  11. *         TO CHANGE.
      M: \2 _, c& d/ L. L' w! o
  12. */ p* s5 I& ~# C/ P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 G- h0 b4 E6 m8 l+ q
  14. *
    6 E# x! h6 H$ j3 H, ]$ O, p; L9 i
  15. * This program is free software; you can redistribute it and/or
    ' K. V( E, x# Z& d) U6 {2 r
  16. * modify it under the terms of the GNU General Public License as
    / I) K7 [1 u% ~
  17. * published by the Free Software Foundation version 2.
    + l  ~! `5 k' _
  18. *
    ) P; h+ G$ v9 Z" y% ~9 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 x+ n* j2 V" f. `9 |
  20. * kind, whether express or implied; without even the implied warranty' [* i! h1 ]4 V* ~- K& n2 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# a( R/ W! S7 E
  22. * GNU General Public License for more details.0 V, r$ `8 q6 W4 V' @
  23. */' b2 Q- _3 v0 P, A# K& C
  24.   x- l1 u/ H* P9 D) d
  25. #include <linux/module.h>+ X# f) l7 k) ^! r3 m
  26. #include <linux/init.h>
    . w: r  d+ i/ \
  27. #include <linux/errno.h>
    / m" z; w. p( Y8 t& G: o
  28. #include <linux/types.h>
      y6 u! Y+ Q' I7 g4 I2 a" s
  29. #include <linux/interrupt.h>/ I& Z5 {  R8 x1 _5 d  h) T
  30. #include <asm/io.h>8 ~) V7 w$ V7 T# F* q
  31. #include <linux/moduleparam.h>
    9 x3 H/ o- K! ]0 U
  32. #include <linux/sysctl.h>; j* C8 j' U' c, M7 e( y  q' Y9 [
  33. #include <linux/mm.h>
    & J: z" N$ @% l& A& w
  34. #include <linux/dma-mapping.h>" u" S1 F+ q" s
  35. 5 Z4 R* k+ e1 R
  36. #include <mach/memory.h>) J, {' W, `! L6 {. Z8 Q
  37. #include <mach/hardware.h>
    / w/ o8 ]- Q2 _1 Y4 _& R& z2 z
  38. #include <mach/irqs.h>
    , k" t8 G2 ~7 H
  39. #include <asm/hardware/edma.h>
    * f3 l# z3 j. d) L! _: s# M; l+ x
  40. + X1 ]7 C5 G3 H* S
  41. #undef EDMA3_DEBUG  s) z. D$ g5 e' y5 x/ D8 Q7 A- s
  42. /*#define EDMA3_DEBUG*/8 a3 M4 @, p, l) Q
  43. 5 w6 Q0 h) t7 q$ t0 }& M
  44. #ifdef EDMA3_DEBUG
    5 ?1 m) h& |' F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), R3 s2 t2 |* s% w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). [" o# a, a. d0 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' j+ i/ e9 x1 e9 O8 M6 x) Q4 j1 N
  48. #else  R( k2 ?9 Y; Y) L4 Y* Z; \: s7 A
  49. #define DMA_PRINTK( x... )& m1 Z) v/ e2 i. B
  50. #define DMA_FN_IN
    2 ~4 a3 E' q& O( D
  51. #define DMA_FN_OUT. {  ~& Q2 O7 N: v1 o; g
  52. #endif5 a8 B; X. c; q. ]4 k" ^0 I. v
  53. % Y. c# a! D0 [8 x; q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 T9 K/ c/ h( {+ O
  55. #define STATIC_SHIFT                3, x) e9 {6 M5 T0 P$ n
  56. #define TCINTEN_SHIFT               20. k5 a# f# P, K. C4 N
  57. #define ITCINTEN_SHIFT              21/ d& k; Q) G" y1 M" h! H
  58. #define TCCHEN_SHIFT                22& G% ?8 i" _5 D, q7 v
  59. #define ITCCHEN_SHIFT               23# W3 }# a3 t- x" D
  60. $ o  D8 E7 b6 ~/ b/ l9 d2 r
  61. static volatile int irqraised1 = 0;
    4 y+ M* B2 ]: E0 F5 S- C9 @
  62. static volatile int irqraised2 = 0;
    ) U* L6 T1 d& k) z! P' J, ^
  63. - ]: s; Z/ V- k% T9 R2 x* q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 x3 R( A2 v# M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f8 U- k, k: ?. E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 W5 u9 U8 T% q9 f  w0 P
  67. + [+ I6 r6 X/ f$ K0 D" R
  68. dma_addr_t dmaphyssrc1 = 0;
    ' U. @  q: D( Q
  69. dma_addr_t dmaphyssrc2 = 0;
    5 l. w* Z* a& \! z9 ]
  70. dma_addr_t dmaphysdest1 = 0;
    4 e5 u" [. X) r& k! K2 i5 k
  71. dma_addr_t dmaphysdest2 = 0;' v" w9 ]6 `; Q  ^+ a

  72. 7 [& G, K4 b/ O0 N" J
  73. char *dmabufsrc1 = NULL;- X1 H) r$ |1 V7 t
  74. char *dmabufsrc2 = NULL;
    . G# Z4 u8 U0 w7 G8 a- e
  75. char *dmabufdest1 = NULL;
    ; L  J  ^" k! @
  76. char *dmabufdest2 = NULL;
    ; r& A( p4 W5 y

  77. 6 |- L' p) B. `* r" d
  78. static int acnt = 512;- P# [9 U$ e1 u8 Y
  79. static int bcnt = 8;
    : |5 j' ]( ~4 B# m9 d8 n
  80. static int ccnt = 8;
    # m2 M+ S7 d  v% N3 z! B! O
  81. ; i( {, \7 w& s0 Z
  82. module_param(acnt, int, S_IRUGO);+ A( X# M% h# Z) ?; u) j7 T
  83. module_param(bcnt, int, S_IRUGO);" \  h' g- g9 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 |; l  m8 t6 `$ K' N" ]2 E0 B0 u, W7 h  Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# N! N5 x* Q8 r. X4 Q5 ]& {! S5 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- H6 P) i% ?& Q. \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# @2 g$ T' g- n! m: K! p
2 X$ e! ]0 m* v& [' E, B; [. m
8 C( ~5 X7 W8 G  n/ z6 y+ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 12:37 , Processed in 0.038238 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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