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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ z4 c: M% z0 B+ |9 N. K, i7 m
  1. [code]EDMA sample test application
    - x( D" j) m' [/ K# r6 @2 s7 w+ Q1 P. K  J
  2. /*7 J. G- m8 o6 c' L# F+ Q
  3. * edma_test.c  h  W! R' N# F- x, z
  4. *
    ( X' W5 U+ @# P+ e
  5. * brief  EDMA3 Test Application1 e- q; C5 z* T9 S: K6 {
  6. *$ K- E3 x7 ^0 ]8 A6 `
  7. *   This file contains EDMA3 Test code.  r  s6 H! N  L* K
  8. *) G" M( r! a- B  I( i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( Z; k5 d" W3 A+ U8 x6 o; S+ |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 k7 X3 w( z4 N( Q* a5 c  f# q) k
  11. *         TO CHANGE.  @5 h# Y( H, u$ B
  12. *9 V% M6 Y# `7 {" y" o9 j+ R5 T2 i1 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% l1 v4 G! @% c7 v7 g
  14. *
    / A4 O" U+ L  A# l; y
  15. * This program is free software; you can redistribute it and/or
    4 d' E+ k1 p* Z: r8 }" A2 m
  16. * modify it under the terms of the GNU General Public License as* O( w6 i& K) o/ G4 h3 F# c4 O
  17. * published by the Free Software Foundation version 2.( x6 b5 _. s% `7 o
  18. *
    % {; \' _7 W* n5 p  y. G: }0 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - `! \! R6 S$ c& ]
  20. * kind, whether express or implied; without even the implied warranty# W3 _3 S! l! D0 S2 d1 k8 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 O- S; ?+ Z: R  W' W8 h2 ]& L
  22. * GNU General Public License for more details.
    ; X# O- ?+ ?. ~$ x6 w1 z4 @
  23. */
    4 X( T& \+ e3 v& J) `
  24. / ^, Z# {; ]" ~6 D
  25. #include <linux/module.h>
    * E8 e/ H% g) O' o- d' H
  26. #include <linux/init.h>
    4 ^0 T5 u, J) d! ]6 I
  27. #include <linux/errno.h>
    % W) f, e. I5 u( J
  28. #include <linux/types.h>  A- E% u6 d* l# |' e# {
  29. #include <linux/interrupt.h>
    ) T/ V" o6 B0 u: t
  30. #include <asm/io.h>0 k/ i! u. z4 r6 ]! S) F
  31. #include <linux/moduleparam.h>, [3 a- z' i% X% S
  32. #include <linux/sysctl.h>
    % \6 K6 M; ], K) _, I+ v
  33. #include <linux/mm.h>
    * `: }1 _5 G3 ?) k6 t8 N
  34. #include <linux/dma-mapping.h>
    % J/ [' c2 _0 V4 ?5 p3 y

  35. & v# W4 k: `: H3 B4 p
  36. #include <mach/memory.h>4 n- p% H( I  Z; d
  37. #include <mach/hardware.h>+ r% ?9 F! S+ \: F; X4 ~; Q5 q
  38. #include <mach/irqs.h>
    ) ]9 d( {& V: c& ~" x7 d
  39. #include <asm/hardware/edma.h>1 I$ h- l! B6 A# b5 W4 i$ |

  40. ; ]1 v. \  |5 \: o3 @2 [+ F
  41. #undef EDMA3_DEBUG0 e: `6 B8 T8 ^' |3 m( M
  42. /*#define EDMA3_DEBUG*/
    ; a4 {* W8 y- k- K

  43. ) J/ y; S, P8 `- a5 D( z5 Y4 N
  44. #ifdef EDMA3_DEBUG7 O& @" z0 _; j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 |' R/ y  s3 |* _* F& @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ~' U! M* D1 f$ A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). w' T/ c* ?$ u0 G1 F& q
  48. #else
    2 k9 K; j# j& q+ x" c" \
  49. #define DMA_PRINTK( x... )$ r- @* z. L8 n  K) L% r
  50. #define DMA_FN_IN
    3 o- J: h* M' X2 ^2 j; f4 s
  51. #define DMA_FN_OUT7 C. S; b! \! D1 s% n
  52. #endif
    - D% u& S% \$ j
  53. , c0 ?8 _, {. e# F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# z% t$ f8 |: t
  55. #define STATIC_SHIFT                3: L) i" E# e" t. M
  56. #define TCINTEN_SHIFT               202 K; m5 J" l+ Y  p! y" M* M
  57. #define ITCINTEN_SHIFT              21
    3 Q: b2 K7 V: g4 m+ Y$ R
  58. #define TCCHEN_SHIFT                22
    ( _! f" y3 R  c6 G5 Q4 t* C
  59. #define ITCCHEN_SHIFT               23
    : ^0 G$ r; c& v" ^  R" D
  60. , T4 {( Z  k6 O# m' Y9 Z
  61. static volatile int irqraised1 = 0;- F# T( D7 x1 W: G$ O
  62. static volatile int irqraised2 = 0;/ V) B, d, r$ W
  63. 5 N5 h0 V/ r7 k% ~! u! d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ C- E8 h" G6 `1 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ^. o# m: ]. V0 O* F3 a1 [8 W( W- m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 B& H3 j! o9 Q+ c' I
  67. 9 B2 s) g& b% \5 r# k3 C0 J, P% L
  68. dma_addr_t dmaphyssrc1 = 0;
    + r) Z0 E. ^$ m
  69. dma_addr_t dmaphyssrc2 = 0;
    7 J* p6 u8 g. ~2 f
  70. dma_addr_t dmaphysdest1 = 0;! }3 O1 x" C& `8 }" g0 P
  71. dma_addr_t dmaphysdest2 = 0;
    $ J5 g: p" K  x1 ^" u* C9 k% G1 a
  72. ) `4 T' [, f) u5 j7 l+ C. B- M
  73. char *dmabufsrc1 = NULL;; \6 e/ p. {% S8 ~+ @
  74. char *dmabufsrc2 = NULL;/ A1 w- H4 M4 ~1 ^+ m4 p
  75. char *dmabufdest1 = NULL;5 u1 B3 D, R/ ^0 o) w# y
  76. char *dmabufdest2 = NULL;
    , H( r* D! G2 ^8 y
  77. ( R, b' q4 g0 y2 U
  78. static int acnt = 512;
    2 q. \' V9 d2 T6 W
  79. static int bcnt = 8;
    / L1 J. b% c2 c, U# Y3 a
  80. static int ccnt = 8;+ b) b+ h" ^6 _) I9 K% V2 Q( j0 j

  81. ( v6 c+ |2 \) t' c( f
  82. module_param(acnt, int, S_IRUGO);
    3 n; \" g$ ^( c8 B# y- m! F
  83. module_param(bcnt, int, S_IRUGO);
    & I% |6 Z% g. l. c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 W: p8 y3 V! V2 b% @
/ N" d/ r* z1 |* l( a) s8 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, N" M5 W% ?: }/ a9 r7 B7 ~. x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ T* ^+ [3 h# j: ]4 ]; n2 Q, E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  f( E  V1 G6 X& Z9 C7 w2 P" Q5 i& V2 z

9 `: J9 F# L. ?! }4 u8 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 10:35 , Processed in 0.038246 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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