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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , n$ ?* h" H9 f5 I1 T' M, H
  1. [code]EDMA sample test application6 p( {. h) S( p7 H8 ^* r. o% m% ~
  2. /*, f: O( G8 C% i7 o  M
  3. * edma_test.c
    1 H+ p% w* D* {) C+ V. h
  4. *) g( t9 k$ z% K* m
  5. * brief  EDMA3 Test Application) T( O$ i$ j$ ~8 y" H6 b0 H* i
  6. *: e. Q6 ?# w+ w$ V9 t4 x' A! W( J7 ^
  7. *   This file contains EDMA3 Test code.
    5 d; L. w  P, m+ J  r
  8. *0 T8 B0 A7 R" T8 S: `7 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H" Q9 r* `. p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # a$ Y( [# q' k' L/ D' J# n) v
  11. *         TO CHANGE.  G2 J: D6 P4 y) I3 l& c9 T, J
  12. *
    8 ]% q# ~& o6 c! P) g4 a6 r% }" S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% h; V  P+ m; @2 Q5 s! {' `' y
  14. *! U+ q+ ]& l- B5 N3 L/ [
  15. * This program is free software; you can redistribute it and/or% L5 o( v: J. z; G: _
  16. * modify it under the terms of the GNU General Public License as
    8 |* u; ~, _8 H; {* V) _/ ~! o
  17. * published by the Free Software Foundation version 2.
    6 q. ]) u" G- h& u5 F" I( P1 Z
  18. *
    # {6 v( s. Y. r( H4 ]8 G: X- H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( n4 L# F" l: w0 S7 w3 D
  20. * kind, whether express or implied; without even the implied warranty
    ! Y( @+ I- n/ j& d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! ~. v( Q7 s7 o! a# V) \1 q
  22. * GNU General Public License for more details.
    5 [' B0 }" L! t# F/ u# |# p9 g
  23. */3 m3 r. E: H/ Z& S7 F$ C

  24. 9 B: i4 C8 I0 o; Q$ p) I' F4 {' Y
  25. #include <linux/module.h>
    3 Z, }+ R8 a, u0 o
  26. #include <linux/init.h>
    6 C: H3 n, g5 f' d% f% I1 I
  27. #include <linux/errno.h>8 U5 G  G# x$ v: e( c
  28. #include <linux/types.h>
    % k1 V) |8 D0 [
  29. #include <linux/interrupt.h>
    2 \: S4 G! V% I$ w: ~1 g4 q
  30. #include <asm/io.h>/ i% r$ q8 n9 L% J7 t% Q- k9 u
  31. #include <linux/moduleparam.h>1 O2 e; E* _8 A4 r
  32. #include <linux/sysctl.h>5 @' K+ H  b9 ], A) ^+ v1 l1 [
  33. #include <linux/mm.h>' X9 U- ]/ r( f0 V
  34. #include <linux/dma-mapping.h>1 u5 n/ k3 i% P
  35. 6 w% N* M7 b7 b
  36. #include <mach/memory.h>+ z, C! h3 K+ b
  37. #include <mach/hardware.h>
    " C( e: Q" J. t) b- A
  38. #include <mach/irqs.h>
      x. F, ^9 X1 j6 \/ B8 ~# r
  39. #include <asm/hardware/edma.h>
    7 e1 r0 F. C1 i" L' a# n6 d

  40. . D' n# C' `3 f, u- W! T5 G
  41. #undef EDMA3_DEBUG
    # l9 Y# ]% e7 h! s2 n( h7 f; D
  42. /*#define EDMA3_DEBUG*/$ g. `5 D3 ]& K1 F6 H6 I
  43. ( N: j0 v' f+ k% Z( ^: w
  44. #ifdef EDMA3_DEBUG& @: }$ n7 F* _, {0 I- V( T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 ]) b  }/ N# A/ ~0 i/ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 Q4 e6 L2 C$ Z$ U) n3 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 E+ [: @& ^% r- b& z  [
  48. #else
    ' H- u& y- f# e
  49. #define DMA_PRINTK( x... )( B. \* _7 R8 `, U' K! O7 p
  50. #define DMA_FN_IN; _& M& B2 m& [* k0 d
  51. #define DMA_FN_OUT
    * Y8 Q! @0 E$ K/ k
  52. #endif6 N. L" n) K0 b7 I1 `! P
  53. 0 N' p" v7 o" @8 z9 A  v5 j0 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) ?7 a  J7 V) c# K1 q
  55. #define STATIC_SHIFT                3
    0 d$ ?4 Z# S' z0 T3 r
  56. #define TCINTEN_SHIFT               20
    + Q; u5 K' p2 w
  57. #define ITCINTEN_SHIFT              21; U2 @- s- {4 }/ e) v# K
  58. #define TCCHEN_SHIFT                22
    9 W/ D- L9 W7 j/ D
  59. #define ITCCHEN_SHIFT               23
    3 C' a2 }& r8 p3 U/ I
  60. 3 Z. S6 U# e5 ]3 q& Q
  61. static volatile int irqraised1 = 0;
    8 l& e6 T6 z" X0 _5 A8 J) m
  62. static volatile int irqraised2 = 0;8 C) Q; A" b# i+ D" k
  63. 8 A+ D# i" A6 V$ U4 J6 H& a% T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, q' w" S! U9 w. p% m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; [$ c# _1 B/ ?& C9 ~$ S6 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A- Q& s/ _: i/ y
  67. - [4 a% `  H& L6 S, T
  68. dma_addr_t dmaphyssrc1 = 0;( M5 C: _1 R, c" M: Q) E& _
  69. dma_addr_t dmaphyssrc2 = 0;
    4 f, o, U3 V' q
  70. dma_addr_t dmaphysdest1 = 0;# Y' q! q% p- X* G( D- y9 L
  71. dma_addr_t dmaphysdest2 = 0;+ f- u% B) [0 {2 |/ t. S
  72. " s/ n8 R0 K$ h$ B. @# K% u3 f# w
  73. char *dmabufsrc1 = NULL;
    + d4 W5 b8 d7 F5 E' u
  74. char *dmabufsrc2 = NULL;
    ! S& k; L2 R" m$ M* N. {* C$ p
  75. char *dmabufdest1 = NULL;- T( ^0 ^% `4 ^$ C5 E  r4 u
  76. char *dmabufdest2 = NULL;
    4 G5 S+ s" W0 R& d

  77. % p. g3 D& r2 l
  78. static int acnt = 512;* }) M, M* j% P, }2 ?. b0 D
  79. static int bcnt = 8;
    , V+ ~5 R) }8 x* B' ^2 f+ o
  80. static int ccnt = 8;' E% W  h2 J1 B/ M. |
  81. ' L, W: r3 [( G6 j. g  {
  82. module_param(acnt, int, S_IRUGO);
    ; N" \1 H6 `9 n/ S( {% g5 Q  N- T. L
  83. module_param(bcnt, int, S_IRUGO);+ |, m! ?7 a- z$ A2 l8 x, O1 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 r0 g2 u; o7 M% Z( V
) Y+ J- P; c' k- V: t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# Y! J0 Z8 B4 f0 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* D! `$ o; C3 F0 m' G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. [0 g! K2 t8 u( P8 p

% V$ d0 |: O9 H5 P+ i. n* d- ?) t/ B  Q* g" z8 @' R" J0 {0 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 10:42 , Processed in 0.046010 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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