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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, R; z6 \3 O9 L* M1 O
  1. [code]EDMA sample test application
    6 l) n$ w1 _8 G; N2 L! B$ \
  2. /*. h, [& }7 z" R5 k: m
  3. * edma_test.c1 o* f# x! o2 j( ^  d3 ?
  4. *
    % N- j" d1 q: ]- O
  5. * brief  EDMA3 Test Application6 T' \: Q/ J7 N6 W& F
  6. *& c6 Y( k2 s9 a4 J# S9 }; }. a
  7. *   This file contains EDMA3 Test code.7 @/ D' U  |4 h9 j6 ^( d, A
  8. *
    * m9 y1 z% G3 t: t" b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ J( F6 y" C8 s/ ^, d) s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 G* |. f: ?) K( Z
  11. *         TO CHANGE.. q: d5 t3 N& p
  12. *
    6 x6 N9 c4 t0 a% N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 q+ c7 `9 V, S8 B  z  b9 a6 Z0 p
  14. *
    : L9 H' r7 Y9 B- k: u
  15. * This program is free software; you can redistribute it and/or3 }/ U( k1 B2 }, a$ }* E7 w* u% w
  16. * modify it under the terms of the GNU General Public License as
    : ^7 ~6 M( W; C& j
  17. * published by the Free Software Foundation version 2.
      B  |) a" R. L( b
  18. *
    5 ^. A; ?1 d* I: D& c' a( t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , Y5 V8 h0 _  \) `5 F! j! `
  20. * kind, whether express or implied; without even the implied warranty
    ; ^& C/ S8 J* g0 @+ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " {4 J0 k" N9 m; X9 H
  22. * GNU General Public License for more details.( m& t& Q; u# x, M
  23. */
    # b/ r5 o3 m( @8 C/ a6 n2 K0 o, W

  24. % s  e$ f& G+ D$ q1 b$ q2 d
  25. #include <linux/module.h>
    " T* l. z: l9 B* q
  26. #include <linux/init.h>
    * @" d! F2 C& @; J: V& O6 f
  27. #include <linux/errno.h>! N' \" u. D/ L8 \, ?
  28. #include <linux/types.h>
    ) }9 L+ \. x1 A+ K: Z
  29. #include <linux/interrupt.h>) q9 P% j1 [7 ~0 Y" D+ s
  30. #include <asm/io.h>' K' i+ w! d: ~- Q# {- ?1 G
  31. #include <linux/moduleparam.h>
      n* J! V3 @7 n4 N: Q
  32. #include <linux/sysctl.h>
    & C$ [! M! Q9 P" \7 N0 J
  33. #include <linux/mm.h>. {5 }+ Q* ?' r; j
  34. #include <linux/dma-mapping.h>
    - Y5 d! ~# x( U: o& V# h8 R& L

  35. 4 [+ _" y' ~. j) Z3 I
  36. #include <mach/memory.h>
      i: }8 U* Q- ^
  37. #include <mach/hardware.h>
    7 X! @( K1 ^6 s9 h- N
  38. #include <mach/irqs.h>3 N4 l: P, ?# U1 P. ?6 r# n
  39. #include <asm/hardware/edma.h>% z1 c6 T4 `5 }0 Q
  40. / Y3 H5 U. F4 b& M
  41. #undef EDMA3_DEBUG
    ; a$ q5 B$ o- u3 c+ u; Q
  42. /*#define EDMA3_DEBUG*/; \8 W* M$ z5 ]* `% e: I' p' L
  43. - [7 u! h' K9 U  y+ f
  44. #ifdef EDMA3_DEBUG
    6 v4 o3 Z/ v' f) M3 t* O) g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - e+ [8 {: l* C; e  `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 G# C, Y) F+ ]0 l# Q( w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 j' j  ^, z* l$ m
  48. #else
    ) @5 g# x1 Z2 R
  49. #define DMA_PRINTK( x... )* V- E4 C7 L6 T5 W4 r
  50. #define DMA_FN_IN1 J$ x7 X/ z: L! C) p2 y2 m1 t- B
  51. #define DMA_FN_OUT: z) k8 q+ D, i) h( B# B
  52. #endif
    3 H! n% p8 w# G6 u& a

  53. : l& z& `3 v$ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# {* R5 Z; \4 ?/ [3 v6 J0 Y7 c( V
  55. #define STATIC_SHIFT                3
    ! c' Q0 o! B4 j
  56. #define TCINTEN_SHIFT               20
    0 q( O. W8 M1 c
  57. #define ITCINTEN_SHIFT              219 Q2 T# [% b3 F& x
  58. #define TCCHEN_SHIFT                22# z) L/ `. s2 o" H1 e# m3 v( Q
  59. #define ITCCHEN_SHIFT               23
    4 Z7 ]: Q/ X% T/ B5 z$ p
  60. : U1 V- B8 [" h6 T
  61. static volatile int irqraised1 = 0;
    & |/ _* ^7 [4 ?% P6 m, n5 v
  62. static volatile int irqraised2 = 0;' v% B* j# D1 V2 {/ w

  63.   Q1 y: K7 A/ e1 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z7 t2 h% u' y  |9 u6 j" b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u& M$ u7 q! B/ u% k9 x) B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / i  y: H9 |7 W

  67. 0 Q- B0 r1 t2 f5 {# K6 e) s
  68. dma_addr_t dmaphyssrc1 = 0;, E, B7 B( H2 D7 q- O! L/ D
  69. dma_addr_t dmaphyssrc2 = 0;
    6 T) m' s  T1 ~5 m2 k" B# K8 C
  70. dma_addr_t dmaphysdest1 = 0;
    " P$ a3 a) s* P7 x, x
  71. dma_addr_t dmaphysdest2 = 0;$ r& E) M$ _) F; i7 f0 ?, `, W
  72. 3 C: F) ?! J/ `! D) \1 y4 K, }
  73. char *dmabufsrc1 = NULL;4 S. L3 `8 V9 Q, o7 c4 K+ s/ n
  74. char *dmabufsrc2 = NULL;
    % }2 K9 t; p: ]* D2 q
  75. char *dmabufdest1 = NULL;
    $ Q% K1 }) O6 e* G! j* W3 o
  76. char *dmabufdest2 = NULL;
    + @7 t3 n9 V7 V# B

  77. ( H$ _  @3 D6 B# J
  78. static int acnt = 512;
    . s4 o  M4 {7 E+ U
  79. static int bcnt = 8;
    4 z4 g; p6 Y8 S6 i$ ^
  80. static int ccnt = 8;
    / c; n7 R) o& O
  81. , D4 x  }( c3 ^
  82. module_param(acnt, int, S_IRUGO);
    4 l1 ~* @" I: ~8 k5 Y3 p) z. u
  83. module_param(bcnt, int, S_IRUGO);
    4 |2 V: g) T' q7 {1 o; {& r0 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: {9 H& m9 G! ^% n/ [- R1 a$ p3 e: M# Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 i  y* q# y# h; b" V; d* R& _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' N; |* v$ c- n0 m4 d2 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# m' O; {1 G$ _* z" d" w+ y
5 g/ O0 p7 Z2 f0 Q' L. T) O! ?& B

( E2 y2 u" H9 z2 t. v' m9 n! w$ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 05:04 , Processed in 0.048470 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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