OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   S: Q# Q7 F9 y. X
  1. [code]EDMA sample test application) m" ]5 j- R( t, S
  2. /*4 N. o1 k8 [% `- }. G1 n
  3. * edma_test.c
    ; ^3 A# j9 c' Y4 u% P' Y) p/ t
  4. *
    ( V1 f5 @8 B3 b. o( \& D; |8 t2 _
  5. * brief  EDMA3 Test Application
    ! ~, ~; r7 `, g- N1 a
  6. *) |* N3 T: a' ~) x  V/ Y
  7. *   This file contains EDMA3 Test code.
    1 \6 Y& d" l. W7 `$ Y
  8. *. {2 @# Y) L. z5 c+ X' f( ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, |. i' o/ m0 X& v( r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 i* e( r! S7 ]6 y( \/ a, x, N
  11. *         TO CHANGE.2 b8 o4 t2 U. h" S( E
  12. *
    ' r; @# E2 ?3 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 I  ^* }& r# b# m
  14. *& ^8 \" [, x+ U$ O
  15. * This program is free software; you can redistribute it and/or
    , ~' E/ u' v: Q; k5 C
  16. * modify it under the terms of the GNU General Public License as
    - D: {! R0 Q8 ~% k% M7 _4 h
  17. * published by the Free Software Foundation version 2.* B8 x0 u( p1 }/ ]
  18. *
    " j$ z9 D" b! x+ V. P; I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " {! ^  B& a, Z6 l% \# V; I0 J
  20. * kind, whether express or implied; without even the implied warranty
    0 G- V6 B: [  \7 y6 u6 P2 X# j; s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! s8 o" z8 l. I# \1 @9 F
  22. * GNU General Public License for more details.. `+ q- i! }4 f$ z* X3 H) Z4 e
  23. */2 F$ H" `+ p" Y3 S( U

  24. 9 ]" E+ J7 u0 D9 j$ K6 w" ~
  25. #include <linux/module.h>
    : k3 K5 U7 p; o% L- N
  26. #include <linux/init.h>7 \3 a! T* T+ I! ]8 P; U/ S6 a( g
  27. #include <linux/errno.h>
    . q& o' @' v) Q2 g) [/ Y7 ]
  28. #include <linux/types.h>
    ) R3 Q+ U& ^: Z* _% D& U
  29. #include <linux/interrupt.h>
    $ a( L9 O' e+ t1 q0 e
  30. #include <asm/io.h>
    $ c4 O% P8 H( e2 g
  31. #include <linux/moduleparam.h>- Q7 l6 g5 c6 s
  32. #include <linux/sysctl.h>: d3 j  i) s7 ?4 Y
  33. #include <linux/mm.h>: l, ]# z, f( v: G/ f3 t& K
  34. #include <linux/dma-mapping.h>
    7 L2 G; W+ A, d

  35.   S, A" q6 o/ m  ^; r
  36. #include <mach/memory.h>! G- [5 C9 t4 x& \% M: {3 d
  37. #include <mach/hardware.h>1 f9 I2 Z0 U, X4 V+ B8 w
  38. #include <mach/irqs.h>
    , _! P$ G  q' n' `3 i" ~3 K$ X
  39. #include <asm/hardware/edma.h>- A" g) [5 N. ^0 S- F# k# P

  40. 4 d, X' ~4 K2 @, A1 i
  41. #undef EDMA3_DEBUG
    # q8 |! L; f8 u1 @; e1 r
  42. /*#define EDMA3_DEBUG*/
    5 z/ ?& t& n( w- \4 t& ]

  43. 4 \* K# e$ l9 m( A
  44. #ifdef EDMA3_DEBUG# ~$ `" H8 T$ g/ P4 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 r/ S: q/ ?) u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' y0 X7 w' I9 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( j% X& Q* y6 C' C1 |. I: r5 o
  48. #else! s9 _# L  [  R& i7 m$ O' B
  49. #define DMA_PRINTK( x... )
    9 i; I/ t" N. F8 n+ X
  50. #define DMA_FN_IN9 @+ a' D- L3 r+ [# Y! Z: Q" a
  51. #define DMA_FN_OUT
    2 R: j* c' y+ H+ u
  52. #endif
    + K- W# g* c( a+ |& b

  53. 8 W6 {$ x$ @" m  t4 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 `7 O# z& v; }" Z6 [
  55. #define STATIC_SHIFT                32 I) E  b; A- c1 w- U2 b
  56. #define TCINTEN_SHIFT               20
    ; P1 ^5 x5 D" @
  57. #define ITCINTEN_SHIFT              21" x& `% h, q+ x  A, U
  58. #define TCCHEN_SHIFT                227 F6 [3 k# \! m& n, [
  59. #define ITCCHEN_SHIFT               23
    ) h7 r' N  ], x  t

  60. 6 r- b+ @9 C/ b' W0 l
  61. static volatile int irqraised1 = 0;7 T0 y2 U1 F6 w
  62. static volatile int irqraised2 = 0;% r* Q* A" D) B( b+ X: w8 I

  63. 1 \, n' W' e9 H7 b) H0 s( U" e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 `- F- i! N' X. s6 ~. F2 ]. Q- ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D2 I3 @1 N: B  k* y0 Y6 r$ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + o: k# J1 `0 }& G( T3 n/ S+ v
  67. . M% V3 Q: r2 l9 K3 y7 h) B9 j  b( W
  68. dma_addr_t dmaphyssrc1 = 0;
    6 ?% F7 \7 O- Q! N# p- b
  69. dma_addr_t dmaphyssrc2 = 0;
    * D  p  H# {" H
  70. dma_addr_t dmaphysdest1 = 0;
    0 ~% ?; A/ e2 w/ n, @; M9 _2 M& `
  71. dma_addr_t dmaphysdest2 = 0;
    : X0 Z- _/ N& `& p

  72. ' g3 J% B' \: l  D* O& H1 y
  73. char *dmabufsrc1 = NULL;
    0 K! W) z5 \- p. a
  74. char *dmabufsrc2 = NULL;
    , u$ b0 a! F4 y% t: L1 o, n
  75. char *dmabufdest1 = NULL;
    8 `" |: D# L8 g3 e/ _- L/ }  C# M: Q, C
  76. char *dmabufdest2 = NULL;
    * o8 u5 ]4 r1 D$ f9 V0 c
  77. : B! b' b9 _$ c& L: g: D
  78. static int acnt = 512;
    7 v- X  N; Y# E; P
  79. static int bcnt = 8;8 n. N- T0 |3 i8 K; l
  80. static int ccnt = 8;2 H# N, D' w) O' h, R
  81. 3 V0 f; S, l- e9 k7 g7 h
  82. module_param(acnt, int, S_IRUGO);0 O1 r4 N/ v  n5 L, O
  83. module_param(bcnt, int, S_IRUGO);& Z) D) T" ^5 }8 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- ?: t$ Z; K3 [$ e5 e
4 N1 z5 ?. S, [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* n7 u; D- @  c0 i6 Z/ B; w1 w3 ?- marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 j, d- g+ ]/ i2 C! N% `+ W2 R" N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Z8 N/ }8 y7 N# e
8 s( A  k9 n0 v8 e& N& ]: d/ S9 M+ S3 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 03:59 , Processed in 0.038116 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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