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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , `8 n$ b* _, ]. L! g
  1. [code]EDMA sample test application
    8 f2 Q# n+ K0 a1 M: j2 t0 G
  2. /*, K7 F( S! c! y9 E; Q$ e0 \
  3. * edma_test.c" M; s4 I. J, ]: o
  4. *, \6 y0 @4 t( D2 H1 y
  5. * brief  EDMA3 Test Application
    % L# r4 q5 ]- {: k- ?. i7 s/ C# Y
  6. *- |7 _! s+ [* Y# O7 T4 |6 {3 q* z
  7. *   This file contains EDMA3 Test code.( I4 N7 M/ }  X& M  d3 u& E. a
  8. *
    , `8 u! M5 J3 w7 r( {* K1 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & @/ b# }% m; s) M) R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 R( Y2 o" R/ `, \# o4 U
  11. *         TO CHANGE.' @) ?: U" T2 h' i
  12. *  Q2 P" {; j7 {2 N; U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + S5 A- u6 r3 A. H
  14. *
    1 ]4 \$ R9 b5 t7 F' l5 i1 L
  15. * This program is free software; you can redistribute it and/or! y6 i& T6 ^; Z8 u+ h
  16. * modify it under the terms of the GNU General Public License as; I7 [) Y: {1 ?' P) K
  17. * published by the Free Software Foundation version 2., _* n' o- f/ I6 `9 {- d* G
  18. *' m! E" Y: F8 B, A( s. @/ n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # u& v' Y" B- B) W1 o
  20. * kind, whether express or implied; without even the implied warranty
    . ~5 l: E* m$ F% C# W1 `% Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% `0 J# c' X8 t% j1 [
  22. * GNU General Public License for more details.
    , \% @: L) u5 y# A2 p
  23. */
    # P6 T$ A: v( h$ B8 I$ F

  24. 6 ~! k( X  M: k4 _: c1 _7 i
  25. #include <linux/module.h>
    % f6 K6 s1 k3 ]. o; e
  26. #include <linux/init.h>5 e+ x* u: G% z; K' Z  ~5 ]0 O
  27. #include <linux/errno.h>" s5 t6 P; x6 ?/ I1 E/ b
  28. #include <linux/types.h>: S; @* h. E$ M
  29. #include <linux/interrupt.h>
    8 m9 r8 a8 b! S: J6 X
  30. #include <asm/io.h># p: r& O" B/ {0 ~" Q$ D* V
  31. #include <linux/moduleparam.h>/ T! R& W( j+ B0 J! ?
  32. #include <linux/sysctl.h>  a8 O1 j& _* ?1 g
  33. #include <linux/mm.h>7 E. c5 S& i' r1 J$ W# T: |4 t
  34. #include <linux/dma-mapping.h>. G/ N, r" `7 p# T! u! A

  35.   u9 w! x) m% P, [# Y6 q
  36. #include <mach/memory.h>/ h' r/ \* m# b7 l: s" T2 ^
  37. #include <mach/hardware.h>3 {6 s; }. V. J* v9 ?
  38. #include <mach/irqs.h>/ f( s4 }' c. d6 t% w
  39. #include <asm/hardware/edma.h>8 F& P1 Q9 \. w9 O9 @: y5 M+ B8 l

  40. ! g+ P$ D) x" A. u: l) c8 y
  41. #undef EDMA3_DEBUG
    & M( o+ s$ M9 U3 g7 C4 x  e
  42. /*#define EDMA3_DEBUG*/
    6 {: P$ B8 u* m* j0 D

  43. 9 i; G1 A! c* @3 {. ?1 ]
  44. #ifdef EDMA3_DEBUG
    2 F, Y+ A/ r- h$ K* g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! Z2 [8 y! |3 i. Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / g% Y' l/ Q3 h: v/ F. k9 o. e9 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      T' d4 P3 a% U8 O: j
  48. #else5 ^3 z, L" K# J# d
  49. #define DMA_PRINTK( x... )9 o3 e1 G. }2 Z# h% P* [
  50. #define DMA_FN_IN
    & U7 n. [0 S9 M6 M6 X" r# E# y6 j
  51. #define DMA_FN_OUT
    . r9 r+ F9 |$ Z  h% v
  52. #endif2 F2 N" ]. c$ X$ p/ F  f3 A) B( V& Z

  53. % W/ @& V+ Y3 v  o( A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % ^5 J! i; w  z1 F9 r# E. O
  55. #define STATIC_SHIFT                3
    . N2 E1 s+ B# q9 ^+ \: O( w
  56. #define TCINTEN_SHIFT               20% R# i7 c) O+ D/ o4 y) V: T
  57. #define ITCINTEN_SHIFT              21
    ! Q. e% u! t8 `
  58. #define TCCHEN_SHIFT                22
    5 }$ C( z: ?6 c: l( t! s. a
  59. #define ITCCHEN_SHIFT               23. z8 m5 d- D" @. z9 _
  60. 0 O; b9 {  z2 b% o8 G" A3 I) ?/ w0 ]
  61. static volatile int irqraised1 = 0;5 R# f* j& c5 L
  62. static volatile int irqraised2 = 0;
    , A3 k0 T. _; ?" I# y/ n/ u/ y
  63. 1 s3 }8 |" {/ T8 j- y* l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k7 @# g$ u: l5 @8 V4 F: C, j- e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' A: d- C1 O+ \: e* c, A5 ?) c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , e  r0 O8 M% D/ K9 L' O

  67. ) I- A. m, l# w
  68. dma_addr_t dmaphyssrc1 = 0;
    , v. _: {- L" ~, y: ~
  69. dma_addr_t dmaphyssrc2 = 0;4 i+ A# q. g( b  G, Q
  70. dma_addr_t dmaphysdest1 = 0;* h$ r7 o! L4 V4 U
  71. dma_addr_t dmaphysdest2 = 0;" y+ U3 Z  W. _/ M' y
  72. * ?& K6 L0 Z  W  T& q# g+ _9 S8 D
  73. char *dmabufsrc1 = NULL;
    3 v; L; _/ G, {' S, Z5 ^% o% T1 q
  74. char *dmabufsrc2 = NULL;
    + j. t$ t: k5 c, Q
  75. char *dmabufdest1 = NULL;; V, Z, L( M  R6 D5 y6 t# ^
  76. char *dmabufdest2 = NULL;
    ; Y6 s1 u7 C% N* s, \
  77. & v% t5 d3 p! f7 u: p- b" `
  78. static int acnt = 512;
    5 Y5 [( O* r+ i! K% }; _6 R
  79. static int bcnt = 8;
      E% H8 `4 c8 k2 V# p
  80. static int ccnt = 8;
    + `- @2 X. M2 F1 d# G, N; c
  81. # U* A4 J6 `$ P5 _
  82. module_param(acnt, int, S_IRUGO);
    . x4 B& g+ g8 d, k3 l/ {
  83. module_param(bcnt, int, S_IRUGO);4 U. k, P/ N5 Q9 T: j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  p1 j! F8 \- g; w

7 Z/ I# A, A& L; ]+ z! p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 `' j7 b; p4 o4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) Z" y# ~- Z+ s1 u- r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 q9 r* G& ^5 I6 o2 x2 P( J3 \. \: Z: [) l  y' k) J+ H9 w( w' n2 s' k& ^
/ s; r5 B1 U; Z+ N0 w1 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 19:12 , Processed in 0.041287 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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