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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 A. f( c% Q0 P9 P
  1. [code]EDMA sample test application
    # _# |% `1 [0 ]3 ^; [) K9 _0 w
  2. /*
    8 @* J4 H6 ^3 M& B/ B4 R
  3. * edma_test.c
    3 }4 E' ?$ v/ I/ ?9 S* B& Z
  4. *
    9 A8 M! x* U; g+ W
  5. * brief  EDMA3 Test Application( j% K( j7 |6 D
  6. *
    " d( t" F4 s) H' M. l! X9 i1 q
  7. *   This file contains EDMA3 Test code.
    $ x4 t+ h. U' p# A9 \- C: K% ?
  8. *
    : l, g) R1 Q% \5 f* T. s( e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 I$ O* v' f- Q2 o2 `$ V8 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 [* R( U* H" M0 V) p
  11. *         TO CHANGE.
    1 N3 \0 G3 {7 M7 O# O
  12. *; K4 M; C1 x) n$ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 V- D5 o; r1 h
  14. *& q& S4 G) I2 S+ h
  15. * This program is free software; you can redistribute it and/or2 x- \& w( H! I9 g9 y" ?
  16. * modify it under the terms of the GNU General Public License as( S, n! w0 c4 Q
  17. * published by the Free Software Foundation version 2.
    ' Z7 N- T5 l7 g
  18. *5 S  w3 `8 V- ^/ Q) V8 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; f. _2 s+ A( }3 e4 r+ X+ a
  20. * kind, whether express or implied; without even the implied warranty
    6 ^0 v* G, u+ l+ m' p9 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " X! J" G8 }) x; y- U$ }8 r0 p
  22. * GNU General Public License for more details.7 R) O( R' z/ h/ Q! J% m8 F
  23. */
    , O" Q! j! V) m3 J* ~! ]
  24. 2 i) K+ r9 O" Y$ n- `$ t: j
  25. #include <linux/module.h>
    / a+ W# }1 b- e6 h* v
  26. #include <linux/init.h>
    # V  d/ M- j  F) K+ E/ v  G0 X7 J. U
  27. #include <linux/errno.h>9 U0 s4 f7 a, J
  28. #include <linux/types.h>
    ' F0 F2 Z& O7 N( r+ X
  29. #include <linux/interrupt.h>" \! h3 o+ u( `' N# L
  30. #include <asm/io.h>
    : f" m* w! {7 b4 [: X5 q
  31. #include <linux/moduleparam.h>( v- Z/ T0 _, e3 }
  32. #include <linux/sysctl.h>. Z  P5 q" q7 s$ i9 {: a6 [
  33. #include <linux/mm.h>
    4 W& s8 d, F& K5 ?1 j& U# q
  34. #include <linux/dma-mapping.h>
    ; D! B& K5 O) i& n9 Q
  35. 5 M$ b/ G1 n$ D& a" ]
  36. #include <mach/memory.h>
    1 x+ R* i: w" o2 b
  37. #include <mach/hardware.h>
    9 m5 h; ^5 E2 k4 |
  38. #include <mach/irqs.h>' c8 Q7 B; O. E! y/ O% s6 P: I! Z2 e6 b
  39. #include <asm/hardware/edma.h>2 ?8 |. Z4 O7 O# R

  40. 9 u. }0 [# R# E* h
  41. #undef EDMA3_DEBUG, a$ b- F* Q% t6 \7 ^* g  ?2 d
  42. /*#define EDMA3_DEBUG*/: w5 S0 F5 S+ d  Z. N
  43. 1 F1 V' Y6 o( Y6 H! u' [
  44. #ifdef EDMA3_DEBUG3 o6 O# m: ^  d" l1 [5 _3 [6 S+ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ~& p7 n) O0 M9 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# m3 @. ~! t' d* x+ q& b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 ?3 Z& P, W4 S8 \  f
  48. #else
    2 r, M) |9 m8 J: I
  49. #define DMA_PRINTK( x... )
    & K% j9 z% }3 J# w7 d, s3 Q
  50. #define DMA_FN_IN
    - I! T6 \  t7 v/ E
  51. #define DMA_FN_OUT' g2 W: B9 u9 X9 v3 n( z2 q2 T! O
  52. #endif& j6 e) S$ O1 E2 p

  53. / [- }, u: E# x) W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 L% W; A# i0 [$ R
  55. #define STATIC_SHIFT                33 g3 A) W& X) l$ ~( }
  56. #define TCINTEN_SHIFT               20) T: w* I: C6 D: U9 a9 i8 E
  57. #define ITCINTEN_SHIFT              21' V- E( G0 x$ p8 K3 N% V: B& ~
  58. #define TCCHEN_SHIFT                22
    8 v* t2 A; @- k. j5 O( b1 ^  n
  59. #define ITCCHEN_SHIFT               23  t; @% X) e+ C) n% p( U# n$ |
  60. ' Z$ k+ p' f( L3 o& Z  v
  61. static volatile int irqraised1 = 0;
    $ P9 E; M' u) O/ l
  62. static volatile int irqraised2 = 0;
    / r) ^1 w$ N+ N2 }) V4 x

  63. % G+ Y  P3 D# N/ H4 _* Q3 I4 {& [7 s: B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; V4 o/ _& T* \" k" ~- H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 t4 ?" y; O6 z/ A  U  a7 W  j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e7 N8 }) S' t: U1 H9 p
  67. # U) \$ u: e" E* [- X" N! Z* T
  68. dma_addr_t dmaphyssrc1 = 0;
    4 o5 a& w& b0 d
  69. dma_addr_t dmaphyssrc2 = 0;" m4 m: }  e1 t( s' e: x- m
  70. dma_addr_t dmaphysdest1 = 0;
    % c. D9 @" ?7 G1 Q
  71. dma_addr_t dmaphysdest2 = 0;
    ' W. g' Q3 u6 {- k* v

  72. 7 A* m0 J7 @# K1 W
  73. char *dmabufsrc1 = NULL;/ K& s5 M* Y! A$ |
  74. char *dmabufsrc2 = NULL;
    & B3 {; o8 C  Y2 y: L+ I. {: Y
  75. char *dmabufdest1 = NULL;
    % N* Z$ h+ z/ `/ d5 V
  76. char *dmabufdest2 = NULL;
    - e! i* v) u- `2 w# G( I4 v. Q4 O
  77. + ~% Q5 ?9 W( b2 s! i: x
  78. static int acnt = 512;% F: h/ v4 ^1 I5 B' K% v& P6 Q
  79. static int bcnt = 8;+ r( C/ I- ]) n0 v3 s
  80. static int ccnt = 8;9 c4 a. e' y7 `' A) n$ m( Z! d8 b

  81. . A! U- V" b: _" Q
  82. module_param(acnt, int, S_IRUGO);
    ; K, U5 X2 f4 }
  83. module_param(bcnt, int, S_IRUGO);
    8 B0 W' O, v( ?' ], ^. K2 H" R! j5 }( a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 {3 u: R1 |1 {
& m: E  N3 o, s+ R) Q0 [5 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# E* A' @, Z' v  [$ K$ \8 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! `, D' H  ]* i& i, a# c' y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ I# B! @& `) {- P

) D2 [1 C1 l- |' A+ i' s! ^" m7 P/ R6 s$ |3 Z0 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 05:19 , Processed in 0.039951 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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