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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # {1 a. T: E0 b9 p, X
  1. [code]EDMA sample test application$ A2 l( s" f1 T7 Q4 ?
  2. /*
    9 l4 e2 \/ L( Y
  3. * edma_test.c+ g; d7 T3 t" v  a
  4. *
    $ O8 O7 `3 f: ]# a$ K( P3 F: ^
  5. * brief  EDMA3 Test Application
    7 @) P9 w+ x! D
  6. *
    3 n4 P9 Y$ c1 I" C- y6 S
  7. *   This file contains EDMA3 Test code.
    " d+ e5 p$ D8 V1 G( s
  8. ** [% J- t# E1 N) T% Q0 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 L2 H: y5 |8 ]& {3 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) b: A# J; @& ~1 F
  11. *         TO CHANGE.1 ]+ C" N% h" w
  12. *, h7 h1 p! [- V: Y3 N0 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + x; @! u# V6 A) d3 S
  14. */ t2 R- |' t3 l& ]' K  A7 u* L3 h+ j
  15. * This program is free software; you can redistribute it and/or
    4 m8 U: T' [  A$ w( @
  16. * modify it under the terms of the GNU General Public License as' ]! `3 p/ P$ T6 a& Q8 p; Z
  17. * published by the Free Software Foundation version 2.- ]1 Z  g4 n2 K1 R$ P* S
  18. *
    4 o2 ]" n; m, n1 C! K3 ~, y9 _" A& Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ?( l+ n( M" N% Q" `8 G8 v+ ]- }$ n
  20. * kind, whether express or implied; without even the implied warranty
    7 c* p5 Z/ Q6 L1 K, Y4 t2 w+ b8 g& D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 T3 l2 R/ q" i# o; M$ E
  22. * GNU General Public License for more details.; ^- h* c6 W# w+ q4 G; _; d, d+ w
  23. */
    6 ?( |$ h2 _/ P/ j, y7 E

  24.   {3 L0 \8 |! f7 g& i+ r& k
  25. #include <linux/module.h>( X/ j1 I3 s" C& G
  26. #include <linux/init.h>" c' w3 H' o5 w( E% `
  27. #include <linux/errno.h>) i2 Z. F$ N& o9 \6 n
  28. #include <linux/types.h>6 R" A4 p* K6 E4 I- |( E
  29. #include <linux/interrupt.h>7 p; n+ A; e. P' ]5 M( v  }
  30. #include <asm/io.h>
    ' s( M/ A' T. G/ ~# s" a: ^
  31. #include <linux/moduleparam.h>
    6 o/ f- f4 k( @) r
  32. #include <linux/sysctl.h>
    5 C/ c% i) x8 e" d' n- v
  33. #include <linux/mm.h>
    + S6 g' N4 F2 C- {  p+ S! l
  34. #include <linux/dma-mapping.h>
    . L6 x* j: d/ P# V

  35. 6 C  I2 H1 \! ]( v% F
  36. #include <mach/memory.h>( W8 f7 _' G7 D1 ]# c
  37. #include <mach/hardware.h>
    7 i- A: M3 t0 J! ]8 B' e
  38. #include <mach/irqs.h>5 f+ f. I) r. f" ^4 r4 t
  39. #include <asm/hardware/edma.h>
    4 Q9 }( A! J& m  |1 Y1 m9 A

  40. - |( v2 {5 g+ P3 \0 X
  41. #undef EDMA3_DEBUG- H( {) \, P" H! t# l& p1 m$ m( R
  42. /*#define EDMA3_DEBUG*/
    * z/ l- `0 x# N" C6 H3 y  E8 Y

  43. ! y" s  r( h3 h+ L
  44. #ifdef EDMA3_DEBUG% h2 j: l# b$ R# E! |% U- Z1 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* C9 r* i+ G, ?: v+ }; V! a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ [( D0 O" r! @! Z1 w7 K% I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & s8 d& \) L- \% p- K  u
  48. #else
    3 N' H! U7 a1 d! L1 K
  49. #define DMA_PRINTK( x... )) G' g  c" {+ [9 c
  50. #define DMA_FN_IN
    ; K1 y$ d9 a" b( t4 I1 h5 `+ i
  51. #define DMA_FN_OUT
    ( K$ g0 K. ?0 i' n4 r
  52. #endif
    + @% @- V$ ~& ^5 A' G
  53. $ Z" V! W% U% O8 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # m" ]* v7 @5 [2 A1 j( j
  55. #define STATIC_SHIFT                34 a0 W7 P2 o, z
  56. #define TCINTEN_SHIFT               20
    4 j, a5 k, l% K1 r$ D+ ]  [
  57. #define ITCINTEN_SHIFT              215 a$ V' `$ q# j# H% @0 d
  58. #define TCCHEN_SHIFT                22
    ' ^" r: k8 V- w- ^, M  ~* }/ S  H
  59. #define ITCCHEN_SHIFT               23
    ( x( ?) R* t% W8 d( J' X

  60. , U% H  \2 C" v, h+ w
  61. static volatile int irqraised1 = 0;6 j' L: X7 l0 i% p  e5 W
  62. static volatile int irqraised2 = 0;& C6 f3 |  T/ F
  63. 3 |+ c3 X3 ~- g  i' y+ l8 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 S  K" n5 w% w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ^: F  }% {" f0 l2 F; T* K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u' w$ d4 n1 ?$ w- I7 j' |4 o
  67. + n7 m, `: R' A# E* e8 I
  68. dma_addr_t dmaphyssrc1 = 0;% j  A/ H- i3 W+ K( B7 g% D5 N
  69. dma_addr_t dmaphyssrc2 = 0;
    3 b% ~+ [. q& z$ }1 ]. a" z* D
  70. dma_addr_t dmaphysdest1 = 0;
    # U' w" ?; t0 r3 g
  71. dma_addr_t dmaphysdest2 = 0;
    ) }# |' K9 T. n+ h2 `2 O2 C! z

  72. 8 `6 o9 Q9 w5 |% F) P
  73. char *dmabufsrc1 = NULL;
    2 R6 p! S- _& A: N+ U
  74. char *dmabufsrc2 = NULL;
    ) O/ Q( R3 r6 n+ \
  75. char *dmabufdest1 = NULL;$ K7 x! G% c4 V5 m$ R
  76. char *dmabufdest2 = NULL;
    # \7 W: M% T0 o
  77. + y& Q& O" }6 ?5 o- j7 b  G+ i
  78. static int acnt = 512;
    0 Z7 H  {% {6 ?
  79. static int bcnt = 8;8 U' E' n; {6 K$ p# o8 n2 C
  80. static int ccnt = 8;9 N& O+ |5 X$ v. s; R0 ~5 U
  81. / _0 `: L7 s" q; b1 q
  82. module_param(acnt, int, S_IRUGO);
    ( j. |9 O0 l7 S; e3 |
  83. module_param(bcnt, int, S_IRUGO);
    & Q" s7 x4 J2 c) T) d6 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) A0 P  j6 t$ T7 s  o$ h

9 r" f# O& j8 o) d, U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* M" T* j% x) I$ f: s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; m# E# ^" l( t2 {( {$ ^$ ~, n( f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" c& k# c4 {- X+ c5 Q' f$ Y& m
# L  p( ^5 A* Y) y+ m7 D2 H' G- ?3 e$ S9 s: D, V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 15:35 , Processed in 0.040248 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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