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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - {* @, v* I# ?" U
  1. [code]EDMA sample test application: R( c/ l) h6 [
  2. /*9 ^+ X1 [. P/ W% N) b) H7 q' c
  3. * edma_test.c
    6 d# C; W% ]# m% }# r2 F; F. a: W+ x
  4. *
    . d9 ?2 P5 b1 m1 K  H" g
  5. * brief  EDMA3 Test Application4 r9 Y: a# a6 R+ @( b& g
  6. *
    % Q- |: U  r# I! ?8 o; D& F
  7. *   This file contains EDMA3 Test code.
    ; k1 K# Z9 L! X. N
  8. *: ~. d6 @' ?0 @+ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 K! w$ p3 a( `) u& K- B& }5 W6 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % q: a, G7 H0 b, e
  11. *         TO CHANGE.0 d& ?6 p& Z; R6 y
  12. *1 m: o( J: O" H1 o" y* G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 U; ?% C# z# m% |
  14. *
    & r3 o/ w* a5 X0 p' ~) }. u( }9 n
  15. * This program is free software; you can redistribute it and/or2 ~3 g+ Y; A. @  y, j
  16. * modify it under the terms of the GNU General Public License as  ?  }% N: ?4 C( x! q# T4 ]( O
  17. * published by the Free Software Foundation version 2.9 F' J' P9 i- |3 T2 ]
  18. *, f# D  t# i" x" N6 y# I( m+ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 T% }; j6 X7 G
  20. * kind, whether express or implied; without even the implied warranty5 M/ f' n+ s8 N0 O" i9 C: F2 @. X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! A) a; i0 s% i; j' ~" |4 m' w2 o( {
  22. * GNU General Public License for more details.
    4 u+ G% y7 W0 `" s) i
  23. */
    8 V2 k" o- s1 G8 O: F3 V5 k( |

  24. / k% X' x2 V+ W3 X$ k9 b, t% R
  25. #include <linux/module.h>3 K8 J- z4 O% N9 ^
  26. #include <linux/init.h>7 e: g) ^6 X; E3 d9 ]6 [% B
  27. #include <linux/errno.h>7 Z, P& w/ i0 T2 Z
  28. #include <linux/types.h>
    * ^1 s* r& h! Q- ]; S$ s. S4 ?6 a
  29. #include <linux/interrupt.h>$ b7 Q' O& m5 K# E+ P
  30. #include <asm/io.h>5 k8 d0 d/ `) H( u+ O" a  _
  31. #include <linux/moduleparam.h>+ c! I5 c. ^8 U0 [& m
  32. #include <linux/sysctl.h>
    1 Q; F2 L' j# d- J4 ]0 v" t  r, v
  33. #include <linux/mm.h>
    9 x$ d( H; l6 j: w7 \4 l/ J
  34. #include <linux/dma-mapping.h>
    7 _0 [2 Y' Y, J4 w0 W- P) ~+ c, b

  35.   ]1 r: L$ B/ t8 [$ d
  36. #include <mach/memory.h>( A1 u- b5 l* X! v. }# M2 a3 `
  37. #include <mach/hardware.h>
    2 ]$ f4 ^! q0 O. ]
  38. #include <mach/irqs.h>: v- e3 o; b1 h! ^- h. Q; f9 t
  39. #include <asm/hardware/edma.h>
      @' n0 k: k( g; s0 N- a/ T

  40. 6 q" C4 L) B7 V5 ], L
  41. #undef EDMA3_DEBUG
      Y6 e3 y  W4 R) }; U
  42. /*#define EDMA3_DEBUG*/; C* n1 Y# L# K- n
  43. & x4 J0 j" Q! R; Y
  44. #ifdef EDMA3_DEBUG
    , K9 [5 O  Q4 L  u: \2 \& Q& c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ]8 e7 q! O3 s/ b7 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 Q& ?4 k9 a: w' u" S$ Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), e/ y6 q3 ?2 y: q/ }
  48. #else
    4 ]5 J: b0 l! S9 @
  49. #define DMA_PRINTK( x... )
    ; Z+ \: K5 J) ?2 I! ?6 c. b
  50. #define DMA_FN_IN$ o" F( ]$ Y0 l( @2 B9 k2 N5 p
  51. #define DMA_FN_OUT9 f! e, n$ ~- d, G9 s* F
  52. #endif
    & u/ u) G0 s9 q2 C5 ?, C
  53. 6 @* s$ E1 B0 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 z) f$ a8 \( E9 O# ?5 o% V
  55. #define STATIC_SHIFT                3
    6 A9 I0 e* \8 l5 {8 ]8 F7 d
  56. #define TCINTEN_SHIFT               20
    : Q2 J- m2 W. q. e! m1 ^4 O
  57. #define ITCINTEN_SHIFT              213 s" o* p2 U; V" Q! m
  58. #define TCCHEN_SHIFT                229 O7 Z- ^- K8 J# L7 G* p" ]
  59. #define ITCCHEN_SHIFT               238 M7 d9 z- M( S) T6 w8 m
  60. 6 X& l- J6 u; H* v7 A: [8 q
  61. static volatile int irqraised1 = 0;, M- Z" z7 q$ P7 s* K4 I! c4 z8 I
  62. static volatile int irqraised2 = 0;) N# u+ O& Q( {( y
  63. 3 i8 F  [! w, j' h$ ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      E3 W) f5 p3 b: m$ i# D( n) w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% e$ J3 }& z) f+ ^6 ?* G! U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v" q* V0 \4 D5 v# W2 \

  67. - b' v4 m8 o' f1 t
  68. dma_addr_t dmaphyssrc1 = 0;
    . ^. E" ^, z# |* G# C- }
  69. dma_addr_t dmaphyssrc2 = 0;
    8 H* _6 }4 I* F  [% e- _
  70. dma_addr_t dmaphysdest1 = 0;
    $ n5 g* z/ a" M  M. H/ Q% D0 b
  71. dma_addr_t dmaphysdest2 = 0;
    7 l, m4 t+ j3 z  n2 l; K5 S& ^( N- ?& w
  72. 9 P) j+ i  T  L2 l% @
  73. char *dmabufsrc1 = NULL;7 h+ b2 d! A$ N; Q. \1 c8 B1 O
  74. char *dmabufsrc2 = NULL;
    . C# n, h" {9 Z6 c3 N8 ^5 N
  75. char *dmabufdest1 = NULL;
    4 V, V$ W+ ?- {5 M) S
  76. char *dmabufdest2 = NULL;
    8 S0 V# g) V7 N9 h7 H3 b, G3 T
  77. 5 `% l1 H8 h6 G
  78. static int acnt = 512;1 B) n6 [1 q/ A8 |1 Q8 K
  79. static int bcnt = 8;. J8 V8 T5 x7 }: s) X& U
  80. static int ccnt = 8;) g0 m+ t4 ^7 c& n8 a
  81. $ a1 u/ k* T3 j1 i
  82. module_param(acnt, int, S_IRUGO);* f2 D- R4 t( d
  83. module_param(bcnt, int, S_IRUGO);
    0 D4 S$ @" j& |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ g4 U+ n* Y, K% a
( R9 v3 a+ m2 \; y+ p7 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y! Q" P& a7 e9 w8 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 Q2 o) i: c) K- C& M/ e0 {% G  ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. s! B# z# c' H" e% G5 V# K" C; \; q1 T

' `7 r, v% y# U$ r, v
# Q: I0 L- K- N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 12:42 , Processed in 0.045218 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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