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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Q  M1 a" ?! ]7 w
  1. [code]EDMA sample test application
    4 |7 m5 B2 R  Q2 H8 |* N# ?
  2. /*
    5 h1 s1 i* d3 s8 J0 b) C7 @4 q
  3. * edma_test.c7 F$ t" b2 v3 B" H. F7 W$ P
  4. *
    . N3 q2 P  V! ?- ^* k' I/ s
  5. * brief  EDMA3 Test Application
    1 Q  w  r- p3 z* _% g% r3 [6 j
  6. *  L% q7 B% I6 |! f0 B
  7. *   This file contains EDMA3 Test code.9 k+ X3 K" k  C2 u
  8. *
    6 Q( r& ]- C! S) x1 t3 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . v6 G4 }; |/ p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" U* L) b! M9 x% n  H
  11. *         TO CHANGE.( Z4 c( I# l9 g+ [% l6 y
  12. *: k# ~+ w9 W0 w, C; j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 Y' n- t/ O* k5 \7 J/ G2 J/ ?9 z
  14. *
    , w* H2 r% V3 _$ V8 h
  15. * This program is free software; you can redistribute it and/or+ O8 t. w( u/ L/ q% h2 A
  16. * modify it under the terms of the GNU General Public License as
    8 k1 X  S" P, a" t
  17. * published by the Free Software Foundation version 2." q; h+ I3 f7 M
  18. *
    . c" ^$ l8 W! j- L' h. B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& T5 T: r( w9 S. P/ p& k6 Z
  20. * kind, whether express or implied; without even the implied warranty
    6 z# m* G2 Z9 N) q  H( ^: [" c8 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 o0 l" t3 ~: a7 y6 g
  22. * GNU General Public License for more details.
    " K! j, b' S: F+ x6 u
  23. */. J+ B* J. @4 _. f
  24. ( L" \% y1 ^% I6 C
  25. #include <linux/module.h>
    & h6 M* r  T, S8 v
  26. #include <linux/init.h>
    # X/ L  r2 G% @1 l; E# [
  27. #include <linux/errno.h>
    # U( @' P1 D2 R/ a4 h: ~4 @4 A
  28. #include <linux/types.h>% z4 ?1 [( q+ `* h0 `; ]
  29. #include <linux/interrupt.h>
    * t9 j( }9 A5 q# R- g; J
  30. #include <asm/io.h>
    : X6 A- v- A: }9 k0 V) a# J
  31. #include <linux/moduleparam.h>% [. s: H0 E3 c
  32. #include <linux/sysctl.h>
    . e0 Z  j) d# X0 `. `4 P
  33. #include <linux/mm.h>
    7 S; s; M) A# e2 Y6 W) A! @
  34. #include <linux/dma-mapping.h>
    # h7 _9 M$ V2 j6 }3 i

  35. / G4 n2 }+ ~% o' x% n- K
  36. #include <mach/memory.h>
    9 Z% c% [& ^; F! K; h. k9 C
  37. #include <mach/hardware.h>! X% D. r5 r) C. z$ q  I- x
  38. #include <mach/irqs.h>3 k" o9 m+ B8 x) u( e/ E3 ?$ B+ ]4 u
  39. #include <asm/hardware/edma.h>1 @- i2 y7 a9 [' x8 Q: C/ ]2 z

  40. 6 N: J1 K4 x0 M) b' v9 H+ d
  41. #undef EDMA3_DEBUG2 c0 f+ U& E- [2 U
  42. /*#define EDMA3_DEBUG*/
    ! E( s$ j2 v9 }5 Z6 q
  43. : s. J8 m, w, b; D, S) t" l
  44. #ifdef EDMA3_DEBUG
    / S) L  B$ u8 R2 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" D8 U6 |* R% }! x1 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 M+ R, @$ [! d: I: J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# a  V0 E9 w1 H1 X6 L& K$ b
  48. #else5 q  a. m; s9 L3 `1 j$ }
  49. #define DMA_PRINTK( x... )3 l5 w5 S6 g. p2 k
  50. #define DMA_FN_IN
    $ @( G% P& ?! d' I, {
  51. #define DMA_FN_OUT
    , v' f; B* U$ m3 Z# T/ `8 ]* Z
  52. #endif
    : l  c( X2 o, q' t* M1 c( }3 d$ u- i

  53. ; {; ^5 Q6 ]; @. w( K2 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% f) b: J/ w6 m, @  B1 F9 i- L
  55. #define STATIC_SHIFT                3
    0 ]. E- h1 _* ~3 y
  56. #define TCINTEN_SHIFT               20, D6 L, E2 M- p  l  \; P
  57. #define ITCINTEN_SHIFT              21: q2 A: L" v3 v" o
  58. #define TCCHEN_SHIFT                22/ x! S) _" x( r2 Z* _! @: H2 K" Q
  59. #define ITCCHEN_SHIFT               23" x0 k* k0 U6 m& Q2 _. K

  60. % _8 x8 ^* |9 A1 m0 g; K+ o
  61. static volatile int irqraised1 = 0;) L  M+ {, _6 T2 v) G+ t) q! b
  62. static volatile int irqraised2 = 0;
    5 U& N3 u& O8 q- ]! m
  63. 3 U. P5 @/ s9 H* u; {9 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 e2 [) T- T3 Y  a$ n; ]" {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 T- j5 J1 G. q; @4 s9 y2 H/ j6 {1 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r% `- @1 O1 H) r2 m" W
  67. & J; Y1 C9 D3 j9 C: p  n! E
  68. dma_addr_t dmaphyssrc1 = 0;
    / T; T2 V! p/ y$ ^
  69. dma_addr_t dmaphyssrc2 = 0;
    / B) j+ `8 k- s5 [
  70. dma_addr_t dmaphysdest1 = 0;$ Q. s+ M. @) I1 z
  71. dma_addr_t dmaphysdest2 = 0;+ r% W. x+ V$ W2 b6 L2 R
  72. - ?# Y2 Q/ A: u3 ^
  73. char *dmabufsrc1 = NULL;: \6 a* S6 o8 I/ B5 C" `% c3 I5 e
  74. char *dmabufsrc2 = NULL;
    : m7 G% A8 A/ |( }8 x
  75. char *dmabufdest1 = NULL;& \5 _* M- |3 d3 \, \  Q5 F
  76. char *dmabufdest2 = NULL;
    ! n3 C( a5 W8 i, i: }

  77. " n& K# g; _) t$ r& Y
  78. static int acnt = 512;
    * @' T9 P: [; T7 ~- E2 S
  79. static int bcnt = 8;/ f4 x9 a4 b2 W3 U6 q- r' S4 V
  80. static int ccnt = 8;1 O/ p3 S- _/ c, o( K
  81. ' M' S7 g( c! _' Q. a( U
  82. module_param(acnt, int, S_IRUGO);
    # i) O: [) O, d1 h
  83. module_param(bcnt, int, S_IRUGO);' `% \1 F# F4 P1 U; ~+ F! X3 |* [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, m/ h1 q- i0 ?1 `0 S  c6 c8 c/ f* D

5 M1 W' q5 y3 H- }: z7 ~: v! g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) b$ O4 b1 ~: Y2 M% l! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( a6 }8 Q6 p! e! z' Y9 Z1 b. h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, Q: I. G6 |, B3 \
* A2 B$ \0 K' m$ W- E) K, k
. Q" f$ g1 M# R' X& _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-28 00:07 , Processed in 0.041051 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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