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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; v6 k' B) {) Q3 l+ u
  1. [code]EDMA sample test application
    # H' X! c8 ?* m& |5 I
  2. /*
    1 D$ q6 S3 G' d1 J. P% k
  3. * edma_test.c
      W7 ]! `1 i5 G8 ~) q) P* e
  4. *
    . k6 F/ M0 S: @( ?, x# g
  5. * brief  EDMA3 Test Application: n9 W/ W( U, c) E* ~6 a+ g. [
  6. *
    # v2 @, Z' B6 ?+ t; M
  7. *   This file contains EDMA3 Test code.
    3 |- p- W6 K0 c" a
  8. *
    * q& D" M7 [0 ]5 q+ B& \: `3 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 M% [  ]5 p" w3 U& T7 `1 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 a3 G, W6 \8 D+ s
  11. *         TO CHANGE.
    0 B" @$ i3 u- ~4 d- k  b2 \
  12. *8 V  s* }9 y  p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( m% p- Y2 w) _; l7 R+ x8 m
  14. *
    , j2 T4 j1 Y* K
  15. * This program is free software; you can redistribute it and/or
    1 J# i$ c( Y, x7 w
  16. * modify it under the terms of the GNU General Public License as9 s' z+ E( W" P3 u8 u0 ]$ x2 g% ], U2 W
  17. * published by the Free Software Foundation version 2.% f+ S! Z: F4 X# V+ z7 E$ |. I
  18. *0 {# t& Q5 A$ k( |& G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" S0 h9 o: d3 u* X" C, U& J& N
  20. * kind, whether express or implied; without even the implied warranty
    * n* B  b# Q$ j0 G, C4 H1 J! N' b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 K$ g  k+ f, t  X
  22. * GNU General Public License for more details.0 l7 m6 U  ^9 V
  23. */: Q4 z5 t. p+ _8 {

  24. # ]& V" O- M3 K8 j
  25. #include <linux/module.h>0 `$ w, h+ y9 W& T! W; M
  26. #include <linux/init.h>3 |2 o" ?3 K$ G/ i
  27. #include <linux/errno.h>6 H0 H% L# f, q, e! Y& r
  28. #include <linux/types.h>
    8 _6 _  `, O( E" w2 |8 H+ a0 i
  29. #include <linux/interrupt.h>0 X# o9 L% j# q* J* {/ B
  30. #include <asm/io.h>! e$ A1 N% c2 P! s9 p/ H
  31. #include <linux/moduleparam.h>! F' e6 s1 y5 ^; c
  32. #include <linux/sysctl.h>8 f; p, J8 N& s2 i+ V+ A
  33. #include <linux/mm.h>
    . g/ a) |4 z: ~2 P+ E
  34. #include <linux/dma-mapping.h>" M0 w1 o. _- C; b) [! j) G. G6 `  `

  35. / q8 ]0 _  q% i) g! G+ x1 P
  36. #include <mach/memory.h>% d5 s/ r+ E* n; S8 D
  37. #include <mach/hardware.h>: }! W) S$ `: ?3 E2 {1 C
  38. #include <mach/irqs.h>  P' y; f3 x. j% a* N) g& ~
  39. #include <asm/hardware/edma.h>
    8 Z2 w' [8 @% d" L! t3 O5 B
  40. 8 E: U7 X3 J0 g0 b
  41. #undef EDMA3_DEBUG
    2 S7 C* @" W" H' L5 i: n
  42. /*#define EDMA3_DEBUG*/
    9 m; L. ]0 G. V, V: I' t

  43. 7 n1 ]9 V; u, n
  44. #ifdef EDMA3_DEBUG
    9 {% ^" X4 H+ B& r6 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * Q7 i' o, `/ |" g8 N% _! ?" ^, s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 `1 }0 |, k4 d- T4 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / A7 ]" V8 v2 R+ H) P% \  e/ Z
  48. #else
    ' ^) I9 `9 E% P" Y. A* F
  49. #define DMA_PRINTK( x... )
    - t* m4 U3 x  ~
  50. #define DMA_FN_IN
    " O1 M. i; P/ r; N* b
  51. #define DMA_FN_OUT
    2 W, n1 o1 P; _" ~6 |, c
  52. #endif. q" x* c, g- p8 Y' J

  53. & Y# ~# F# K" }2 e& X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ ]( m8 U, n- C9 a: U
  55. #define STATIC_SHIFT                3
    " A; @. b. y5 ~/ [* R5 \+ k
  56. #define TCINTEN_SHIFT               20
    " I3 R) }) X' h
  57. #define ITCINTEN_SHIFT              21* X- ?! \; e. o! j9 X
  58. #define TCCHEN_SHIFT                22
    0 C0 \0 a9 L0 ]- O' a* N0 k
  59. #define ITCCHEN_SHIFT               23- C) W% W, N% ?4 @/ u
  60. 5 m% q$ y- G9 g1 m
  61. static volatile int irqraised1 = 0;
    3 w2 K* k/ Y5 d. G0 \6 O
  62. static volatile int irqraised2 = 0;
    4 d: w& O7 n- d& C& Z0 ]7 L! y
  63. 1 Q2 o2 L0 c& U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 z) P2 N4 J8 P' Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! e# l; C7 P, J% w7 M& r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V& s8 i# q. }& K  W
  67. ' \. O; Q& ^4 ?7 Z. U# h
  68. dma_addr_t dmaphyssrc1 = 0;: Q) _+ y3 p' r: _: o$ u6 r3 |
  69. dma_addr_t dmaphyssrc2 = 0;
    ' z1 S0 V5 I1 ]7 _$ C/ e9 [
  70. dma_addr_t dmaphysdest1 = 0;' K: E3 @$ x' h, v& N1 u
  71. dma_addr_t dmaphysdest2 = 0;
    / Y8 t& E  L+ {8 Y% k3 E  K

  72. 6 `# H' N. ?7 D% x, v
  73. char *dmabufsrc1 = NULL;" V0 C* q& Q+ ?  h) C9 h  a
  74. char *dmabufsrc2 = NULL;
    1 j  w+ b5 N6 f' `# A" J
  75. char *dmabufdest1 = NULL;
    ( g2 m; Z" _1 y, b
  76. char *dmabufdest2 = NULL;5 i+ R" ^/ Y9 U5 w7 E. w

  77. 1 [( ~+ r8 b, z' K; g: U
  78. static int acnt = 512;) K6 M% I4 j' u, A1 m) K% }
  79. static int bcnt = 8;
    , X* }6 [$ J+ w% c' X
  80. static int ccnt = 8;
    # s3 x" d& X& D  M# S8 R
  81. 2 b1 f- I+ \( s( e- ]9 x7 ~
  82. module_param(acnt, int, S_IRUGO);
    ) X* X* R. [% w3 w' T
  83. module_param(bcnt, int, S_IRUGO);
    ' n1 E# ]) d/ U% w' [. K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 q8 w4 W  k4 c- n( V, n0 T! ]3 X- R4 J/ n+ A6 O5 y6 d, c- N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  X# D: k1 Q3 K( M' E8 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 ^+ i* s& A; ^. d9 {: V/ ~+ D7 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" i  f" E! W9 Z* m
6 I0 r1 Q/ ~' J# ?- x, H
5 s) {& u- F4 G% W- h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-3 18:58 , Processed in 0.041366 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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