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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 P) y+ h7 r: \$ l; x
  1. [code]EDMA sample test application4 k) Q* B' r& O" ^/ Q2 u
  2. /*6 D. I' w9 H7 n4 u2 q0 m% F; Y
  3. * edma_test.c, l$ b4 t  t, j3 J: J
  4. *
      X2 y; h5 l8 [8 c
  5. * brief  EDMA3 Test Application
      s) ^8 S, Q( w6 ?6 n
  6. *1 t. ?3 @  T" u0 b" f
  7. *   This file contains EDMA3 Test code.
    8 X( F; }! [9 `2 P: `' t
  8. *& R% \+ o  T3 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' \# y/ l5 k; c6 G" p1 d, Q  e$ J6 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- f' m' B: f" B. m' u
  11. *         TO CHANGE.
    ! i% H; b; g8 K2 r* Q1 d* V. L
  12. *: G* }6 f& S& Z2 D  R/ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( C6 V, H# u) c' [
  14. *
    4 M8 Y0 C7 q$ q: y
  15. * This program is free software; you can redistribute it and/or% @/ X/ W1 E9 A9 T( F" M
  16. * modify it under the terms of the GNU General Public License as% G# v0 @) t3 I4 s* G- f
  17. * published by the Free Software Foundation version 2.) y9 `# e2 {: N* R6 Y6 v) x4 `
  18. *2 `! v4 {6 b* `; M- v& B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! G- c3 Y0 J& @
  20. * kind, whether express or implied; without even the implied warranty
    6 h# E3 u9 V' \1 V& n1 S5 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 Y0 V9 p; a) f( Q) I
  22. * GNU General Public License for more details.
    1 Q, H+ P$ u' m
  23. */6 B) d! R2 u5 G+ I
  24. * h8 S) v/ p' Z+ F6 w+ \: r
  25. #include <linux/module.h>
    : a$ @5 |1 d2 T. A6 Z. c
  26. #include <linux/init.h>
    6 o, F% n7 ^5 n  j2 b$ a
  27. #include <linux/errno.h>
    / K$ L+ z% I* I) I0 x
  28. #include <linux/types.h>
    ! Q2 v# [3 z: e/ ?' s$ V
  29. #include <linux/interrupt.h>2 q4 \& r. j; g1 p: `' Z3 y
  30. #include <asm/io.h>
    ; M' A$ q+ y4 u7 a  J" i3 q
  31. #include <linux/moduleparam.h>; J2 w2 d' `8 e8 M
  32. #include <linux/sysctl.h>
    2 [7 s6 U$ C. e* l
  33. #include <linux/mm.h>* I$ Y: V" J* d, c0 ~
  34. #include <linux/dma-mapping.h>
    / N, b$ z9 Z  i8 T% e/ X

  35. 0 ~0 w: K# _# O7 E' J
  36. #include <mach/memory.h>8 T# U! z8 K; k( \' V
  37. #include <mach/hardware.h>
    1 t- T, F/ h. t: e
  38. #include <mach/irqs.h>
    2 S3 _+ }, G2 h  f# Z
  39. #include <asm/hardware/edma.h>
    . W+ k. x" f' y! P6 ?2 d7 u$ S* u
  40. , {4 k% ^- x. K# E5 n
  41. #undef EDMA3_DEBUG
    , U1 e- x: G8 z: z
  42. /*#define EDMA3_DEBUG*/
    - y9 q1 ]1 M( V( \% x( r! C
  43. ' D! x, Z0 T6 I5 C
  44. #ifdef EDMA3_DEBUG1 K% b& O, _  h; |( w* V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! s4 m6 p! z  T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! C/ j6 |  G1 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- J8 D( E! x$ D
  48. #else
    8 W$ c8 D0 _. s2 @
  49. #define DMA_PRINTK( x... )' T' i' s6 C$ D+ c
  50. #define DMA_FN_IN
    % E( O6 T7 Y8 v' D2 b* D
  51. #define DMA_FN_OUT2 @* ^& i& k' V* _7 ^9 Z
  52. #endif7 X/ U: ~6 y( s" R$ |- |

  53. + C- \; C" v' M9 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 Q2 a9 x3 u  _, `2 l
  55. #define STATIC_SHIFT                3
      \, @# e( n3 ~$ }
  56. #define TCINTEN_SHIFT               20
    ( Y2 I9 _+ a- ~: c7 S2 X
  57. #define ITCINTEN_SHIFT              21
    . b; L3 l1 Y' J9 J- X6 L
  58. #define TCCHEN_SHIFT                226 I; {: F' |# W* a6 w$ t- V
  59. #define ITCCHEN_SHIFT               234 j5 c9 R' G2 b; f1 m- ~

  60. ( A( V0 k! e9 b& J% Y( f
  61. static volatile int irqraised1 = 0;1 Y) i5 l! b' d: W! B
  62. static volatile int irqraised2 = 0;  L! [9 H9 C. C
  63. $ V, V& K2 U; W* m4 k! N) v2 j9 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 [% ~: @# u2 Y- K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z4 ^# m8 @- v, e: G2 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n9 M5 u2 z+ N- J( P

  67. + C  V3 V+ O+ T0 F
  68. dma_addr_t dmaphyssrc1 = 0;1 V+ R# d; q7 m5 ?9 j
  69. dma_addr_t dmaphyssrc2 = 0;
    3 X& {6 K' V' |: b
  70. dma_addr_t dmaphysdest1 = 0;
    1 G5 S+ ]) w. S- `! P
  71. dma_addr_t dmaphysdest2 = 0;
    + R' T* \; H2 B0 M- F

  72. / y0 E+ e  B+ _* }
  73. char *dmabufsrc1 = NULL;
    $ @( l4 h% Y. Q3 s3 C9 {7 s
  74. char *dmabufsrc2 = NULL;7 b9 B* W+ z8 W) W3 x) V
  75. char *dmabufdest1 = NULL;
    ! ]0 d: L3 t2 R6 _
  76. char *dmabufdest2 = NULL;
    ' |3 f0 n& y5 L# P* B+ Q
  77. ' L, s4 v; k. w9 _
  78. static int acnt = 512;
    . d. e' C8 ^; q9 N; p7 L+ c1 H; Y$ G
  79. static int bcnt = 8;) o1 d8 W% }; @- R# q1 D- n
  80. static int ccnt = 8;( w! H- d+ \4 r6 K# ~

  81. * j+ F' C# S9 n/ n1 C4 z( v
  82. module_param(acnt, int, S_IRUGO);' A) z) B! e9 l4 v% Y
  83. module_param(bcnt, int, S_IRUGO);5 H5 M6 v, ~  v( x3 `! G) S6 w) \& Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 ~; ^' @% Z, T2 v3 {! P
4 c+ L3 X4 r- m+ P9 r8 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% T; r! W* Q7 _' [( n- O- w0 B9 L7 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" r$ d6 l# h8 l8 M1 s5 [0 `8 `; c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- z. P+ a, S9 W
7 x  ^. E; p) @: S; W$ L# |1 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 22:43 , Processed in 0.044932 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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