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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , \9 E+ y* P1 m4 u$ t$ e: b! s7 q
  1. [code]EDMA sample test application
    ! t5 ?. u2 J  \2 B, g6 n' }
  2. /*
    ' w; p2 A* S* ^; {3 U
  3. * edma_test.c# I5 S, V9 o" H% v- V; m- n
  4. *
    : M* G7 _# M* k/ v, e
  5. * brief  EDMA3 Test Application; u0 I. p- J# g) V% s6 z6 z$ _; ~
  6. *7 W2 y" d' u5 `, n/ z0 z1 S8 H
  7. *   This file contains EDMA3 Test code.
    ; B( G/ W4 n, ]' w" C- f/ @
  8. *0 X5 X9 A; C- l; n7 ]% y/ }" l5 }, ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) \  z& j  h# n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / o( w4 @: ^$ L7 t- m9 s4 D
  11. *         TO CHANGE.& N/ b2 K! ?1 g: `0 r) \6 C" L1 B
  12. *
    - D2 H8 O- C  K7 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// G, i. G* Y2 h& t9 a& k5 q0 ?
  14. *7 d, o: I! _7 ?4 X) G" Q
  15. * This program is free software; you can redistribute it and/or; d" P0 M0 P, {+ e( B( K7 L9 d
  16. * modify it under the terms of the GNU General Public License as
    7 s! _  i$ V8 [
  17. * published by the Free Software Foundation version 2.! h3 S% N5 Q* u+ t( h0 l6 n
  18. *
    6 `/ _! |# e" _; u$ j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - r9 R% ^8 S4 P3 L/ g
  20. * kind, whether express or implied; without even the implied warranty; N  [3 A% {( Y4 F7 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 F) F- I( w" E% n0 O
  22. * GNU General Public License for more details.$ G$ Q/ B4 Y1 }, ]
  23. */; E1 t. Z8 r1 e3 o6 E
  24. ; m( x1 y6 x2 B5 \6 i: w
  25. #include <linux/module.h>; r( ^$ q: }% Z1 t- T6 L
  26. #include <linux/init.h>
    ; d6 v$ ]; t6 j  ^* k
  27. #include <linux/errno.h>
    % R8 r! [- T5 }+ `8 c. s9 ~$ q
  28. #include <linux/types.h>: S: X6 q( h# G, q. U% {% ]) K( t
  29. #include <linux/interrupt.h>! b3 q$ ]7 I' w2 K# ?
  30. #include <asm/io.h>5 ?; X0 b( o7 U% j
  31. #include <linux/moduleparam.h>0 d0 X* q9 B- G& L
  32. #include <linux/sysctl.h>
    $ {1 [+ k  [& C! q1 G3 P: y
  33. #include <linux/mm.h>
    7 x6 A$ q/ ?# q
  34. #include <linux/dma-mapping.h>4 }9 k% X3 \2 k* ]
  35. $ r4 N% H* q: ]
  36. #include <mach/memory.h>" R/ X# `- H$ V1 _1 s# a
  37. #include <mach/hardware.h>: I" r0 m' C9 }! C) U
  38. #include <mach/irqs.h>9 o8 \( u/ j* B- F4 f" M; P6 S
  39. #include <asm/hardware/edma.h>
    7 w' A$ f, T3 }4 P& G9 f, I; H
  40. 2 p8 P. v, r/ F7 H+ |- d/ ]+ `, t9 @
  41. #undef EDMA3_DEBUG8 S; K! Y: o  ^- i' j" W; ?/ e
  42. /*#define EDMA3_DEBUG*/3 `; z5 J# j2 O5 j

  43. : O4 A, O' h) V! _
  44. #ifdef EDMA3_DEBUG
    7 i4 c: v5 u' G# a3 n; r0 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ H' p8 Q$ d) d- j0 v5 ?! v% S" ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 X0 @  q/ m2 O- c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# q* o0 E  Z! Z( b
  48. #else
    + M* M! ?5 }: ~0 L
  49. #define DMA_PRINTK( x... )
    - t( r9 z+ ~6 P# [: [# Z
  50. #define DMA_FN_IN
    " _8 }' u% ^( v6 {  @# v5 B
  51. #define DMA_FN_OUT
    * P/ P& `+ x  @( Q5 z, ?
  52. #endif
    1 P# i/ a2 y$ z2 y
  53. ( e3 P# D- s& {7 L; T, C# {5 p: ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 p4 L7 X0 a4 }  T- U9 q
  55. #define STATIC_SHIFT                3! L! r# P! M+ a. d6 Y
  56. #define TCINTEN_SHIFT               201 z" Z  r7 C- r: g- H; i5 ?
  57. #define ITCINTEN_SHIFT              211 I' p5 O( k5 U" W) D/ `  {
  58. #define TCCHEN_SHIFT                22% e+ A) b1 ]" S2 W7 x0 {
  59. #define ITCCHEN_SHIFT               234 E3 `8 ~/ p3 X0 z% `" c

  60. % i% f' j. i- h* U- f
  61. static volatile int irqraised1 = 0;$ }" F, \* C: p3 g6 f
  62. static volatile int irqraised2 = 0;' F2 w) d1 V5 U6 J8 d  X

  63. / E) {2 H: k8 _  G* r6 o0 y" E6 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G: }1 Z' q6 S, w! g, C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p. U) O- [1 o7 w$ k0 ~7 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W( _# z* q! C8 P3 K! [, E+ |

  67. 8 m* ~  _5 o3 ~/ d5 s. y% Q
  68. dma_addr_t dmaphyssrc1 = 0;
    ! P7 g" m7 v" P% R& m
  69. dma_addr_t dmaphyssrc2 = 0;  w1 E$ B, @. g8 |
  70. dma_addr_t dmaphysdest1 = 0;: H! w( D, U- |; Z$ K
  71. dma_addr_t dmaphysdest2 = 0;" W1 H2 {& [! Y- }' C
  72. 4 ^$ T! i& [) D! {5 @
  73. char *dmabufsrc1 = NULL;9 |0 m. ?+ @" Z$ U. |- K
  74. char *dmabufsrc2 = NULL;
    ' [$ O4 q; f- _8 ]
  75. char *dmabufdest1 = NULL;  u& W; l1 r1 E- ^+ m
  76. char *dmabufdest2 = NULL;; i3 n( S# ?$ n& R4 Y
  77. / T% Y% m$ j9 I( K) {) T
  78. static int acnt = 512;2 H4 ^- X7 S9 E* ~0 Y
  79. static int bcnt = 8;
    9 B( I1 Y) S- i0 e/ I8 X% t7 y; y
  80. static int ccnt = 8;
    . \& c- L% Q* }5 K' [6 o8 h
  81. 3 ?" W% m) B0 [3 H) h3 Z$ v- q
  82. module_param(acnt, int, S_IRUGO);! R$ m) m! F! ]) U. {3 S8 z3 U
  83. module_param(bcnt, int, S_IRUGO);
    8 q" N$ }; x. j$ l& \% A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 X& k1 s  c! Q4 n/ H+ A/ f5 e
. Y1 H2 N/ k0 Y! |6 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 [" B/ n# H% u% {: [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, z2 q: {3 k5 v3 K- o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' o' N3 I' Z" T0 I+ L# ]7 A6 A
! Z0 o  H( T) q# o
* f& w& y5 ^' V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 03:23 , Processed in 0.044958 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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