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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * T" s& t+ e4 a' q9 @& P% s
  1. [code]EDMA sample test application0 v) }$ g/ e' i  y
  2. /*4 `0 K9 R) T, Y: G; }) V1 s* x
  3. * edma_test.c8 @6 P! \! K4 T) m; a0 w
  4. *' o3 ?" u2 G% \+ X5 I4 b& c
  5. * brief  EDMA3 Test Application( l7 k# z8 k0 X* x# T2 b  f
  6. *0 X; l& b1 U) y  d) C0 n- T6 x8 p; H
  7. *   This file contains EDMA3 Test code.
    & d* Y8 I# X/ U* P0 i1 \* ^, U5 F4 c& q
  8. *
    4 `- I+ {6 h3 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ]6 w$ ~- g9 V% V0 X( \$ p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  m! R* ~. f" X. t* ^0 H
  11. *         TO CHANGE.
    + P& e6 D; z0 Y9 t1 }
  12. *' E* ~# D9 X+ j* I  g' z, ]9 B# S- k, ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ i4 V4 ?+ T  ?
  14. *
    - z. }9 N2 ]! _( j" I2 m
  15. * This program is free software; you can redistribute it and/or0 H, h4 H8 X, _! m* f
  16. * modify it under the terms of the GNU General Public License as
    6 S8 C5 w$ Y4 t! R* K
  17. * published by the Free Software Foundation version 2.
    ( C7 s7 }" S' f( Z
  18. *
    / e+ J2 W, }, L8 W+ t# M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 Y5 I. X( t1 t0 |: M
  20. * kind, whether express or implied; without even the implied warranty
    7 g0 A3 a( I8 `8 L3 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ c( g3 x) ]- Z  T3 T
  22. * GNU General Public License for more details.
    " `! {3 j6 L4 S4 A7 ^8 a
  23. */4 B: R" G* I7 f  L4 ?' P( Y
  24. 4 S* o9 x) F* q, U) w
  25. #include <linux/module.h>
    : t, G: b" r" t) v! u$ J
  26. #include <linux/init.h>
    0 G/ S7 r" f( \/ E5 h4 y
  27. #include <linux/errno.h># D5 v$ T, g. Z1 `
  28. #include <linux/types.h>) R$ Z4 n! A! S
  29. #include <linux/interrupt.h>
    " U$ L- s- N3 ^0 M4 [
  30. #include <asm/io.h>& E  z, g5 q8 ~! U6 P
  31. #include <linux/moduleparam.h>: {( o0 Y( x1 ^1 }8 S
  32. #include <linux/sysctl.h>
    ' Q' G) P5 S3 q: q: `! k% t
  33. #include <linux/mm.h>2 N6 a' x4 n- Z
  34. #include <linux/dma-mapping.h>
    9 b+ J4 _: S/ a4 G, P

  35. / }9 ~) _$ [7 n. b1 h6 P
  36. #include <mach/memory.h>& q! b- |' }+ d
  37. #include <mach/hardware.h>
    ; U% \/ |% N2 R% ~
  38. #include <mach/irqs.h>
    ) a! H% J* Z# {5 I9 h5 _
  39. #include <asm/hardware/edma.h>3 Y! i1 I! D5 K! E/ E: C
  40. , C+ h2 s, n3 u4 X1 n! |! P, ?. h
  41. #undef EDMA3_DEBUG
    ' W; k. g" U$ A* e* N+ C
  42. /*#define EDMA3_DEBUG*/% I. ~1 I' Z; f5 M1 V" o
  43. 8 |- V1 ~# G* J% w" ^  c
  44. #ifdef EDMA3_DEBUG3 c4 c- Z1 r; _' Z' e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 |& j7 B3 Z: D- ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 \( U. ^, j/ o, _& W5 L" X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 ^. F- j( Z8 x- {
  48. #else
    1 \8 u+ R0 U2 Z: m. }+ q; K+ d" I
  49. #define DMA_PRINTK( x... )
    6 A) N! I; l( n9 `  J3 a2 K! [; Z  ]
  50. #define DMA_FN_IN0 N9 |' P# R0 a3 q4 q, h0 z& ~
  51. #define DMA_FN_OUT/ x, o- K' W" f# \
  52. #endif7 Q3 G" P/ J6 e# S% r; {! a4 Z
  53. # R3 Y5 g) p. J8 q1 p+ {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 c9 A2 S5 X: [7 l8 X  b
  55. #define STATIC_SHIFT                3
    / e0 \1 w$ ~- o, S/ v% |& t
  56. #define TCINTEN_SHIFT               20
    6 s! ~6 X* D5 c4 y# Y
  57. #define ITCINTEN_SHIFT              21
    : _# Q$ A: |% P* Z9 w. n
  58. #define TCCHEN_SHIFT                22
    9 O4 l% ^: n2 }+ J
  59. #define ITCCHEN_SHIFT               23& w) |! s) h9 p: ?& J# n+ J
  60. " H6 K9 X2 v: X% ?( @' A1 T! m
  61. static volatile int irqraised1 = 0;) |& P7 o& v- I: i
  62. static volatile int irqraised2 = 0;
    . F+ y  w+ y! w1 }  q6 g' \2 W# M2 c

  63. $ C# ?) l) x) r+ S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ^5 P- C6 Y) {4 `  O8 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; S4 k  b* b5 g8 l! R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) i( T7 p1 ^, {5 s  s2 K! t
  67. , b6 W6 G: l, x6 k: E& J
  68. dma_addr_t dmaphyssrc1 = 0;
    + Z' _$ B0 J5 }! {, w1 y0 @( P' a
  69. dma_addr_t dmaphyssrc2 = 0;
    " C! d3 H3 i: C
  70. dma_addr_t dmaphysdest1 = 0;) P- i3 Q/ O  m  n
  71. dma_addr_t dmaphysdest2 = 0;: ~+ G3 F1 ^) U
  72. 9 j2 Y- G0 m4 D" z& R
  73. char *dmabufsrc1 = NULL;5 x4 V6 y+ C. p/ m/ |& y
  74. char *dmabufsrc2 = NULL;
    " o7 Q; _) E8 p( o2 [. ]5 L
  75. char *dmabufdest1 = NULL;# F& e7 X/ I- X
  76. char *dmabufdest2 = NULL;& m2 m0 z3 s7 f8 e2 X, h/ x* g- w

  77. , e1 E: I* c4 R8 Y& K& v
  78. static int acnt = 512;2 V9 O8 j9 ^+ j! E
  79. static int bcnt = 8;7 h4 s. w& {, p
  80. static int ccnt = 8;
    " Y3 N/ r( i' F

  81. / e% s* U7 ?, Q! L& U$ x
  82. module_param(acnt, int, S_IRUGO);
    3 e- D* g: j; y
  83. module_param(bcnt, int, S_IRUGO);
    ! c/ I5 d$ l5 \9 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 R/ ?/ J* H0 g3 x$ Y1 D/ B0 m
( y9 t: q' g$ Y8 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* C$ i5 ?" Y, Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ m$ d% j# ?6 e4 z* v2 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* F# s8 Y0 z! W4 e
( h' E& d7 s' X! E
+ [* ^# {" S) H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-23 02:26 , Processed in 0.051703 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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