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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& O. K4 ]* t' z0 _: S0 l
  1. [code]EDMA sample test application) \/ g1 ]+ J) R
  2. /*
    . d  x3 c2 t8 r
  3. * edma_test.c
    1 Z: H4 B5 s, ]/ R) ?4 R& V9 u
  4. *
    & v! X. N0 u4 ~& \! ^4 e3 `; h
  5. * brief  EDMA3 Test Application
    % Z2 f7 f) w3 P" E9 N( x4 ?( L
  6. *
    ; b" ?5 v  H) V% L# \9 \
  7. *   This file contains EDMA3 Test code.! Z4 F; b7 |8 I' o4 h
  8. *) C- H. R3 Z2 }* c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + t( l" A3 l3 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , v4 S1 e% M8 W  x
  11. *         TO CHANGE.& R2 W. J1 [3 f. l$ S: l
  12. *
    $ m( A0 {+ v4 l0 ?( Z) w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 D8 w; w7 ]# Q3 T, A3 e/ n
  14. *6 S7 Y' h+ U: q; K  t7 k, a
  15. * This program is free software; you can redistribute it and/or6 a+ q, [: g+ \
  16. * modify it under the terms of the GNU General Public License as- K- H& `/ i% s: m- j# B  o3 i
  17. * published by the Free Software Foundation version 2.9 I4 c# \9 K0 V$ z7 z" D# w( ]# I! e
  18. *+ s8 S/ H! N: w; {- L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: J$ C- [0 t$ `) G6 K7 C6 C; C
  20. * kind, whether express or implied; without even the implied warranty( R0 ?8 @$ u6 Y1 A; {) }- d" K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + B& M, k, B: m1 W3 o  h$ ?9 n3 v
  22. * GNU General Public License for more details.
    4 I! N* b  u+ M* u1 ^# y! `
  23. */
    4 ^9 S. X5 `* o7 ]2 ]
  24. : W1 Y# R5 t! c. d
  25. #include <linux/module.h>/ F, u5 o0 r" z$ F3 Y1 m# F
  26. #include <linux/init.h>% }! P) _$ {. X( B
  27. #include <linux/errno.h>
    # L' Y$ n8 ]* t: u  B
  28. #include <linux/types.h>
    1 e' B: ?5 ~8 a
  29. #include <linux/interrupt.h>$ W) y* ^% O3 _' @+ j' g' y
  30. #include <asm/io.h>
    ! x' w  ]: `4 S, c/ W
  31. #include <linux/moduleparam.h>, K) L, S9 t& ?% K2 L  a+ F
  32. #include <linux/sysctl.h>
    - A0 S; J# f6 {7 {) A
  33. #include <linux/mm.h>7 Q, d$ E5 j" W4 W
  34. #include <linux/dma-mapping.h>
    ! i; z; |5 p' V9 J! }

  35. 4 q  D' b6 z: J- A
  36. #include <mach/memory.h>
    " D: g" k$ \6 N5 c+ I8 a
  37. #include <mach/hardware.h>! }1 K1 W6 r# n3 X! q; C" ]
  38. #include <mach/irqs.h>9 f; o( e5 h) e+ p; j" n0 d$ _! C
  39. #include <asm/hardware/edma.h>- x+ s4 S! l  z
  40.   D  D9 s! n* F: Z& v) ]1 o
  41. #undef EDMA3_DEBUG; i8 p2 |5 A5 G0 c9 m) y
  42. /*#define EDMA3_DEBUG*/
    2 `4 O" x$ H! |" h& F) N. w

  43. & Q1 n9 M/ J1 U" l) f
  44. #ifdef EDMA3_DEBUG
    ( A& \) |; q" U6 f# g3 d% J; ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" C. E0 t: r3 v: _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & G0 F; t$ e9 A8 q& l  E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + Z9 A* r. P( O. M6 S" i1 w
  48. #else& W& I# l: j$ D  y) d- u; U9 l
  49. #define DMA_PRINTK( x... )
    " z8 M& s5 J" z
  50. #define DMA_FN_IN% @. R+ |9 Z, l% B! N- {; a
  51. #define DMA_FN_OUT
    . b4 V8 {* C, J% {$ _/ m
  52. #endif
    8 `8 _' h& G; I0 J1 O$ @" Z) B
  53. ) Q0 e5 ]( ^( @3 Z6 v* D4 `, |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & k; q; G9 {; I) @
  55. #define STATIC_SHIFT                30 q9 P) n2 G8 @: }3 `
  56. #define TCINTEN_SHIFT               202 {+ U, k# \0 K) N0 m
  57. #define ITCINTEN_SHIFT              21# |2 e; \7 E- _, \& U7 U
  58. #define TCCHEN_SHIFT                226 y1 X" g/ R1 d
  59. #define ITCCHEN_SHIFT               238 [# q% m, R1 r" z9 g2 }7 P$ l1 x
  60. - M" Y2 r7 o1 g' J. d; C
  61. static volatile int irqraised1 = 0;2 u" P& F8 _. n8 A  K& ]
  62. static volatile int irqraised2 = 0;( T6 ^- |' l. K7 a5 P/ |$ u

  63. / }# R# R% n. q' R! W  u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m0 k4 _" D: @5 s  z5 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 O( u+ u! r3 L1 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 x0 N& \- ~% b  u) R
  67. 4 K, {$ J; v- Y+ T+ j  N
  68. dma_addr_t dmaphyssrc1 = 0;
    4 c  T. X9 N( U& q1 z( n7 ~
  69. dma_addr_t dmaphyssrc2 = 0;$ A5 h, e; S2 ~8 J) C
  70. dma_addr_t dmaphysdest1 = 0;( T# ^" s  R9 ]$ E: _+ Y
  71. dma_addr_t dmaphysdest2 = 0;
    4 n1 U" G  R7 ?% }& {3 b
  72. 9 [# a4 q" g6 b" ^8 ^) Q6 \$ u
  73. char *dmabufsrc1 = NULL;
    % k) Q+ ^1 |  {1 M- l" g2 ]! k5 _
  74. char *dmabufsrc2 = NULL;
    * G1 P/ i/ B; L5 E4 `6 S- E
  75. char *dmabufdest1 = NULL;
    7 q8 k+ T7 _% ^% A! j. J
  76. char *dmabufdest2 = NULL;! A4 f& q8 E/ a" i, y

  77. # j+ T: s: l. |' b) m& g% K2 ~2 i
  78. static int acnt = 512;
    6 s1 `. n0 K8 g$ E! J, Z) Q
  79. static int bcnt = 8;
    $ {  m5 z! H" f+ X4 B2 s
  80. static int ccnt = 8;- h, P' c, g8 i& u( w$ l2 V' K8 ~, g

  81. 2 }9 g0 m. |( E  p* Z; S" f$ N
  82. module_param(acnt, int, S_IRUGO);& Y3 i& u8 E, p1 Y* a
  83. module_param(bcnt, int, S_IRUGO);
    1 Q) O. ^- S7 w/ h, T, L. _' h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 X/ A* k% N9 c6 ~  `5 l1 x

5 Q/ M7 s1 B' k9 v2 M4 o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ F2 ?0 Q0 w2 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) t0 e! n( \( `' d% R9 L  V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: z5 R# L2 x$ v% d
  L$ C1 X& a1 b3 e* n+ l4 n4 e
# V3 ]  u. G7 f" {' v5 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 00:01 , Processed in 0.040046 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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