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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! X) C% ]8 D+ @: Y+ \
  1. [code]EDMA sample test application. r2 M: A* I: _/ L
  2. /*
    3 P9 y- x7 [* S0 M- v
  3. * edma_test.c7 ]3 [  K7 D& V5 D3 }9 v
  4. *
    ) a* C1 a% X/ F! N
  5. * brief  EDMA3 Test Application* o6 ^- J- i5 [; x$ O
  6. *; A: G' r2 ]( a- h( V
  7. *   This file contains EDMA3 Test code.# _6 s+ n9 ~) e' W
  8. *0 I7 t3 T( w; u% r& T7 Y' t' q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; o2 b+ B. U; ~& ~* J1 t' a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 L% K2 t3 b0 ]
  11. *         TO CHANGE.
    . t( T7 w$ @) o* G0 H3 g: a( z7 V
  12. *
    9 o( \7 f- e9 r! N) g. A; d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : n' _% Z8 e! Z& c, E
  14. *; h- D  {3 B7 w; X% G- G9 \; v/ G
  15. * This program is free software; you can redistribute it and/or5 a5 A; @1 c1 L. A
  16. * modify it under the terms of the GNU General Public License as. O7 p3 y9 x1 X# E* p4 U: @0 z6 C
  17. * published by the Free Software Foundation version 2.  J+ J* C7 Z# Z$ \
  18. *
    ! C4 o5 L: \& M$ R# @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- j8 N  ?8 t! O% H; ]
  20. * kind, whether express or implied; without even the implied warranty
    / P+ c) M! q- v& x7 V% H# ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 P1 K* Q! V. C0 L4 Q" T2 p
  22. * GNU General Public License for more details.
    ' r8 z" K3 ^; ~, a; `
  23. */6 P! l$ i' B0 w+ P- J

  24. , n3 ?2 @5 B& z3 ?# a
  25. #include <linux/module.h>4 I) v2 j) S! a4 l) W! l( g
  26. #include <linux/init.h>
    ) Q5 N  ?8 `) m, {9 E% k% I
  27. #include <linux/errno.h>
    . C. l( C1 m5 D! B+ F
  28. #include <linux/types.h>" J* {9 O0 a* `' J
  29. #include <linux/interrupt.h>6 a$ ]; M4 q. B: c
  30. #include <asm/io.h>
    / Q- P' R" p7 n
  31. #include <linux/moduleparam.h>
      f& P$ U3 r7 g: T& L$ i" G
  32. #include <linux/sysctl.h>& W# ^' o+ Y8 i/ J/ ?+ a
  33. #include <linux/mm.h>
    & v7 V, `: G9 x, ^' J6 [+ R
  34. #include <linux/dma-mapping.h>
    : F# Y+ `' U: |' l9 q6 `( H

  35. 7 p" U* O- k0 M, a, [9 f- Z6 ^+ f* b
  36. #include <mach/memory.h>! H2 b$ A5 J. B4 ~4 K+ |
  37. #include <mach/hardware.h>5 w7 j% N9 a) F
  38. #include <mach/irqs.h>
    % J8 c# D0 ^5 r& M3 {- P. J3 E6 }
  39. #include <asm/hardware/edma.h>; O3 D# N! ?0 Y. b# m; K

  40. ! {9 i, G4 ?$ s5 G1 i. j& w& G
  41. #undef EDMA3_DEBUG8 ~  A1 N* Q3 j8 L8 Q
  42. /*#define EDMA3_DEBUG*/% z# ?/ G8 ^; f# ^9 v. l) f

  43. 3 {- C* L5 b/ ^- P3 [$ k% G3 Z
  44. #ifdef EDMA3_DEBUG: u  H, c/ m! q9 Q9 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 z& W& G$ _1 z5 X  D& @8 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + f1 p/ {. ^* n+ s- U$ F: d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * ~' |0 f6 v  w. v. x" L* t$ C6 f2 J
  48. #else
    6 m( `. C/ \2 A9 @( T% |9 c+ y
  49. #define DMA_PRINTK( x... )
    ' E, `$ W4 V% |' e* Z
  50. #define DMA_FN_IN1 b( ], ?( b* K7 Y
  51. #define DMA_FN_OUT
    ) T5 S7 o1 y/ ^5 F/ ]9 ~' T
  52. #endif; [, f0 Z9 i' O6 G( a* U

  53. 0 z: x; k: _+ H( S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) u2 U( j, s( ?/ k' _
  55. #define STATIC_SHIFT                3
    5 D7 j, J/ P. c
  56. #define TCINTEN_SHIFT               20
    5 S* [9 Q# A4 E% R) U4 N8 M" C) u5 v
  57. #define ITCINTEN_SHIFT              21
      m; D3 J4 a0 n9 f8 @2 l7 n
  58. #define TCCHEN_SHIFT                22% Z3 ]' o/ d' t! C) G
  59. #define ITCCHEN_SHIFT               232 A7 A9 K2 p5 F" ]' m

  60. ' a3 F& W3 \! J$ P  D2 ]
  61. static volatile int irqraised1 = 0;2 p- Y: N' _& t# I( t+ n8 P& {5 i
  62. static volatile int irqraised2 = 0;
    0 J/ p0 p4 b  }0 V+ V2 R. R# h+ |

  63. 9 [4 x, W& Y3 x8 M( ~- i9 O5 @4 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) j! ~+ E8 J5 `; y. M/ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! h6 \; C2 U& }0 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 T" M5 w; L! i3 E7 x& L. ?& S

  67. 6 v! |+ f, G, N; n% a7 `
  68. dma_addr_t dmaphyssrc1 = 0;
    " k" t! S2 O' Q
  69. dma_addr_t dmaphyssrc2 = 0;+ ]& f7 j- o) z0 [( R1 D6 N0 m
  70. dma_addr_t dmaphysdest1 = 0;
    - ~& @5 I# |2 R+ h) z7 J' c8 p
  71. dma_addr_t dmaphysdest2 = 0;; r, f% C9 X  o

  72. 5 y6 ]8 ~2 D; e2 U
  73. char *dmabufsrc1 = NULL;
    ) Z1 h0 F/ Q. A1 a" N- B9 ~
  74. char *dmabufsrc2 = NULL;' c; b* v' b: J; S6 C  Y* G
  75. char *dmabufdest1 = NULL;
    9 `' @- l4 V( }3 V* B
  76. char *dmabufdest2 = NULL;
    & ]$ V/ K' v9 Y5 O2 H: d
  77. % |( @" h  w: V
  78. static int acnt = 512;8 {2 \+ G0 |8 J8 H: e4 Y
  79. static int bcnt = 8;: C' @( @& I6 L- d& p+ {: ]+ ]
  80. static int ccnt = 8;4 d$ S& k' A7 Q# g$ Y5 }
  81. & q4 }! ]7 u8 W# |# }
  82. module_param(acnt, int, S_IRUGO);
    0 J, j! m. ?, C0 A# E; I
  83. module_param(bcnt, int, S_IRUGO);
    , y) C$ p5 |1 c% {! z% e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 t. Q) u, c: U4 y4 }
" a  P' Z" T) P7 C* \2 ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( M( d. O" ^- @# P& b* K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Y* P! ^% R8 y2 O/ N/ P! Q% M/ S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ~# A6 H' A; e1 c; ^( z; Z; B; X6 x/ T% i* m+ U8 U4 g
* ^2 j! N3 A3 p6 s# n1 A% |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 08:04 , Processed in 0.037000 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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