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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( F+ P% d* h. a' R) g
  1. [code]EDMA sample test application0 K8 w: u7 Y% k" i
  2. /*
    2 N; |( G$ ^7 Z/ U9 I
  3. * edma_test.c: Q; a8 }" e2 n+ K* \
  4. *
    8 F/ Y  }9 M5 \+ |
  5. * brief  EDMA3 Test Application6 J* Y4 l! A/ g0 b$ c8 a
  6. *+ S) d- F+ Q# z, Z, r
  7. *   This file contains EDMA3 Test code.
    % Z* j7 j( v+ {6 _3 c
  8. *3 V& m- L: b, A  w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 x$ C! D! T! t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 S/ K6 r" V4 q
  11. *         TO CHANGE.
    - H4 C* E$ ^/ ~1 e5 u
  12. *) J6 `" ?' k2 n+ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ~" c0 L6 t9 n+ x1 p
  14. *4 F0 X1 k6 f. p
  15. * This program is free software; you can redistribute it and/or
    6 ^# a5 B2 y* d( h
  16. * modify it under the terms of the GNU General Public License as* _+ {8 c+ E; t) l6 R/ h: P
  17. * published by the Free Software Foundation version 2.: z( `) D; s8 `, O" p
  18. *
    + _) [, S) p# G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. V* c8 f3 _5 V0 C
  20. * kind, whether express or implied; without even the implied warranty
    6 t/ W  |' e9 S7 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 U5 a& V( u# b) d1 h6 N, {- c6 R% n
  22. * GNU General Public License for more details.9 {9 _' S! ~; x" P
  23. */+ b/ F" d, r" T( }# R- r9 B. A
  24. " r. ]! c) s6 u2 Q' t
  25. #include <linux/module.h>
    " i+ V% L- n) n% y+ C
  26. #include <linux/init.h>
    ' Y+ r7 |1 w9 i9 t* J7 ?+ E% n
  27. #include <linux/errno.h>) R) C6 i8 n4 I: ~! C) N
  28. #include <linux/types.h>" Q4 o- W3 n7 V8 F* h' k
  29. #include <linux/interrupt.h>7 T9 Y6 X/ d+ E) K$ b0 b/ A
  30. #include <asm/io.h>
      Q1 T+ `$ l$ J# t; ~, ^% J
  31. #include <linux/moduleparam.h>
    * U4 J. I5 l! n2 @; D( v
  32. #include <linux/sysctl.h>
    1 k7 `# i( o& e! E& M
  33. #include <linux/mm.h>
    . N6 e6 ^2 @+ m8 K0 x+ S6 U" H8 r' g
  34. #include <linux/dma-mapping.h>
    * G9 N; _0 n6 o/ m+ `

  35. / P- M, }' p% t
  36. #include <mach/memory.h>3 }% C9 j' }3 O" s2 @
  37. #include <mach/hardware.h>  S( `6 t3 X$ _) w+ n/ e# F- V
  38. #include <mach/irqs.h>
    2 D% N: O$ Z/ W8 I9 j. `5 V! a) ~
  39. #include <asm/hardware/edma.h>
    5 t- z& [" s6 G6 ~+ s6 H

  40. $ Z  p1 ~$ m2 [$ C+ U4 K7 S
  41. #undef EDMA3_DEBUG$ v% K  N! E/ `% t
  42. /*#define EDMA3_DEBUG*/. `5 I/ N; h2 I$ j

  43. : c0 q1 l; f$ ?/ V
  44. #ifdef EDMA3_DEBUG
    ; z6 _* h; U- Y# K- m% J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . J, _" g8 h2 a" {! f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * }* H. c9 d3 `' _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . w: K3 A. i& O# [6 n/ l& x
  48. #else( W6 R, n7 N, R0 q& P
  49. #define DMA_PRINTK( x... )
    7 l- b9 b1 p+ B: h9 Y) Z
  50. #define DMA_FN_IN
    9 ?, a; [8 _7 |9 c4 k4 Q
  51. #define DMA_FN_OUT
    , }6 S- f0 o. c; N1 G
  52. #endif7 {3 d1 h  x2 v$ |% F  I! A* w
  53. 5 a0 @  N5 j  N) b) B" B: s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), ?( R2 ?3 u. x5 M5 ?4 D4 _
  55. #define STATIC_SHIFT                38 A7 Y* R+ N$ q. V
  56. #define TCINTEN_SHIFT               20( v: F5 Z" B, ]1 D, h. R/ q
  57. #define ITCINTEN_SHIFT              21- b& q$ G% }1 I4 m& s3 v6 l
  58. #define TCCHEN_SHIFT                22
    5 w" u( b3 u' Z
  59. #define ITCCHEN_SHIFT               23
    & m0 f  A1 {0 z% D

  60. - k* a# |* V4 Y/ I9 {7 q
  61. static volatile int irqraised1 = 0;% ?' r( |, p$ V" x) g7 Q
  62. static volatile int irqraised2 = 0;
    6 }$ i' @/ f- [  K9 v; }

  63. 5 I/ c) ]  D  n. b( }/ G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" h8 m! q8 O5 C9 w* n* z$ l2 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : M; B" \  t* i, I, a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 h! X' ^; o* f6 _/ d& ^
  67. % Q- |6 l5 }# c. T! U; c
  68. dma_addr_t dmaphyssrc1 = 0;/ ]2 u* a9 m- v% x
  69. dma_addr_t dmaphyssrc2 = 0;8 E# s& ?# X! A: l2 {
  70. dma_addr_t dmaphysdest1 = 0;% w) f; v8 M- q% v9 g  I9 f' l
  71. dma_addr_t dmaphysdest2 = 0;
    - `6 o3 B0 g+ ]

  72. " P% ^0 C% Y( `$ P# D' K" w) c  `( y
  73. char *dmabufsrc1 = NULL;: e1 K: x( L% x/ e. p% f4 F
  74. char *dmabufsrc2 = NULL;4 V# l; P5 a' V5 [1 x2 x
  75. char *dmabufdest1 = NULL;/ F  a7 W' s: n$ s8 R0 ~
  76. char *dmabufdest2 = NULL;" |& u' _: `, n$ N! G
  77. 0 E, t. R1 h% y5 I. A9 x
  78. static int acnt = 512;
    ! W3 y, u) r1 a2 I" A# b* N  h
  79. static int bcnt = 8;
    / A! i& f. r5 w0 L; T. S
  80. static int ccnt = 8;* w8 }; e4 Q# K3 c

  81. & S  S' T3 f3 g0 o- P
  82. module_param(acnt, int, S_IRUGO);6 l0 {, F4 _! i
  83. module_param(bcnt, int, S_IRUGO);( P  N# p# e% p6 w& e+ a4 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 x: B  N6 V* p$ x3 f5 O: [$ \

( G* }4 _, Z( ]! i$ C) |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% V1 H+ }5 @" T5 ]5 S* L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) f( ]& S4 t( Y, Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% _0 Z0 u5 W2 p( ]/ n

! p. g7 X# N0 X$ x$ g% s% N
) V/ c- H& ]8 t& }( G1 u# {; Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 00:52 , Processed in 0.036739 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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