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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 C' {6 N5 K3 M3 F  ^2 a# A
  1. [code]EDMA sample test application
    1 n+ r  F3 i. l' C9 K* v
  2. /*
    ) `/ S! c; T$ `! N  R0 {
  3. * edma_test.c
    ; G& h2 ?% M* \2 t
  4. *2 |) p# |0 u6 t: w6 O/ m) W
  5. * brief  EDMA3 Test Application
    ! u5 V% i8 A8 n' ^3 p
  6. *" y% a& m- p( |4 q
  7. *   This file contains EDMA3 Test code.7 \8 R3 r2 p6 n# n5 J  V
  8. *$ ]1 K2 o% z/ V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; _3 B  q; B# w6 Y5 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 F% A- f/ l, h
  11. *         TO CHANGE.4 H: N* N$ A* p! R
  12. *
    ; H! E; ?6 D3 V6 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + U1 E3 ?8 F4 E& @% y0 W
  14. *
    ; \! \) ?0 r& t: M
  15. * This program is free software; you can redistribute it and/or  F' L% z* e: s/ J+ j8 h5 }; @4 }' ]
  16. * modify it under the terms of the GNU General Public License as
    " ?) i1 r3 O0 e/ v
  17. * published by the Free Software Foundation version 2.
    # j/ ~2 N4 ]( v5 y% j, K
  18. *
    ! M- \# l8 ?) s! T$ m& R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" v% c" r# K- v
  20. * kind, whether express or implied; without even the implied warranty5 y+ \! O1 l# R( Z. F7 c9 x# A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 {+ ?4 e; P! s9 F8 q
  22. * GNU General Public License for more details.2 H9 V5 o" }1 v4 `: K0 C$ n. `9 I
  23. */
    + |, Y7 l# P% g$ [! E

  24. 6 m9 b; ]' `0 q/ ]* a
  25. #include <linux/module.h>
    % G* U6 e! H6 C' m/ H
  26. #include <linux/init.h>+ [" u+ P1 P, ^0 i1 E
  27. #include <linux/errno.h>1 z; I- g% P7 s9 M
  28. #include <linux/types.h>/ G: K6 T4 ~3 B9 b0 R, S7 W
  29. #include <linux/interrupt.h>3 I7 q% I$ K& Z% W0 t
  30. #include <asm/io.h>, i- @, O- Z, }( d8 \' c# a
  31. #include <linux/moduleparam.h>; e& Y- T) _& u: E
  32. #include <linux/sysctl.h>, c) K2 a  Z$ d. b; N
  33. #include <linux/mm.h>
    # v5 h) e) z  V( @$ R* C1 C
  34. #include <linux/dma-mapping.h>- E& k/ W- I' Y% X( \4 f' y; j/ n
  35. $ J" \/ T. x# \0 u
  36. #include <mach/memory.h>0 X: A- J) v1 Q- F  K+ M* E" o
  37. #include <mach/hardware.h>
    ( ~; Q0 i% }. k3 e
  38. #include <mach/irqs.h>
    & O9 }( n: q( n: O- O
  39. #include <asm/hardware/edma.h>
    1 K# ~# O, K& n0 [; l" g7 O9 H( {1 x
  40. . f) E: }. i6 P3 l8 j* _6 c
  41. #undef EDMA3_DEBUG
    # _( p- S' b. f$ i" ]4 M) S; Z
  42. /*#define EDMA3_DEBUG*/
    ; h( o7 S& b, m
  43. ! d0 g9 J0 ^& L9 W$ s
  44. #ifdef EDMA3_DEBUG
      v1 X% a  b! x& c- C* ?9 s9 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / B" L+ G. `. l4 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . L' B) t. j9 q5 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 }7 H" m' |6 u, O5 C5 O, M) G. O5 }
  48. #else
    # ^0 l+ }" E* D0 {8 C
  49. #define DMA_PRINTK( x... )) q0 o. W3 e/ C6 A$ A
  50. #define DMA_FN_IN
    2 B  I2 _5 Q  [) m) z! Y- n
  51. #define DMA_FN_OUT3 v: T0 V. ?; n
  52. #endif: {7 L$ y8 p. R
  53. $ u- e, k* ~. N/ T% }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 [4 ]* M) E, W9 n+ ^7 J
  55. #define STATIC_SHIFT                33 z- X$ z: a) X4 R
  56. #define TCINTEN_SHIFT               20
    . z; d- c" s+ j* k! {& p: @1 Q
  57. #define ITCINTEN_SHIFT              21
    4 Z& V+ l" v2 d% [( C$ ?# _
  58. #define TCCHEN_SHIFT                225 s7 i; {, \/ l, `3 L3 z) N$ A
  59. #define ITCCHEN_SHIFT               23# s& ]4 R. S* m3 S! p6 m
  60. ; J+ t2 W5 w: p, X1 w6 E6 \+ F
  61. static volatile int irqraised1 = 0;
    ' T" |8 a4 l7 x. X
  62. static volatile int irqraised2 = 0;! r  R% T; C7 }
  63. ; P# U" u/ R, T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: u- m& Y% w2 x" [8 R* }2 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- s4 y- e  [( B3 a8 ?0 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 o( ]3 j9 ?* |! c: l5 r
  67.   ?7 ]  S0 b8 R9 x' E
  68. dma_addr_t dmaphyssrc1 = 0;& H3 r& O% p& t) ^" D. m' h
  69. dma_addr_t dmaphyssrc2 = 0;
    8 G6 I/ u5 ^' Y9 Y' ]" y0 n) f
  70. dma_addr_t dmaphysdest1 = 0;8 m1 r% U: V/ D5 Y, e
  71. dma_addr_t dmaphysdest2 = 0;5 o( f) |  X; F1 [! n% P7 h
  72. , B  i5 ?5 k8 @  H
  73. char *dmabufsrc1 = NULL;
    8 p: U) G, i" a- [3 ~
  74. char *dmabufsrc2 = NULL;
    : n" c6 K; e5 c& K
  75. char *dmabufdest1 = NULL;
    . V8 m6 B# ]& C
  76. char *dmabufdest2 = NULL;
    % c- A: q! x, Q0 }$ E# m" s$ ]$ b

  77. 5 D& ~1 C; a# k; T; ^
  78. static int acnt = 512;- O( r/ g0 C  v8 r8 `' ^
  79. static int bcnt = 8;: E) x2 T& j/ E
  80. static int ccnt = 8;" ^; X( I/ V* R
  81. ; s- ?! |. p! c2 i6 {/ V
  82. module_param(acnt, int, S_IRUGO);
    ; K$ V" X7 p8 V( @8 g& L! M
  83. module_param(bcnt, int, S_IRUGO);7 t8 K) f# E, I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! b0 f6 |! _9 L% J* a% D2 O
- k8 Z7 K+ [9 Q( S2 S% \7 B* z" z4 _3 B( k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% o: q# o; B$ w$ D( zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& \) `' X9 D) V+ t% I' ?5 p! |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 d5 a) f" s! V: Y  J! Q6 t
, ^( X/ m% j1 P4 i* I1 Q4 Z
5 l8 G8 N7 `1 A* ]* Y& B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 12:14 , Processed in 0.037283 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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