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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * C; F/ z8 d- `. y
  1. [code]EDMA sample test application! E; d+ v' t, H" ^2 |, \
  2. /*, u" Z" Y3 l/ T2 Z; O, Y' b. x
  3. * edma_test.c  K+ e1 K0 P+ ]) q
  4. *' c! v- L8 C, F* K( c- n8 W
  5. * brief  EDMA3 Test Application, i- X3 S- Y( q- |
  6. *
    6 E+ w/ f0 P; K% Z) A4 r, I
  7. *   This file contains EDMA3 Test code.
    : c3 V& n2 ^5 H9 H1 h& p
  8. *
    : m9 r8 P. Q$ K# J2 v$ ]$ c  @: K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 n* Q3 b) l8 Q! u9 `3 K' V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 @7 a" L6 _- }  F5 R1 d
  11. *         TO CHANGE.
    - {# X$ M% g$ ?0 J( `7 x7 m
  12. *
    5 K, w) H6 R' u/ H( c( ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ ~# Z8 g: i0 v: {) E, l3 K# L
  14. *
    3 d3 V  U2 K& U1 p
  15. * This program is free software; you can redistribute it and/or0 H4 d+ y: i* \- u
  16. * modify it under the terms of the GNU General Public License as; E1 S" `8 A1 A6 j; S, L$ m2 {4 A
  17. * published by the Free Software Foundation version 2.4 N6 ]3 @* ^! L; q
  18. *
    " A* J3 U* V3 K& n. {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / G8 W* S4 K6 _
  20. * kind, whether express or implied; without even the implied warranty1 U2 t( F$ ~7 }9 r. F8 |- ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . l( M# i& U- T5 C8 J1 t1 A3 J$ |8 @
  22. * GNU General Public License for more details.
    6 b2 l: L: d+ g
  23. */$ p  ^6 O4 u* A1 ^

  24. , D2 L# F& |/ D( p1 v4 m2 F
  25. #include <linux/module.h>, a/ N7 P* v  Z. B$ N8 g; ]
  26. #include <linux/init.h>& ^/ }7 P* H) r* ]7 }8 m
  27. #include <linux/errno.h>5 X: P, @6 b* ?% J9 w, c
  28. #include <linux/types.h>" R' v- U7 n% Y8 a1 O3 l5 r1 C
  29. #include <linux/interrupt.h>6 K; |/ B: y/ e7 [  a8 Q( Z5 D, g
  30. #include <asm/io.h>
    8 ?, G8 G- N8 s0 u+ y: i
  31. #include <linux/moduleparam.h>
    / c9 B! d4 y$ w4 I) ~- d
  32. #include <linux/sysctl.h>
    . R9 \  [1 @4 b4 ~+ r
  33. #include <linux/mm.h>$ ~5 [6 }3 S/ G0 r
  34. #include <linux/dma-mapping.h>
      d! B) k4 g- s2 v8 w8 O' L  K  l% `7 ?6 h

  35. & f; Z# G) g/ s. S% Q
  36. #include <mach/memory.h>( E% f5 u8 l" h
  37. #include <mach/hardware.h>
    ; v6 J- R4 i1 ?
  38. #include <mach/irqs.h>0 ?& p) i4 A: Y) c
  39. #include <asm/hardware/edma.h>- h# M  s( [0 |7 z
  40. ; s$ c* O+ P" p- r" j8 g
  41. #undef EDMA3_DEBUG
    0 Y% M0 Y2 ?9 \8 d3 z4 H& a
  42. /*#define EDMA3_DEBUG*/' N+ W: t5 F' S2 b/ ^4 E

  43. ; V: n$ g+ n0 p( C; ~! @2 i5 l( r, N
  44. #ifdef EDMA3_DEBUG
    1 T' E8 ?! x6 D/ v9 j2 n" `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " D4 E( S: ]5 f- H% N+ F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 Y/ ~$ E! o4 x0 ~8 l5 e' w7 T6 E( @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , C; J1 h& f" ]
  48. #else
    0 i: O; {& Y) M, {  e2 h$ a  ?
  49. #define DMA_PRINTK( x... )
    : X/ A) U- M( z8 _8 r) D" R% C0 I
  50. #define DMA_FN_IN3 a- x5 w5 U. C" p
  51. #define DMA_FN_OUT
    " _$ N. N2 r6 k& q/ k, f
  52. #endif# a/ f- z! n* E  p; H
  53. 9 X- c. A+ j' I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 K. Z" I5 |. U" R
  55. #define STATIC_SHIFT                36 @' \6 \2 v+ w( O
  56. #define TCINTEN_SHIFT               20
    6 A) s" P# `, `
  57. #define ITCINTEN_SHIFT              21
    ' _" B! V$ q5 Y( e+ V9 S
  58. #define TCCHEN_SHIFT                22& n' n: p. d# X5 G$ D' m8 H$ _
  59. #define ITCCHEN_SHIFT               238 O1 B3 \6 A4 Y2 Z9 l, P. @- @

  60.   @1 Q" C4 W' y: W9 Y9 u2 G
  61. static volatile int irqraised1 = 0;+ a* X0 `2 d7 W# u" V) I
  62. static volatile int irqraised2 = 0;* q4 N" t# y' m) ]. ~+ x/ i) D; Z5 F
  63. 5 p0 E+ F! i0 _; R, B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Q8 l- s5 K+ m) O' q8 ~$ w4 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 L! {: A, H* @7 F, a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 C* g2 J* b( v, O5 Z

  67. 5 _$ e: f+ R% W1 g
  68. dma_addr_t dmaphyssrc1 = 0;5 _) t7 w1 _) P: v3 ], K% E
  69. dma_addr_t dmaphyssrc2 = 0;$ i5 C: C! R: \( f: w. a; ~
  70. dma_addr_t dmaphysdest1 = 0;, j3 L+ r) A$ M5 c6 f* H$ j
  71. dma_addr_t dmaphysdest2 = 0;: t8 a" ^5 T" {$ q

  72.   C3 B. Y2 t+ k' I9 j) M' \( U% ~% }0 `
  73. char *dmabufsrc1 = NULL;
    6 P+ ?  v. k, e' `: K. ?) v# X1 {
  74. char *dmabufsrc2 = NULL;
    : P, u# p$ Q: W0 Y
  75. char *dmabufdest1 = NULL;: v. s, R  {% `4 n4 N
  76. char *dmabufdest2 = NULL;! a* R0 \0 _5 t, }4 @
  77. ( ?5 A- u$ S+ M5 e3 i! @5 A, P8 ^
  78. static int acnt = 512;
    , ]; I' n9 u$ Y8 F4 }# h
  79. static int bcnt = 8;
      u5 t8 U4 ?3 A1 ?+ L: ~6 I& F
  80. static int ccnt = 8;
      z0 a/ f: q: Q0 o( E
  81. ( Q+ X9 ~. ?& f; t
  82. module_param(acnt, int, S_IRUGO);  L' q7 I' p5 A5 k  n2 H3 J1 C
  83. module_param(bcnt, int, S_IRUGO);
    / N! L  K0 j6 k* ]' S9 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 h  M( h& Q; D% b  \
& E7 h) f! ?  j" z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. m  X- K5 G* r9 K1 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% g) d! T' K1 a4 T; `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# M- A6 M# o4 N4 g$ V& O# Q! \6 c0 m- v" H: B6 F# r" b# U3 @

* Z" E1 w$ p0 B$ L+ W; o: q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 22:34 , Processed in 0.042177 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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