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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - V; r. P, C/ ?  _  W; D9 v+ e  A" c
  1. [code]EDMA sample test application
    ( c" L/ n6 f$ P& P% F  H  U; B9 ^
  2. /*, u$ r" }7 u- q; R7 ~; }
  3. * edma_test.c# m' R- o2 P* e! L" K
  4. *
    : t6 o( C* \! W* z
  5. * brief  EDMA3 Test Application6 d0 f. w) Q/ r; r
  6. *
    ; k: Y& X+ i( w& l. G3 a5 N+ l: K  L
  7. *   This file contains EDMA3 Test code.
    " \$ J3 w5 a; k+ p
  8. *
    : E3 b+ s! }# p2 i" ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      w$ H/ w* w* l2 p4 P; _" b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( p* b, z) p- e0 j3 h6 V+ I5 m
  11. *         TO CHANGE.2 D9 P/ @4 B/ U4 o7 z9 L2 D
  12. *) ]) k7 U; Y2 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      v% f6 D8 p& [1 v
  14. *
    7 ]0 S: u! j0 S7 B
  15. * This program is free software; you can redistribute it and/or
    : T/ |) E9 G: U/ _/ c8 Q; o
  16. * modify it under the terms of the GNU General Public License as: z0 \' P9 g+ O' {
  17. * published by the Free Software Foundation version 2.
    & W6 F) b1 f; B2 S, p9 r
  18. *
    $ J' V! C6 Q! p4 x6 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 ^4 O8 _* P' q6 u7 B% D
  20. * kind, whether express or implied; without even the implied warranty4 C3 @" ?) a2 r0 n. J$ _" C2 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, D, q2 R3 ^4 L- o1 g7 f' ^
  22. * GNU General Public License for more details./ x: |) Z6 b7 D4 X0 {
  23. */
    0 a- s7 d/ X+ a; y

  24. 7 x$ o& C/ V. l* V1 l/ e1 v  |- d
  25. #include <linux/module.h>+ Q8 `" X5 z2 ?# i0 v3 O( u3 n3 q
  26. #include <linux/init.h>
    4 g4 ]0 J' M/ {
  27. #include <linux/errno.h>
    + ]% a# y: w+ T+ s! b% J+ U
  28. #include <linux/types.h>$ l# h5 i' c& h4 G4 N: |
  29. #include <linux/interrupt.h>
    ) K0 E& b/ R! X% R
  30. #include <asm/io.h>
    6 t, B: Q2 J  C7 ?, f
  31. #include <linux/moduleparam.h>
    1 A3 K  j- F: A( x' m$ N
  32. #include <linux/sysctl.h>$ {1 @# T1 C, B. }- G: y
  33. #include <linux/mm.h>
    / V0 E6 p) _' S. n
  34. #include <linux/dma-mapping.h>
    * s' d7 z' Z& A$ p- |

  35. : E' t3 f; H; M5 ~
  36. #include <mach/memory.h>
    # N5 M7 F2 I8 @1 i
  37. #include <mach/hardware.h>/ M# M5 |1 ^& z4 H2 [8 ^1 M
  38. #include <mach/irqs.h>. k4 w7 p" ^/ X( ^  M9 f; \
  39. #include <asm/hardware/edma.h>
    - O. D( @$ w9 q$ [, G1 H( \
  40. ! p; g& v9 K6 n
  41. #undef EDMA3_DEBUG0 E) g( m: ~* C2 M! D
  42. /*#define EDMA3_DEBUG*/* x1 B" l# n/ \8 x! G
  43.   y7 y- k- u8 Y" a5 H: w
  44. #ifdef EDMA3_DEBUG
    + f% n' A/ o: D/ _5 i) L( K% q+ n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), z% b/ q) B- k( H$ y; P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' \  X! t, k/ N! R! h9 m; G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) H- c8 T6 T1 j# J3 p4 i
  48. #else
    & d* K" D9 q; |% ~
  49. #define DMA_PRINTK( x... )
    * Y4 |* y# M" s1 s) V
  50. #define DMA_FN_IN
    " f% Q% E7 z; Y  m& E
  51. #define DMA_FN_OUT
    ; D9 X( T; V0 f$ I5 e' n
  52. #endif3 e3 Y2 d0 L' F, S
  53. 7 P) G5 u/ y: l' l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). H/ Z. Z$ i; n
  55. #define STATIC_SHIFT                35 b% \2 J/ X6 L+ C* ^$ U4 c
  56. #define TCINTEN_SHIFT               20; S$ T) k3 L' I: ?( D. O! K( M
  57. #define ITCINTEN_SHIFT              21. T  T5 x3 J3 o9 X7 Q/ l
  58. #define TCCHEN_SHIFT                22+ o  A6 n& v5 f8 W
  59. #define ITCCHEN_SHIFT               23# {& k: ~. c1 _

  60. * g: t7 t. k0 ?4 M) ?) E
  61. static volatile int irqraised1 = 0;
    - _" {" o& A6 E8 {0 Y1 l
  62. static volatile int irqraised2 = 0;
    ' _- Y# e- o1 s" P2 e
  63.   w8 J) ~6 e6 H0 n, W+ z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^! d' z) S* }8 Y1 q$ c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : x2 u4 P% d& k. k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! I, K  X; W5 @1 {+ `) J

  67. & f( f. i) ?1 ~7 _! a% j
  68. dma_addr_t dmaphyssrc1 = 0;" K0 D% |# z: p) b) m! u
  69. dma_addr_t dmaphyssrc2 = 0;
    ( S0 x& D' X( X6 {
  70. dma_addr_t dmaphysdest1 = 0;
    % k5 g3 p7 s4 P- v1 O7 M/ u: T
  71. dma_addr_t dmaphysdest2 = 0;
    ( |1 j3 g5 T  \* s; d( m' R
  72. # ^' K  ?6 Q# v+ j# Q
  73. char *dmabufsrc1 = NULL;
    : R  s6 t0 e0 o, v& E3 g' T; r
  74. char *dmabufsrc2 = NULL;% I. h9 b& N+ M8 o: @  E# N7 t$ D
  75. char *dmabufdest1 = NULL;
    ' z2 j" k" ^" u- Y
  76. char *dmabufdest2 = NULL;
    6 a& M' j+ m9 b' v; t6 X  [8 k

  77. , g2 d$ e4 l+ f& X
  78. static int acnt = 512;* O; H+ _0 K& o: d' y
  79. static int bcnt = 8;% v- u! U5 r! f& s2 L( I
  80. static int ccnt = 8;7 N% }7 ^( v& D& ~" f: o- T

  81. 6 P5 B$ d7 O8 z7 b* [% O" V. M' S' a
  82. module_param(acnt, int, S_IRUGO);
    ; L9 U' y" D3 T: S. [8 a& V  _
  83. module_param(bcnt, int, S_IRUGO);
    , r( h. h9 K% E6 ]/ u- M2 w1 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- X6 a& b8 L! A- O3 A  K5 E, v1 _# o$ q. e) U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  r* }4 ^$ O  {, k! `2 F( l$ y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 I! x- O4 H" L) H+ T! H& C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ~2 q6 |7 |0 n! u  D& _1 N" D, B6 g* F  W) p

5 |& N/ R: H6 M$ K/ \7 L0 u/ O0 @0 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 19:28 , Processed in 0.043396 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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