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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  t& C. n: p$ ^- m" B% [; N# L3 y
  1. [code]EDMA sample test application
    & m% \1 x( o! c% b$ Q' ?
  2. /*
    2 M: I  X% N/ a1 W# o
  3. * edma_test.c
    1 i- C5 _" @( [) F1 E) i
  4. *
    ' u0 b( J7 |; V
  5. * brief  EDMA3 Test Application
    . W( h9 w& [" o& U6 l
  6. *2 y9 d; J6 a7 k
  7. *   This file contains EDMA3 Test code.) U7 @& ^6 t+ U6 c. F4 q( W% y# K
  8. *# \! t% [( d6 w7 A: b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 c) e6 I9 z# U1 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ @+ a& x" c7 ^0 W
  11. *         TO CHANGE.8 e8 c; @! P; G9 h1 F
  12. *0 E9 h5 o$ P- w3 A0 |! m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' M7 ?/ R: @& `  k. b
  14. *+ x' O* R* P0 x' [0 F* d+ v
  15. * This program is free software; you can redistribute it and/or8 ~9 c7 K( U5 r, M
  16. * modify it under the terms of the GNU General Public License as. B4 D% p+ w5 q( D4 J
  17. * published by the Free Software Foundation version 2.
    * _6 c4 {+ P# l( b; e" U
  18. *  V/ k8 O2 K6 Z& Q9 d" D6 H+ ~; x+ p# V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Z# Z% d9 R) c: F# l  M6 N7 d( ^! ?) V
  20. * kind, whether express or implied; without even the implied warranty
    + g, i" O" n2 P0 w! ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 D7 H/ l3 d8 i* R% {, M. ]* |$ i- r
  22. * GNU General Public License for more details.
    2 i0 S8 l! Q: [* b
  23. */
    3 q$ I5 v9 m6 A# |4 P
  24. % j# d! O) a6 U  N4 y& L
  25. #include <linux/module.h>, J$ q, T  E' Y! u- b5 }
  26. #include <linux/init.h>* r1 S' y& ^/ ]& U7 K
  27. #include <linux/errno.h>. u. h# Z. d5 w, ~; C
  28. #include <linux/types.h>2 K4 S" ?# {5 v, A
  29. #include <linux/interrupt.h>7 A' R% M. {  t  U7 d) p* Q
  30. #include <asm/io.h>
    8 V6 d. l' v: \7 E1 T# E
  31. #include <linux/moduleparam.h>3 ?/ m* U6 S8 A7 r, A# U# E
  32. #include <linux/sysctl.h>
    0 I3 B! }+ j* Z- f
  33. #include <linux/mm.h>
    - J. ^- O$ ^/ k. |
  34. #include <linux/dma-mapping.h>6 F. h0 l% M5 d. @

  35. 8 k7 j# q1 y1 E. y1 D
  36. #include <mach/memory.h>
    4 V7 [) u/ A6 D- B
  37. #include <mach/hardware.h># l. e# Q' h9 V! N4 j0 |
  38. #include <mach/irqs.h>( @8 l) C' O$ D
  39. #include <asm/hardware/edma.h>8 d; D) A, u+ T; }

  40. + ~' ^! [, q1 I7 K! u: j% i& p
  41. #undef EDMA3_DEBUG* h( V: x. S7 T1 W  ]& b9 O+ d6 u+ |
  42. /*#define EDMA3_DEBUG*/
    5 [+ P* W4 }  D4 k

  43. $ x! F8 A, d0 _3 J$ F
  44. #ifdef EDMA3_DEBUG
    ' _% b/ _4 z. m  P! j  U, O5 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # O2 ?1 x/ Y- [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): u8 B) U) A( a- \7 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + c6 G% P6 G# h5 r( O* }7 V
  48. #else5 i! i, E* f" Q0 I' w; H2 I9 @
  49. #define DMA_PRINTK( x... )0 v0 t# V% z" d$ S
  50. #define DMA_FN_IN
    . I/ f+ Q8 @; Y$ ]9 V, m% s
  51. #define DMA_FN_OUT; f$ i' d/ w4 e+ w$ j% v8 N9 j3 H2 }
  52. #endif
    9 v8 [) w% a( z4 z. [2 j: A+ j

  53. # y  v' A4 s! }* s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); u3 h% r' F; H' k
  55. #define STATIC_SHIFT                3
    . M( Q' [; A/ Q' H
  56. #define TCINTEN_SHIFT               20
    0 Q6 e3 u' [4 f4 f1 p
  57. #define ITCINTEN_SHIFT              21
    + G9 B% _% F1 s  M1 x
  58. #define TCCHEN_SHIFT                227 v% C# s- B" K6 H- K
  59. #define ITCCHEN_SHIFT               23
    * Q' G: \- A- K+ q( [( D( R

  60. ! n) v" F3 A4 H. w  D2 E
  61. static volatile int irqraised1 = 0;
    5 \8 S6 }" }, J* v$ z- Z1 |
  62. static volatile int irqraised2 = 0;
    $ H& \: X' \- v# W# A

  63. % \9 f" a8 Q! J' B) V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h! j6 o3 n4 V! e+ N) t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 k/ D# J' [% P$ r* F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, U/ v9 j5 Q1 |$ d# L  m
  67. # R+ o. \" q( Z' I
  68. dma_addr_t dmaphyssrc1 = 0;% O* R2 @" \( n, H# y& j; {) Y6 P
  69. dma_addr_t dmaphyssrc2 = 0;) C  N! {; C7 n+ [6 P! }
  70. dma_addr_t dmaphysdest1 = 0;& m2 t6 b0 A) Z0 D& ^' K) w
  71. dma_addr_t dmaphysdest2 = 0;
    ( c" |2 Y1 {  f: D
  72. # C6 H3 ]( Y- L" |+ y! L. e! P
  73. char *dmabufsrc1 = NULL;: G- Y- J& \' r3 i2 t
  74. char *dmabufsrc2 = NULL;, ^6 t% N) q* ^( k1 B
  75. char *dmabufdest1 = NULL;: m  w* h* }5 T
  76. char *dmabufdest2 = NULL;: ^) C$ m* i" a
  77. & [0 {- ^) h: g9 P! @
  78. static int acnt = 512;0 `9 b$ e/ h: _' ]. o
  79. static int bcnt = 8;3 H& a8 x; |% D  f- M' v
  80. static int ccnt = 8;
    ; ^# Y* E! J7 R# S$ X9 x( Y; m
  81. 2 P3 Z: [  \3 A+ |& C; ]# H4 E* S# @
  82. module_param(acnt, int, S_IRUGO);
      `3 b3 ]8 K' a: t# `: O
  83. module_param(bcnt, int, S_IRUGO);
    2 w0 F% ~9 v& y' ~* o3 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 }7 j* S7 b- p/ Z# D
& {) Z9 r, f' E- e* j* z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 M% Q4 n8 |$ v7 `+ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' v0 \( t  \9 |+ D; O, g* b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) L5 V5 ]6 d9 S" A4 a) M
2 ?) U6 m( d  M/ Y' k
( o! _1 K7 m5 }9 }/ Z6 Z8 k; J: G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 19:09 , Processed in 0.044945 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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