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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' [- K8 r5 C; v& x9 J
  1. [code]EDMA sample test application
    ; F+ u0 ]/ `  P3 u1 V2 @" o
  2. /*- p5 b* l; l- {
  3. * edma_test.c
    1 }0 h- C' Y' T7 P) r6 V
  4. *
    ( b/ `2 k' X' N, \9 L2 I
  5. * brief  EDMA3 Test Application3 S3 B* a. R( o0 U
  6. *
    ( K& X$ A* U! k8 {
  7. *   This file contains EDMA3 Test code.- h4 S& a% [! G  y8 n
  8. *+ s  n8 {" c5 C$ }0 M* e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# s% \: @* _  ^, k% q! ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 |4 Q/ t2 I+ u  m
  11. *         TO CHANGE./ q. _; {) `5 T  C% D
  12. *# R* B# Q: x  h$ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// z8 P1 \* s$ |6 Z# Q5 I* i8 c
  14. *1 p8 h7 M1 ~$ \) r: S/ g. ~( }7 k
  15. * This program is free software; you can redistribute it and/or8 }6 Z& r3 b( [* F: k6 q" H6 C
  16. * modify it under the terms of the GNU General Public License as
    3 p3 N: _. ?1 N
  17. * published by the Free Software Foundation version 2.
    . V* ]4 r6 N$ Z! G1 K
  18. *9 h! v. n- A9 W* j" F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, p  u' u8 `1 E
  20. * kind, whether express or implied; without even the implied warranty% W) F. ?4 L; j* \' G: @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 D2 e3 I# U  C! v
  22. * GNU General Public License for more details.4 i$ {: W, |7 V
  23. */: G  B+ i: V2 ?1 g% g. e5 |* A
  24. 6 L8 L! t) Z" m& c1 _6 s, `- b
  25. #include <linux/module.h>; w$ K1 w9 ^: m7 r% @2 o2 T
  26. #include <linux/init.h>4 k( x' M1 f" O" `2 b
  27. #include <linux/errno.h>8 {4 v& L+ a9 g
  28. #include <linux/types.h>0 J+ l$ U9 e$ e/ L5 {2 u
  29. #include <linux/interrupt.h>
    : H0 F) R9 Q2 a# z' i1 X
  30. #include <asm/io.h>
    2 f* {+ |) `# ]' w3 l+ l" e
  31. #include <linux/moduleparam.h>$ F; i+ P8 [- ~
  32. #include <linux/sysctl.h>8 c9 Q2 v* c; L
  33. #include <linux/mm.h>
    * a2 l0 a- k, [: g+ e' q
  34. #include <linux/dma-mapping.h>/ x# _, l5 Q- @

  35. 4 ?2 B) d5 l7 J) ^
  36. #include <mach/memory.h>
    ; A# J3 o2 k6 u6 h
  37. #include <mach/hardware.h>
    : u' p6 x/ y9 h6 j7 N* B
  38. #include <mach/irqs.h>6 P  Y" ~5 b1 ~4 X" R  G2 M# K
  39. #include <asm/hardware/edma.h>  R" g+ Z; K( O8 o/ R+ M3 J
  40. 5 L$ H3 h* c4 ?( b& o
  41. #undef EDMA3_DEBUG
    2 I5 V: |- }' G* l
  42. /*#define EDMA3_DEBUG*/
    8 T- a/ [' R; r
  43. - c* y( t1 ]3 z% p& z6 b: n
  44. #ifdef EDMA3_DEBUG
    4 @. I% \0 L# X: w- Y2 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% o& H* f. F2 y2 C/ ?! A1 n3 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : {0 a% V7 d6 h- [+ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' u0 ^$ v2 c* ~
  48. #else$ u% c. _* _: u; E/ F% w
  49. #define DMA_PRINTK( x... )
    ! a# }' F9 s  j. c+ m; u
  50. #define DMA_FN_IN
      B; u- \$ i" G4 F  u" X/ \9 w- {
  51. #define DMA_FN_OUT
    , [7 ]* q) `3 U9 d+ k
  52. #endif0 c# `! H; s) [2 l: ^

  53. 7 }  |4 M% }. s9 q- D/ u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) |7 l; v7 `" n, b% J# i: Y- A9 s' D! s
  55. #define STATIC_SHIFT                3
    6 d' q0 `' b0 ~; Q3 e- T2 Y
  56. #define TCINTEN_SHIFT               20
    ( D7 B6 p$ ?5 o0 P& U& Q7 p
  57. #define ITCINTEN_SHIFT              21
    ' A) ^+ T( ]# K( @3 |
  58. #define TCCHEN_SHIFT                22- O, ]2 k. C; s9 H$ T: G
  59. #define ITCCHEN_SHIFT               23
    , p. o9 G6 k; r- [1 G+ |+ G' B
  60. 6 e: V6 Z  V5 V: Y& D  _
  61. static volatile int irqraised1 = 0;
    # E6 H" |+ D; n) n- n3 j
  62. static volatile int irqraised2 = 0;
    / P( c4 z% V/ @; m) Z

  63. / l7 S& d4 U" x( o2 B6 y' D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A( L8 c5 `* s/ Q6 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. i6 r: v9 q+ ~  V, Y. Y; m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( z/ X$ f% k% o- @; D/ x3 B

  67. 7 w; ^1 x( L" }/ y& Y6 l
  68. dma_addr_t dmaphyssrc1 = 0;
    0 A5 q- L. t4 j. p
  69. dma_addr_t dmaphyssrc2 = 0;! [) n  P  E; {2 G
  70. dma_addr_t dmaphysdest1 = 0;
    9 U0 S, [( @" r6 ~. Q1 n
  71. dma_addr_t dmaphysdest2 = 0;
    * f" i5 D% P+ c. y
  72. + }5 ^+ O- V6 `1 R5 V7 i* g
  73. char *dmabufsrc1 = NULL;
    % U& ^1 f, S3 n) [/ w5 _! _
  74. char *dmabufsrc2 = NULL;
    ' E: v" c) W8 S2 e! l, ]" l
  75. char *dmabufdest1 = NULL;
    ) l* z9 i( X& p! T6 y% w
  76. char *dmabufdest2 = NULL;
    7 z0 X" H! ?9 H* I; p: T
  77. , H) s) s  U6 N  G! W0 \  C* F
  78. static int acnt = 512;6 v) u4 A, B* @3 i4 y) i8 y
  79. static int bcnt = 8;+ o7 G9 p& c& ]2 G+ [0 F8 S3 E/ \
  80. static int ccnt = 8;
    5 M- }) \8 S- h$ z; D+ q, P

  81. 7 \1 w- V' H) E' G
  82. module_param(acnt, int, S_IRUGO);) \  ]% H$ G; _# Y! @6 g
  83. module_param(bcnt, int, S_IRUGO);; c( R5 y/ t* n( n( d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 |- c9 y2 _4 O  v

* ~! E+ [1 z& W* k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 u( ~3 Q0 A$ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: o8 Z: J+ }, H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ x% J3 Y/ a2 E+ x# Q! b1 m0 ~6 n+ z! d- u0 f# g: g

/ Y* B3 Y7 Q) a* D( g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-11 22:06 , Processed in 0.040318 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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