OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 o' l& Z6 g& y, x# `9 C
  1. [code]EDMA sample test application( P3 p' P- P/ j- ~1 b8 a
  2. /*/ N. ?& ~1 }+ S- K+ w- J. |
  3. * edma_test.c
    2 c, ~, c3 r$ x( W; _/ T1 n
  4. *
    ' x/ f# D" i( e9 w2 v% G% Q# c
  5. * brief  EDMA3 Test Application" ?5 n* K$ P* Y% c7 }$ K
  6. *$ K# F1 A5 u: c, R1 K
  7. *   This file contains EDMA3 Test code.+ \4 ~$ G  d* I+ g- ]/ r% x
  8. *
    0 I- ]9 N' @% i8 v+ w8 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( y% G# l3 m1 e% Y& W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      w2 k! w7 s  i* S/ B& Y2 [! I
  11. *         TO CHANGE.+ I) O, z9 }/ }5 c; Q9 @5 T
  12. *
    ) I" ]1 Y' k' }+ a' C, F5 d! g' Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' o' h+ N! M* E" F) a9 ~9 Z* e
  14. *
    / c+ s( h5 @* e
  15. * This program is free software; you can redistribute it and/or
    2 z/ R* Y8 `  p
  16. * modify it under the terms of the GNU General Public License as
    ' f$ n1 T4 N) Z# p$ R) _
  17. * published by the Free Software Foundation version 2.! y. }1 _. }, S4 J5 x/ P1 u
  18. *
    7 \5 h" e, Y7 ~; J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 S- z. T. ?& j7 v
  20. * kind, whether express or implied; without even the implied warranty
    8 \, c! d  K2 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ b$ ^4 W+ s) W3 x# F
  22. * GNU General Public License for more details.$ Y4 I7 v0 O) i$ \1 r
  23. */
    ; M3 R! h2 r, M" ?. k

  24. 2 c, [! E! s! z
  25. #include <linux/module.h>
    7 L& b* b4 }! ]* I1 e: F
  26. #include <linux/init.h>
    6 {! \+ I9 f% [2 Z/ R. N' E# {. L; ~
  27. #include <linux/errno.h>7 z# E5 @8 G5 X& a7 t8 |
  28. #include <linux/types.h>
    " V( g( a3 C  j1 ]) [1 M6 t
  29. #include <linux/interrupt.h>
    7 h, W, g& a% k1 z" I8 ]
  30. #include <asm/io.h>1 V# @. t9 t& u2 }  o
  31. #include <linux/moduleparam.h>
      T3 A( d  |) n5 q  [8 E6 q
  32. #include <linux/sysctl.h>1 G2 ]0 |6 q# u$ _+ |( o
  33. #include <linux/mm.h>+ w& D# A/ ?3 `0 z- K6 g
  34. #include <linux/dma-mapping.h>7 t/ g  I5 j% I) H. A4 z

  35. ' O3 z0 j* X+ u9 \  V
  36. #include <mach/memory.h>2 M& v. y" T' F' H
  37. #include <mach/hardware.h>/ U' ^/ e1 E' v  ?
  38. #include <mach/irqs.h>2 o; y0 c2 h% n$ W- x
  39. #include <asm/hardware/edma.h>
    & N4 N6 z4 Q% x. J% A7 d( m# y
  40. ) p3 o1 [$ w% ]. R8 x+ ^
  41. #undef EDMA3_DEBUG
    ; Z6 n+ g, F& d# R( p+ _. K
  42. /*#define EDMA3_DEBUG*/3 k$ Z2 z& [  p. T/ G! J
  43. 1 m) q5 Q9 l, J( s
  44. #ifdef EDMA3_DEBUG; ?( z  p( Y" t$ R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ B/ ?. X1 c# ^1 z# l; a% D) j& o! N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( S* W3 J- M3 P) L% W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : `6 X, N8 }- O/ I4 K
  48. #else9 u  U% N( L* X* E+ c% n0 S
  49. #define DMA_PRINTK( x... )
    - }7 f; E3 g/ m  U+ L1 B
  50. #define DMA_FN_IN+ B4 _8 }6 ~& }/ T4 @' J+ I
  51. #define DMA_FN_OUT! a5 h$ f6 s# d4 T7 h. D2 I: o
  52. #endif4 {1 E0 B. I4 y9 `. d

  53.   @% J# C. X- C* r/ O3 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" J5 d6 @7 y* K8 G2 T
  55. #define STATIC_SHIFT                3
    , a" M8 F% q# i8 d, N) D
  56. #define TCINTEN_SHIFT               20
    , S" h6 m5 L) r7 ?2 ?% G' t& M, K
  57. #define ITCINTEN_SHIFT              212 Q4 o4 q  a5 G2 {5 ?
  58. #define TCCHEN_SHIFT                222 R2 \8 V. X8 |% B/ V2 J- p* p. [
  59. #define ITCCHEN_SHIFT               23
    + @3 w" P: d8 H; h- R! r

  60. 4 ?. t2 G4 ^( |
  61. static volatile int irqraised1 = 0;/ u9 j4 ]7 A' w, ~' m: A, U
  62. static volatile int irqraised2 = 0;
    7 {- ?2 S; L" ?2 x% {
  63. ; Z! l! J+ r" P% U8 L& v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - g+ b# i8 d! m0 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ u9 @* k7 g3 a/ h0 c' M& X  w! g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& F  L! A% _* U. L5 `: z* q& s# R
  67. 2 b, K# D3 v2 p. T# ~0 ?
  68. dma_addr_t dmaphyssrc1 = 0;5 u6 Q9 d% w9 c( u5 H& ?* ?
  69. dma_addr_t dmaphyssrc2 = 0;( P% p) n8 s" U0 w
  70. dma_addr_t dmaphysdest1 = 0;0 \4 `5 h+ K. F. y) I: d. J6 G) O
  71. dma_addr_t dmaphysdest2 = 0;. i+ f( w( u* c" ]9 c

  72. & p1 W8 t* j6 _4 Z( Y
  73. char *dmabufsrc1 = NULL;) b" a4 m( t# J2 ]% t" H8 D
  74. char *dmabufsrc2 = NULL;2 I" r1 u5 }$ R! A; J$ z
  75. char *dmabufdest1 = NULL;
    ! a' C4 Y5 |2 N9 l* a
  76. char *dmabufdest2 = NULL;' d+ T1 B9 d3 A7 s2 u; x

  77. ! S( C& d8 ?- L2 }$ B1 k
  78. static int acnt = 512;
    ( D, c; Y0 I' K# x2 [% d, H
  79. static int bcnt = 8;
    ) |& @: z) e6 P6 B* C3 y4 P
  80. static int ccnt = 8;# t0 u9 O6 Z2 j8 w$ Q  I% k4 t
  81. ! v' y+ |% ]% s0 p* m! a
  82. module_param(acnt, int, S_IRUGO);' r+ S. g, t1 V. D( K
  83. module_param(bcnt, int, S_IRUGO);
    # ?1 e$ g; F5 s3 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  n, X; n/ I3 c9 j+ d
8 S% k+ z7 U7 i- K7 S4 U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q* [; A7 R) t3 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& H- M7 w* V, V" `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 K9 G& w% Z! z6 S5 J- H8 w7 G

, ]. n/ K$ i3 K! ^" V
7 `  D' g% R/ O' J, m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 05:52 , Processed in 0.039819 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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