OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , O* j/ ^* Z& O' Y5 p
  1. [code]EDMA sample test application/ W  o7 O' H5 t" e
  2. /*% Z- j; G+ s: J: P* r7 l
  3. * edma_test.c
    6 x+ [- y% s" U
  4. *1 \* V% n- O5 F' y' g
  5. * brief  EDMA3 Test Application% {( V8 ?) y4 U5 R! Q% |& C4 Z1 u
  6. *) M9 O1 P( l  h8 u9 W4 o
  7. *   This file contains EDMA3 Test code.
    ' P2 ^# q7 L: f4 i- w/ i  S- v/ L
  8. *9 _: W' g& r& k$ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 t- P, v- E, R5 g+ W. ?: D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" f  Y6 M  Q2 G
  11. *         TO CHANGE.
    0 x% c  b2 e9 b& ]" h* p
  12. *# g/ r5 r- O. z7 ^$ v. B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 _5 ?2 V" G/ C" \  O+ b7 A
  14. *" B9 l& F9 z8 i3 ~0 d' s: |( F- Y
  15. * This program is free software; you can redistribute it and/or% q# a7 l" H& G" B0 m$ @, n! S0 U
  16. * modify it under the terms of the GNU General Public License as/ l% N8 |+ Z; @; t% M. ]. g: a
  17. * published by the Free Software Foundation version 2.
    % }: C/ Q% `0 G5 ~
  18. *
    % U8 m( z6 m& B7 J1 u5 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , A3 I9 t% @5 M3 \& s3 J
  20. * kind, whether express or implied; without even the implied warranty* J8 P4 B$ x' X* k/ _+ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 d7 |$ Z: O% T( g: B" Q8 d
  22. * GNU General Public License for more details.* e. w& d* M6 k' {9 B: b
  23. */& w9 y3 y; \, b1 P

  24. - I9 m6 s5 N9 u: v4 f
  25. #include <linux/module.h>
    / D7 I+ p" O( E; N' k( G, y/ L9 O  e
  26. #include <linux/init.h>' `( F. S1 R* H- l
  27. #include <linux/errno.h>( I8 l) |+ W- T! r  {
  28. #include <linux/types.h>5 I/ B# @6 {6 l7 |
  29. #include <linux/interrupt.h># G  s  k4 p: \$ E5 m) o
  30. #include <asm/io.h>
    $ g: Q8 ^/ g1 c) i3 Y
  31. #include <linux/moduleparam.h>, H( a. z% [+ T5 [. y% p
  32. #include <linux/sysctl.h>$ h) y3 Y8 W5 k7 m1 L; x8 ^6 T
  33. #include <linux/mm.h>0 r2 u' G9 @; G3 \. D9 t
  34. #include <linux/dma-mapping.h>3 H+ U: W/ b, |- j9 v" |. C

  35. 3 d2 \) |- E3 H7 [. [
  36. #include <mach/memory.h>
    0 S1 ?; D; L7 J
  37. #include <mach/hardware.h>4 x4 @8 u" c2 n+ e6 w
  38. #include <mach/irqs.h>
    0 M3 o! W- D0 l% I
  39. #include <asm/hardware/edma.h>' M& A! J; }# ~5 \: I

  40. + S% j/ u6 ^  u& p. M
  41. #undef EDMA3_DEBUG
    : {/ v2 o1 x# K8 t
  42. /*#define EDMA3_DEBUG*/; @& Y, `& o0 h/ z2 F/ F' L, I+ d
  43. ' Y/ M6 ]1 k1 w7 Z& `
  44. #ifdef EDMA3_DEBUG  A5 V, B4 Q, X0 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 b; }+ x+ T/ k* s$ g2 t# y! K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 `# ~( j- y, u5 \5 B( E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + Y- j8 L5 F; x0 f  Y' c0 T
  48. #else
    / n* [6 Z) z, n% c
  49. #define DMA_PRINTK( x... )
    % i) [& Z3 q! ~, Z0 Q+ o
  50. #define DMA_FN_IN
    7 {4 U* m6 b7 X% q. P
  51. #define DMA_FN_OUT
    2 D+ g0 ~. K  y0 k9 @6 F
  52. #endif4 c3 W6 L9 [  r: p8 s

  53. / S" i9 Q+ v# d  {9 P$ V* ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 r# J* A5 M$ {/ ]/ j! ^6 f2 R
  55. #define STATIC_SHIFT                37 x1 A  l8 M# I% `9 |, J
  56. #define TCINTEN_SHIFT               206 ^& J8 J& R, f- V* g  f8 c
  57. #define ITCINTEN_SHIFT              212 }9 S! ~& n* Z6 x/ p0 |
  58. #define TCCHEN_SHIFT                22, }8 V6 ?9 N6 i, I
  59. #define ITCCHEN_SHIFT               23
    - W5 T3 e5 ~3 K( Q7 _; V9 ?) \" w
  60. : m  K  U" q0 q
  61. static volatile int irqraised1 = 0;" p( ~* E) ~5 i: E) }
  62. static volatile int irqraised2 = 0;/ D. M$ A) z5 W$ r5 V

  63. ( W1 M8 W/ D2 j, z) S  Z& K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 _1 g/ ?/ |) n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M# b& @% g. j2 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S$ K- x. c1 u$ T$ s9 |. ^
  67. . `% I% K7 V, j) P
  68. dma_addr_t dmaphyssrc1 = 0;
    ) k" J- p) P  H- r/ f' o; j3 v
  69. dma_addr_t dmaphyssrc2 = 0;7 y7 E# W7 n1 ]6 w2 _8 x3 u7 b( e/ G
  70. dma_addr_t dmaphysdest1 = 0;4 i- y2 m# h1 J, v6 d  |
  71. dma_addr_t dmaphysdest2 = 0;
    8 P/ I$ J' J5 {# o
  72. ! m8 H% Y7 w& {& t5 B* Z* G% y
  73. char *dmabufsrc1 = NULL;. x# `& \; c* w' l8 r
  74. char *dmabufsrc2 = NULL;
    * c$ Z8 q8 m- G0 |( B
  75. char *dmabufdest1 = NULL;
    + i( N  w% j1 O! G/ k. v& @1 {2 ]
  76. char *dmabufdest2 = NULL;
    8 L0 w1 j. d* @" s) q# a

  77. " |. B+ \0 R  a  B) B6 l
  78. static int acnt = 512;$ Y6 B8 C; ~" d. i
  79. static int bcnt = 8;1 o  [+ ]& {2 Z! J; H) I1 k
  80. static int ccnt = 8;
    + f6 U( v- {2 Q- V
  81. 2 D( C/ j2 P  f9 ]" w) q6 W3 I
  82. module_param(acnt, int, S_IRUGO);( X- v3 D$ r2 o7 n
  83. module_param(bcnt, int, S_IRUGO);
    ( k5 @1 U2 \0 J5 J+ X' L- W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 z+ _% Y) T8 U3 |& s# ^- L  `
9 Y6 L; ]% x& `; J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* y4 t) {, f% b7 P' i+ ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  X2 q$ y2 y7 @- E; b" w2 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- |; y  r" F$ r8 t) P0 o
! Q7 X0 H; p+ K
9 N7 ^- \0 [$ s+ `  t+ q3 q" k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 20:14 , Processed in 0.040580 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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