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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ O- d: @; L& W& J) g. l
  1. [code]EDMA sample test application8 O6 q2 V9 V. b2 K3 d) L- m
  2. /*
    " Y4 Z, X6 X/ a$ |2 Z9 Y
  3. * edma_test.c
    8 i# O- w* Z- z
  4. *- y* _1 C" C( d$ _/ U( ~
  5. * brief  EDMA3 Test Application( Z+ a, V- B& A5 Q5 D. j
  6. *+ |9 I7 c( R8 x5 e/ w
  7. *   This file contains EDMA3 Test code.
    1 M- h/ x2 k& T7 S
  8. *
    9 s$ H/ y) d9 n9 m, t: ~8 p/ J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ f$ Y) b9 z% b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Q" V2 R  v" a# E3 ^# m+ _
  11. *         TO CHANGE.3 G& l8 M$ d* U, O5 m6 P; Z
  12. *
    6 A2 V2 U" _4 a- m1 l# P' {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; L' g/ }9 ~7 L% B$ U" e
  14. */ H# k$ q/ T+ R& E6 `2 m
  15. * This program is free software; you can redistribute it and/or; ?+ V5 f* a! U7 d
  16. * modify it under the terms of the GNU General Public License as( J8 X& f: k8 B) ^
  17. * published by the Free Software Foundation version 2.
    ( U4 {- b4 T, J  y: B5 `
  18. *, _. }, \' U( X% j$ E7 n& Z7 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; k1 Z0 x) u- R' x$ _. |
  20. * kind, whether express or implied; without even the implied warranty
    . C. P" R% n1 N! {7 u, u" r8 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 f2 s  ^: |7 q0 c% n+ K
  22. * GNU General Public License for more details.
    3 R) T6 ~( t; g: W2 x
  23. */
    " a( H% P0 j7 T7 w  A, V/ G
  24. * B( z5 o" `' r1 d* b! c
  25. #include <linux/module.h>
    + W( ~& j0 C2 U& l* E9 p
  26. #include <linux/init.h>
    % x2 \  J' o7 X0 y" B
  27. #include <linux/errno.h>
    * H0 A, ]/ ^3 }5 P$ |4 h. d8 q
  28. #include <linux/types.h>
    4 K) v$ g/ v& U, B$ v, X! E
  29. #include <linux/interrupt.h>
    ( d) ]: R, F3 m. g; r
  30. #include <asm/io.h>0 ~3 h; S( \9 b: I9 X5 b# S8 r9 f
  31. #include <linux/moduleparam.h>) n: r. Z' l0 T( f, u% S
  32. #include <linux/sysctl.h>
    ' w, Z4 v" z5 O& o4 O6 M
  33. #include <linux/mm.h>1 o6 ]: y' [3 \
  34. #include <linux/dma-mapping.h>
    / R8 y1 U) T# _/ V) a1 _
  35. ' A$ q. j) \$ f5 o- _
  36. #include <mach/memory.h>
    . i4 ]% ]9 F1 l
  37. #include <mach/hardware.h>& ^, b" H: X  U& @
  38. #include <mach/irqs.h>
    # \7 ]4 p" a) H( B0 N9 F6 b
  39. #include <asm/hardware/edma.h>
    3 j# L$ O% P0 i3 W- Q9 p/ Q
  40. 3 c0 O% s9 E& {( N3 ?: T
  41. #undef EDMA3_DEBUG* s8 A9 J) b+ ~  Y8 r
  42. /*#define EDMA3_DEBUG*/; h* W) `( ^( _" |

  43. 7 b0 p2 x5 K; d* e3 f# @
  44. #ifdef EDMA3_DEBUG
    7 i* a0 q  ^& p" G: x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 B5 y: o: Q( |, y3 o5 m+ n0 z5 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 N2 @% ?& u" U# L, |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 _4 n0 s7 m  u" C5 ^
  48. #else
    ; f$ H- m7 X9 D' K& N: [
  49. #define DMA_PRINTK( x... )+ j8 `  F3 Z9 W6 _
  50. #define DMA_FN_IN# ?2 A" ~" ~! k7 g/ y
  51. #define DMA_FN_OUT
    0 k2 h- P7 k  V3 K: [. ?6 z
  52. #endif6 X# t# S3 G! i& k, U. s
  53. % x$ l1 x! s7 }2 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ m7 h! E& n% O2 D$ ]  O
  55. #define STATIC_SHIFT                3
    + j- Y3 M& o( F2 y
  56. #define TCINTEN_SHIFT               20, t1 I5 C+ ?; R- z$ Q+ T/ |
  57. #define ITCINTEN_SHIFT              216 A8 w& Z. M7 Q# ]0 I
  58. #define TCCHEN_SHIFT                22( X  Y. T8 t5 d4 d
  59. #define ITCCHEN_SHIFT               23' S* g$ v) Z3 N6 f, h; K" r" k
  60. # b4 ^' z4 ~1 S+ N0 |9 j
  61. static volatile int irqraised1 = 0;$ c4 N% Q/ J4 K+ P# e! s, Q
  62. static volatile int irqraised2 = 0;
    7 j* m; Y1 \# F: ^
  63. / @7 z: i: R% ]9 K7 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Q# o6 ]( @  D" \0 p" m( ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) j6 K! L% H- c$ n0 \3 h7 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) v) P& i2 r* u

  67. % u) a# S3 n4 q" Z/ Z) G, O# y
  68. dma_addr_t dmaphyssrc1 = 0;: T  J1 w! C7 Z
  69. dma_addr_t dmaphyssrc2 = 0;& f# `$ \7 n/ {; d
  70. dma_addr_t dmaphysdest1 = 0;, @4 i2 h/ X8 M* Q7 W
  71. dma_addr_t dmaphysdest2 = 0;% @/ s+ r* |3 _4 c( z! O

  72. 1 N/ w+ h: j2 H% d# x# f
  73. char *dmabufsrc1 = NULL;; H0 ?- c" n" I* q$ u/ t; a
  74. char *dmabufsrc2 = NULL;$ l1 l" X. _, f+ Q4 q5 R
  75. char *dmabufdest1 = NULL;
    8 u( I! \5 _' D
  76. char *dmabufdest2 = NULL;
    ' S* l# C3 \6 x3 l
  77. * B; J/ {. I$ Q4 p1 T
  78. static int acnt = 512;& U/ f& R" I# S1 M
  79. static int bcnt = 8;
    , v) O3 e  N9 {: F6 H
  80. static int ccnt = 8;" _( k# @" {" d5 z/ t1 w
  81. 9 M& Q2 F& s" Y0 [% {% g  j
  82. module_param(acnt, int, S_IRUGO);
    & c" v8 T, C3 P9 g
  83. module_param(bcnt, int, S_IRUGO);7 k) A3 u& m% V1 _3 O( |+ }+ X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) [+ U7 ?5 r* E$ T; r4 B+ H
0 S+ d& a1 |4 d0 A( R  J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  Z: a" h  I' F& T' O) u: S+ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, {# u) c; p# Y4 Y( X, T( e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 r) ~; I% q2 w* Y# P: X  s  F3 c3 f  r* R: }( t
( i# Q: D7 T3 E' e' P$ _, J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 09:24 , Processed in 0.038878 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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