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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |% I$ d9 O* q8 z- I% H% M6 f7 n
  1. [code]EDMA sample test application
    # h1 o( R0 g3 \6 c; p
  2. /*7 C3 u9 ^. u: H( l& D
  3. * edma_test.c0 g1 {9 M; V8 q
  4. *
    ; g& j# t/ D3 s
  5. * brief  EDMA3 Test Application
    , S1 F! @# ]; u
  6. *
    8 P5 u$ A$ c" w9 _9 D+ |/ b
  7. *   This file contains EDMA3 Test code.6 d  |+ }$ L' R/ F3 @
  8. ** X) M8 `5 [* {8 s% m3 m  k% T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! {: H) \+ Y6 [3 ^5 }9 m7 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# g/ D, u3 w# D  l; w
  11. *         TO CHANGE.3 h# c$ o: C: u
  12. *! `1 |- R7 H, v% ?% x* q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % P' A, {# ~1 [/ x4 {$ o
  14. *
    5 e0 x5 I1 r1 @0 c+ g6 c% `, J
  15. * This program is free software; you can redistribute it and/or; {) }2 z2 ^6 w+ h
  16. * modify it under the terms of the GNU General Public License as
    ! }& F' M; Z  k  o  y
  17. * published by the Free Software Foundation version 2.
    , H" n: D6 G2 b3 [: ^+ n1 c9 T. g
  18. *7 M1 y( d: y8 N& K2 r% |# J+ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* X- x: r: I- N
  20. * kind, whether express or implied; without even the implied warranty7 I9 U( R& k1 I$ Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      F1 T8 G; I7 Q/ P! z5 |' u2 U, K
  22. * GNU General Public License for more details.: Y! P* w+ K! {2 q7 D6 k
  23. */
    , l' Q, h  t# @7 O1 L* l- O/ ~# O

  24. 1 c5 F/ X* t5 X! Z! n+ k2 P
  25. #include <linux/module.h>
    + u! @" z) q' g$ k: p% U5 V: a/ n. J
  26. #include <linux/init.h>
    $ }, D  K8 @$ P9 y8 x8 ~
  27. #include <linux/errno.h># I* Y/ F9 Q, @
  28. #include <linux/types.h>
    + b8 e! k: B3 t' ~' z
  29. #include <linux/interrupt.h>
    , W3 b7 P$ X# u' s. C0 e
  30. #include <asm/io.h>6 X! f! B4 {& \6 Y, ^' y# r* Y' o! v
  31. #include <linux/moduleparam.h>8 O7 t  ~: d' _; R, G8 ~
  32. #include <linux/sysctl.h>" A1 @- x( j) e- J& ~( H
  33. #include <linux/mm.h>) Z) X3 p+ y& k4 L
  34. #include <linux/dma-mapping.h>
    & X& `% r; f( d# k

  35. # q: z6 @: Q$ B) E
  36. #include <mach/memory.h>: G! S2 ?  e( R& T
  37. #include <mach/hardware.h>
      |! c) w' D6 I$ C
  38. #include <mach/irqs.h>
    4 @! }$ E  Y/ v* T) }3 R
  39. #include <asm/hardware/edma.h>
    ( R* Q6 R( s0 X& e  K8 v
  40. 5 m4 z) }5 T& ?" R$ E5 M$ O8 E
  41. #undef EDMA3_DEBUG
    ' h& R& y" U# M3 X
  42. /*#define EDMA3_DEBUG*/& G6 p0 t; }' l1 h

  43. 6 y7 |) }' b# L+ ^5 z# K% `
  44. #ifdef EDMA3_DEBUG
    3 V& @. K# n9 o4 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 I- a* S$ \& d8 I( p+ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 }. X$ x0 h7 d3 N+ k9 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 {/ d0 O( }$ l# J4 o9 t* e
  48. #else( a7 s( z2 T" H
  49. #define DMA_PRINTK( x... )
    , u3 v  @8 j- z9 t& [  U
  50. #define DMA_FN_IN
    % f. I+ l7 i! q
  51. #define DMA_FN_OUT+ U5 h& x4 Q  r& }7 h7 D1 g
  52. #endif
    , h- I! ^+ \" _; u, ^1 ]

  53. - f, m" f1 W0 b4 h' e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 y0 r. _5 a+ u4 M% H+ b
  55. #define STATIC_SHIFT                3- X0 F4 @  w% r
  56. #define TCINTEN_SHIFT               20
    8 D) }7 s, d3 J, a
  57. #define ITCINTEN_SHIFT              21
    / w6 @2 b' E% f5 r: o! C
  58. #define TCCHEN_SHIFT                226 _4 l6 ^( N4 c5 p+ X
  59. #define ITCCHEN_SHIFT               23$ _" b, Z, q( E5 c* H/ p

  60.   F2 i8 l6 D. U' p8 J
  61. static volatile int irqraised1 = 0;3 K  s0 u9 n2 @1 L2 B
  62. static volatile int irqraised2 = 0;
    * D: u0 H& g5 B( K
  63.   u$ W/ Z, [# j- J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 i5 B; a$ g8 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% a1 x' E6 F8 h- @  `) {9 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D) R0 I- {" x5 W) C

  67. : E' r* M+ r3 T+ {
  68. dma_addr_t dmaphyssrc1 = 0;  z! Z, q- B' Z3 }) B
  69. dma_addr_t dmaphyssrc2 = 0;
    : P; b3 W; O$ r8 |" P; @
  70. dma_addr_t dmaphysdest1 = 0;
    0 G2 X; }" D6 C1 S3 }
  71. dma_addr_t dmaphysdest2 = 0;. o) g3 {7 L" ~

  72. 3 S) @1 j- D% n# v* Y5 L7 }
  73. char *dmabufsrc1 = NULL;
    2 t( G* h: `& c% C0 ], J6 m9 f* Y1 U
  74. char *dmabufsrc2 = NULL;
    " f2 Y/ u. l, J/ t4 C8 _' ^
  75. char *dmabufdest1 = NULL;
    . ^( I- ]5 [+ g7 @4 C3 T
  76. char *dmabufdest2 = NULL;
    7 O( J+ u, X9 C! C) v
  77. 3 w% M& H! |# x( t" C
  78. static int acnt = 512;
    ) @8 S! q% x' h! o$ I4 e9 K" X
  79. static int bcnt = 8;
    ' E8 L& c. R5 e$ ^  b. D
  80. static int ccnt = 8;
    1 F+ A& R' b! g; g1 ?! ^
  81. " F2 w0 r4 `$ X) V
  82. module_param(acnt, int, S_IRUGO);- L( A- p0 |) v2 m5 o5 S8 j/ x
  83. module_param(bcnt, int, S_IRUGO);
    2 s0 x% l. a8 p1 H0 x. e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 l2 z  o" i2 N2 y8 j
* Y! g7 G% z- `: i$ Q9 c  L; W' K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  J: q! v7 _( @) q& a+ \6 q+ f( Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; S1 y- l  d: N( O" Z5 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) k) c/ h, R% w  B3 i2 S* Y8 i8 z: l$ x
  \0 X- W2 o7 a! Z; J/ W8 F
, j6 ]- b# v9 `, Q5 I4 F5 k4 ^' p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-16 17:56 , Processed in 0.044195 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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