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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( l2 P1 ?8 }% x3 b
  1. [code]EDMA sample test application0 ?6 T" ]/ ?3 ]9 e1 d" |5 }6 q
  2. /*
    & [9 u; y1 G9 g
  3. * edma_test.c% \* K8 t5 c! \4 s- J' a0 Y
  4. *  G" l+ d2 h6 V) R( O4 e# s$ e
  5. * brief  EDMA3 Test Application6 |% B7 \* ]9 V1 D" O# I5 d9 b
  6. *5 u' a; }1 S  f" L; u
  7. *   This file contains EDMA3 Test code.
    8 K3 M: f$ E/ A! R: ~
  8. *$ P% g2 c# e% w5 B$ B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 x. a, `4 X3 b8 E& e- L' C5 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) g' B/ h6 ?/ A; N& l
  11. *         TO CHANGE.
    & j0 m7 L: k4 b. X9 T  n# P
  12. *8 n% I; U$ r+ H4 J( X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 H/ q8 T/ ]: K0 z$ O( _% I8 n, ^
  14. *# I% @4 _# h% r# e- Y3 ^  f  }
  15. * This program is free software; you can redistribute it and/or7 o9 k- S( K8 f  a
  16. * modify it under the terms of the GNU General Public License as' c1 R$ X' I6 \% s/ m( w
  17. * published by the Free Software Foundation version 2.& u2 D) N/ Q: L0 O  H8 C& L6 _# w
  18. *$ v6 p( l3 q8 v1 u/ [: \3 a: A5 W' F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # o- Z- y" S' p# w' p4 o1 q
  20. * kind, whether express or implied; without even the implied warranty
    % c1 ~/ r# B, d* e$ s- p# ^9 E* d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- q' x8 D+ Q; K9 q
  22. * GNU General Public License for more details.+ ^" i* ^: o2 T+ Q( D3 ^
  23. */+ ^* Z$ Y1 N" `7 _/ C& W

  24. ( |  m. [5 C+ E' k, H3 w+ d* p9 c
  25. #include <linux/module.h>, o4 H+ I3 z6 q/ W; h3 a4 M
  26. #include <linux/init.h>2 R+ T  X3 c7 D
  27. #include <linux/errno.h>9 k! F" I1 G9 X# E1 [1 ~0 q" @. X
  28. #include <linux/types.h>& G1 r' F, h+ M
  29. #include <linux/interrupt.h># m9 [7 S1 b% a) g  I  @
  30. #include <asm/io.h>, A' s5 U( M5 u8 `* u  g
  31. #include <linux/moduleparam.h>; y9 R- P5 H0 _* T3 x5 V8 j( d3 h
  32. #include <linux/sysctl.h>" }9 u; _  L) ]2 K( c
  33. #include <linux/mm.h>- ~9 U% c% g. }/ Q+ r$ \5 D/ L
  34. #include <linux/dma-mapping.h>( t1 J5 d+ x* o5 S  z! x

  35. ; k; U* _3 a. T
  36. #include <mach/memory.h>5 ~& Q3 ?2 o# |4 b: ]5 S# S
  37. #include <mach/hardware.h>& y5 @4 i+ b2 d" a3 B9 p6 p, k, G9 z
  38. #include <mach/irqs.h>
    9 i. u: \: G- |: V7 p4 j4 Z; a7 j
  39. #include <asm/hardware/edma.h>
    6 V: O8 e1 D- f7 m( T% v, {

  40. ( G  C- [# K* R
  41. #undef EDMA3_DEBUG
    1 W% p7 U4 L0 Z, R4 m) w$ L
  42. /*#define EDMA3_DEBUG*/2 e$ r- N& Y/ Y: E
  43. - o. @8 l& ?0 t0 ~3 p( c3 @  L6 u
  44. #ifdef EDMA3_DEBUG
    3 T9 n- }% c5 R5 r; @; M& a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 d0 \7 R- W) O# ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 U7 P, ^4 V, ]7 j8 I4 n, ~) H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 Q6 h+ Q/ R4 |
  48. #else. k( q$ R0 V$ a  \" p  w1 G( Q% h2 b6 C5 o
  49. #define DMA_PRINTK( x... )3 M9 e; {! [; Z) i3 h) G5 b( H
  50. #define DMA_FN_IN$ I; f' q6 f$ u5 j
  51. #define DMA_FN_OUT* J  s8 }" N4 ^4 \
  52. #endif+ g1 q5 T$ F6 H) g8 `& P
  53. 8 e, i6 @# p: ^: V2 t* `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ^  @7 F# J& ~5 _" P* `
  55. #define STATIC_SHIFT                37 }5 r, n! u0 k" R8 t3 d7 ?7 \- y1 k
  56. #define TCINTEN_SHIFT               20
    0 A3 \8 \7 ]" k& b) k
  57. #define ITCINTEN_SHIFT              210 U' V" F4 e" G' Z8 o8 x7 g' c& h+ Q
  58. #define TCCHEN_SHIFT                22$ M; j7 E1 g* [) Y) s6 }% G
  59. #define ITCCHEN_SHIFT               23
    & Z* U7 [! R( r& |8 |' Y

  60. / R0 R, i0 a6 v0 ~& S
  61. static volatile int irqraised1 = 0;2 _+ y- j0 W: [# O
  62. static volatile int irqraised2 = 0;) g5 A/ D' B; ~5 o5 J3 ?. Z  }

  63. . r3 i& Y# s% a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X) p4 j7 i1 f% E9 [/ C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' i4 V7 k, A# B4 e6 x) ^" E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + a: M: o! k2 N3 N* w

  67. 6 l1 F, y0 U  r
  68. dma_addr_t dmaphyssrc1 = 0;( D/ D# s; P0 T: e9 b# d' H& D
  69. dma_addr_t dmaphyssrc2 = 0;
    # F  T7 k+ h3 e8 V* V
  70. dma_addr_t dmaphysdest1 = 0;0 V: W5 M5 h7 Y8 w
  71. dma_addr_t dmaphysdest2 = 0;) m; Z6 m* G" F4 l6 i, _3 Y( E

  72. - ?/ b" T. u: C0 Q; O3 k0 Z
  73. char *dmabufsrc1 = NULL;: u9 K) h: }4 ^4 Q  _  m, E' F( P
  74. char *dmabufsrc2 = NULL;
    & G9 g& q1 A8 s# {% D" z# ]
  75. char *dmabufdest1 = NULL;
    * k, w4 d$ ]7 g$ L- a
  76. char *dmabufdest2 = NULL;' b  Y+ R/ K! Q( Q$ I8 d1 t7 D9 `" M
  77. " v( q( Y4 u  z7 X& F1 t
  78. static int acnt = 512;* @( M" R' M4 V  g6 Q2 ^" F
  79. static int bcnt = 8;
    0 J: E1 h" M. n! o2 u/ c7 z; i
  80. static int ccnt = 8;6 o) N% b8 P. N0 N9 ]1 ~
  81. / l$ f. }9 A* p7 ^# |4 k
  82. module_param(acnt, int, S_IRUGO);
    5 O2 z0 }7 a0 o, L& E" r
  83. module_param(bcnt, int, S_IRUGO);0 P0 f1 u# ~8 F' V8 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  O7 |% N8 r" |- N3 a1 e1 S$ @7 Q, P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* e$ f' T! _1 ]: p5 F( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 `; G& Z# w1 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! ^* n5 K: L) H8 S7 i
, P3 L, b1 Q. y: j( v: h' ^( x" R8 n( C) X# V$ h* |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-9 08:45 , Processed in 0.057938 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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