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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ i1 X! i; L4 L, D: r
  1. [code]EDMA sample test application
    ! y. T* j+ l/ T  i0 O  ~* N
  2. /*
    # a" Y+ @: ?6 |) ?4 E5 p" W
  3. * edma_test.c& V1 ]  _3 @- U  |' D
  4. *, u7 k6 t$ |# b8 a' M
  5. * brief  EDMA3 Test Application0 q* _. ?& t1 B3 w
  6. *
    ! u! ~% [6 }- X1 `, V
  7. *   This file contains EDMA3 Test code.
    - q" \, q& n4 M, S/ @! I
  8. *6 b) |! ^- @; A) U8 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 ]8 j) s7 r1 X4 H" _4 A" d! Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 J, ~% g4 _( q7 ]3 l; q) z* \
  11. *         TO CHANGE.1 A5 q4 q6 f/ h/ [/ c9 d
  12. *
    8 M4 Q/ z" ^. b/ J+ c0 ^2 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ D% S2 X1 R, k: t/ H
  14. *) Q; W+ n* Z/ m6 Z) q, f- D
  15. * This program is free software; you can redistribute it and/or9 t/ b% z$ k% {4 M
  16. * modify it under the terms of the GNU General Public License as
    . y/ I1 j# D% C9 ^1 W& A. q
  17. * published by the Free Software Foundation version 2.; S( f  D+ Z: T; X
  18. *
    3 k- S  j, Q5 N! [( ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 A, h1 R* M- J& m! l4 j/ r2 j2 n
  20. * kind, whether express or implied; without even the implied warranty
    ! j$ |. V( ~4 v9 F6 ~( p1 ~& b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  y: P8 J$ j; a
  22. * GNU General Public License for more details.6 O4 o; A) w5 H; S$ o
  23. */1 v) g1 W/ k$ ?- L/ |3 t
  24. / |5 W# A9 Y) L
  25. #include <linux/module.h>
    7 Y, u3 {9 O, h) N
  26. #include <linux/init.h>) ]% d+ b& {8 R( D) m! n$ l1 |  M) S
  27. #include <linux/errno.h>
    , }. \: k/ G$ j. ~% A
  28. #include <linux/types.h>0 I2 J) i: A5 D0 q& i% H2 C
  29. #include <linux/interrupt.h>
    / ?" g  z, U# W/ e( P7 O3 ~' b
  30. #include <asm/io.h>; N% _% x& J/ `% o. e) U
  31. #include <linux/moduleparam.h>3 c7 i* a* z( P3 \
  32. #include <linux/sysctl.h>& A8 ~: a9 s. e2 `
  33. #include <linux/mm.h>
    1 f  R8 h) e$ b9 e$ ], R
  34. #include <linux/dma-mapping.h>/ J6 @' I/ j& A4 ^/ m

  35. ( \  j6 M& v: l( x  G& ^, H
  36. #include <mach/memory.h>( X# [1 Y( L" v. a: c. t  @! k8 K
  37. #include <mach/hardware.h>: H0 f, Q6 u' Q. s6 k
  38. #include <mach/irqs.h>6 x1 c$ x! z/ w( B# M* A; i" c
  39. #include <asm/hardware/edma.h>4 b& @# d3 [$ X% U0 B% \* c, e

  40. 7 Q! Y% x1 f1 l% W6 G' m0 h6 M
  41. #undef EDMA3_DEBUG
    + l6 M- n" Y) m; w: x  e9 W: D
  42. /*#define EDMA3_DEBUG*/  W% m8 @/ G! ]. B" [8 A
  43. 0 u. ]& u. n* P9 s% [/ {7 c% e
  44. #ifdef EDMA3_DEBUG8 M0 d# V7 j5 O( |6 w1 p. n, y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). G$ |: ^( Q, h8 h( _8 {2 m% V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 y8 r' S, w& x0 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 |, V; V3 A! v; n3 A
  48. #else* O: \: J5 t6 W
  49. #define DMA_PRINTK( x... )
    8 `+ U" b7 P( y4 V( k1 p$ z+ m: J
  50. #define DMA_FN_IN
    ; p" ~4 C0 @' b& n5 ]
  51. #define DMA_FN_OUT6 }2 P  Y: j( z8 R8 L6 k+ C7 q
  52. #endif  S. K9 P% i2 O9 ?

  53. $ q$ T' J9 P9 z" {$ Z9 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' a  B; g6 g% `7 E7 W
  55. #define STATIC_SHIFT                3* R! |& F: h( i$ G
  56. #define TCINTEN_SHIFT               20
    ' @. B) S# ~. b" R$ w% @" i3 }
  57. #define ITCINTEN_SHIFT              214 S' {1 r$ j7 k# C
  58. #define TCCHEN_SHIFT                22
    * C- G' h9 z8 i9 a; J8 n: _
  59. #define ITCCHEN_SHIFT               23
    7 Y" F& |# \1 ?# ]* l& L2 n

  60. 9 g5 u; c) e+ x3 t: ?
  61. static volatile int irqraised1 = 0;" p9 {" H5 r4 [4 a2 n4 g4 n
  62. static volatile int irqraised2 = 0;5 G) a/ N" r8 |
  63. & v# e6 e: }9 f& L, k, H: w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ~3 b, H) u. v4 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 N" d1 F$ h' N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 j2 k. g5 Z4 a' L0 n4 V

  67. + ?" M( \( N% G: m
  68. dma_addr_t dmaphyssrc1 = 0;7 y' _. X& C* h1 @
  69. dma_addr_t dmaphyssrc2 = 0;
    5 H! u9 R3 G7 L, |4 e0 a" H7 `
  70. dma_addr_t dmaphysdest1 = 0;1 z* ]$ U# d1 {) u# H  h3 O: D
  71. dma_addr_t dmaphysdest2 = 0;
    , ]6 n( I0 ?, ^! b- o, c0 ~

  72.   Y- j) y1 Y7 ~6 d3 N* f8 c
  73. char *dmabufsrc1 = NULL;
    5 }5 p2 ]0 m6 r0 U' a
  74. char *dmabufsrc2 = NULL;: v9 j5 l2 [; [
  75. char *dmabufdest1 = NULL;
    0 \1 k3 J" o( y. y; g/ Z
  76. char *dmabufdest2 = NULL;  N8 K" F$ q2 C/ Y' U
  77.   n' n  o) [9 X, `! g
  78. static int acnt = 512;
    5 M% ^8 D$ A5 `9 C6 T
  79. static int bcnt = 8;
    - ^5 ]+ Q0 U1 I. f7 {
  80. static int ccnt = 8;
    - X3 h& |7 R! Z1 @
  81. . `7 B, y  a3 ~) M9 b
  82. module_param(acnt, int, S_IRUGO);4 ^, f7 S0 U8 g$ |' _
  83. module_param(bcnt, int, S_IRUGO);
    4 m/ |7 C, w( {( ^& i& G5 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 t; ^; D5 Q& M' d% }+ n

9 W) @" C" a" i1 X5 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 {" _; \7 }& y, ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [- @/ `+ a3 T5 W5 N; ]' M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! C3 x2 I! S: @5 I9 j
" v. Z( _* T0 D4 n" r2 ^; Z

) f/ V8 u4 {' \+ r5 E8 c0 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 08:32 , Processed in 0.040071 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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