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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ r' k% W; v" H1 X3 B
  1. [code]EDMA sample test application+ U4 ^8 H6 k- h: e* d
  2. /*8 W/ C' j' e6 K7 E8 O5 z! W
  3. * edma_test.c- G4 S) ?3 U. W1 E% E3 C# L
  4. *
      s* P8 r$ ?; Q! S, a5 O
  5. * brief  EDMA3 Test Application
    ( c( M( w0 o6 [8 b0 P
  6. *
    2 |) `& t3 a% R' H4 M- W& f
  7. *   This file contains EDMA3 Test code.5 o" [1 s# X$ {  @$ v$ A
  8. *# F1 W- I& w$ F4 `; v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ~" \( l% B) ~) c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' K7 q" u: J  p2 _+ l. f0 L, S
  11. *         TO CHANGE.
    ; _  r, Q2 y6 o" q
  12. *% U0 O' \. t# X6 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 ~- z$ C$ |. n6 K
  14. *
    " y1 G) g( X, {* h/ o  n! L4 ]
  15. * This program is free software; you can redistribute it and/or4 b% T; [$ J7 G( v6 H; W/ j
  16. * modify it under the terms of the GNU General Public License as7 n+ N  L7 |6 u$ G3 A
  17. * published by the Free Software Foundation version 2.
    1 W( M1 u4 b4 m& t2 y6 C, |
  18. *
    ! N% R5 ~5 N$ C  w: r3 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / f. w( V2 f( V
  20. * kind, whether express or implied; without even the implied warranty( J; x4 r& M: h+ g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & F1 p% z1 [6 R" ^7 F* t
  22. * GNU General Public License for more details.
    1 ^5 m' ]4 a: q; b% b
  23. */
    ' n2 Q5 `/ N+ m

  24. * B9 |( d1 p6 ~1 s4 _; {! ]- i3 Y
  25. #include <linux/module.h>& F6 B+ J# s' r$ P" Z& y2 a2 f
  26. #include <linux/init.h>
    / J5 H. D+ A% |: Q1 V
  27. #include <linux/errno.h>
    " t9 s9 h3 X: K3 g5 ^3 S# G
  28. #include <linux/types.h>
    9 _  @% k/ r& D! D, s1 d0 r
  29. #include <linux/interrupt.h>
    6 z! Y& s2 V7 ?' {/ {
  30. #include <asm/io.h>0 \" Y& x  j! t6 ]8 v
  31. #include <linux/moduleparam.h>* Y) P" s" i9 b, Y( ?6 s2 U
  32. #include <linux/sysctl.h>
    2 K! o$ }7 C/ u" e! @: A& H  K4 V
  33. #include <linux/mm.h>
    , W/ K; b5 ~" c# i4 W
  34. #include <linux/dma-mapping.h>8 h5 J" w' e9 z$ [# ]
  35. ) f( f' y* n/ q
  36. #include <mach/memory.h>
    ) G# K7 \) R1 A3 j; B0 G  G0 e  Y
  37. #include <mach/hardware.h>
      _! ^, N, V' T6 t- ]6 s- F0 J
  38. #include <mach/irqs.h>4 ?6 Q: K( y  q! ?1 f6 b! _
  39. #include <asm/hardware/edma.h>
    : ?$ H! B2 s; b% g8 Y: N1 d1 q- K& l

  40. ' C. r1 f# J/ H; o
  41. #undef EDMA3_DEBUG3 p) L  v) R  b" J
  42. /*#define EDMA3_DEBUG*/7 p9 q- `1 f- y5 c$ ^- Z

  43. 1 W8 T3 m2 G8 i! O' c/ o# B
  44. #ifdef EDMA3_DEBUG1 a& n3 B, C. t3 ^( ?5 y% x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 |8 }8 i' H) w% C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 g# z$ N! R2 m3 t8 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ t6 S; ?9 `1 {, }) h2 B/ j
  48. #else# E7 q% M% z& O/ O' X/ Z
  49. #define DMA_PRINTK( x... )6 K) v. @+ ]/ n/ u( @
  50. #define DMA_FN_IN. ~9 b& ]: ~5 T
  51. #define DMA_FN_OUT
    3 g% K3 I1 w+ d
  52. #endif$ k2 d. l. |# f
  53. / F" ^, L7 p& E: v" h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) c! w& B% ~9 G5 S5 ~
  55. #define STATIC_SHIFT                3
      B% {; }( E9 Y, Y& f  M" v
  56. #define TCINTEN_SHIFT               20
    0 \: s+ Z# t9 q7 d* r3 k
  57. #define ITCINTEN_SHIFT              21; ~" }" r6 y. R
  58. #define TCCHEN_SHIFT                22
    2 [1 v# z5 |# u5 p7 O1 k' v9 b) k
  59. #define ITCCHEN_SHIFT               23
    7 K0 I+ V7 J- ^: L2 k+ \6 k  ^
  60. 9 V, e0 R3 W0 t0 i9 D7 d
  61. static volatile int irqraised1 = 0;; P& F! w* }+ E/ {* u8 h, E/ j
  62. static volatile int irqraised2 = 0;
    ( }7 T7 ]3 l( B$ J) ~3 A+ l% {7 ?

  63. % f+ s9 z) |0 d" D; C; J/ @, ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: C0 a4 D$ j+ m+ Y2 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( [. n. L4 w* ?0 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 {6 ^7 d9 C/ J7 e9 Y& B$ L

  67. " `4 I& e3 J3 L0 Q7 N) K
  68. dma_addr_t dmaphyssrc1 = 0;, _8 H0 l. X' ^( @( b4 k  }
  69. dma_addr_t dmaphyssrc2 = 0;
    3 s2 a( m7 S& n' M
  70. dma_addr_t dmaphysdest1 = 0;
    ( w8 p, c, q& S0 O4 x, o7 C* c7 h
  71. dma_addr_t dmaphysdest2 = 0;% t' H6 |3 S/ y8 o$ P

  72. 6 u# F7 w7 d8 Q
  73. char *dmabufsrc1 = NULL;
    8 y. y+ e8 g9 X4 a' z
  74. char *dmabufsrc2 = NULL;  [: g6 D( A# M% s8 ]7 z
  75. char *dmabufdest1 = NULL;6 c! A% o" [+ j, B6 x  q8 w' T
  76. char *dmabufdest2 = NULL;
    - A  ~# Y8 G7 @9 U  }

  77. 7 Z0 m3 t/ n1 z$ y* Q' w
  78. static int acnt = 512;
    7 I+ u* l& J2 k( q
  79. static int bcnt = 8;
    6 k+ a: T& S- q# V6 B- _' U
  80. static int ccnt = 8;- ^5 C9 |1 c" _1 Z! r. ]8 v
  81.   a+ g% S8 H& z# x' G0 ~' _$ l
  82. module_param(acnt, int, S_IRUGO);+ p# C: L) V1 a% N
  83. module_param(bcnt, int, S_IRUGO);1 V) K$ k4 a: Y$ K4 e$ M& B. O% S( ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* T% x4 X+ S/ f
1 S, F) O# M' ~' h9 B0 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 O3 n: v, M* u6 P6 K! A$ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( ~* h  r; ]4 ~2 l! W& W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' x: B/ k+ M1 s8 v; V
, E7 g- c- _! `

' S- L# z8 w) `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 02:32 , Processed in 0.040660 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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