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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " ]* ^- i; b8 v' d
  1. [code]EDMA sample test application
    . S$ ]- S- T" X" q% S4 o8 V
  2. /*6 O4 O% D$ ?, s5 ~- B" y/ k* y
  3. * edma_test.c
    ) A* [9 W1 I9 j8 ~, M) L
  4. *
    & t% T& s7 n! G' o+ ]* ~
  5. * brief  EDMA3 Test Application
    7 M1 j* }( b' g$ w3 d$ \) Z1 V
  6. *
    1 k% ?4 E  h; Z& k9 o4 l
  7. *   This file contains EDMA3 Test code.
    * s0 U$ S4 S, {, i
  8. *
    6 v6 f, B, x4 z7 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: M5 l3 a1 c) ^1 s' k. n- |  d5 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" F* I8 O& c% C# [& f1 C
  11. *         TO CHANGE.
    9 p5 _, q0 [2 D
  12. *
    + F- X- P8 |& n- w7 V( M* s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 a# ~6 x+ v- |* j. L
  14. *+ e) I4 h2 j0 `# s
  15. * This program is free software; you can redistribute it and/or
    ; Q/ k9 |0 p/ i; b* c
  16. * modify it under the terms of the GNU General Public License as9 L7 p# A( t7 u0 l+ A. ?
  17. * published by the Free Software Foundation version 2.
    3 |. d$ j; h2 I+ J0 ?5 d1 K
  18. *
    / D2 m0 ^1 d: p+ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 {' p0 E' T, O3 U4 U+ H
  20. * kind, whether express or implied; without even the implied warranty
    4 i; k8 m4 M% x% q1 b. s4 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 S3 K7 f) |' B6 K
  22. * GNU General Public License for more details.2 W1 @2 Q9 ?% r* v& Y" _+ d0 w
  23. */
    & V! h, Q$ X  V* b3 n
  24. 5 H" l1 ~( ~7 E" I* U9 R
  25. #include <linux/module.h>
    4 Y; o+ z& R0 H7 J' b
  26. #include <linux/init.h>
    5 J+ p6 S$ t* ~# r* X
  27. #include <linux/errno.h>
    ; w7 `7 u; R3 r9 o
  28. #include <linux/types.h># p$ U( c& |# M8 |7 L" n  Q. ~  e
  29. #include <linux/interrupt.h>
    : F# n2 P) D7 p3 y! r4 I; F
  30. #include <asm/io.h>
    & Z6 w1 Y4 W3 [/ h6 q% Y3 J! [
  31. #include <linux/moduleparam.h>$ c2 g! ?$ g" f  ]+ y
  32. #include <linux/sysctl.h>- q* f  B3 @7 P+ ]2 V7 K/ J
  33. #include <linux/mm.h>
    ; Z3 t  W; H8 L5 {* X% R; s8 K# w$ m
  34. #include <linux/dma-mapping.h>0 A9 G8 `" U$ E2 Z& d' ^+ R

  35. " m& @. w& O' e" o" I8 g* F
  36. #include <mach/memory.h>0 w5 ~; ?: D, Y5 x! ~
  37. #include <mach/hardware.h>
    / Q0 m& n" h0 i! }9 W5 N/ V6 c1 }
  38. #include <mach/irqs.h>; o' W4 ]6 @" l# P% K6 l6 L
  39. #include <asm/hardware/edma.h>
    : v# N& J  \4 I4 {
  40. ( X/ J: ~5 O( ~; Y0 ^& G, F
  41. #undef EDMA3_DEBUG; {. ~5 X$ G5 s3 |% R9 [  R6 o
  42. /*#define EDMA3_DEBUG*/
    " \; a, `- d/ X6 u- i0 o: o2 J

  43. 0 ~4 \" B9 Z, o6 @
  44. #ifdef EDMA3_DEBUG
    1 d) \. H* T' W) r1 O; R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ }) l; }2 v1 T1 |8 m& E9 J  w/ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 N9 S& \: J* x6 |+ A7 G' X& N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ T3 p! _3 b: b2 Z/ p3 [+ \" J+ h( |
  48. #else4 e5 u1 F4 o3 O9 v: Z  T! v
  49. #define DMA_PRINTK( x... )7 i; x! m2 b5 l/ s- P  A
  50. #define DMA_FN_IN" U& e& }+ E2 y
  51. #define DMA_FN_OUT
    $ |7 x- U4 P' K
  52. #endif
      t& k. J' U6 r- g3 N3 T
  53. $ j$ k) D  y& ~1 a/ Q% n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 [* s6 x% i1 p" X+ z( B& K
  55. #define STATIC_SHIFT                3
    8 ~# y# E* E& ^2 X3 q
  56. #define TCINTEN_SHIFT               20
    : x" S* ^7 X4 }1 I% x: h% s
  57. #define ITCINTEN_SHIFT              21
    : f' ?8 e* C1 K6 I% ]$ R# Z
  58. #define TCCHEN_SHIFT                22
    * i+ k1 k; T5 z6 t+ E) [% c+ ~6 e
  59. #define ITCCHEN_SHIFT               231 \. C3 x- R1 K/ E2 I5 a- P3 F7 @

  60. 8 {) d! @$ m7 Q: |* U" R
  61. static volatile int irqraised1 = 0;( _( O0 R0 n/ y# B* O# O
  62. static volatile int irqraised2 = 0;
    ) d1 x" O3 V$ m1 h2 M
  63. 1 o( ?, d' R+ c4 A' f: w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; I( }0 I- }* u; w; c9 l5 j) c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r% b2 X! y6 J' H/ Y% U# S2 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% k2 N5 S" R+ T8 ]2 ?9 ^

  67. # k: P7 `% v: B" A+ I7 r' S) u
  68. dma_addr_t dmaphyssrc1 = 0;
    ' D; c% e& E5 X5 I- J
  69. dma_addr_t dmaphyssrc2 = 0;; T. Z- S5 C, B; C  ~
  70. dma_addr_t dmaphysdest1 = 0;
    : |% X  B0 Y: V& T1 ?# i& m) O; j
  71. dma_addr_t dmaphysdest2 = 0;
    " c+ ^+ {  J; y3 u$ H+ E$ }9 a6 @
  72. 2 @9 a$ ~( w6 c) ]
  73. char *dmabufsrc1 = NULL;
    ' a* N9 S2 S0 [  a' {+ g/ y% @
  74. char *dmabufsrc2 = NULL;2 G7 Q0 A6 }( _4 C3 \
  75. char *dmabufdest1 = NULL;6 a! p' d( }- z# b2 ?2 ^
  76. char *dmabufdest2 = NULL;
    " w. A6 f; K6 V2 H4 K: j5 L1 k

  77. - c( [! k, K% c$ m
  78. static int acnt = 512;8 S* P4 y# b* s0 h/ o% w3 ^
  79. static int bcnt = 8;
    * p1 z- \& V( x8 N0 G3 |
  80. static int ccnt = 8;/ z/ h0 h# g5 M. d

  81. 7 L/ \/ E3 r( ^; @+ G% v
  82. module_param(acnt, int, S_IRUGO);) `& N  ?# h& \3 d
  83. module_param(bcnt, int, S_IRUGO);' ^( z2 B$ i. m$ Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; E4 w" Z+ A7 z- s& T, u9 t( l2 R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' R% g& f3 U, n" F- `9 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ L' I" h; _5 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, o/ x# R( y: ]
: K/ O0 z) B2 G: N0 h/ Q/ l# k  @; ~% z& g0 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 10:08 , Processed in 0.049326 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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