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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ \6 `+ s& J+ ^) I& N
  1. [code]EDMA sample test application4 d& D" U4 G4 G9 a
  2. /*% j! ^( ]1 G4 k. b
  3. * edma_test.c
    * {8 T0 E- ^6 D5 w# A7 I8 u
  4. *
    9 }! U( T" x- E( W9 o
  5. * brief  EDMA3 Test Application
    6 a" K$ k. l7 e7 t  Y- i  z+ H" N
  6. *
    ( Y* C+ X/ {/ {4 k0 x. C
  7. *   This file contains EDMA3 Test code.
    1 O0 j( R1 ~8 s
  8. *% C0 Z7 J" g. Z1 M, f& v: s, ]# J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 s. `7 x  G' X5 k% i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, q0 B7 o3 Y' C# a5 e! x) Y; M
  11. *         TO CHANGE.
    ( x' i4 l2 a/ l+ n' U1 _
  12. *- L7 C" V( s+ N% y1 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 W: D: E8 p1 |
  14. *
    8 C' g: ~  B8 K* E  j
  15. * This program is free software; you can redistribute it and/or
    ; o, i/ w. C* B: L
  16. * modify it under the terms of the GNU General Public License as$ _5 q/ i  q- ~/ [- k2 N' q
  17. * published by the Free Software Foundation version 2.! R+ u7 Y9 }# k; B' H6 Q
  18. *% L5 J! \# v+ s1 l2 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' A1 Q  `* M- _
  20. * kind, whether express or implied; without even the implied warranty
      Y# S1 a# y, s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % L3 U  H/ z5 x$ _" b
  22. * GNU General Public License for more details.& T/ }" q+ b+ W" i% C
  23. */
    + [: R* b! ]1 K' z
  24. 6 L1 g5 D7 c7 h% l/ c; j* k
  25. #include <linux/module.h>
      r1 g4 _* x: Z/ k  C
  26. #include <linux/init.h>
    / |& G7 f1 H/ f; G6 j, N
  27. #include <linux/errno.h>! D  A) N: f" x$ R. ?9 L# g; g
  28. #include <linux/types.h>
    7 w" v8 I9 P* o5 E% U3 X9 g% U
  29. #include <linux/interrupt.h>
    " @+ c# H! r) e; s+ H# X
  30. #include <asm/io.h>
    ' _& l$ h$ Z4 {  T$ \% e
  31. #include <linux/moduleparam.h>$ C4 x1 c: c3 Y$ @" w5 Y( L
  32. #include <linux/sysctl.h>
    ( @7 i7 P4 H2 n9 Y1 I9 |# f
  33. #include <linux/mm.h>
    . s" m7 p+ s% g7 |$ t7 b
  34. #include <linux/dma-mapping.h>
    0 }+ H2 @. F# Z6 o' r/ [

  35. + p- r$ }9 V$ {
  36. #include <mach/memory.h>; |% W. _* B$ A# M8 _  _3 d; w* l
  37. #include <mach/hardware.h>
    # z2 _1 V7 B; v' }5 i- Q% H1 U
  38. #include <mach/irqs.h>
    ) N% T- @; v' I$ L
  39. #include <asm/hardware/edma.h>
    : d. P5 b5 T6 f: V0 `" ^

  40. + `. D8 Y5 ^* ?% }
  41. #undef EDMA3_DEBUG; C8 F& b3 k- M7 R' J1 e) s
  42. /*#define EDMA3_DEBUG*/
    . P" J6 D2 c4 L% G' X# D

  43. 7 [) O( C# p$ M+ q
  44. #ifdef EDMA3_DEBUG" j/ K) O6 K/ j/ H0 ?* j; b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) B& I; f7 R1 Z! ^! C6 H8 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! v, B2 M* C1 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& S+ q1 r+ H+ p* u6 H
  48. #else4 N3 N+ K: X5 R: K
  49. #define DMA_PRINTK( x... )) M; n& n$ A2 u3 Q8 U) b- r
  50. #define DMA_FN_IN# r/ U( p3 p  t& ], ]
  51. #define DMA_FN_OUT
    6 E& f4 @; H$ \8 L/ `- x
  52. #endif; h/ z4 @& ^  l2 G2 P* K% x- ~
  53.   {+ B! @5 d/ T! C6 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " u  o# R% E4 ~  g
  55. #define STATIC_SHIFT                3- V( D3 J/ q- F) }
  56. #define TCINTEN_SHIFT               20
    8 T1 t# i9 L: w9 U$ _( A9 i
  57. #define ITCINTEN_SHIFT              21
    # G, _* [6 l* g' m" b. \* h* j
  58. #define TCCHEN_SHIFT                22
    & L6 I* H1 V3 C# a' `
  59. #define ITCCHEN_SHIFT               23
    # [7 i+ j7 ]/ ?+ Q. w: `

  60. : \8 e" f( y( F6 V  [4 B" k# l& ]6 m
  61. static volatile int irqraised1 = 0;2 ^: X6 v; m8 v8 C- D, X% S& l4 @3 Y
  62. static volatile int irqraised2 = 0;5 T2 t" Z5 e% X$ L8 u! s

  63.   x0 P3 j/ O5 u1 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 S: ^* E+ C6 \8 {1 N* b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * l% }  }" v. {0 c7 r! T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 d) A0 A. J- w. _. `
  67. . J8 t# U# z" x* D( t
  68. dma_addr_t dmaphyssrc1 = 0;
    2 n  V* U* I8 I0 V+ ~& u9 k
  69. dma_addr_t dmaphyssrc2 = 0;
    # W  l/ J* @& r8 e) D" j( T$ [
  70. dma_addr_t dmaphysdest1 = 0;) F% K" ~* k- C2 I  a" K
  71. dma_addr_t dmaphysdest2 = 0;
    $ R5 a* G1 O  n9 L% I; J! h( }

  72. 4 X/ V5 E* j( b: b# W8 Q
  73. char *dmabufsrc1 = NULL;2 Y! }: n9 s- u
  74. char *dmabufsrc2 = NULL;0 [* F$ r) g9 I
  75. char *dmabufdest1 = NULL;
    8 C) Z% E! O8 W4 g9 b2 M
  76. char *dmabufdest2 = NULL;
    + H2 C2 U* {: |2 j6 U2 Z! x$ U
  77. * b" C- k4 S, @6 t  T8 K5 W
  78. static int acnt = 512;
    5 y  o. x0 G% R
  79. static int bcnt = 8;8 I. I7 M2 B* P+ q' e  W
  80. static int ccnt = 8;6 P2 ?0 W' Z8 x# Z' e8 m  r# v

  81. & t  d2 P  t) _) g
  82. module_param(acnt, int, S_IRUGO);" R3 T8 ^( f; ~, l7 F
  83. module_param(bcnt, int, S_IRUGO);' H/ ~/ O+ b3 I! o2 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: ^7 v/ Z0 D. u% r& m4 F/ v! x" S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" x! p" q/ `7 T. uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 `9 l3 A6 R% K7 @2 Z' V( n- o% e3 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 i+ v8 i3 Z9 n; R: Y' y

6 t% ^7 t: ?/ H! J, l5 A6 b! s( \
- h' y, _% j* \& |. B9 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 07:19 , Processed in 0.041623 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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