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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ q( k" [- F/ ~0 P/ N  v. G. Z+ O
  1. [code]EDMA sample test application
    ( C2 E; Z8 l. Y/ p) `
  2. /*0 w6 h6 T" L0 H
  3. * edma_test.c
    0 u) i& }4 z& z- G- v# _) W2 X
  4. *
    * @- V9 p! A" D3 T, c! U- }
  5. * brief  EDMA3 Test Application" n8 J$ o$ \' i. e# l3 T) r
  6. *' R% l; x  z" h! R
  7. *   This file contains EDMA3 Test code.+ H, u: B3 Y! Z4 ]) v7 z* c
  8. *6 R9 o% w* z) }- u8 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ n8 U: ?5 A9 |- h! l% T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' D$ L9 I; H5 ^; F! j3 ], ?7 s3 x& q
  11. *         TO CHANGE.
    $ r6 i: H7 U0 j2 y
  12. *+ q& N0 z' }$ o7 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 l6 @; _$ Q/ i  X/ b; ]/ b
  14. *
    . ?) g% }. e/ r9 x
  15. * This program is free software; you can redistribute it and/or% X: G, p5 H) y
  16. * modify it under the terms of the GNU General Public License as) b2 Z+ ]' C6 V- s6 [( k/ o2 ?9 p
  17. * published by the Free Software Foundation version 2.
    ! ]6 y8 u. d: K, H- q, ~& S
  18. *
    1 d& D( M$ E0 p" m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; X8 _! x+ f% j  k
  20. * kind, whether express or implied; without even the implied warranty
    & t9 [2 w- |2 J7 }0 E, R" J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 O; T: j7 d& g8 a" s! q
  22. * GNU General Public License for more details.: u* R! q2 L* f
  23. */
    9 r' f, }' b) r0 I; C, S

  24. + B- Z# I/ H4 E; l: I" r
  25. #include <linux/module.h>5 S1 _) }) o: B
  26. #include <linux/init.h>$ J- E. _7 A& n$ k4 c; X: r
  27. #include <linux/errno.h>: g  S8 d8 u( T* t4 `# D( }/ H
  28. #include <linux/types.h>4 t% I  f' x1 G
  29. #include <linux/interrupt.h>; q+ ?; W, E% O, D- \
  30. #include <asm/io.h>
    8 M4 v! t3 o$ q% f' I5 Y3 A0 b
  31. #include <linux/moduleparam.h>
    6 _, [/ i. N: K' f, G
  32. #include <linux/sysctl.h>
    . ?  l' R9 @8 B. F+ K
  33. #include <linux/mm.h>
    ( i8 o6 L5 j* @1 v* H$ g7 J
  34. #include <linux/dma-mapping.h>
      z% T9 r) r8 Q# g0 d
  35. . [* a# B; g/ b: E
  36. #include <mach/memory.h>
    ! H5 H! D% g$ K: i
  37. #include <mach/hardware.h>
    9 K, G  z# N1 H" r
  38. #include <mach/irqs.h>
    0 V! f/ k' m5 J0 l" O# Y( L4 @
  39. #include <asm/hardware/edma.h>
    $ r0 C: d9 }, M( z6 w
  40. 7 j* r4 f2 n& Z; h
  41. #undef EDMA3_DEBUG0 j! o4 J0 o" R/ s2 P! V% O; x2 P3 n
  42. /*#define EDMA3_DEBUG*/
    " k/ ^& h6 E9 }  t

  43. + M# {) y( [$ n2 x/ O
  44. #ifdef EDMA3_DEBUG
    8 D* o; K( p1 f9 T- Y7 c+ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / _4 s: m$ _& E) a/ X8 x. V, q1 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 E! _/ G/ I, t# f% V  k8 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' Y- u+ q; j; c9 M. v- q
  48. #else
    , I9 m/ G9 T* y$ \( r' k  U
  49. #define DMA_PRINTK( x... )
    " J# x7 h; g& Z' F- l
  50. #define DMA_FN_IN" j- t6 X+ |' e) R5 m7 w5 n5 h8 I8 M
  51. #define DMA_FN_OUT7 x+ D) J& ]) @" m5 {9 e2 d, b0 x3 G
  52. #endif
    " j% h8 Z, C8 p5 }  z
  53. 8 A. n) M- l5 z4 q+ F* A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 `8 J2 x) g8 F
  55. #define STATIC_SHIFT                38 `2 X  y/ q5 ^! m( R2 I* N
  56. #define TCINTEN_SHIFT               204 C$ ^/ A0 n) m9 v5 T8 B
  57. #define ITCINTEN_SHIFT              21+ u1 A# ]7 Z9 W* Q( _
  58. #define TCCHEN_SHIFT                224 u$ h# k0 k. u9 n) J/ @% H' M
  59. #define ITCCHEN_SHIFT               23
    0 u) a& b' p! o  C& R+ W* O

  60. 5 M8 E+ N8 p6 ^  g) D+ F! Z
  61. static volatile int irqraised1 = 0;
    1 f8 o5 e+ E; x
  62. static volatile int irqraised2 = 0;( O$ _% r2 s* m' j( k  p, T& p

  63. % F& l! K1 K7 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * A* c6 h3 ^# U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {& G& T. H/ E$ \- l. h) K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - S& E" c& z- E* d
  67. 4 D5 n% P; N. C/ |+ h& @6 t/ P
  68. dma_addr_t dmaphyssrc1 = 0;( W6 q  c% i) X+ i# s
  69. dma_addr_t dmaphyssrc2 = 0;
    7 W7 c( v0 M; x+ |& p: ~0 g; I
  70. dma_addr_t dmaphysdest1 = 0;- G% ~1 Y/ [% ~% r: @/ m
  71. dma_addr_t dmaphysdest2 = 0;5 O- A# q. J! S. b8 U% R
  72.   T/ C; Y1 e# r% {, f8 W
  73. char *dmabufsrc1 = NULL;4 L& D! \0 }. w% s- [) b: d
  74. char *dmabufsrc2 = NULL;
    , v4 M' y; t$ i! w; e5 e
  75. char *dmabufdest1 = NULL;  P  p' F+ f1 Q8 K7 p
  76. char *dmabufdest2 = NULL;
    8 q: e  N8 V( B7 [4 E" @8 I% q
  77. 4 `' v3 D+ M" l, P! ^! @7 Q. d
  78. static int acnt = 512;
      H( n2 ^& {- |; {
  79. static int bcnt = 8;; u9 w- _) h& O+ O  V: o5 M
  80. static int ccnt = 8;
    8 _* Y2 i: L) B" G1 E
  81. 8 J/ C( X( c  _  t& R, |2 G% ?' ?
  82. module_param(acnt, int, S_IRUGO);
    , |/ D/ Z9 |7 `
  83. module_param(bcnt, int, S_IRUGO);# `7 s3 z6 a. S9 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ W( O: a' p& E, b4 b& f: f' p& w! o5 @- ~0 m* ]2 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. Z8 y4 [, e" |! m0 `* k5 p# X, u+ w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ @9 U' ]# C& V1 H) O3 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! M# P3 D8 D7 y4 t
8 w, S! w  a: k2 f$ ]6 X) _* W+ H+ [( [5 `4 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-27 21:35 , Processed in 0.040225 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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