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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' B4 {; x$ k. d) ]& x
  1. [code]EDMA sample test application, R/ a% q4 u9 [/ M  e4 t& H
  2. /*
    ( T  z, e: A2 R; V
  3. * edma_test.c6 p( E& j5 ]5 d- |  A3 K
  4. *
    . ]7 A/ ^+ r  [# z5 }
  5. * brief  EDMA3 Test Application$ `5 Q- u6 a. P7 \( x0 U# @4 S" w* \  y
  6. *
    ) M5 T4 D1 n4 ]
  7. *   This file contains EDMA3 Test code.
    4 ]2 o9 b: i* v; {2 y. C0 w& u
  8. *
    " x, I, c0 o& E5 h5 v6 C( S5 U7 F9 D' ^  Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 c4 v# d# k5 W2 ]* H) W/ b! m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ _- c1 C& {$ z% b0 |! I- ~
  11. *         TO CHANGE., x4 a8 G% w7 l% t+ C
  12. *
    ' `4 S# y) x; Z) D$ C' j; x; T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 P8 J! ]8 I# ~. ?
  14. *
    # t. M3 V4 `  L' K- S4 \
  15. * This program is free software; you can redistribute it and/or
    5 j, d, j& C9 B' G8 A+ {5 {5 V
  16. * modify it under the terms of the GNU General Public License as
    / i$ d9 D3 \: V+ ?$ t
  17. * published by the Free Software Foundation version 2.
    . S7 t, E; F/ i3 k' p/ S/ f
  18. *
    7 K; J7 _- m) R) W8 ^3 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Q! A3 z0 u; Z) |. Y3 w+ s
  20. * kind, whether express or implied; without even the implied warranty
    8 I7 O% f/ m; Q; N/ D. X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * I( P4 }/ d$ Z& M: D* a# n
  22. * GNU General Public License for more details.
    . d. j$ Z8 L! ^' P% \
  23. */+ w( z8 f% u; _, K6 H5 a

  24. 9 T! @  @8 D7 R; d
  25. #include <linux/module.h>
    - g8 }7 f+ B5 v  s
  26. #include <linux/init.h>& e) D  d+ B( w& B1 w4 ]
  27. #include <linux/errno.h>
    9 I; W) ], j/ G) d1 s
  28. #include <linux/types.h>
    - F8 {; M" G8 \9 h8 f) Q! F, E1 n
  29. #include <linux/interrupt.h>2 }% }) [( t) y2 g
  30. #include <asm/io.h>
    2 C7 o( \9 P) `1 ?
  31. #include <linux/moduleparam.h>
    + v7 y- s* [% y8 d5 Q1 G* ?  C4 J+ M/ N
  32. #include <linux/sysctl.h>0 Q+ O" U1 i. Y& Q4 y1 m
  33. #include <linux/mm.h>" |& n' ?0 n7 u$ ^7 S5 o- N2 R
  34. #include <linux/dma-mapping.h>
    1 a+ e4 k6 v6 ]0 S% I3 w. {6 z$ L* B; w
  35. $ ?! n- `5 B6 h% Y+ ?
  36. #include <mach/memory.h>
    - q* G2 t$ ^. ~7 [9 Q# [8 M) q7 o% @) c
  37. #include <mach/hardware.h>/ }# Y* }& w! V. k2 p( v
  38. #include <mach/irqs.h>9 |/ Y7 _9 D: Z" ^
  39. #include <asm/hardware/edma.h># {& N" V2 K. V$ y

  40. 9 N  H* ]( J% o0 L# `
  41. #undef EDMA3_DEBUG+ N$ D6 O6 l3 V4 j' j( X1 ?- A
  42. /*#define EDMA3_DEBUG*/
    ! S8 T  v) J, g8 f9 R6 S1 }, ?
  43. ) q( F: Z* L" T: d+ z. I2 j
  44. #ifdef EDMA3_DEBUG: l: E1 [/ S$ d3 Y' R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 r+ b$ ]  c5 ^( H: Y6 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( F! [# [6 e2 F1 B1 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): v& r; t7 f  C2 a! D. z  C
  48. #else
    3 `$ j: [) D& t4 M3 U& o& m, I
  49. #define DMA_PRINTK( x... )
    $ g) v. O. J2 D( h
  50. #define DMA_FN_IN7 m5 a1 ^( X$ W( z
  51. #define DMA_FN_OUT/ O' X5 V4 c3 N2 x  U4 L4 ]
  52. #endif
    % B; O4 R& F2 ^- Q
  53. 3 Q6 U/ [9 o/ M6 S) b# c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / \* {, t2 M' [  c5 ]' _
  55. #define STATIC_SHIFT                3
    9 R# F* |% N$ |/ |6 ?, T+ _1 l
  56. #define TCINTEN_SHIFT               20% Q8 _: Z& e2 i8 K& C4 F
  57. #define ITCINTEN_SHIFT              21$ [3 P; W7 p; W1 H- d7 a8 G
  58. #define TCCHEN_SHIFT                22
    9 k. A  s! O5 l& |" E3 n
  59. #define ITCCHEN_SHIFT               23' A' m* L) y* z2 c' W' w

  60. - J& u) m( A- k
  61. static volatile int irqraised1 = 0;2 y% m- m; K. s) x. h) l2 v
  62. static volatile int irqraised2 = 0;2 f" \9 F) [; C3 i* Z3 j

  63. 1 |# w$ E& T$ Z5 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : j) t8 U$ t2 s6 o8 @7 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' f- {7 x' ^. T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S; l4 P& |: l( W' m/ \% u

  67. " ~. c: M. ?: w7 b, C2 ~' X3 p' F
  68. dma_addr_t dmaphyssrc1 = 0;
    0 u* _9 ]1 r  N
  69. dma_addr_t dmaphyssrc2 = 0;
    + _7 ?, W  [+ o3 V, y, J8 ~" j
  70. dma_addr_t dmaphysdest1 = 0;
    , c; p$ p: X+ `0 Q
  71. dma_addr_t dmaphysdest2 = 0;  |* ]" x: q3 [( S( t

  72. , y6 N/ }' K, l4 n- h* y
  73. char *dmabufsrc1 = NULL;
    9 M$ ~8 e+ x% W7 k, @. a
  74. char *dmabufsrc2 = NULL;1 p- {& q, C& f
  75. char *dmabufdest1 = NULL;% ]. c; F- J  r9 P5 u6 A! {. J
  76. char *dmabufdest2 = NULL;( [5 `5 o% m! ?1 V# `

  77. # @  D* I; J! }4 a$ q) s. Y
  78. static int acnt = 512;
    ; i- @  H) b. h7 a# V; a
  79. static int bcnt = 8;
    & D5 L8 \4 D+ \/ D
  80. static int ccnt = 8;
    ( w# A4 f$ ?6 w4 B
  81. / `/ e( D0 k8 s1 M
  82. module_param(acnt, int, S_IRUGO);) N. [; b  a" ^7 e
  83. module_param(bcnt, int, S_IRUGO);
    ) W0 m# N0 ?) B/ q# V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 W: w3 b3 ]1 A# z5 I
  |: n0 q2 h' w, O/ N8 Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ d6 i9 ~$ w6 V3 l) J. marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 {) w' q5 S4 `) _8 V* t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 u( _2 f  x5 P9 q

0 O3 u/ t' m( N* X! M- j+ ]5 D; o9 T# ?0 p, L2 P( V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 17:19 , Processed in 0.044313 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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