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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ]5 B! y( W1 d4 [* U4 W
  1. [code]EDMA sample test application8 N" U/ [! ?2 f# f3 z
  2. /*
    7 ~1 M4 p3 V/ [/ ?; Z- o8 Q; _7 w
  3. * edma_test.c
    ; }# G6 K0 ?7 v1 ~9 `8 P
  4. *
    ! q7 k/ N/ l$ ~- {+ O* u6 C% V
  5. * brief  EDMA3 Test Application
    6 t1 f/ c! h3 J' \! h/ n
  6. *
    1 a& V$ m; @$ T, C+ p
  7. *   This file contains EDMA3 Test code.& s. r& A; @, P' L
  8. */ g) ^" Q+ }+ K! x# z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , M" [4 Y" C3 V( \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # |, y+ t. b6 O% k+ h7 R) B
  11. *         TO CHANGE.
    ' r4 P$ g: F' o+ b. ?
  12. *
    ! Y3 O2 b/ g# Z; `5 T& P5 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" T/ |. J# q5 v5 G
  14. *. }" f& P4 F$ Y, E/ M7 J2 o+ I8 X
  15. * This program is free software; you can redistribute it and/or
    & n7 D2 b! G$ }0 g, X% c" j* ^2 l
  16. * modify it under the terms of the GNU General Public License as
    ! W, r1 D. q/ {  u( L* N8 o: U( w
  17. * published by the Free Software Foundation version 2.7 Z3 F  [3 |+ N" u& ~
  18. *
    7 H. T5 Y- `" a; j- r' \9 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 R6 q6 M  H% ^0 n
  20. * kind, whether express or implied; without even the implied warranty4 r7 s$ L, @' w: ?4 t8 y# F1 q+ i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 }7 x, r, K& i8 T5 D6 P/ O# d! w1 K
  22. * GNU General Public License for more details.7 ?) I+ \1 c& J
  23. */3 X. Q/ a/ C' k$ |2 C* M3 d8 Q: ~

  24. / }! q- G2 ]% @% @0 C3 K& _  T" B3 L5 i' J
  25. #include <linux/module.h>
    $ u0 ]4 d4 A% X" E* o
  26. #include <linux/init.h>0 y9 U( W6 S3 M: \, F% o
  27. #include <linux/errno.h>, P! e% X2 |! A  a$ k, L7 O
  28. #include <linux/types.h>
    9 C  j6 G- l' `  u3 j
  29. #include <linux/interrupt.h>0 m3 ?8 I, h: \8 R' v$ ?
  30. #include <asm/io.h>; @' M$ Y6 l. g' x
  31. #include <linux/moduleparam.h>
    " a  r0 e1 P# F% g: Y
  32. #include <linux/sysctl.h># [. {: j2 F6 M
  33. #include <linux/mm.h>$ g3 ?* t5 Z5 U' G
  34. #include <linux/dma-mapping.h>
    4 C+ [' J; l% v  @) e" f. m/ }

  35. 2 n, D3 }, b; d7 y& [9 V
  36. #include <mach/memory.h>! a( O; t6 ?7 e0 |8 O% s! {6 v! F
  37. #include <mach/hardware.h>  k. J- ^5 V6 ~9 I+ L
  38. #include <mach/irqs.h>
    2 O) Y% d8 s% c/ R8 a
  39. #include <asm/hardware/edma.h>
    3 h  y; f" S' \0 a

  40. , c* g3 H; }2 V1 ^
  41. #undef EDMA3_DEBUG
    ' H* Q$ q$ B* h/ q, `
  42. /*#define EDMA3_DEBUG*/# ^6 t7 T4 @; g3 J/ t: H

  43. * `3 ]1 K/ e2 y& A
  44. #ifdef EDMA3_DEBUG
    3 [7 E- z) p0 j9 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 l% I7 s! A% N; \) u( s+ W! m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ w! ]# [1 v+ [. o6 Z1 y& b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* Y# V, p) }/ f/ v8 d) [; \' a3 y
  48. #else8 z: F! x9 Y( f! X) m( L
  49. #define DMA_PRINTK( x... ): C' Y( r/ h5 Z
  50. #define DMA_FN_IN
    + i: P9 O' O2 D  J, t& H
  51. #define DMA_FN_OUT
    8 w/ m$ ^) E! {: Z
  52. #endif
    ; t6 n! B. g8 a3 ?  i/ F0 b
  53. " [2 F* B/ M( T& X7 A& u; Q4 l: T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + i0 `) o2 n1 P3 F4 g
  55. #define STATIC_SHIFT                3
    : H' @! m1 X* U( E9 f. \$ s3 ~
  56. #define TCINTEN_SHIFT               20
    2 A7 `* ~" D8 s  i
  57. #define ITCINTEN_SHIFT              21
    : e# v( o4 g" d+ d! p
  58. #define TCCHEN_SHIFT                22
    ! t" g/ V7 l" |0 q3 K& \' z% d
  59. #define ITCCHEN_SHIFT               239 j. J% G1 c7 [# A' g) a8 Y: ?* D( S

  60. 8 d1 p# L0 \# O; C; Q7 s+ Z
  61. static volatile int irqraised1 = 0;* C) |" F* `2 E- h
  62. static volatile int irqraised2 = 0;
    6 l7 j; |5 _, t% R% c4 O

  63. % j+ a& \1 y3 V/ z7 W$ I" c! [# p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - `2 h6 u  R8 n% r$ b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - I# w. ?) X5 M1 |$ |: s% p0 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u  z' M- E; }# e) d, M; _2 \0 _

  67. - l9 m2 Z& A* G: ?' _" m. I" i
  68. dma_addr_t dmaphyssrc1 = 0;! _; O( \- M0 A
  69. dma_addr_t dmaphyssrc2 = 0;) M! }+ A' z4 M& {9 L3 s
  70. dma_addr_t dmaphysdest1 = 0;1 r$ P8 [2 Z4 }7 D
  71. dma_addr_t dmaphysdest2 = 0;! i7 X  z7 ]9 S* o

  72. - q. X/ @/ t! \9 Q" U* y4 c
  73. char *dmabufsrc1 = NULL;
    4 T% n5 h2 @1 [: _- U1 k
  74. char *dmabufsrc2 = NULL;
    # m% t7 v0 O. x4 Q" z
  75. char *dmabufdest1 = NULL;* ^9 W9 i# r2 C, m1 c$ Y& }$ C
  76. char *dmabufdest2 = NULL;
    + c: t" [. t& \/ E) M8 X

  77. ! y  m* M, K* O2 |$ g. \; }5 C
  78. static int acnt = 512;/ a; {. B. ?% d2 n# e
  79. static int bcnt = 8;
      c7 A. e2 L/ U2 `- a3 F
  80. static int ccnt = 8;# _2 a, a# _! X9 d) I. Q9 y

  81. / ~% `! p) R) M+ i2 u4 p( S9 v
  82. module_param(acnt, int, S_IRUGO);) D0 _; X* R1 `& e, h, z: I
  83. module_param(bcnt, int, S_IRUGO);
    ( u9 K2 d" b/ E) m& h) m8 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 w& \: w, b/ y6 k+ k: Y( D' r4 s+ g9 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 T3 }6 ^' m6 u) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 m6 O$ S) S5 ?' o+ G; n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 P8 c5 d' h, [# R) [
4 c( l1 L2 {0 H2 N9 a1 P+ K! j- h: L! V: D) i4 _+ q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 13:19 , Processed in 0.041628 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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