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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . x3 ^& ~+ v7 ?6 Z4 w
  1. [code]EDMA sample test application
    & s8 G; X5 ^! `" S
  2. /*
    3 f5 x" }9 {; ^! N3 ?9 e
  3. * edma_test.c
    ( @, k4 |7 Z. m; w/ u7 ?- I
  4. *  d4 E  C! `: @+ g% V
  5. * brief  EDMA3 Test Application
    8 W7 r" N2 _" b- f. ?& N
  6. *7 g; y" X3 o4 y, Q8 C* t% w6 g
  7. *   This file contains EDMA3 Test code.3 y% m8 D: Q. u- \
  8. *3 E/ a2 u( X( P) Q% n  @3 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % m, g) f7 T+ ]2 e2 N, y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ~( D) L, o$ m! O8 G9 J
  11. *         TO CHANGE.
    5 ?; K2 R; L8 {. ]) U- G
  12. *% [, y& d* I+ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ C! v8 H& C; Y
  14. *
    ! h4 |, `  L. h  R
  15. * This program is free software; you can redistribute it and/or  ]! k) D; [. E; m4 N; h2 p
  16. * modify it under the terms of the GNU General Public License as
      v  P) K7 r' r! Y5 J7 M1 W
  17. * published by the Free Software Foundation version 2.
    . S+ I; r' X) i1 b
  18. *# t  r/ t+ n) `4 }( H5 {! L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% y, u( R9 R, w, {; R
  20. * kind, whether express or implied; without even the implied warranty! {7 M2 a; A4 Q) o7 Q/ U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ g: S4 G, O) Q" f5 g" j
  22. * GNU General Public License for more details.
    ; l9 ^# q1 v) o# F
  23. */5 J3 o& }. _7 ^# B& g- L
  24. & _6 ], {, F1 J" }0 w
  25. #include <linux/module.h>
    % W8 o: h- R* ]7 j# e# T( t
  26. #include <linux/init.h># v) C; a! w! G- c8 [6 ^1 D
  27. #include <linux/errno.h>
    1 {2 i1 I* c! w2 G
  28. #include <linux/types.h>
    8 y2 y, o! J; @  N
  29. #include <linux/interrupt.h>
    & @+ b- o" x; w6 ~: J! w
  30. #include <asm/io.h>& Y$ P# s2 T5 E% H$ H
  31. #include <linux/moduleparam.h>" u  f/ S# i3 `- O3 t
  32. #include <linux/sysctl.h>1 r, r, g" D- S, b5 f, h7 N! F
  33. #include <linux/mm.h>' K3 n& }0 w2 A4 F9 c, D
  34. #include <linux/dma-mapping.h>4 s+ d6 T' Z  w7 n( j& |; \. ]
  35. & L. \5 N! I) m2 J, k
  36. #include <mach/memory.h>
    7 c; N/ V7 z6 t# u' b7 C6 T2 Z
  37. #include <mach/hardware.h>
    ! T+ p. Z: A3 [$ v
  38. #include <mach/irqs.h>
    6 ^# E/ _: u; z  T. ~# J
  39. #include <asm/hardware/edma.h>
    3 Z4 t) d8 O( k8 C. J. o

  40. ( `& n' R# Y1 O
  41. #undef EDMA3_DEBUG
    1 t: R: I8 N( ?: C1 i
  42. /*#define EDMA3_DEBUG*/
    - K, `7 ^7 T8 Q; J( x% O8 @6 \$ b1 ?8 v

  43. ) P; e6 N5 k9 x" i/ o8 Z* {
  44. #ifdef EDMA3_DEBUG
    8 q4 y9 z; S5 f  T( ~/ x" q8 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ B7 q3 X6 h5 j/ S3 q% m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 z2 Z5 Q9 Z1 R* S. r* o& s0 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ H) Z$ g/ ?! [0 M
  48. #else
    ! Z7 s0 B) k4 n4 x1 w" [' T* C
  49. #define DMA_PRINTK( x... )
    + K2 _. ?. N) D4 U5 Z/ ?
  50. #define DMA_FN_IN% l6 ~6 q1 j. M* u/ _
  51. #define DMA_FN_OUT" k( o9 _3 T4 q* ~  m- S" N
  52. #endif
    : V) t3 k% R. y3 `& P

  53. 1 B2 J3 k& |+ Y2 D, i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! N, F# ~7 B! d
  55. #define STATIC_SHIFT                3/ f6 I3 a" X3 m
  56. #define TCINTEN_SHIFT               202 h+ b. v9 ~1 o( O- Y
  57. #define ITCINTEN_SHIFT              211 Q# a9 R1 k8 y' Z4 o- X
  58. #define TCCHEN_SHIFT                22$ C: s: H9 h  W6 R* F1 u+ S' W# L
  59. #define ITCCHEN_SHIFT               23
    / i0 I, ]; K) Y4 ~) e

  60. * H/ D# J) m7 P9 @
  61. static volatile int irqraised1 = 0;
    + H9 x, Z$ e. \+ i4 e. x1 w+ a8 I4 F
  62. static volatile int irqraised2 = 0;5 ]5 [- i% u2 M& P3 U" C' I" C

  63. . A4 Z4 d! Y( E5 p& ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. [7 M# b1 V9 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& V' W/ h- l! I$ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Y  @) v; S" f0 Q! o0 F7 H! f

  67. + v/ o7 a: x" o. A# e
  68. dma_addr_t dmaphyssrc1 = 0;" @& G* j  m! f, X( ~  }
  69. dma_addr_t dmaphyssrc2 = 0;1 Y- d5 K3 U( n0 J9 b4 x
  70. dma_addr_t dmaphysdest1 = 0;
    ( e5 h! d' J' @- q2 [* G
  71. dma_addr_t dmaphysdest2 = 0;3 {/ [6 `- O9 W. F5 L$ A+ K; y

  72. % n& e2 R$ R7 x: r& Q# V( Y
  73. char *dmabufsrc1 = NULL;
    4 U$ G% D; ?7 Q* q+ D  C
  74. char *dmabufsrc2 = NULL;, ]" G' Y9 @) w3 F4 S% J
  75. char *dmabufdest1 = NULL;7 V, g- ^: o) ~8 \# D7 ]
  76. char *dmabufdest2 = NULL;1 t- U4 n. o  Q  @
  77. : x' g! j) F7 K9 X  \! E3 l* _' B% K
  78. static int acnt = 512;
    ( \$ u) h. g# ?( X
  79. static int bcnt = 8;1 l2 ?: m- ~! G& r' J
  80. static int ccnt = 8;
    , K# x4 c. V, ?1 ]: q2 i$ y
  81.   U% i3 `- _' I  Z) c' q8 d
  82. module_param(acnt, int, S_IRUGO);
    ) {, G$ [% s9 ?
  83. module_param(bcnt, int, S_IRUGO);
    8 D) v4 i0 H! h* \, l2 o) e6 n3 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ j& y; _1 [! W+ N
; f& x4 D8 `' i+ @; t4 I. Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% M: L( x  f+ X3 W" A- d$ c/ Y; H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' N7 Q& `. |. P/ j  Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% ~5 V9 U' l6 f3 q7 E& T! z9 k5 m0 \5 T- J, f& B) {& Y

) O2 Q! v7 B0 m+ X1 x& ]; b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-13 21:45 , Processed in 0.044823 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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