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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) @6 ~2 |8 n% \" ~, q
  1. [code]EDMA sample test application
    1 [1 `% g' z* O' G5 C
  2. /*4 i$ l* W: Q# E! X
  3. * edma_test.c
    - h% \0 ]6 \. q$ j
  4. *% {( S. k7 p) c" |6 z
  5. * brief  EDMA3 Test Application
    " R! f# W4 b7 e4 i
  6. *( B; W# _+ H6 o6 b' q* n  A
  7. *   This file contains EDMA3 Test code.- _# C: {8 T% z3 n) O" I
  8. *
    $ }$ N  v1 k& `0 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 R% o; e" ]! }' e; v6 U0 F1 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 |. T7 r: n  b. y- V& x) a
  11. *         TO CHANGE.
    # }" n0 i( Y; H" R( L
  12. *- E" S! y5 Y% I: J0 F! |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " R, A* \: d; ^' X0 t" C4 w( P
  14. *; D9 r+ B6 A' ~, ~
  15. * This program is free software; you can redistribute it and/or
    / L, V6 u+ w1 F; o6 `( K$ W( t
  16. * modify it under the terms of the GNU General Public License as1 p5 e( k9 B  A: @
  17. * published by the Free Software Foundation version 2.
    ) Q: [6 z. {& Y( R1 Y4 e7 {: C
  18. *
    + g1 S/ @* ]+ G# K* F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  J6 j# b3 i. U: O1 r# }5 z0 V
  20. * kind, whether express or implied; without even the implied warranty
    ) ^# W  _, ^& ^" O1 L1 Y  c7 [- V! {* W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: |  R; S+ y4 D4 B% _# i  S
  22. * GNU General Public License for more details.7 o# Q/ r. b, |* q
  23. */+ O, z* J- u/ c0 R

  24. % h; ]" _1 v0 d- o; h( w6 D+ f8 F! q
  25. #include <linux/module.h>
    ( T7 f2 N0 q, @7 m( ?" ~, L. M
  26. #include <linux/init.h>3 m4 T! P; @1 l( q
  27. #include <linux/errno.h>
    9 n  Q7 c# M+ G# L' l. e
  28. #include <linux/types.h>% g% ]9 \4 S4 L, J. H
  29. #include <linux/interrupt.h>
    $ i: u: r$ K0 |. d7 A8 r: \7 d+ a
  30. #include <asm/io.h>* l2 r) [" K6 V) N4 d5 t" k
  31. #include <linux/moduleparam.h>
    ! x# c* b: Q) t" d4 }/ D; M
  32. #include <linux/sysctl.h>
    3 p% A! Q9 K* Z
  33. #include <linux/mm.h>4 ]  r! J/ i& X
  34. #include <linux/dma-mapping.h>
    * x# U& V8 ?& T2 w4 x; d! ?/ s
  35. , Y/ b$ r1 l) H0 C! R) d/ D. Z0 {( a2 y
  36. #include <mach/memory.h>
      |3 ^2 x; O/ l; k- \* ]
  37. #include <mach/hardware.h>2 F  }9 `/ ~0 f& ~; d0 s8 o7 D
  38. #include <mach/irqs.h>
    / z( l) a. `2 u, {
  39. #include <asm/hardware/edma.h># N: i+ ?% T8 G0 T

  40. ( R: Q& F5 v6 F4 B
  41. #undef EDMA3_DEBUG
      n" r/ w8 \4 A8 j) q
  42. /*#define EDMA3_DEBUG*/, ^* t5 ]1 @8 V' ^8 w8 r$ h- |
  43. . n  o+ n0 o! ~5 r8 l- P
  44. #ifdef EDMA3_DEBUG
    " V( A, f$ x% M5 c) v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ B) T/ X) T5 \! w9 f+ @. A  v/ h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / I) Z$ x# g; f8 V% K8 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), {0 c, Q% l- r+ h1 ^' M- |0 }+ D
  48. #else
    7 _- z+ n) d( u1 l) e
  49. #define DMA_PRINTK( x... )- ~- ~3 S8 q& q. r$ H
  50. #define DMA_FN_IN1 S9 F6 ^6 Y' ~
  51. #define DMA_FN_OUT/ I! G. E# j9 V- \# R1 c
  52. #endif
    ) H" _  a5 F' Y. T$ C3 k1 U. R# S

  53. 1 C* K+ y5 d) ]$ \# M8 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 w. {/ A/ x2 n
  55. #define STATIC_SHIFT                3" U. j; E" O& E& r4 @8 }: G
  56. #define TCINTEN_SHIFT               202 Z2 \7 i& z- m. B1 @5 L% l
  57. #define ITCINTEN_SHIFT              219 R( W1 C" j; s9 M$ |3 e) A
  58. #define TCCHEN_SHIFT                22
    $ \3 e! \& Y' e% ^
  59. #define ITCCHEN_SHIFT               23
    2 |$ t  P  F8 k4 q0 D  }2 ~

  60. . [8 Y; ?6 e" ]/ B  T  R: @6 E
  61. static volatile int irqraised1 = 0;
    , ~( B$ [/ B* ^; ~
  62. static volatile int irqraised2 = 0;
    7 ?( f$ w1 [& k5 s

  63. 2 Y% p8 H, [- Z! n! V! ~; b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A+ y1 T: f0 P8 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 l: P) W2 J3 g! F9 V) l3 n( O( K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ^" m# t7 E' S
  67. ) n/ k) ?- O! L
  68. dma_addr_t dmaphyssrc1 = 0;
    - S3 O4 h, M$ a& Q
  69. dma_addr_t dmaphyssrc2 = 0;
    : J3 [1 {0 E6 y
  70. dma_addr_t dmaphysdest1 = 0;' n+ V( O- H; r/ D8 ?# {
  71. dma_addr_t dmaphysdest2 = 0;
    8 v7 q7 Z# h3 u2 j7 o

  72. 3 }" C# @$ J# w2 v- ]2 y- F
  73. char *dmabufsrc1 = NULL;* t- f- k$ x# W. }
  74. char *dmabufsrc2 = NULL;
    5 Z4 M% l; c+ X" |1 T( a8 C
  75. char *dmabufdest1 = NULL;
    . @" ?9 Q  ?* J, u1 F
  76. char *dmabufdest2 = NULL;
    1 J2 k3 _0 g6 T5 C

  77.   N% [' C  G$ v& B$ y( k
  78. static int acnt = 512;6 N% F) k6 s6 K! H3 l
  79. static int bcnt = 8;
    2 i4 }! P6 i( h* c8 O! b. N% F
  80. static int ccnt = 8;( h) V2 ]% R6 H6 k$ J# a4 e1 D

  81. . O) b' z. p4 @3 [9 X
  82. module_param(acnt, int, S_IRUGO);0 e9 j) z% n- `4 k% f
  83. module_param(bcnt, int, S_IRUGO);
    ) Y' I% y: \( O2 B2 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( T/ f- X6 u( a) Z

8 L% S5 [8 f% m- q3 |) C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" |) E% l# k4 H" y$ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 B2 Y: x# f& v) j2 ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ Q  a- B& B3 _' a! }# T! C& H4 g) K& n5 `4 c9 T

& d: i( J% J9 o4 h% T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 02:59 , Processed in 0.038496 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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