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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % H9 u& ^5 t* P/ i- i1 ]7 y) }7 Z
  1. [code]EDMA sample test application
    # R$ P$ z* G2 U- l' w
  2. /*# S, I* g6 {8 A# ^. i
  3. * edma_test.c
    $ L, @' K/ b! X1 j
  4. *! ]5 R2 A8 R: ?) S/ J2 f" d/ d8 f
  5. * brief  EDMA3 Test Application
    " Q) F% {2 J, n
  6. *2 r# |5 k4 w2 [, o4 _
  7. *   This file contains EDMA3 Test code.9 u  b9 ^$ s7 D" P: s+ i, x; U$ k2 p
  8. *1 Q  m; q- N; S8 \& m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- ~0 P) ]" a3 Z! N3 i5 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 W- B# ~# a8 f( e
  11. *         TO CHANGE.
    - G4 h' K8 v, z4 t. }
  12. *
    $ {: n! d1 @, ?8 o  l) J: r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & r+ }- m' q9 f+ M' Z6 x& g
  14. *. o7 Q; Y# G4 _4 @9 K. a5 x( Y
  15. * This program is free software; you can redistribute it and/or
    ' o0 h& G" d  D2 T0 p- M6 U* d, k
  16. * modify it under the terms of the GNU General Public License as2 Q" l2 z# v% O6 J  j6 H# A' g, y
  17. * published by the Free Software Foundation version 2.1 g! V8 W7 p0 }6 I
  18. *+ g- m9 b4 r( @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; r6 B3 Y; e4 r2 w- |0 r1 [- X
  20. * kind, whether express or implied; without even the implied warranty! [9 S) E4 v4 ?1 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , F8 x( L( F4 W+ ~( ^0 h
  22. * GNU General Public License for more details.
    - q: m- R" i! [( |7 s
  23. */* T! I3 E4 \# h( R8 i8 i/ w

  24. 3 h7 o' U: \. s9 A5 E) d& D0 s7 W
  25. #include <linux/module.h>
    ; S9 R+ {8 y+ b
  26. #include <linux/init.h>! q# V0 \9 |( w: r3 L- \) w
  27. #include <linux/errno.h>& `2 R- }1 N+ f& H7 o0 o1 J1 ^
  28. #include <linux/types.h>9 G( ]9 v. ^" h1 C
  29. #include <linux/interrupt.h>3 f- Q' A! ?# @: s
  30. #include <asm/io.h>
    # N% N. X8 d. J0 i, j
  31. #include <linux/moduleparam.h>2 H9 E+ ^) _  `0 Y& v( S# J
  32. #include <linux/sysctl.h>
    6 B) q! b' C5 W- B, f; j( ?! r# B
  33. #include <linux/mm.h>- @; `" W5 f! o; Z* d& R
  34. #include <linux/dma-mapping.h>1 k7 Y! V5 j3 V: g, B

  35. + B+ \' C; t2 U- l- d' ?- S! Z
  36. #include <mach/memory.h>
    9 S+ t/ [& N5 Y3 k1 y2 w3 M# c
  37. #include <mach/hardware.h>' a- `  o* M: k' I$ k" j' V7 f% J
  38. #include <mach/irqs.h>! y. ?2 }( l4 W: G3 c
  39. #include <asm/hardware/edma.h># W5 R' e& k  `5 D6 Q7 z

  40. # U: L& H2 ]. [8 ]  S  N8 o. J
  41. #undef EDMA3_DEBUG
    * x" j& ~2 ?) c- A$ D' e
  42. /*#define EDMA3_DEBUG*/
    * L' H6 T/ W4 z7 n: s! o

  43. . a7 M( Q4 ^1 _, }9 {1 y
  44. #ifdef EDMA3_DEBUG
    3 ?9 h7 K3 H* J( a) f* k& `) @- z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* i6 r4 R# c" R, z& r$ ^7 g* y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# g- c) ^3 t8 N) o4 L. B4 d' y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); k2 r( X, N# |, l2 ^, h
  48. #else
    ' _& ]% H$ E- _" F7 C
  49. #define DMA_PRINTK( x... )* t4 D  t8 V6 e/ z* U2 _  e
  50. #define DMA_FN_IN
    ) ]- c+ J. Q/ q& [4 a: ]/ |
  51. #define DMA_FN_OUT
    # W+ p- M4 Z, o( r; }! C+ f6 h$ x
  52. #endif/ S' B+ }! ~4 T( U2 i4 _% C& \* f
  53. - O. [6 a$ O. J2 G. }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 K0 Z8 q. m1 n2 T$ X+ Y+ V1 y, c
  55. #define STATIC_SHIFT                31 E0 \+ r# f7 Q  @7 }+ J
  56. #define TCINTEN_SHIFT               206 {1 L3 i4 k. \3 a
  57. #define ITCINTEN_SHIFT              21! W1 G3 n; M3 f0 i1 A
  58. #define TCCHEN_SHIFT                22
    , w0 [* z  g0 V( n
  59. #define ITCCHEN_SHIFT               23
    . \2 T$ {; A. O, t. ]; s: i! |

  60. 9 B: u1 p& Y  w8 B7 \* o& k7 i
  61. static volatile int irqraised1 = 0;/ [" B. d* p$ U! q
  62. static volatile int irqraised2 = 0;
    5 B1 x8 p# b0 u$ V( N) k: ]  u
  63. 2 \7 s  [9 n5 p% @- i; T. {+ f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      u1 D# p9 ]# V$ M1 B; v3 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) S8 L9 v, r; o  e6 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; J7 \; G3 I7 i: z. O# `- m

  67. . Z0 X+ x7 A- V# Q
  68. dma_addr_t dmaphyssrc1 = 0;6 Z7 J4 Z6 U+ X! ^7 i8 y: y& y
  69. dma_addr_t dmaphyssrc2 = 0;7 Y) H, p( N3 A$ M2 F
  70. dma_addr_t dmaphysdest1 = 0;
    " {! p% O% t- g. E
  71. dma_addr_t dmaphysdest2 = 0;8 i& T  P) t- s' ^% I

  72. : S# a8 g7 Y9 [2 t
  73. char *dmabufsrc1 = NULL;
    / V+ }3 P$ s2 [: D! x) h
  74. char *dmabufsrc2 = NULL;
    + \, f+ P& k% Y) E4 u3 e
  75. char *dmabufdest1 = NULL;7 _) [) t% _; x3 R! \" @
  76. char *dmabufdest2 = NULL;
    % t0 P% O2 |* \0 W

  77. % e4 M$ G: F6 T9 D9 l" [6 C) J
  78. static int acnt = 512;+ b4 j' ]5 @9 b# k' Z/ V
  79. static int bcnt = 8;
    4 j8 h. A3 a5 l3 H, P, @: Z
  80. static int ccnt = 8;
    * g3 j) s% Y! ^; t. n

  81. 5 K4 w, ~' z2 i' N( k4 w, p
  82. module_param(acnt, int, S_IRUGO);
    ! B4 D! ~3 e3 w* K6 d
  83. module_param(bcnt, int, S_IRUGO);7 I5 a0 y; ~% n. N/ @4 z; t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 ~0 E' J# L# h- c. J. B  c; e! {) n
  T2 u* Y: L  X" X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. n  W8 _. R4 x: |) ^. P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' g/ q! m. P4 c/ t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 m2 H% A( y6 k2 N# x+ K4 _1 _+ P# N( g& O9 f$ b8 I; K8 n
8 a. y9 M0 ~3 K" I- E+ v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 04:57 , Processed in 0.041993 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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