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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. |6 t2 i  u: S0 t1 R8 [
  1. [code]EDMA sample test application
    6 ]2 O0 z# M% t3 B5 V& K
  2. /*' k7 c" B" J! d/ f  z! E8 m+ ]
  3. * edma_test.c0 N6 B. t- G  k5 E
  4. *
    , X* B9 n  {& @! Y7 m, H) @
  5. * brief  EDMA3 Test Application! W3 o& G* d& c) J% y  J; H" e& O
  6. *: r, K7 i3 R7 v/ L, P
  7. *   This file contains EDMA3 Test code.7 ]1 r! z1 q/ g# p
  8. *5 @* w4 f# i) w* Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / U9 R0 o0 n/ x. `" ~' J4 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 U) H4 C  m! j5 o* O* u0 K( M
  11. *         TO CHANGE.# C. s4 o6 F) }6 F
  12. *6 N( U& V/ Y0 u4 L2 W; \+ q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 s; |/ |7 M# v3 O6 q: D. x+ C7 n
  14. ** j$ q' c3 U+ r- `4 {7 [
  15. * This program is free software; you can redistribute it and/or: o' o6 q" i4 U
  16. * modify it under the terms of the GNU General Public License as
    , y5 v' _- \: K: m6 D
  17. * published by the Free Software Foundation version 2.1 v, I3 k3 x7 U! e& _0 E5 ]) e
  18. *2 A+ v5 k" l& {" `0 J% r" H. A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 H! ?! o* u3 [. d' A4 j* P
  20. * kind, whether express or implied; without even the implied warranty/ g8 {% O/ K0 G! l% c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. g. O4 e. c+ p
  22. * GNU General Public License for more details.
    7 R: j) p8 m# n2 e1 q; \2 E
  23. */
    % ~$ r5 l$ P$ e+ h+ ^+ J$ z0 W
  24. + l3 r' b, R( S  m- ~% U
  25. #include <linux/module.h>
    $ s# h& l  `  X) [$ B& m$ K, L
  26. #include <linux/init.h>; R2 }& H! M7 a
  27. #include <linux/errno.h>
    5 y) h% S, D0 I4 a8 x% `
  28. #include <linux/types.h>+ ?- |/ L' O) C+ m- j: z  y$ n
  29. #include <linux/interrupt.h>
    ( H9 |0 @" f$ ]( F* x" _. f4 g
  30. #include <asm/io.h>, q( k. ]: [  m6 M6 q
  31. #include <linux/moduleparam.h>
    0 p9 u& A2 w4 Q% g5 t* q
  32. #include <linux/sysctl.h>
    * k: [! N, l: A4 F8 i
  33. #include <linux/mm.h>" H! J4 u) Z0 a& _
  34. #include <linux/dma-mapping.h>
    * w4 E& X* t* M

  35. 7 w  ~; @( o0 d  x+ u' u" L
  36. #include <mach/memory.h>0 H4 \, i1 t7 g* x+ l
  37. #include <mach/hardware.h>$ G' @6 M& _( I! o7 e' K; m
  38. #include <mach/irqs.h>: ]) g4 _0 p0 J+ N
  39. #include <asm/hardware/edma.h>
    & v# N& d# X2 y# }

  40. # R, M+ b* Q) o) ?: `0 v
  41. #undef EDMA3_DEBUG
    ( Y: u) ]* w/ a, t! ?% h- V: v
  42. /*#define EDMA3_DEBUG*/8 D2 \* Q- s! D9 X: {
  43. ' `# }8 \' t: A+ W4 J1 U
  44. #ifdef EDMA3_DEBUG+ f7 h! `2 o. U7 ^3 j' H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 ]3 i7 |  g9 ^' R& Q" r, f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 S0 `4 S9 L& j( g7 g; f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ F7 N7 D- N+ J, O$ e
  48. #else
    # o& B5 c0 X1 f2 K% c
  49. #define DMA_PRINTK( x... )+ I+ k4 J- y6 v3 P& L; m( [
  50. #define DMA_FN_IN$ A- u# H" m7 x: t) d
  51. #define DMA_FN_OUT
    : R6 b  n9 m) }( ]! [) s0 m
  52. #endif
    ' w( T6 X. S% c3 v$ q8 b# p
  53. 1 ?7 s$ M, m. c. B2 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 e$ f1 Z/ C0 t6 j
  55. #define STATIC_SHIFT                3
    ; i" U! t3 V4 f7 e/ o( I0 }
  56. #define TCINTEN_SHIFT               204 r6 c, H% l' ]5 `
  57. #define ITCINTEN_SHIFT              21$ }6 l. n6 C% c, M6 n6 c1 t
  58. #define TCCHEN_SHIFT                22
    , }2 w9 z6 G) I, g+ z. C# j
  59. #define ITCCHEN_SHIFT               231 z! c& u9 q1 O1 E: e9 b2 _+ J0 R% H

  60. 1 o0 u" l) l+ `( t4 f
  61. static volatile int irqraised1 = 0;
      Z% ?3 a6 [. t3 c; m! L1 L9 ^
  62. static volatile int irqraised2 = 0;$ ?( \% g$ V% A2 }- }, K/ l' |( N

  63. ) v: g) u; C5 K: `0 Z! I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ^4 z  P6 g7 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " [1 `0 q  q- w6 E$ Y1 u, A& ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- O+ W1 o$ r3 L
  67. ( H" B" `+ e' R& x5 u* x" Y0 j
  68. dma_addr_t dmaphyssrc1 = 0;
    ) t2 z5 v& g. p* l) c4 ?" N: M
  69. dma_addr_t dmaphyssrc2 = 0;
    % ]5 x2 j3 z' z' [
  70. dma_addr_t dmaphysdest1 = 0;7 B+ |, C. d8 V$ R) m
  71. dma_addr_t dmaphysdest2 = 0;
      w! s6 j& \8 ?

  72. ! A$ g3 ]2 A) @' g) u4 Z/ d+ _: m4 J
  73. char *dmabufsrc1 = NULL;
      ?( j  Z) M; S: F& W
  74. char *dmabufsrc2 = NULL;2 T: ?' Y$ v' R; V% u
  75. char *dmabufdest1 = NULL;1 Y+ O) H  Q% S0 i( R
  76. char *dmabufdest2 = NULL;
    , X! Y1 r( j- S* }+ j/ j
  77. ! q* ^& Y/ G4 R. J6 V, Z6 y( c
  78. static int acnt = 512;
    $ Y# `0 E7 \0 r% j2 L/ c
  79. static int bcnt = 8;- u9 h6 K3 }8 p3 M6 a5 Q  D! \! J
  80. static int ccnt = 8;
    % c! G, ~" d6 l' b+ g9 i$ `
  81. 4 u! k+ g/ `6 |+ z- z! I
  82. module_param(acnt, int, S_IRUGO);
    5 h) I! \8 P) F5 B9 X% D4 g" d
  83. module_param(bcnt, int, S_IRUGO);1 t1 p: P; Q3 c4 Y. G" \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- `: g/ K3 P0 ?2 ]
' g. Z9 b+ A# ?/ f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& a6 J* ~" g2 i+ I) h- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% k) B& G+ ?5 c" P$ f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 u! ?9 ], w$ F* I7 J1 K/ \7 E

0 y: M& ^$ b# I2 i$ l* {' Q* A
2 j3 \. o1 j6 B5 @+ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 17:01 , Processed in 0.039940 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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