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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 i; Y0 S$ y- K4 B" [4 F, X( f
  1. [code]EDMA sample test application$ Q$ y! S- j' h; C
  2. /*
    2 h2 Z9 y4 r: M: E
  3. * edma_test.c
    . }/ l5 I, W% p  S* D
  4. *
    8 W4 O& D; w3 _# E% x- ~
  5. * brief  EDMA3 Test Application
    $ v$ I5 Q5 n' b& Z  v
  6. *+ i* B. B, D. q1 c6 ]5 Z, L( C; [
  7. *   This file contains EDMA3 Test code.  g) b' h+ x5 ~: H: q0 z; F+ W
  8. *
    : t3 E/ @" E8 W0 U! s$ Y' U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 V( Q1 o5 `3 m0 S* g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , I$ _+ K( \  A2 M
  11. *         TO CHANGE.
    / p# Z4 V/ P9 t" `
  12. *# ~! f. z8 [- ~, ^7 ]' W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 M2 |( r: G9 \' T
  14. *2 D" ^: L- O- s8 A: `
  15. * This program is free software; you can redistribute it and/or
    . R( \& r% d( t; ~% {# ~! i
  16. * modify it under the terms of the GNU General Public License as7 t( S* ~, m6 c$ B# |, a: X
  17. * published by the Free Software Foundation version 2.. O& S$ p9 c  W
  18. *
    1 h0 j3 E" y- z5 R9 u/ E, R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( ]5 E: V+ `, P& \) D: V
  20. * kind, whether express or implied; without even the implied warranty
    ' p" x) @, ]' U' P0 ^' r4 |3 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  y1 V/ I5 u4 g4 ^. p, f
  22. * GNU General Public License for more details.
    & {7 L8 A5 X/ ^/ o$ W7 a7 w
  23. */: ]; n. w! f- C% O: }% @1 |
  24. ) O0 r9 S( |% \
  25. #include <linux/module.h>
    5 E1 |& N) Z% v' e6 X" m! h
  26. #include <linux/init.h>0 U0 C- b9 V% h2 g5 \' y. @
  27. #include <linux/errno.h>* T' h8 o: o4 Z0 y4 V7 u1 s
  28. #include <linux/types.h>+ ?6 A( |( X( h& I2 g' X) w- c
  29. #include <linux/interrupt.h>
    - v1 {* b' l7 H+ G+ k' u
  30. #include <asm/io.h>
    8 _; Y9 v5 \+ ]: x! S6 N7 @- ~
  31. #include <linux/moduleparam.h>
    4 S- j2 ^9 \: r% P; b* ]$ x
  32. #include <linux/sysctl.h>
    ' E+ H; I: v; y3 b" m; ^
  33. #include <linux/mm.h>1 S( b% G( }3 W# \' q& X& d
  34. #include <linux/dma-mapping.h>
    " y- C2 n% E5 n
  35. 7 k7 F) k# U/ x5 p  V- B  y
  36. #include <mach/memory.h>/ ?- x0 o0 t& y# P8 K2 o
  37. #include <mach/hardware.h>, z$ v' B# H- w: q$ j
  38. #include <mach/irqs.h>, V; Y; K1 h# `* a9 ^
  39. #include <asm/hardware/edma.h>
    6 A, N  B: h  f
  40. " X$ e9 K* i, g- k; F3 I! F
  41. #undef EDMA3_DEBUG/ Q. n+ ~: U" D' M
  42. /*#define EDMA3_DEBUG*/
    / E1 e; b* h* J) T0 b0 Q( V+ F
  43. - ~/ [! N+ a5 T- ]) }: B  y, `% j
  44. #ifdef EDMA3_DEBUG+ w( P$ p* u, M" o2 `! Q8 V% L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! X2 Q/ _/ N/ Y2 {1 t8 ]6 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 n  w3 g; t; v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ?& E# d. C% O# c7 u# l( H
  48. #else0 A5 o$ v' X( C5 U2 G
  49. #define DMA_PRINTK( x... )6 a2 _0 f. P" z8 f
  50. #define DMA_FN_IN  M5 G7 T- I0 {0 Q
  51. #define DMA_FN_OUT
    ! n6 p* i5 o1 A$ @$ a) V/ }
  52. #endif
    7 G) i" w/ ]; {5 s( D

  53. . Q5 d9 ?* Y! h+ [( O! Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 h/ i9 k( O7 _1 V* }) y7 Z4 M* Z
  55. #define STATIC_SHIFT                3
    + M) e5 \8 S( P( j4 n
  56. #define TCINTEN_SHIFT               20/ }/ c% Q5 U: {9 r
  57. #define ITCINTEN_SHIFT              21
    - s; ]! u1 }7 w" P' \+ k& b. @
  58. #define TCCHEN_SHIFT                22
    9 \- X. O* F8 C& f
  59. #define ITCCHEN_SHIFT               23
    7 y0 p  R- M! y* v$ e9 b, w4 Q
  60. . y3 t/ y6 D/ E7 O( _( n
  61. static volatile int irqraised1 = 0;7 t' o5 g  ^; V8 n# z& _
  62. static volatile int irqraised2 = 0;
    ( W* I8 F7 n1 ~/ a+ k

  63. " e: s" A) i" y! i# ~3 z- Q4 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ A0 h- t: U7 P. t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % k/ U2 K3 a8 |5 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 _5 z7 N1 o& x

  67. 2 p7 W3 J7 P0 z0 T3 m& @
  68. dma_addr_t dmaphyssrc1 = 0;/ j; o; B' ]( ]6 i2 T
  69. dma_addr_t dmaphyssrc2 = 0;( p/ ~- e+ y4 X1 H: g9 R
  70. dma_addr_t dmaphysdest1 = 0;
    % D4 s/ D" o* W& }( K
  71. dma_addr_t dmaphysdest2 = 0;
    * ]  D) q( b% N: i8 P# L( t
  72. / h, i+ L' I# z
  73. char *dmabufsrc1 = NULL;4 Y  |# ^0 Y% \1 K* G. F+ c% \1 L
  74. char *dmabufsrc2 = NULL;
    $ T+ _  z6 d' X( I# U4 H" E
  75. char *dmabufdest1 = NULL;
    . }3 N9 t% V7 m# a7 x" q
  76. char *dmabufdest2 = NULL;, a( ]' I/ g! I7 [0 ?+ ~0 H

  77. ! V  K& j' F8 n2 L5 S9 b0 }2 {
  78. static int acnt = 512;
    + G  Z& ^: ]8 O3 h/ z
  79. static int bcnt = 8;
    3 R+ D8 Y; |, d$ \' I2 F
  80. static int ccnt = 8;( Q: \1 T. r8 E) h1 _/ c; i( ~
  81. * o# _6 m, P* D0 C8 p, g
  82. module_param(acnt, int, S_IRUGO);9 p% I3 F  ^2 o1 Q: D# \
  83. module_param(bcnt, int, S_IRUGO);
    , N, @* I, ]5 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' h& v- b- A  ~% w6 q" Q
  p, e; r6 X- a, p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o* I( b4 k# d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 L4 N9 E- ~5 d% F! ?9 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]: G$ h* Z* `" U
6 o) |3 U! \' N5 O
2 S+ `8 S' y) q$ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-7 10:28 , Processed in 0.039839 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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