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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 j' L& a7 {% a, @) l& X6 r
  1. [code]EDMA sample test application
    + _% x7 z+ V: T8 f
  2. /*2 N' F% p( e7 I/ k% e* A
  3. * edma_test.c' m: E4 b+ m$ I& H' t& y+ ]: H
  4. *
    % J, n7 [* d0 u" I- s' E
  5. * brief  EDMA3 Test Application/ f" T0 x' Z; q! I+ q- j1 R
  6. *+ Q  A/ b# {* _" b( h
  7. *   This file contains EDMA3 Test code.5 t  S! q, z6 }( n
  8. *
    4 G8 R5 K: ?5 w" d$ Z8 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : ~# E$ L/ R0 W2 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : [- W, N+ q* M0 ^- b7 B' }, j
  11. *         TO CHANGE.
    * L" Z& q0 u/ H5 B2 ?
  12. *
    8 j3 |8 N! R& K1 f" p8 e' Y& u3 y" x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) S" j" e. q& G, F5 j
  14. *8 `6 o! i) z5 I" a
  15. * This program is free software; you can redistribute it and/or
    2 j# ?$ P2 ^4 K# m- f/ ^2 P
  16. * modify it under the terms of the GNU General Public License as: l' E& U$ K1 c, O' |$ F
  17. * published by the Free Software Foundation version 2.
    # k; o6 |: ^( B7 e0 C/ D
  18. *% G$ c" P; E8 L& Q/ J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # y0 Q  K# k0 T2 ]+ V  s/ I
  20. * kind, whether express or implied; without even the implied warranty# s* ^; S4 w3 U9 t  D5 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; \8 x( _8 m$ m! P# y& U) ~. r
  22. * GNU General Public License for more details.1 `) o! d4 y) e5 W2 w8 |* F: c4 h5 _
  23. */+ e0 c5 o1 L* F0 a4 O

  24. ) Q2 e; y, [% l4 Y% v
  25. #include <linux/module.h>' Z) a. C3 Q) Q( M5 B' p% l
  26. #include <linux/init.h>
    0 i8 @2 S5 i$ E0 n9 q0 I, H& f
  27. #include <linux/errno.h>
    7 Y6 X, `' J2 N7 C2 U9 A6 R
  28. #include <linux/types.h>! _$ w) s/ k3 _/ h* g7 M# m
  29. #include <linux/interrupt.h>) k1 t' j- Y3 J: y
  30. #include <asm/io.h>
    1 L7 t# ]. Z$ g
  31. #include <linux/moduleparam.h>
    8 l/ ~3 x+ E  S" ]; \
  32. #include <linux/sysctl.h>
    ' P1 F& l7 M4 {# D+ Y; V, e5 I
  33. #include <linux/mm.h>
    3 C' Z, e" E: C. z
  34. #include <linux/dma-mapping.h>
    ) Z" A7 X+ _5 [2 b" {8 i! M% T" J# \
  35. % L$ F) v7 W5 w6 l* p; c
  36. #include <mach/memory.h>. @: w5 Y1 [( g2 }& }
  37. #include <mach/hardware.h>$ l5 `0 h; c6 P, }$ R
  38. #include <mach/irqs.h>
    7 F! d$ w3 Z2 }# b
  39. #include <asm/hardware/edma.h>) P" s" D: w% V
  40. ! p1 {- j4 s* C
  41. #undef EDMA3_DEBUG
    7 G# S- G1 P7 Y0 _
  42. /*#define EDMA3_DEBUG*/7 m; Q+ ~$ w$ E) }9 H" a6 V
  43.   {, W6 W8 ^% w
  44. #ifdef EDMA3_DEBUG9 J) z, f  @; ^9 H6 s! Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 L. x  W: I2 X. s# l+ d( @5 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 \! `7 ]0 h" A" R; J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! C- R% U9 B' z* U; V1 s+ U
  48. #else
    3 e$ a( @- e# ~* h% C% g/ _
  49. #define DMA_PRINTK( x... )
    " p8 t( }# q9 k' ]
  50. #define DMA_FN_IN
    % Q( e2 a+ g- c: \; d1 i
  51. #define DMA_FN_OUT- t( v- k4 }0 C5 E9 n
  52. #endif7 o  }0 ?$ _! `( j  N# x
  53. + }7 k# C" F8 |9 d5 K* V! F( y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). F9 V- |6 r! n% [2 y& b- M
  55. #define STATIC_SHIFT                3
    $ f7 j3 x7 j+ ?+ g* t
  56. #define TCINTEN_SHIFT               20
    . y  g' r) e3 X- s. N0 X
  57. #define ITCINTEN_SHIFT              21
    . D* Z8 F; @) L7 `0 }- j" h, Y' y
  58. #define TCCHEN_SHIFT                22
    5 W$ a: g5 M( C0 k) W
  59. #define ITCCHEN_SHIFT               23
      \( O; K) C9 B8 d

  60. + \% [* U8 g+ W
  61. static volatile int irqraised1 = 0;% e: u2 t  e: s. g- Y; c
  62. static volatile int irqraised2 = 0;
    3 U1 F& F$ x# t* }

  63. . I# E! T9 h4 t. i# A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ S  a. b8 X3 }+ C6 q/ @  |5 F& t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Z4 T7 [8 i+ O% A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 t) D& P8 C" R1 d

  67. 7 I5 a8 v$ B7 E. P3 C* w
  68. dma_addr_t dmaphyssrc1 = 0;
    ( T7 `0 r4 {/ u& ~
  69. dma_addr_t dmaphyssrc2 = 0;
    ) `7 y8 \, X, m
  70. dma_addr_t dmaphysdest1 = 0;# e4 O! G& H, C. k! q  R
  71. dma_addr_t dmaphysdest2 = 0;4 p1 @1 {7 f+ i
  72. + T4 y/ |9 O& z- N  y
  73. char *dmabufsrc1 = NULL;
    7 T/ {  Z; W3 ^. U
  74. char *dmabufsrc2 = NULL;% z& y3 E) \/ J0 M0 S0 S  Z
  75. char *dmabufdest1 = NULL;: }$ A5 Q. N  w- j0 N/ _
  76. char *dmabufdest2 = NULL;: O5 E9 j* A3 ^7 p
  77. 2 A5 w8 k, }" [- K
  78. static int acnt = 512;* x) I: o' a, i0 K( ^' t
  79. static int bcnt = 8;
    & P: R6 m' h" }
  80. static int ccnt = 8;
    " X, @& ^4 P- [' H
  81. : d, \( \+ n% g/ v8 ^" m5 |
  82. module_param(acnt, int, S_IRUGO);( y& ?  \+ M6 I
  83. module_param(bcnt, int, S_IRUGO);  @8 U: H% I2 U3 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  f* D. q7 C$ {+ l) p* Z0 c
; ^$ b& D5 q$ F) Q  W6 Z& T# }  t4 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- S, T! p3 b" _5 b3 `, U+ ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N. n0 ~/ N- Y. R& G. j( e& O: K) j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: U) F7 Z3 X! e8 Z$ q3 s7 O$ y9 q0 h7 k7 q* t
" H% r+ L3 o' @7 t& Y% u. T9 m, M2 n2 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 14:29 , Processed in 0.039252 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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