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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. k4 z* y( z$ g% }+ m
  1. [code]EDMA sample test application0 T+ E# |  m- S3 {
  2. /*
    & X( p3 _  b6 C- M# [' b9 c
  3. * edma_test.c+ M4 R7 X" y% O: Y  T. Z* P2 q
  4. *
    ( N( y; j, ^5 c5 B( e) S
  5. * brief  EDMA3 Test Application
    / Y/ l/ u5 Q' s; W4 _! {( T
  6. *
    . n) A: h# C* r4 a5 t5 O
  7. *   This file contains EDMA3 Test code.
    8 d7 P! b; c4 ?$ X3 ~4 [% a6 ]
  8. *$ L& w* z# t& O# T+ z- k5 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( I6 u: \$ q1 N2 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % D- l1 J0 S7 \8 J( Z
  11. *         TO CHANGE.! z" ~& m  L: i6 ^3 H  [# C; e) f( }
  12. *
    $ a+ i+ `1 k  M& C  h: @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: D0 Y  u' _1 e/ y$ l
  14. *, v  l) _4 z# C0 _2 o% H
  15. * This program is free software; you can redistribute it and/or
    ( y. v, W; j* F( k+ d9 Y% {- C
  16. * modify it under the terms of the GNU General Public License as
    # D/ C& m7 u$ J' k# H% l
  17. * published by the Free Software Foundation version 2./ ~/ ^6 z9 h4 [  h5 D* z- s
  18. *4 b: U& p. K! m8 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - K: m2 d! x0 m, M  i
  20. * kind, whether express or implied; without even the implied warranty
    2 S- U- I& c* W3 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 `& V& @* u% s. M2 ?) M
  22. * GNU General Public License for more details., ]1 L+ x3 X9 ^1 b: B
  23. */7 N* t+ s$ ?: w4 x) o# W& W. E

  24. " P% C( l/ j% [$ }3 }4 S% W
  25. #include <linux/module.h>
    1 H) z/ c2 H" K8 z3 L) F" }1 s
  26. #include <linux/init.h>. o: X  W8 I3 H6 F0 Z& |# K
  27. #include <linux/errno.h>6 g$ s1 e5 Q9 l4 v( N
  28. #include <linux/types.h>
    4 X  ]( ^' n4 i4 r1 _* d; G) \
  29. #include <linux/interrupt.h>
    5 S" X" ]+ o* `) G2 k* d
  30. #include <asm/io.h>
    ( J5 n8 v/ G9 |  E, Y
  31. #include <linux/moduleparam.h>) f2 w& O7 G5 m: G: j
  32. #include <linux/sysctl.h>
    " j! N) \( y% E
  33. #include <linux/mm.h>, e5 ^; }2 ~- c3 ~. R
  34. #include <linux/dma-mapping.h>
    & W2 P$ G# W( J" Z2 J1 c
  35. - M( a1 n- q( L  Q6 b
  36. #include <mach/memory.h>
    $ M1 ?. [& F1 p! q8 t& D. }
  37. #include <mach/hardware.h>1 h0 A8 F0 {0 C
  38. #include <mach/irqs.h>
    3 l5 d( f1 v- r9 m0 P9 Q7 a6 T
  39. #include <asm/hardware/edma.h>; F( U. m, Q5 M" @6 K6 V

  40. 1 o2 P% y. Y9 j; ~; R
  41. #undef EDMA3_DEBUG
    3 c" {5 g- d% D% F  {  u
  42. /*#define EDMA3_DEBUG*/
    & d6 A* c9 S8 c3 {/ V7 x8 y7 H

  43. 1 E$ F8 \" [- }% \
  44. #ifdef EDMA3_DEBUG7 Q4 D, I$ R9 _2 ^( a7 e3 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 w3 a' B; q# X# A9 s: L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 i* k2 N/ T* E" g% A6 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % u: r6 t$ Z' h3 K  v. R
  48. #else
    ' ~  F- e9 z. z
  49. #define DMA_PRINTK( x... )
    ) Q8 c+ b8 |6 S5 y8 T! f/ T8 Q
  50. #define DMA_FN_IN
    ; P6 \9 M& c0 u7 [& K
  51. #define DMA_FN_OUT! `, J- H1 p6 C/ D6 @6 N/ e8 k+ f
  52. #endif* Y2 q3 {$ T3 a) x& y( {4 Y8 _

  53. 1 q1 E' l8 J* Z/ ^* m' X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) H7 [" A: S; o1 A5 q5 X- Y5 [# v
  55. #define STATIC_SHIFT                3
    - ~, [/ ~1 c4 W
  56. #define TCINTEN_SHIFT               20: l# Q" L! w0 W$ s; o3 Z( @
  57. #define ITCINTEN_SHIFT              210 K, b' \# \+ [& P; [' w2 R+ y
  58. #define TCCHEN_SHIFT                22
    & i9 p: B% d! p: n" L4 b; A
  59. #define ITCCHEN_SHIFT               23. k+ \/ x8 z4 P  J- |4 {& M# U

  60. 2 X0 @2 S5 e- s0 F
  61. static volatile int irqraised1 = 0;
    , r# t! y& h) `* X
  62. static volatile int irqraised2 = 0;
    - ?7 a+ a; b- `' O& ~& [/ W2 a

  63. ! {( M* {9 w, A, `0 U; {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " l8 K. |) o% s' }9 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 I3 H$ u. E  u6 H" d) V; T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . x: d! e6 x" u0 S$ Y2 l
  67. ( x0 R* u3 {# P4 a; D8 P) h" |
  68. dma_addr_t dmaphyssrc1 = 0;! G: e- Q0 }, N' y8 R1 d
  69. dma_addr_t dmaphyssrc2 = 0;% N% X* t% i# K9 R! G; O
  70. dma_addr_t dmaphysdest1 = 0;
    . [4 o) i3 D& p/ G
  71. dma_addr_t dmaphysdest2 = 0;) O9 X, g9 {$ M

  72. 9 W1 t/ l3 [% W; U! @, h1 k
  73. char *dmabufsrc1 = NULL;7 A7 \' p; Z+ y4 x1 N
  74. char *dmabufsrc2 = NULL;  I3 b) D& z# b* }
  75. char *dmabufdest1 = NULL;
    9 y, D% J+ M7 ]
  76. char *dmabufdest2 = NULL;2 L6 C& q* H/ L/ U: ?
  77. ; I& L6 |6 D8 O& g$ N( A" u
  78. static int acnt = 512;
    $ n5 q) N" u5 P  d* `& b
  79. static int bcnt = 8;
    : o' J/ x( p8 g% h
  80. static int ccnt = 8;
    ! c' M/ E0 @& r1 t( @

  81. - d" ?/ j* _8 ^& {; O
  82. module_param(acnt, int, S_IRUGO);
    8 u* b! X4 {  P
  83. module_param(bcnt, int, S_IRUGO);, ~4 }: O( S( z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 e0 n9 n- X9 Q2 o" A
4 a3 j: C+ D# d2 F* S. E4 n% r! k( c4 i) C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y  P  d+ o' H) m9 W6 j* i; C5 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. d7 B2 m8 E0 G% H+ E1 d/ P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) ?: {1 z4 O& e# `4 G

# O% y: g" g' |
& H6 i# T/ q% J  Q/ O$ g; y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 13:37 , Processed in 0.037623 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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