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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ~* h* w1 I: d. I  m* g
  1. [code]EDMA sample test application. q2 o# y& V3 i* i6 P
  2. /*% x, A4 d! }0 H- L1 y( A1 o
  3. * edma_test.c  b2 M( v+ S* l" H
  4. */ P+ F9 n  E  Y* A3 O
  5. * brief  EDMA3 Test Application
      N5 }' _. W/ n% c0 z
  6. *1 {3 j/ O& M0 W3 q8 V( O' f
  7. *   This file contains EDMA3 Test code.' x8 }  \7 x4 S% S
  8. *6 v6 `, ?4 {/ @* x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 F/ \: G2 x3 Z2 r2 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- q2 u- n* t  \+ o0 w: d7 `
  11. *         TO CHANGE.4 [3 q# o3 a4 C- Z' i( D
  12. *
    9 W& \' b# \! _$ F  E0 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % @6 F/ I5 [2 i- k
  14. *
    , ~) E- C8 Y7 E, F3 j' E
  15. * This program is free software; you can redistribute it and/or
    8 k: T6 N4 F7 v+ f6 O
  16. * modify it under the terms of the GNU General Public License as
    7 ?8 n- T/ G! o4 h) w* t
  17. * published by the Free Software Foundation version 2.
    ) S' g6 H- M( e3 A1 n  N
  18. *  B  R( w/ a" o  E& Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. D. N/ ~# |; Q4 C2 i3 V# l
  20. * kind, whether express or implied; without even the implied warranty9 }+ H, Y: u6 l2 _$ @) A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 Z# ^5 ^% D/ s' c
  22. * GNU General Public License for more details.
    : V; u: R' f5 p
  23. */
    4 |& X4 P, }6 G& \. b, i6 X
  24. ) t, |. r* B  ]6 S: R4 J
  25. #include <linux/module.h>2 J, x8 c$ B1 ~$ ~6 \
  26. #include <linux/init.h>+ g' z; ^0 B+ U* \/ |
  27. #include <linux/errno.h>7 c3 @1 g8 c& \+ e7 u  a/ W( L
  28. #include <linux/types.h>, o& r  o5 Y) A0 h
  29. #include <linux/interrupt.h>
    2 u  F2 r; W) ^
  30. #include <asm/io.h>2 e7 Q2 g$ H( ~8 N) S4 s
  31. #include <linux/moduleparam.h>
    & G$ S  Y: x) L4 u5 J3 d4 _$ \
  32. #include <linux/sysctl.h>
    7 v7 Z, c0 L/ J+ z9 t$ V' F
  33. #include <linux/mm.h>  S- A+ p$ R) s! `7 T
  34. #include <linux/dma-mapping.h>
    3 w, b' |7 P- X/ W, N9 l0 f! J6 Q

  35. - Q- F( o% p) L$ n) I
  36. #include <mach/memory.h>5 ~, H+ k* f. p
  37. #include <mach/hardware.h>& E+ X, Z# f  r# W1 L4 g/ k8 a% E+ P! y
  38. #include <mach/irqs.h>& x. S& T" ]$ _% h
  39. #include <asm/hardware/edma.h>2 m( Z) \. L: X" H# Z& B

  40. & D  }+ H: v( _8 D9 u3 j! x
  41. #undef EDMA3_DEBUG. E* L9 w; P' N# d  K
  42. /*#define EDMA3_DEBUG*/
    % d! O( _0 l% G+ ]8 s5 h& d
  43. - ]* Z3 ]$ I. l2 O
  44. #ifdef EDMA3_DEBUG$ s/ Y) ?% G. p8 v7 w, I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 n0 k4 K; b8 Q- X+ J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * k7 @+ y4 E3 K( h2 P! O, o& F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ B* U0 \8 H: W# p- _: E. R3 m  N- A
  48. #else
    " u3 |" |& V1 }" p( e
  49. #define DMA_PRINTK( x... )
    ( l1 d% X( [! [1 [, N* d9 e
  50. #define DMA_FN_IN( P) I" c, ^! V, Q# u( e4 U1 z
  51. #define DMA_FN_OUT0 X+ e' `, D; V. S( f$ M% @* w2 w9 R$ j
  52. #endif
    / H1 h/ q  a/ U& f5 d; C0 A0 ]
  53. 8 x7 h: v7 f$ X' Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 w$ w" ~7 W+ _; @. j6 x1 g
  55. #define STATIC_SHIFT                37 D4 z8 }  L4 }3 j& v  @  U
  56. #define TCINTEN_SHIFT               20
    3 M8 S  Y% K% X# j- e. F# w% {5 k7 K1 Z
  57. #define ITCINTEN_SHIFT              21/ ?( x# ^, ~1 d; c
  58. #define TCCHEN_SHIFT                22
    6 U: d  O. t. C! w: Z( J, S; o
  59. #define ITCCHEN_SHIFT               23
    ' F2 y% L& ^% g' S) j7 g" d

  60. ' E/ g" {" Q& g
  61. static volatile int irqraised1 = 0;' t+ p5 N! [8 l0 ?7 R
  62. static volatile int irqraised2 = 0;
    5 c! H5 |1 Q, j( {

  63. 7 w6 f, F! i$ a) O0 [# q0 |$ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % P% X* B& y4 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 O# k- T1 i2 D& [1 E5 f) ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * g0 P+ i! B! O. M# m- r. ]2 T0 c
  67. ( b4 q3 d! N$ Q/ N3 f
  68. dma_addr_t dmaphyssrc1 = 0;9 F% `; w0 U) r* g- J: l
  69. dma_addr_t dmaphyssrc2 = 0;
    ( w) Z1 ?) d8 E6 _& r% b
  70. dma_addr_t dmaphysdest1 = 0;
    " q1 A5 O9 Y( |9 e- y
  71. dma_addr_t dmaphysdest2 = 0;6 Z7 _% m! I* ~  K2 e" M

  72. ! c6 `% B" y: p! ?" k1 s/ G
  73. char *dmabufsrc1 = NULL;- S$ V+ w- {: H& j& v  a$ K
  74. char *dmabufsrc2 = NULL;
    ! R$ b- c0 U" `* m
  75. char *dmabufdest1 = NULL;
    ! F! I* I% N% @6 a
  76. char *dmabufdest2 = NULL;
    9 a3 r; \& F8 y( C; M

  77. $ o- i% u0 m0 K9 w- H
  78. static int acnt = 512;
    ; p, g( m9 h3 o9 O, S8 K
  79. static int bcnt = 8;$ g* a+ `0 m. H& d
  80. static int ccnt = 8;
    " Q6 i, Z( O8 Y  V5 @& m
  81. ) Q6 Y- ~  v; [0 r( b' j& F. v
  82. module_param(acnt, int, S_IRUGO);
    " Z1 L  L2 W* }# r( a$ P+ q
  83. module_param(bcnt, int, S_IRUGO);% X% T1 |+ e* h% l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  e; i- b. [) d; S. w6 T2 T. U" Q& ]7 z; S/ c3 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# A6 j: }* O  d/ M2 X$ h6 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Y( E( M! N: s/ _1 R; a3 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 i3 I4 H) g% c2 h, b' p

: G/ v9 h0 @* W' v7 O. P
( H/ U/ f1 M" R* N2 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 06:41 , Processed in 0.039109 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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