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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! \$ M3 T$ Y- N4 |& p3 m
  1. [code]EDMA sample test application
    / o3 m* I. S, `6 q( q
  2. /*
    / R3 O' v, P+ v! k+ U
  3. * edma_test.c
    2 F/ G0 Z8 h' L* n4 U  T: L+ u
  4. *
    - J# k) @. }; }& T  u
  5. * brief  EDMA3 Test Application
    7 ]: p7 V$ a+ z' O% S% z& r  ?/ A, y
  6. *
    " z/ K+ v" `5 j8 @
  7. *   This file contains EDMA3 Test code.: T2 |1 \7 E7 ]9 U- ?+ c
  8. *2 d  _  M- v7 o$ V! S6 {3 A# d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) Z/ ]5 u( p. w/ f" K  v3 b) U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- c; u$ A1 V7 a. n/ E
  11. *         TO CHANGE.
    : l2 q! E! ^" |& m: l/ {& D
  12. *% ?; Q& s+ p9 \" |1 v+ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! P, U+ _* i0 p
  14. *
    * X/ y: S3 m0 p2 [' p0 }0 {
  15. * This program is free software; you can redistribute it and/or9 ?* B2 Y$ j2 x+ r
  16. * modify it under the terms of the GNU General Public License as" c. L! [% [4 f3 [! b) ^1 v$ G) y
  17. * published by the Free Software Foundation version 2.( e  E( O; T& n( m$ }
  18. *" E/ n3 P# m& Z: h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . {& s) n4 ~8 G- H7 p' o
  20. * kind, whether express or implied; without even the implied warranty
    3 h+ ~+ [+ Q$ N4 ~/ J* p- j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) q% N9 a$ a0 }7 x& ?5 T
  22. * GNU General Public License for more details.% J' f8 K8 ^# Q( d9 h. g1 F1 e
  23. */
    * P# [( }  u. i# O4 ~; y0 N+ y0 H5 Y' B

  24. 0 O$ @0 X* G% A/ E1 {
  25. #include <linux/module.h>* T' c! h* r" w, q" {& ^  l' s; g
  26. #include <linux/init.h>" l/ [. X1 R6 O- p3 W# \. u' z
  27. #include <linux/errno.h>
    ! `! u* a9 r2 Z3 l$ i
  28. #include <linux/types.h>) e" w$ V; S! W! |
  29. #include <linux/interrupt.h>  n/ q  l' _5 C  V. `6 S
  30. #include <asm/io.h>$ n/ P2 {/ h( P& E" u" A# S
  31. #include <linux/moduleparam.h>
    4 M( t5 [  p; j9 \6 z& l
  32. #include <linux/sysctl.h>, w6 e3 A* w$ s7 W. X5 N0 q* c0 e
  33. #include <linux/mm.h>
    7 }4 N+ q8 t# L( ^0 [' O7 L
  34. #include <linux/dma-mapping.h>! \" C" X, _# g/ M5 {7 w
  35. , f3 Z% z& d* ^
  36. #include <mach/memory.h>
    ; J4 H+ U8 R2 V+ r* I8 P' j# U  ]2 s3 d
  37. #include <mach/hardware.h>& @* E/ |  G3 A; h* x. a% |. o8 s% H8 u, c
  38. #include <mach/irqs.h>/ |# N4 z3 ~& G) r8 R2 k% C& Z
  39. #include <asm/hardware/edma.h>+ w1 v* D1 w: V7 d7 \  L- ^/ E- a0 i

  40. 6 M5 A) x+ P" q' F6 D' Z/ {6 D
  41. #undef EDMA3_DEBUG. X0 q1 {: @" b
  42. /*#define EDMA3_DEBUG*/# G0 _5 |& a; i$ O9 A
  43. 9 n7 \% G8 e5 E9 V! K4 O
  44. #ifdef EDMA3_DEBUG
    * I' b0 b% s( z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / V( `6 e! `0 T) G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 P3 @6 M- }  }; L; ~- K+ k/ O& _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 s; ^. @* s9 a2 E4 s
  48. #else4 s! k* D; R5 K
  49. #define DMA_PRINTK( x... )* v" K. i+ N3 k( v) c) p
  50. #define DMA_FN_IN" \4 `8 o! Y' _$ W/ F* c
  51. #define DMA_FN_OUT8 a* o! g9 B/ y. [, S; f2 K
  52. #endif4 ~$ L: L- a  ]/ v
  53. # Q- F# A1 a, S( }3 H8 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' P$ h* K( h" F  j
  55. #define STATIC_SHIFT                36 T7 j+ w, T: g! ~
  56. #define TCINTEN_SHIFT               20. Z3 p: s+ Z; {: z
  57. #define ITCINTEN_SHIFT              21
    , I: I  ~$ b# ?! v6 t) G$ Q4 x
  58. #define TCCHEN_SHIFT                22* S  g  Y  \; Y% e9 R' h
  59. #define ITCCHEN_SHIFT               23# l9 R  ~6 }+ o. L3 n

  60. 0 ~1 v6 S8 H, e+ K: w$ B: @& N. b
  61. static volatile int irqraised1 = 0;
    * d0 _7 p8 U1 W* q- w
  62. static volatile int irqraised2 = 0;0 j0 H- f. q6 }* l& l, c( D
  63. 5 Y; h5 R2 D! ^; x* s1 C# d( y: U& u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ H+ Q9 q. j; j, X! e/ ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }5 B6 l; v6 p* b6 S& m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; \0 w, y2 I+ }9 u

  67. ) w/ s( g3 m6 R7 i
  68. dma_addr_t dmaphyssrc1 = 0;4 ^3 D# a4 ~; v
  69. dma_addr_t dmaphyssrc2 = 0;
    2 o/ c  z% F2 i( |2 _' f" I
  70. dma_addr_t dmaphysdest1 = 0;
    7 O* G4 J8 h2 \
  71. dma_addr_t dmaphysdest2 = 0;
    0 r  D6 T" H: d( K
  72. - j/ }- {( e9 |! ?' Q$ K
  73. char *dmabufsrc1 = NULL;
    . f: O$ ?3 f  T
  74. char *dmabufsrc2 = NULL;
    % i' f2 x5 m0 c/ s7 b5 @
  75. char *dmabufdest1 = NULL;6 r$ \/ y6 G6 W& b
  76. char *dmabufdest2 = NULL;- [+ S3 [8 G7 u2 w. c
  77. + m$ i$ f& X2 k  x9 ^0 a
  78. static int acnt = 512;/ g. l) U/ {: G
  79. static int bcnt = 8;
    ( E; G- n+ D" e: H& T( ~4 |! f. A- Q
  80. static int ccnt = 8;
    7 [* x3 w, V! Z) o8 u/ E

  81. 4 T* x( j9 m: Z7 U: j: Q' i
  82. module_param(acnt, int, S_IRUGO);% v/ O, P8 v! B8 W
  83. module_param(bcnt, int, S_IRUGO);+ u8 W5 d+ `2 l: ]. M! M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ b/ W- n& B1 {) u: A

( j- \9 r) Z# n: ~: Y: e5 q" |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" i: Q% Q" F) b' m, G" `( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: b) h( I( N5 c: y$ }- q% o9 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, w! x/ c+ r& s$ q" b2 j
* _% X& F: y0 D/ v$ D7 V
9 i$ W$ l2 w& d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 05:36 , Processed in 0.036566 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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