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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  q7 e  M2 \+ M( t) b
  1. [code]EDMA sample test application
    * R9 |, N) o3 V; r$ e" N; @
  2. /*' ?+ w: `4 m  \
  3. * edma_test.c& ~; B+ P/ v$ U/ I1 ]% G) ?% x6 ^
  4. *; c5 L/ ]- s' q& j) L1 G+ l
  5. * brief  EDMA3 Test Application
    % N+ P; ^) [( @7 E! b0 U
  6. *
    % ?+ O' ?$ f. t  x7 W7 K
  7. *   This file contains EDMA3 Test code., L, j, o! P/ s/ t1 C
  8. *- l) W) Z, w# P0 E' |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' J* V1 M' i: i1 O! _: Z( P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% ]: U* R  @3 B  f5 g9 a( T5 K) ^
  11. *         TO CHANGE.
      ~$ y" k% l2 ]# |
  12. *1 j6 {, B+ d$ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  \8 H& Z6 M0 ~
  14. *# \4 K( m7 h9 e  Y+ w9 z! w
  15. * This program is free software; you can redistribute it and/or
      Z3 Y  K( D0 k& d  o8 u& c
  16. * modify it under the terms of the GNU General Public License as- n) ^7 O4 L0 v! `# I
  17. * published by the Free Software Foundation version 2.8 F! `" g& ]( Q3 i( ^: o3 N5 `5 U
  18. *
    4 R  a, F2 h$ L9 [4 X! b) ^- `+ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 G2 [+ h1 R0 i+ i
  20. * kind, whether express or implied; without even the implied warranty0 I3 c+ U' ]- A" {7 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* \: H9 l4 [* c( O& ~5 W( [4 M# _
  22. * GNU General Public License for more details.: w; ]6 t0 K5 n; j5 k
  23. */; D9 @7 d! [6 m5 L- M

  24. . ]7 V* g0 x2 ~! h
  25. #include <linux/module.h>
    9 ^2 T7 K! F8 F) y
  26. #include <linux/init.h>
    0 x8 H2 O+ M9 T; P. e
  27. #include <linux/errno.h>
    : e% y6 N- c2 f0 W
  28. #include <linux/types.h>( P; c& b$ f7 h
  29. #include <linux/interrupt.h>: A% W2 l4 b8 M/ U& v4 V
  30. #include <asm/io.h>
    # L3 f/ }5 ?9 D
  31. #include <linux/moduleparam.h>& Q1 u. \- b2 \: j/ G8 j
  32. #include <linux/sysctl.h>
    $ T4 |; x9 B0 u. U: B" t
  33. #include <linux/mm.h>/ L; O2 F$ d) ^: v8 G
  34. #include <linux/dma-mapping.h>. M7 J' S5 s0 i+ u$ |
  35. , T* O( F! ^; p  _$ C0 ]
  36. #include <mach/memory.h>) p: M5 U- L7 \% e2 ~( s# q. F
  37. #include <mach/hardware.h>; h8 Q, t* Q' |; a
  38. #include <mach/irqs.h>3 |/ o+ z9 L" |4 y
  39. #include <asm/hardware/edma.h>" h3 h" ?  M8 a
  40. ! u% [) z0 S" Z6 ?
  41. #undef EDMA3_DEBUG
    * |! F+ [/ K5 z+ Z1 L
  42. /*#define EDMA3_DEBUG*/
    ( U& }8 {+ m) K! B
  43. + G8 l9 I( q9 s7 P$ I/ x8 ^
  44. #ifdef EDMA3_DEBUG9 {' }7 ?5 D/ _2 l  I" x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 J) ~& V( ^7 {, E% n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . b* X+ V0 ]+ F0 s5 q, E& [  |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 [$ ]/ H4 t! C. w5 L
  48. #else  a3 m0 O% ^5 w8 F* b5 b
  49. #define DMA_PRINTK( x... )0 O4 ?: C# e9 Y) V8 P2 P% X& a. R
  50. #define DMA_FN_IN
    8 h7 P/ q+ g6 Z! _( _* N. @+ J
  51. #define DMA_FN_OUT/ R8 B, [, H! J5 r) z7 M9 T
  52. #endif" t. u) M$ n" n& P' g

  53. & ]7 K2 Z: {1 v/ ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ Q4 u% A* e* P. X0 v( C5 q5 P
  55. #define STATIC_SHIFT                3! G% {; |2 [) m
  56. #define TCINTEN_SHIFT               20/ ^. c/ U6 V4 ?* D5 V# K
  57. #define ITCINTEN_SHIFT              21& E. f1 E$ ^! N& C6 w2 e4 o: {5 O
  58. #define TCCHEN_SHIFT                22* c; ^9 p; G1 B  ]0 a
  59. #define ITCCHEN_SHIFT               23
    5 M  [. R3 G* N. Q
  60. 3 ~! X0 I: V& R; Z
  61. static volatile int irqraised1 = 0;6 F1 U9 }; g" C  A
  62. static volatile int irqraised2 = 0;% f& O8 ?# V4 Y2 r

  63. & S  L$ ^+ u- g7 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [( d& C4 }/ x0 b8 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, k" k8 S9 N/ S$ i  F+ q" d+ V, K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . n% K  {: f( W! ], H7 H
  67. ; Q( F: A! m- o0 \5 K
  68. dma_addr_t dmaphyssrc1 = 0;$ Y! E/ G3 O& Q9 Z- `4 r% ?
  69. dma_addr_t dmaphyssrc2 = 0;
    " ^6 m+ g/ G+ C& p( z* h
  70. dma_addr_t dmaphysdest1 = 0;
    0 J' O1 S1 D. G6 L9 \2 w* f5 h/ _
  71. dma_addr_t dmaphysdest2 = 0;
    9 \9 v4 P  |2 k0 h
  72. 0 D2 x. b# q# ~/ Y1 f! f
  73. char *dmabufsrc1 = NULL;
    8 ], T8 S  d' V5 P
  74. char *dmabufsrc2 = NULL;) ]9 x4 y- A2 r- Y9 z3 k: U; h3 @7 N
  75. char *dmabufdest1 = NULL;9 c. h# {2 O7 R0 r. q
  76. char *dmabufdest2 = NULL;% g  _& j0 B( Q9 t" D5 M' B

  77. ! l7 |; r& u0 S/ Q
  78. static int acnt = 512;; g; b! l  x/ N
  79. static int bcnt = 8;
      G8 O2 w7 F! D; m
  80. static int ccnt = 8;
    2 R) X5 T3 [- z5 t# @

  81.   k  _* W. a! ^( S+ ~
  82. module_param(acnt, int, S_IRUGO);
    6 S# f' `' ]& E. c' o6 M0 A, f
  83. module_param(bcnt, int, S_IRUGO);$ `- b  m5 O; j+ ]+ i6 @' D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% H$ v' L5 v8 A5 ^/ `- U6 B% r( i- K8 ]  ]6 o* z' c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 U& n/ `4 c7 `- V1 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" E7 }# {8 r. p. N# F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ J' Y; [& _( W" l! l6 B
( X9 y1 R( f2 R0 U9 d  \) l- _

2 i) L6 Z- Z3 Q- P7 u$ C" e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 11:45 , Processed in 0.038597 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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