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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- P' N4 b) n/ }/ c; A4 u0 B- R
  1. [code]EDMA sample test application+ y: u, \/ `) y" k/ f1 W
  2. /*
    & [: h, X5 n! `6 b8 v0 u
  3. * edma_test.c
    $ @& e' G: C; F: d/ U8 I1 d
  4. *
    & a7 _5 [! a+ o# I. ?4 ^( Q
  5. * brief  EDMA3 Test Application1 G8 K$ A2 g/ Z! ]0 K
  6. *! I4 f- V7 F9 s' m3 N
  7. *   This file contains EDMA3 Test code.
    : O. `. r. R# [. D% M9 q# o0 c
  8. *
    / L. W; F' u! p8 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# c# f$ k. I! Q* S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( H; k* i7 W5 o
  11. *         TO CHANGE.0 m& _6 L' w. {! J. U% q) \
  12. *
    2 Z: h* n& w! U! n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( G% @( z( q4 |+ p% B4 O
  14. *3 X+ X# {% q8 \2 B/ W4 h" `1 W
  15. * This program is free software; you can redistribute it and/or
    " C$ Y' _6 f0 W" B! E
  16. * modify it under the terms of the GNU General Public License as" X  D$ A, \8 N8 ]  f* o! {0 o
  17. * published by the Free Software Foundation version 2.- y/ U, N' h/ f9 Y' W( F
  18. *
    : U+ @% I+ p4 z7 L4 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, f$ y5 |; J7 s2 D
  20. * kind, whether express or implied; without even the implied warranty
    " ~0 G+ N$ q% o' I- w/ a4 f/ y, k* V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 F( c9 ?9 B* c* |7 e+ H
  22. * GNU General Public License for more details.2 O" _% @! A9 C! T& D8 s. [
  23. */
    8 l8 I' c+ r2 M* \+ n  p
  24. 0 r% e2 Y- r1 P, t5 {3 {- S9 }
  25. #include <linux/module.h>
    " ?" c7 }5 Y$ P! i
  26. #include <linux/init.h>
    9 Y: Z& U3 `  _
  27. #include <linux/errno.h># [! x, l, n5 ]3 I/ S
  28. #include <linux/types.h>/ H' D. K' g0 z% U8 t$ y5 j. v" i& U
  29. #include <linux/interrupt.h>8 e, g6 T' ~9 H4 T
  30. #include <asm/io.h>6 ^& Z" E% P% D, `# Y( S
  31. #include <linux/moduleparam.h>0 m7 X% U; H+ ], b8 j( u: r' t2 O
  32. #include <linux/sysctl.h>
    . J8 ]$ L+ z" v& T4 }# x
  33. #include <linux/mm.h>
    . h6 ]! W; _$ ]% b7 Z* W
  34. #include <linux/dma-mapping.h>
    ' Y+ @1 ^+ r9 |& C6 G

  35. ! ^% n5 K- g* x- `/ ~" A. `1 ^) u# M7 r
  36. #include <mach/memory.h>. g$ d& j( Y% |
  37. #include <mach/hardware.h>5 y' w, N9 ^. U- Z
  38. #include <mach/irqs.h>
    1 R, d( d9 n9 J0 s1 x' R
  39. #include <asm/hardware/edma.h>9 O7 A, r$ x3 Y$ a3 X8 a& P! B; ]6 }

  40. 8 `; T2 C: R; _5 K/ C1 P: U
  41. #undef EDMA3_DEBUG' k7 x' @& E5 Y9 e8 [! W* a) f
  42. /*#define EDMA3_DEBUG*/
    % r* w, B5 S7 x  W- `& _0 Z
  43. ) {$ C3 q; j  B0 q; E# p
  44. #ifdef EDMA3_DEBUG4 ?& J! u3 e  f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / E! \# {2 l7 ^, Q  K; F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" E! ?* g6 C  }" z3 V9 H8 f- M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* s% B& c" a( q2 |" N* \
  48. #else
    $ c* q) O4 \+ R* a; k2 @
  49. #define DMA_PRINTK( x... )) Q+ z; L% \- Z/ w6 R
  50. #define DMA_FN_IN
    0 A# y: I1 Z3 ?) ?+ _( w- q
  51. #define DMA_FN_OUT
    9 n7 B: L) z7 x+ W$ v5 d
  52. #endif9 d) [5 E3 i+ U, P
  53. 9 T; o% e8 Q1 F- q+ u! w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ c  o7 y/ h2 w, B. X. h
  55. #define STATIC_SHIFT                38 k% c1 r( w: X; @' W6 A0 w- u5 v8 A
  56. #define TCINTEN_SHIFT               205 v/ S( l" @4 C7 ?
  57. #define ITCINTEN_SHIFT              21  Y6 i  e2 w% M2 t8 m
  58. #define TCCHEN_SHIFT                22
    - i5 F, C7 X  A& z% v) ]
  59. #define ITCCHEN_SHIFT               23
    ( ]' _( c  O1 j) y5 O5 K

  60. * m7 k& k! r# J* r8 B* N
  61. static volatile int irqraised1 = 0;
    ' U" |1 C5 d! J3 j* }
  62. static volatile int irqraised2 = 0;4 {- ?7 t5 m3 B2 P# O4 U
  63. 8 z9 K3 k1 T/ K  L+ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 I3 W2 U6 Q! ]- P1 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + a7 ~4 ]' D2 Q7 }4 c2 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) Y# ~0 g$ _; V) l" a
  67. 2 c' c, i3 y6 r! p9 p: C- p
  68. dma_addr_t dmaphyssrc1 = 0;
    " z5 r% V+ O( L
  69. dma_addr_t dmaphyssrc2 = 0;
    ; U( `2 G; d$ \* S4 U. i2 k
  70. dma_addr_t dmaphysdest1 = 0;  s8 x: ?1 E: [
  71. dma_addr_t dmaphysdest2 = 0;
    2 D2 V+ O9 g3 o6 n8 `4 ?! w

  72. 4 V' Z9 o0 r& e
  73. char *dmabufsrc1 = NULL;
      D7 v0 i7 i1 D) D2 X
  74. char *dmabufsrc2 = NULL;
    0 _3 I. a: U4 o; b4 w. L
  75. char *dmabufdest1 = NULL;1 n4 D4 I, B) b9 h: H, c
  76. char *dmabufdest2 = NULL;
    / N* J+ m) U, I" F* L( p

  77. ' h$ l. k( p3 E% t
  78. static int acnt = 512;' X! B  Y5 y; q; `# G: f
  79. static int bcnt = 8;) R0 Q+ D  V) u' L
  80. static int ccnt = 8;. G5 ~0 J& C% ^; n+ Z

  81. + l6 M0 N- t5 U: A! j3 |; j4 N; k' ?
  82. module_param(acnt, int, S_IRUGO);  J+ Y9 ?' M  d( [  A
  83. module_param(bcnt, int, S_IRUGO);7 Z- d8 U7 p5 B5 U2 I% {5 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, Q3 c6 x% x# r3 @
2 x) R$ T$ Z$ r& {: k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  x, v- D# q7 U$ z& S# ?7 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) J9 O, r8 D$ E# R+ [+ U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- i0 I8 f+ x! b7 n# T- H( A* a5 J/ X6 H' x; `
, l5 q. e% @# E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-2 07:36 , Processed in 0.041776 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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