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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , R- J! v. ~. \3 f6 W
  1. [code]EDMA sample test application) [2 E) M  R+ U+ c3 F! z
  2. /*; t  h- A4 C- w- t9 c* j+ W
  3. * edma_test.c
    ) B4 @' v/ a0 a
  4. *
    - D! X9 e' }) ^
  5. * brief  EDMA3 Test Application( j* N# p/ z; b# }& D, |* |
  6. *
    0 j) b- D" @! w7 @
  7. *   This file contains EDMA3 Test code.0 m  v$ Y7 r  x' M! M
  8. *
    + _  l( @7 e  ^+ F! s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . M0 h* V/ j" o3 ^, C1 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 V' I. r4 n. K1 b" a7 J7 S9 T  r2 z
  11. *         TO CHANGE./ x( ?7 r6 w, q& D6 U) `# G7 T
  12. *- r. C7 h, D2 c" r4 b2 K) Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. s# J1 S! B. N, F
  14. *
      u( E3 S2 q8 O! o+ n4 O8 \
  15. * This program is free software; you can redistribute it and/or
    , d- h# w5 e$ r
  16. * modify it under the terms of the GNU General Public License as. V+ \6 w* K! h: b+ J& i
  17. * published by the Free Software Foundation version 2.
    $ S, q8 B/ r' E' E3 x7 o$ k1 s
  18. *# B) r  p' C% `# ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* c; l3 H! V$ e( L! j8 [6 }  @) j
  20. * kind, whether express or implied; without even the implied warranty
    ) u" f/ }  H% B+ |3 v2 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 t$ x6 X1 M$ g  C
  22. * GNU General Public License for more details.
    6 \+ N( h, m% k6 q
  23. */
    0 d/ T- B2 i3 d7 S1 N) n
  24. 6 A3 O: s$ d1 \* e; k9 q& a$ R
  25. #include <linux/module.h>
    & c. k  `9 D2 J
  26. #include <linux/init.h>9 N9 t+ \& I; n+ v. B9 i
  27. #include <linux/errno.h>
    ; d) i$ Y! v' b, |
  28. #include <linux/types.h>
    ) ~; m% e1 L2 m7 g3 I$ r: ^/ ~
  29. #include <linux/interrupt.h>
    4 }7 [- G" H  @$ r+ O: G9 R5 h8 t0 j
  30. #include <asm/io.h>* S, c" N6 o9 R# @' P7 o7 T
  31. #include <linux/moduleparam.h>
      L3 ~4 ?8 y  p9 p
  32. #include <linux/sysctl.h>/ G- b% Z; t5 K2 k6 c
  33. #include <linux/mm.h>0 k' e2 K+ \9 _. m
  34. #include <linux/dma-mapping.h>) Q. D7 n4 u+ [0 T: @( C

  35. 7 x3 C8 c5 A; @8 `
  36. #include <mach/memory.h>
    . l  e7 n9 g+ }/ Q9 \( {
  37. #include <mach/hardware.h>$ J& ]. P9 V! x: h
  38. #include <mach/irqs.h>* Q4 _; p& E# T7 d- Y7 Q
  39. #include <asm/hardware/edma.h>
    9 r1 x0 y) H' z

  40. 8 M: A6 t3 P% N7 i
  41. #undef EDMA3_DEBUG
    4 E- Y4 Q$ v+ f1 l* R- s/ V
  42. /*#define EDMA3_DEBUG*/
    2 o2 w# ]% Q, r' D
  43. / L& [3 ], y+ N8 a
  44. #ifdef EDMA3_DEBUG
    - B8 `* C/ D6 A% {4 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' d) P3 o' y. y3 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % l; _/ ?3 t, F% r/ p6 \8 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- c& }# K/ a# m! h7 _$ t6 r
  48. #else
    " q% Q& L* w( K1 S5 a% w
  49. #define DMA_PRINTK( x... )3 X& ^; ?8 }" t- I
  50. #define DMA_FN_IN
    ( E3 k2 t$ x1 q0 M3 M
  51. #define DMA_FN_OUT' u7 M. D' n. \- N0 ^+ D* l( z! g; ^
  52. #endif/ U% [4 A& A" M  x5 K

  53. * g& {1 Z8 l5 A0 d9 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ]# P. u8 Z" `7 E, U& \% g4 A: G6 z
  55. #define STATIC_SHIFT                3
    ! J% D6 ~& B8 r2 c& m* A
  56. #define TCINTEN_SHIFT               20
    9 J& Z& t1 s+ @* t& Q3 H
  57. #define ITCINTEN_SHIFT              21
    * a4 m! L, g9 S% _8 m
  58. #define TCCHEN_SHIFT                22
    9 L& ^6 h4 ]  R/ H" G6 r
  59. #define ITCCHEN_SHIFT               23
    9 T8 _2 G6 i9 Y5 Q

  60. ) ^8 b1 N% E1 O! ^
  61. static volatile int irqraised1 = 0;
    0 W0 V& s. k# k
  62. static volatile int irqraised2 = 0;0 P1 w) ]: y. u9 H) d  [: g9 ^

  63. & D; Y, S2 h. R. O5 P: @  e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A" `& ?8 z$ y5 R+ @8 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y9 B/ C$ r1 Z1 Z  d+ C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 A. F" ~  Y0 q! h
  67. ; f: T# B& h7 i* [3 c' f+ `: U
  68. dma_addr_t dmaphyssrc1 = 0;* Y9 p; M4 t4 T0 g% S+ i
  69. dma_addr_t dmaphyssrc2 = 0;
    - J5 I9 C% [8 H$ M* S' e
  70. dma_addr_t dmaphysdest1 = 0;7 O! z, N4 ^( k& o% t
  71. dma_addr_t dmaphysdest2 = 0;1 ~2 M3 a- F! ^, {

  72. . c6 H/ p: M5 y
  73. char *dmabufsrc1 = NULL;
    4 Y; u. Z  w- u9 X
  74. char *dmabufsrc2 = NULL;
    9 P+ }: `& j, Z: R/ @8 k5 K$ Z
  75. char *dmabufdest1 = NULL;
    / F- |& F4 a* }- x1 B  }
  76. char *dmabufdest2 = NULL;/ {1 n9 x3 q: q6 f

  77. & l) e7 m$ Q) s+ t, b3 i9 K7 \
  78. static int acnt = 512;' J, W* H$ E  D! R, P' R% d  C
  79. static int bcnt = 8;
    $ F: e0 M* i1 A: J" q
  80. static int ccnt = 8;
    4 x; ~3 ]' {) D0 c1 `

  81. * E- z5 z7 N. c% ^  [0 k5 r* ~7 ?
  82. module_param(acnt, int, S_IRUGO);
    ' T7 Y, r0 a& @7 Y
  83. module_param(bcnt, int, S_IRUGO);
    " l0 y' g5 D( a8 Y4 \3 c1 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, `1 F  |6 r' R  y; z. [- d4 ^' V# m/ D! i& V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- o& [5 [# x6 ^0 B8 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  d% \2 d$ C1 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ?! V4 n  X# @( t3 z$ |9 e: L7 P; z# z
+ T  M2 P+ a# u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 02:44 , Processed in 0.038449 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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