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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! b9 D2 v" |% X
  1. [code]EDMA sample test application
    5 `2 @$ ]3 y6 b1 T9 E
  2. /*3 O9 j2 \$ `9 `  t+ }" z1 S
  3. * edma_test.c) J4 f& t8 f' g4 @/ n; x
  4. *
    , Q8 Q6 W( e' _
  5. * brief  EDMA3 Test Application
    ; L4 y2 u  ?3 ]" u# D6 p, `
  6. *$ P( `- A' A3 d/ c
  7. *   This file contains EDMA3 Test code.
    ) D2 @1 C9 I! y$ ]
  8. *, f  k8 i- O1 I+ I# }7 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. a! ]4 |" S/ Q, u8 ]# B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 o6 z+ K: k* I
  11. *         TO CHANGE.
    0 L' p- z0 J2 \- Y7 L% i, Q
  12. *
    ! a' K+ r0 X  ?$ T6 ]! m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & |7 d) ^4 Z8 K: @  v
  14. *
    * a* w; C# C" y: m, O- t: E; F
  15. * This program is free software; you can redistribute it and/or/ ?8 e* C% X$ f( A) x* }  y
  16. * modify it under the terms of the GNU General Public License as1 ^/ b9 n; h4 l/ z* j
  17. * published by the Free Software Foundation version 2.
    1 Y9 p% R. T1 V
  18. *
    ' \2 X2 E& [; x  E4 \+ X/ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; j) E1 M* G. N6 n" v, I+ c# ]+ a- |  G
  20. * kind, whether express or implied; without even the implied warranty- u' X( u2 k8 U8 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 M( U, p8 B* ?+ f/ Z
  22. * GNU General Public License for more details./ G9 |: ]# v1 B2 x$ |
  23. */
    3 i9 M# z, {& M. f  w8 t9 u

  24. ' ?7 [6 \; t2 Z. s
  25. #include <linux/module.h>
    ' r  y2 q* {5 x7 B+ O# x
  26. #include <linux/init.h>8 G5 s% v/ x; d$ Q1 |( i
  27. #include <linux/errno.h># ]* d3 V# h( V$ X# r) H
  28. #include <linux/types.h>
    & t, R. {0 R8 a, v. o+ z
  29. #include <linux/interrupt.h>
    8 i* C2 N, L5 j5 H6 Y8 W9 ]3 U! f" V
  30. #include <asm/io.h>
    3 `; x$ P) H. f
  31. #include <linux/moduleparam.h>
    # f2 e! }, e4 D7 n* O0 C
  32. #include <linux/sysctl.h>
    7 E3 ^$ `) a% O
  33. #include <linux/mm.h>- M& B) W1 p1 i  `
  34. #include <linux/dma-mapping.h>
    6 P% u, g+ S" }( d
  35. ! B  W6 r! W" @1 P
  36. #include <mach/memory.h>' w! f/ H7 L! e3 Y2 `6 R( r
  37. #include <mach/hardware.h>5 ?' Y' W0 _0 `4 U
  38. #include <mach/irqs.h>
    . R+ O0 Z9 t; V4 V: G' @6 T% \- E
  39. #include <asm/hardware/edma.h>6 |9 x) o7 d3 N
  40.   S7 g, h* P5 D/ i( @7 ~, r
  41. #undef EDMA3_DEBUG
    ) o$ Z: Q; I. p" l7 L4 M+ O
  42. /*#define EDMA3_DEBUG*/, u: e) v! P+ i4 I- _

  43. ) p" n) k- M6 D
  44. #ifdef EDMA3_DEBUG0 t9 v$ N" Z- Q! c7 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      Q5 k. z' N% L2 Z4 _5 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), A1 m/ O4 ]) p& _/ q+ B, s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Q7 n+ A" C1 ]2 v
  48. #else
    ! f( D) O8 }& a7 D7 J4 R
  49. #define DMA_PRINTK( x... )  B: R" k/ Q) p# {
  50. #define DMA_FN_IN
    8 c$ V+ f. A3 g
  51. #define DMA_FN_OUT" x. Y5 t. v9 e$ S& t
  52. #endif
    7 r( p' q: H6 w3 P0 F7 p% ]
  53. 4 a# o+ q/ R  N; i- X" [4 q, Y$ [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 A; }8 K- g; Y/ A
  55. #define STATIC_SHIFT                3
    1 E2 z( f0 o! l* Q! d: j& ~5 B0 j
  56. #define TCINTEN_SHIFT               20
    8 r- F3 j$ k. O1 X
  57. #define ITCINTEN_SHIFT              21. G8 e/ A3 I: o) i# K- L5 h2 K/ W6 a
  58. #define TCCHEN_SHIFT                221 l( n# u; }& p/ ?" d! Y
  59. #define ITCCHEN_SHIFT               23
    8 f2 W! j) n- V
  60. ' y7 Y& {' z8 g! Z* }; U/ t
  61. static volatile int irqraised1 = 0;( H. C, i* b; p5 a& l
  62. static volatile int irqraised2 = 0;
    2 q, n9 ~0 i  N; s0 Q/ R
  63. , A& e7 s% n2 g: n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 }# h/ K4 L: i" l% C- T9 f- v% s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s) ~) K& u0 [% A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q1 {: }1 p. v+ \! L/ `4 E

  67. * @7 H: w. m  B. H
  68. dma_addr_t dmaphyssrc1 = 0;
    - f- k1 N/ o% W& S0 B3 c) _
  69. dma_addr_t dmaphyssrc2 = 0;. K1 I8 @6 [& q* d: B0 K
  70. dma_addr_t dmaphysdest1 = 0;
    - Y" s0 V4 l* i( \4 U% c
  71. dma_addr_t dmaphysdest2 = 0;% k0 n  {% g4 y: k7 R

  72. : N2 R. s( b: m% Z) |
  73. char *dmabufsrc1 = NULL;8 ?; W# K! A8 B- q! i( f$ L6 N
  74. char *dmabufsrc2 = NULL;' u: H, ]! Z$ |4 c, a6 s8 C5 h4 S
  75. char *dmabufdest1 = NULL;
    ! \2 Q) F1 c0 {: D; Q. S7 o) u
  76. char *dmabufdest2 = NULL;" t2 a0 a: J0 D4 ~6 ~
  77. $ j, e( d/ V$ ~4 a5 \' t; w
  78. static int acnt = 512;
    1 T' N) \( x( `2 a) r
  79. static int bcnt = 8;. p# d' h: O3 h* r
  80. static int ccnt = 8;, y  k" |6 P! ~: }

  81. 5 t. W: o5 [; J9 L3 P0 p
  82. module_param(acnt, int, S_IRUGO);( V0 Y9 L' ~5 x7 h
  83. module_param(bcnt, int, S_IRUGO);
    + ?1 V& r# \  Y, ?/ }+ D1 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 e: Q9 U, g6 D% R! ]; T
( R$ m: V. g% v9 B" Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ]5 L# b% ?3 y3 ]- A% d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! {+ {0 f. b! P) W! c  _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 \+ q  w0 \+ \' I. w- ]+ |) X- s) }& T5 p: f" \# L& a

; A1 m. ~+ @: G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-27 10:49 , Processed in 0.040742 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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