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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 v) `+ l+ }. J! f( l
  1. [code]EDMA sample test application7 h, L, D5 c4 }/ L: T/ Q) w
  2. /*. A# [9 X2 ^# j, w% b
  3. * edma_test.c
    " ]7 D0 N, J/ t$ `4 K. U/ m! e
  4. *
    , O0 f! [% J  q
  5. * brief  EDMA3 Test Application
    % e* _9 m) ]" ]! C; A% R1 y6 D( T
  6. *- L8 \3 G% y7 x2 W  Z" U/ U$ J! Q
  7. *   This file contains EDMA3 Test code.
    5 X1 M, a7 M6 n- B3 O: f( K
  8. *
    $ _# m+ U* G7 J& ]  x  \' ?6 g4 i( V- v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 C% u6 Y1 r+ w; E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      Q3 O. R7 g3 z  W8 u1 T5 l
  11. *         TO CHANGE.
    + N8 A: \' \& T8 U
  12. *
    - D) Q, V1 K* k7 K. n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. G. e2 f2 _* s/ S$ [
  14. *
    7 E" V% i( ~. [
  15. * This program is free software; you can redistribute it and/or7 }+ _7 U/ Q( t+ H" W' J
  16. * modify it under the terms of the GNU General Public License as( w; g; d6 B( _& r+ x- }) h
  17. * published by the Free Software Foundation version 2.% D2 Q# W5 c! ^5 ]
  18. *
    / i0 {! I& _6 ]4 Y3 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 v$ {( o/ n" C7 ~) p; k' I- ^. M
  20. * kind, whether express or implied; without even the implied warranty
    + q) ^% P1 H% B8 @/ k5 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( ^9 K' l4 Q6 ^8 m
  22. * GNU General Public License for more details.1 j; @, L% ^9 W- ~' B( R% A7 k
  23. */
    5 |8 Q3 s1 _0 N) N( v
  24. " K3 M& @; ~! U9 Y+ k+ i6 T* ?
  25. #include <linux/module.h>
    4 x  U5 k9 y8 N  y) j
  26. #include <linux/init.h>
    1 w# F* f( y0 @2 f0 s4 q# F  G
  27. #include <linux/errno.h>
    7 O  o: O$ [* b& f; c" r
  28. #include <linux/types.h>
    ; T! O3 l  O  l$ K2 M# ]
  29. #include <linux/interrupt.h>
    % k! l" ?4 _9 c$ p  q
  30. #include <asm/io.h>
      F; X9 a* j# p: H0 d: e2 R
  31. #include <linux/moduleparam.h>) n1 ?) ?8 Z. U
  32. #include <linux/sysctl.h>
    $ u; N7 a7 q$ u: b) `  x! F1 b) h
  33. #include <linux/mm.h>2 e" n& k- d0 ]3 @1 W% C: ^" B
  34. #include <linux/dma-mapping.h>+ o6 i- g+ x' V( z, O0 y
  35. ( m$ p! `5 ~' K) q& `4 V
  36. #include <mach/memory.h>! w2 \2 f- t8 D% C7 K2 A1 w3 H
  37. #include <mach/hardware.h>
    7 Y4 h/ Z3 y) S% m# G
  38. #include <mach/irqs.h>1 p/ c$ h$ z0 j
  39. #include <asm/hardware/edma.h>
    ) J* q9 E. S& N: [/ \! e. A
  40. 9 Y7 v1 |% J7 Q1 v) ^$ E4 i
  41. #undef EDMA3_DEBUG$ y6 F2 I( e3 p+ ^, L* o
  42. /*#define EDMA3_DEBUG*/
    & \& `7 `7 A9 o4 q. p
  43. ( ]0 C: z0 S3 h3 n
  44. #ifdef EDMA3_DEBUG
    * r8 e3 @9 G! }3 S( k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ R4 T0 f$ G7 F7 ]. D, J5 r5 X6 D4 y+ I6 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" c; `* m/ [- |- e8 k; J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ H, [; l1 |- P# @
  48. #else
    6 V; b, z% J: |& [, J: c
  49. #define DMA_PRINTK( x... )
    1 M2 G) m) s& k6 n8 R
  50. #define DMA_FN_IN/ [: }& _5 P, n% U+ r4 T9 f
  51. #define DMA_FN_OUT
    ) Q% l& ^# V9 b
  52. #endif  U8 y/ W( ]* w: I5 n, V

  53. ! r- M, s7 A, t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 R, b' t% q. M9 r
  55. #define STATIC_SHIFT                3
    0 {& o" Z& v6 |. q
  56. #define TCINTEN_SHIFT               20. h2 @+ \4 m' ?* ~7 e2 w
  57. #define ITCINTEN_SHIFT              21
    ) I% n" @: v: E  B% K$ T
  58. #define TCCHEN_SHIFT                222 i8 d7 R/ h7 b4 b; k0 C6 v$ k" q& H  A
  59. #define ITCCHEN_SHIFT               23
    & l6 \6 c! Q2 u, x6 M
  60. % d' \3 ^6 L% A+ [. O; E  d
  61. static volatile int irqraised1 = 0;
    $ [. H7 F8 A" f# i( |6 S
  62. static volatile int irqraised2 = 0;7 \0 F  V& w; Y% M  H8 b) Q

  63. 3 T! M* o, {& ^9 c% X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 O0 v2 ~/ I- Z% _/ n0 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ^+ E9 H% x5 P2 L% G  I; @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J. _+ ]/ J" M. T2 s
  67. - a3 R5 Q8 G/ b
  68. dma_addr_t dmaphyssrc1 = 0;
    ' |: B' v# U+ n0 y
  69. dma_addr_t dmaphyssrc2 = 0;  j. E: O, U8 {. V0 C2 Y. T% {: Z
  70. dma_addr_t dmaphysdest1 = 0;* M3 I, Z9 F$ }- e; d
  71. dma_addr_t dmaphysdest2 = 0;
    2 F- X0 h: }4 K' R* b3 G

  72. ) C9 j. |: L" k* ~  o
  73. char *dmabufsrc1 = NULL;% y6 U+ w/ Z7 y6 h0 q' C9 z
  74. char *dmabufsrc2 = NULL;; d# S/ v- J. w( k4 r) e5 n0 M
  75. char *dmabufdest1 = NULL;
    ) Q; G; z' A  i; E. x% O
  76. char *dmabufdest2 = NULL;; C8 x& k/ `5 {) ]0 b$ y( F
  77. 6 j0 |) q# m' ~: U) ^
  78. static int acnt = 512;9 f' I) D$ |1 D3 m4 K& p' @
  79. static int bcnt = 8;- V- E0 V0 Y3 R8 q6 E  t
  80. static int ccnt = 8;
    % j8 D* U7 y+ a

  81. " f7 B& H) Z5 R  S, v+ b
  82. module_param(acnt, int, S_IRUGO);
    & u* k$ `6 G4 i9 z5 t0 ^
  83. module_param(bcnt, int, S_IRUGO);! t9 A' I9 k' z( N" E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 x& Z: t' ~  ^: n' _
4 V- k" ^3 f( K" R0 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 H1 [6 z( a8 E8 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ ]; X/ ]  _1 R$ j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ?1 Y8 n, h, T' @" _, V& w

7 H" c& j' |* F& \, ~) n( |% y0 Q- D% |9 ?/ G1 P0 k2 G2 O0 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 22:28 , Processed in 0.044952 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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