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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : t$ U1 P$ C( Y$ U6 A
  1. [code]EDMA sample test application
    0 q+ [8 V& I" Z; i
  2. /*/ K9 B3 d- r: r1 ?
  3. * edma_test.c
    4 p  \: I8 a/ D% b' L& F. i
  4. *
    3 s% q, B9 w" m% v. c
  5. * brief  EDMA3 Test Application
    3 u" `! s, g9 ?. i. K; r( }6 `
  6. *6 Z/ _3 A( i8 f7 Q; f
  7. *   This file contains EDMA3 Test code.' @4 i% `' O% I, Y$ y
  8. *( k) [8 [, D, }% ^* R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - ^( R4 z$ X! Q" |% k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, N  t& T1 s8 z& d3 F
  11. *         TO CHANGE.0 V2 N! F3 O- x6 {! R% ~2 B
  12. *
    7 d+ V1 D, M- N' g2 N7 Z% L7 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " V3 b' e: h+ I5 [( m1 c
  14. *3 u# n- N8 ~7 {/ m! X6 t
  15. * This program is free software; you can redistribute it and/or$ p% B* Q6 r: F7 z$ Z
  16. * modify it under the terms of the GNU General Public License as* s  c6 K( F1 {
  17. * published by the Free Software Foundation version 2.; g1 l8 @( p% j$ f* J
  18. *; s# K& H' l# E7 b( o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 \- h# Z; g; C5 I, |
  20. * kind, whether express or implied; without even the implied warranty
    ' S: s1 \1 N' A) h1 h- b" G) g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , c6 |& H' J1 T5 n1 b+ q) x% h& l
  22. * GNU General Public License for more details.
    ; G% y: y, T# d( F, W, Y
  23. */
    " u3 m0 q/ g5 L! ]; G. i* [8 |

  24. ! i) d5 Z$ F5 z9 J2 F1 D: C9 g
  25. #include <linux/module.h>, y6 ?4 W* O7 d6 R9 n
  26. #include <linux/init.h>
    9 U- _* o4 I; |" P0 U. H
  27. #include <linux/errno.h>) K; H4 n" w6 c2 C8 r2 s/ f
  28. #include <linux/types.h>
    0 ]5 e  L, g# z7 \( V% j. w; D
  29. #include <linux/interrupt.h>- X. V2 y1 K. O" X4 [! V+ K( z
  30. #include <asm/io.h>; q' [" w  Q: r8 d) t3 ~/ ^
  31. #include <linux/moduleparam.h>. i1 a$ O+ N7 o7 |: O$ w
  32. #include <linux/sysctl.h>
    " L% ~0 E" H4 j4 H! Z0 b
  33. #include <linux/mm.h>
    + H( C) Y( F8 `  j  O' V8 _
  34. #include <linux/dma-mapping.h>
    8 X4 r4 d7 L5 A, P
  35. - e1 W/ e; s2 m& z  W
  36. #include <mach/memory.h>8 W) @/ _+ O" C
  37. #include <mach/hardware.h>
    0 W+ L, v$ @+ P- e9 D
  38. #include <mach/irqs.h>7 V; \; X8 e* z2 q
  39. #include <asm/hardware/edma.h>9 b8 q" Z+ w0 W8 B) c6 c
  40. ! F- H3 t4 N+ h( Z
  41. #undef EDMA3_DEBUG/ G- B. c' Y) p3 b! X  p; C
  42. /*#define EDMA3_DEBUG*/
      W4 c( }4 y: f- J' t6 T

  43. ' C2 ?- r: r" ^! J
  44. #ifdef EDMA3_DEBUG
    ' t+ h: o9 U. F/ w: j$ f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # s4 V' b% y0 }2 y7 u0 |$ f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 _1 c  _3 G2 P6 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  J( @# k3 |$ m# u* V
  48. #else
    $ E! x8 ~% O8 |  F. X( c1 s1 T
  49. #define DMA_PRINTK( x... )6 c/ b, S0 L3 b0 F" O
  50. #define DMA_FN_IN0 j7 H( K% [# R. j. @
  51. #define DMA_FN_OUT
    * a; J, K3 z& ]' I* }
  52. #endif9 d7 B- @3 T2 q8 \
  53. 0 v+ k) y7 c, c  y1 j( E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); I; |# ^( ?* t- }& H
  55. #define STATIC_SHIFT                39 W' u3 v4 L# |+ }" {* g
  56. #define TCINTEN_SHIFT               20
    1 d' a/ A' e' \1 i' E! c; p! y
  57. #define ITCINTEN_SHIFT              21
    ) o/ x4 e9 G! S4 ]  \4 |
  58. #define TCCHEN_SHIFT                22
    ; f( z" R( [) j. J
  59. #define ITCCHEN_SHIFT               23
      s  m* p, E0 q, u2 N. m* X6 k+ ~6 Q2 H

  60. 1 {/ A" F% _, E7 i2 P: m- r- W
  61. static volatile int irqraised1 = 0;) @( O* m$ A0 _' i& a+ }
  62. static volatile int irqraised2 = 0;
    7 z6 \9 j! \$ x
  63. $ _4 B5 @, n- h. D4 h! n8 @9 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R) A4 k* X3 \% j, H: m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e' k. \4 K3 P) V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 s' v/ f% V. k; M* v
  67. 2 ?3 L# e; O. t/ U
  68. dma_addr_t dmaphyssrc1 = 0;( y" p6 h' B+ O, {; Q& g
  69. dma_addr_t dmaphyssrc2 = 0;1 U& {$ v* X% G2 A
  70. dma_addr_t dmaphysdest1 = 0;& X3 N7 A/ P; ^0 Q, w- Z% ~
  71. dma_addr_t dmaphysdest2 = 0;
    + U* J6 [6 l8 Y$ ]! o5 p$ @

  72. ' A; w4 M8 L" o( t- `% H
  73. char *dmabufsrc1 = NULL;
    ! x' o6 r( W  S' @3 @
  74. char *dmabufsrc2 = NULL;2 }+ _$ F6 ?0 b$ p* I5 p' U& h5 \# [
  75. char *dmabufdest1 = NULL;6 e0 X: T" b6 D% M3 x7 ?; f* S% I
  76. char *dmabufdest2 = NULL;! w6 O6 t" ^2 o
  77. ' \% a- p$ e9 f  T9 B  z
  78. static int acnt = 512;/ I. c/ w% F8 D7 K- u# J( U
  79. static int bcnt = 8;* m8 z+ M6 i8 Q- j
  80. static int ccnt = 8;
    7 B" t/ {+ E1 i3 m

  81. - c8 w, f8 w; F3 _
  82. module_param(acnt, int, S_IRUGO);
    7 I0 `$ P  M# v3 R. p" A6 U
  83. module_param(bcnt, int, S_IRUGO);
    , U* d0 `3 N7 B/ c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 a$ |% X& s4 K; g+ k' ]# l: U3 R9 f9 w+ g/ n* M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( h7 _: t8 a1 ~  Z- f. G$ A5 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 n+ ]! W3 s# D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ?) d4 G5 W& [5 o
" p! W2 f& G% J; ]; `+ a$ x* `! q8 i' k7 N7 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 15:10 , Processed in 0.039760 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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