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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% u% e! L! J5 q- |, {& o% ~* `
  1. [code]EDMA sample test application
    ; `, V) D8 Z1 D3 e
  2. /*+ U0 l( o8 J5 z1 J8 K8 o
  3. * edma_test.c
    ) u6 X, a$ M  t. O9 w
  4. *% q0 D! x0 t8 c8 K0 _
  5. * brief  EDMA3 Test Application( y; J6 P) V: S6 r! `& }; m8 H
  6. *
    & Q8 W$ p* t6 V( Z$ a; q
  7. *   This file contains EDMA3 Test code.2 D7 Y8 q9 M: x5 R* V0 Q* W
  8. *1 L$ D% T! @# D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% |. F4 P+ o2 J" u# u& G& S6 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      M( G* _' Q6 _0 D, T+ Q
  11. *         TO CHANGE.
    4 m5 L4 ~( {! q1 ^
  12. *' d* Y2 L* U$ a0 B$ S2 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 A3 d# z1 D8 O
  14. *
    ) T5 e( l  _, [' {; @' R" V# C1 a
  15. * This program is free software; you can redistribute it and/or
    . N" E: ~0 M$ \$ p
  16. * modify it under the terms of the GNU General Public License as
    . [" E1 n0 M; i+ ?
  17. * published by the Free Software Foundation version 2.( }* \" c1 e2 T  m* o) P  v- O
  18. *4 M. A$ W' ]  [9 r+ l# O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' i1 i7 n6 k7 K  E: _6 H& x% N
  20. * kind, whether express or implied; without even the implied warranty
    5 O; C6 o: J8 l1 R% T+ B8 }1 M0 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 c" o2 h( Z! Y# w+ R  }: a
  22. * GNU General Public License for more details.
    / X9 L: V; L) g, ^3 ^! h
  23. */
    0 e8 H0 F# A# Z& N2 |

  24. $ |' d5 r+ u9 @& Y1 k: P" {
  25. #include <linux/module.h>
    $ D) ^0 z+ F9 V/ f0 ?; M
  26. #include <linux/init.h>
    0 |* X; x& S' U) p: |
  27. #include <linux/errno.h>
    + ^6 u5 \9 J5 p3 I4 t0 N
  28. #include <linux/types.h>6 ^& y. J7 J8 H% A' ?$ O% ?
  29. #include <linux/interrupt.h>
    5 Q) h9 o. F( s3 e2 L  q2 c3 N
  30. #include <asm/io.h>
    ) V% N6 J6 a7 a7 ~. q
  31. #include <linux/moduleparam.h>
    2 k0 x6 [3 p1 G& S
  32. #include <linux/sysctl.h>& ]3 D" S$ b6 j) d# K1 S
  33. #include <linux/mm.h># x9 a3 [1 R4 J) b( z8 u/ b. w
  34. #include <linux/dma-mapping.h>
    / J% S* H% r& n& ]& Y1 z
  35. " i1 ?6 B- r9 P! E5 O$ z' Y
  36. #include <mach/memory.h>+ Q" ?; W2 P" f1 X; z
  37. #include <mach/hardware.h>+ Y; v6 k. T0 V; e7 @
  38. #include <mach/irqs.h># o8 }: Z+ h& Q6 R
  39. #include <asm/hardware/edma.h>
    * |# R. j. c0 q
  40. 9 V$ d) o* ]: m+ Y" n- S
  41. #undef EDMA3_DEBUG1 r/ \. g" {; s8 Y9 ^
  42. /*#define EDMA3_DEBUG*/0 o- b/ d& C8 s8 E6 r& }5 h

  43. 6 e6 z( |0 d9 e7 M
  44. #ifdef EDMA3_DEBUG4 r9 ~2 p# B* X, L# V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): A. |7 ]7 o. x+ {8 ^: u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      q5 R/ \% N0 F2 a  G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 g5 ?. }6 l) ?% j' R6 X
  48. #else
    : ~! Q, W: N, e7 Z& Q4 O
  49. #define DMA_PRINTK( x... )$ [( w- J+ I5 |" J
  50. #define DMA_FN_IN0 R; a/ w& N* z: {' Y) A, i
  51. #define DMA_FN_OUT- E: \/ M  U$ }6 G# b' l: k
  52. #endif
    6 ^3 m3 p7 @: B

  53. 3 F$ e2 q4 D3 H* M1 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & n: O1 v5 p3 r# b1 A6 q
  55. #define STATIC_SHIFT                3
    . F& X3 [* K, p- D3 d
  56. #define TCINTEN_SHIFT               203 ?& f+ A# K, d/ ]# P
  57. #define ITCINTEN_SHIFT              21
    7 Z4 f2 w) a) m0 Q% O9 G
  58. #define TCCHEN_SHIFT                22) i6 r. p' A" {1 ~
  59. #define ITCCHEN_SHIFT               23
    9 F+ I, p; I) g& j9 D& Z) p
  60. # D" x+ ]' V. G  B8 x9 f
  61. static volatile int irqraised1 = 0;
    ( O5 Z( |/ d$ `- x
  62. static volatile int irqraised2 = 0;
    ( C# p4 B! D  ~# l
  63. # i6 p4 f& n6 f* _7 ~7 f5 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- D5 U9 C+ A2 g7 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( W, U4 j1 _7 ^3 `- e5 c( v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 z1 F9 z; ^) V9 z( f/ E+ ?/ l  Q

  67. $ A- C/ c8 z. r- {0 m9 B  q
  68. dma_addr_t dmaphyssrc1 = 0;
    5 D, C" K  F0 N6 z" e
  69. dma_addr_t dmaphyssrc2 = 0;" G; L# |" d3 [( F. K
  70. dma_addr_t dmaphysdest1 = 0;
    + ~- s" H7 M- A/ A: V; h  C
  71. dma_addr_t dmaphysdest2 = 0;
    / q6 K8 ?; t9 G% B% @9 }9 G

  72. & N1 \5 @3 Q! s  J$ x1 |
  73. char *dmabufsrc1 = NULL;
    & K4 i6 l3 {( a' k8 c
  74. char *dmabufsrc2 = NULL;4 d+ S1 F0 z% I
  75. char *dmabufdest1 = NULL;  J* f; s4 z, |8 i" G
  76. char *dmabufdest2 = NULL;3 P5 B' s2 F' U+ J; s& p' x) g
  77. ) O( H' x7 m: z; Q# }& s0 }
  78. static int acnt = 512;2 C- n( `& i0 R
  79. static int bcnt = 8;% L4 G  A  k5 P, U) L$ q
  80. static int ccnt = 8;* I0 o! y( x5 k" a8 U; K- @# t
  81. 2 H. U# p. J. T4 ?- N/ b. s& c3 C, A) U
  82. module_param(acnt, int, S_IRUGO);+ r3 J4 @8 |  M% _- g* S
  83. module_param(bcnt, int, S_IRUGO);
    6 Y6 S/ b+ D- [# g+ Y+ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) Z* q9 a$ {% T% d, y; m# D# F% G0 O9 }& H3 L4 O5 Z# G# Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* `* k( G$ X' m) c* a' @" Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 Q) W5 T" H# H5 f/ y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 n* `, O; H) b7 N, R8 _) n* B% _, ~) N: f1 T3 c4 V/ U
) s/ R, x  F! A( z+ s/ w; K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 13:15 , Processed in 0.039139 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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