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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 N" \6 h; |; ^
  1. [code]EDMA sample test application% @' O& A6 I7 P" n0 K
  2. /*, q) [" G$ ?0 i* u
  3. * edma_test.c
    $ v1 h+ C  |" z& l$ m' }6 ]' A
  4. *
    0 g9 f1 H# j  Y& P; {
  5. * brief  EDMA3 Test Application8 \# s( [% z0 h, Y# D# f# y
  6. *) ^' Q6 W7 a9 K& P% r
  7. *   This file contains EDMA3 Test code.
    0 K; T! \3 ]/ }# s1 O6 l
  8. *
    1 q# g% {8 _- L$ O' `# @; z- L6 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; {+ Z, f9 U' a, g9 }, T9 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( i- o0 m8 D/ @
  11. *         TO CHANGE.
    ' V8 Z% D4 t5 ^& K
  12. *. _8 s  V" N1 A/ N! j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* a5 Y: \3 s  t) V
  14. *: [) Q- [; P( b3 B& Z6 v7 H) a
  15. * This program is free software; you can redistribute it and/or
    # h9 K. [4 x% M1 b  `6 O* z  I1 s
  16. * modify it under the terms of the GNU General Public License as
    . @. b/ a# K" h' |+ r7 `" H9 [4 b3 k
  17. * published by the Free Software Foundation version 2.
    / H4 e& Z" A; q/ M' M5 P
  18. *
    & \5 j+ E- m) {/ ^- X' L: H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) a. F3 }5 c7 b) d, K; u, C5 `
  20. * kind, whether express or implied; without even the implied warranty1 T4 c* m/ W' i; J* l+ e; e7 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ w# B: e3 H) Z! A+ Q/ E
  22. * GNU General Public License for more details.
    ( @. F8 V( ^5 u* t) V
  23. */
    * v* ^0 p1 d6 }
  24. ' |3 k) l5 u" C- C( l
  25. #include <linux/module.h>
    1 k' L. f% S0 w& U2 `
  26. #include <linux/init.h>
    ; b! q! u: j$ x: c& M, X
  27. #include <linux/errno.h>
    . ^- _5 }2 ^6 D; [% P4 O
  28. #include <linux/types.h>
    , ?$ d" o! Q7 L% X- w( v1 A
  29. #include <linux/interrupt.h>
    ' n9 \( e* T' h9 N- f* q
  30. #include <asm/io.h>/ R& Q) H7 P& I* V
  31. #include <linux/moduleparam.h>8 F4 L: N& z8 t3 S  _
  32. #include <linux/sysctl.h>: n! y+ d( [9 M4 T
  33. #include <linux/mm.h>
    0 ]2 [; j$ H5 P( K
  34. #include <linux/dma-mapping.h>
    8 K; C2 v0 W+ D( a6 C: L8 t& Y
  35. ( I- V3 K2 M$ X: D' x$ Q- L9 r  B$ T
  36. #include <mach/memory.h>; ?+ V. d" _) |3 l) D
  37. #include <mach/hardware.h>
    - c2 D. Z9 c* O- s9 n( B7 d
  38. #include <mach/irqs.h>! d5 y* _9 R& G( w
  39. #include <asm/hardware/edma.h>' h, g7 W: f9 M  L% `0 |* S
  40. # c0 [* K2 f2 h$ s1 Z; M+ r7 d
  41. #undef EDMA3_DEBUG
    + M# A6 i# ^$ X* `/ I* k
  42. /*#define EDMA3_DEBUG*/+ w* Y6 v# D" f( D' y
  43. + x3 z& J9 d5 n" ]
  44. #ifdef EDMA3_DEBUG  I4 C0 ]0 @; D; |7 b& u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % k" _! W: J$ J( t9 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * L1 p3 P# Q8 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( j. L3 }6 `4 u" y5 i7 J- n& D' b; r! [
  48. #else& j* M* X; }) @, `5 w. w# g8 T
  49. #define DMA_PRINTK( x... )
    6 ]# @* d4 r, b9 y; b, {
  50. #define DMA_FN_IN8 p2 A+ G  J7 O+ B+ U6 \9 A3 F. A
  51. #define DMA_FN_OUT3 Z! h  ]/ p/ F& c/ G
  52. #endif2 _. O! F. a. {* W0 A
  53. . o8 ~. H+ h. L  m+ `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) {0 z% }1 x* Z' n) R
  55. #define STATIC_SHIFT                3
    * b7 A+ s' G* ?4 W/ M2 ?
  56. #define TCINTEN_SHIFT               20' }4 d" Q& l8 b* Q
  57. #define ITCINTEN_SHIFT              21
    2 w* r) [" [% ?# B; Z& w
  58. #define TCCHEN_SHIFT                22: I1 a  i* I+ M/ ~, i9 Q. E
  59. #define ITCCHEN_SHIFT               239 T" a. v" z' ?. Z
  60. 2 r  V1 h7 F) S5 i! z6 M" @
  61. static volatile int irqraised1 = 0;
    $ }4 R6 l& P) }1 S0 N/ K
  62. static volatile int irqraised2 = 0;$ x- P, H1 r$ W* m# G$ J

  63. & d' J+ B% S& \* ?) g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ S$ H* B1 y6 x6 N) G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% `/ T0 \, H( w( X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q0 O  S5 {/ R
  67. 3 M; g. I( r4 D7 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    9 V" G3 ^& K3 K: |
  69. dma_addr_t dmaphyssrc2 = 0;; H! M6 t0 u4 ^% L1 p* B# c
  70. dma_addr_t dmaphysdest1 = 0;. h+ ?8 |& D1 R8 x
  71. dma_addr_t dmaphysdest2 = 0;  q5 c. f5 [$ n
  72. 1 _: a0 H3 S1 R) |. g  ?2 L8 K
  73. char *dmabufsrc1 = NULL;! V, A( I, Q4 {
  74. char *dmabufsrc2 = NULL;5 g* i2 u0 _" @) S5 u
  75. char *dmabufdest1 = NULL;
    % W- W8 l" X# s3 D- g/ y3 M' q. ?4 \' t( F
  76. char *dmabufdest2 = NULL;/ S+ {* ~; F# i6 ?( s  K1 W& [9 g2 L
  77. % J, z5 R8 v" ?3 r1 O' X
  78. static int acnt = 512;4 w( ^) A' H5 g+ r
  79. static int bcnt = 8;
    : X9 v) P% J( i1 f  ^* J$ I  y
  80. static int ccnt = 8;1 p, T' U2 R3 |+ N% F

  81. % \0 z) [' o5 K
  82. module_param(acnt, int, S_IRUGO);/ u+ I: D8 f5 y3 Z6 F
  83. module_param(bcnt, int, S_IRUGO);) E# P. S% D2 K  U$ i& F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 N4 _# w& M5 w  K* ^1 }# C
' H5 I$ P5 s# T1 x: [3 W2 {+ `) g! c8 N/ a8 J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: o1 _6 e7 J# |! n* xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ L9 U" `! w* i. {; Y: Z! W& I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 w3 p2 L: h% k7 i

# b3 s6 \0 k7 ?+ k' S- T2 [+ f: L! q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 01:50 , Processed in 0.043106 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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