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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! B6 K& g9 c! i) s
  1. [code]EDMA sample test application
    9 s2 m" H9 m" Z; L, B& x& k  c
  2. /*/ S& `4 e- N/ U' |& w7 m
  3. * edma_test.c5 w' R0 b* \, }. B; z
  4. *
    . |; @5 w. ?; H5 I" z
  5. * brief  EDMA3 Test Application5 z/ H1 @1 m2 `' L0 H& o
  6. *0 I2 y3 k1 U/ y
  7. *   This file contains EDMA3 Test code.
    5 \7 [5 W* R3 F; W5 q' u) \& v
  8. *
    : S+ R/ c$ |' @+ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " E& _& N" q+ s. [" ~  B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; L( _, w$ g" S7 E, ^
  11. *         TO CHANGE.  J" R8 \. a" u3 W
  12. *
    " f9 J* n8 y8 i9 ]7 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# t, S: K. w0 i2 |, p
  14. *% ~5 Q; @5 A& {$ b
  15. * This program is free software; you can redistribute it and/or0 e9 m) U0 z- @9 \' G
  16. * modify it under the terms of the GNU General Public License as3 R  B5 u# I/ J+ r0 o6 |3 ^' T
  17. * published by the Free Software Foundation version 2.
    2 x7 N% z6 t$ J, y' C& F. {
  18. *9 S1 z1 E9 z8 U! }  S( D* c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . _5 \+ a  x- ]: Y4 q
  20. * kind, whether express or implied; without even the implied warranty
    ; h7 d  i. _) v  Z( K  ]5 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& ]. \  }3 K1 F$ C( G: q
  22. * GNU General Public License for more details.
    4 z* S& \; A: K
  23. */. C/ M) L: x5 p# \
  24. * }& A3 E" q8 A% H& m
  25. #include <linux/module.h>, d  @, B% X0 c4 L% b
  26. #include <linux/init.h>/ c# r: R8 j. @9 M3 @' m
  27. #include <linux/errno.h>
    - O2 k) g0 J2 b0 U, I* p" q) g9 w9 S
  28. #include <linux/types.h>/ y* s( ^3 j' Y5 ~8 d
  29. #include <linux/interrupt.h>
    ! b$ g& c0 ^3 @% q. b4 C$ }
  30. #include <asm/io.h>
    ( \5 b" v4 c) a) k' ]9 C2 _
  31. #include <linux/moduleparam.h>
    ; n8 r) M  X, R8 i: _: r) A1 O- P
  32. #include <linux/sysctl.h>
    & ]: C3 g( _, n( N% y/ w2 u3 D  j
  33. #include <linux/mm.h>" `3 Q+ p' U+ @
  34. #include <linux/dma-mapping.h>& I, q6 t, ~8 \
  35. 8 p% \' M3 o$ z- C% w
  36. #include <mach/memory.h>
    # ^/ F" }( m) ?1 `9 w
  37. #include <mach/hardware.h>
    * H  g+ R0 @" E$ G
  38. #include <mach/irqs.h>
    ( c/ f" u; P6 b3 c. a
  39. #include <asm/hardware/edma.h>
    ; \3 [) k% X  g( E" X

  40. $ P' r5 Z3 o: z* L% d  ?8 H
  41. #undef EDMA3_DEBUG# l( a; e9 ^+ m3 O" K
  42. /*#define EDMA3_DEBUG*/
    , [. g# K; n! `
  43. 8 C7 I# z& |3 N3 Q, w# v0 b
  44. #ifdef EDMA3_DEBUG  h9 Q# b. m% e+ d: T! _; j, D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( \. v) h- W+ V' G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 E& U/ C' H* t3 n8 K7 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' o4 W- [9 v) G' S  h$ F# P
  48. #else  e9 R8 N' i" ~" Z+ Z! X4 S* g
  49. #define DMA_PRINTK( x... )
    - [, e5 z4 N# x5 m
  50. #define DMA_FN_IN
    ( [* O: a( E' i$ q& ?& U3 w6 S
  51. #define DMA_FN_OUT
      R$ D! I- M! L+ `
  52. #endif
    - U5 x1 I! w7 m9 {
  53. + p8 ~( k/ b6 J* x5 P+ j- t. ]' r. B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ m6 S# H8 p  m9 |7 c0 W7 }; x
  55. #define STATIC_SHIFT                3' S% ?3 r$ K" y* ~1 V
  56. #define TCINTEN_SHIFT               20
    ; y" @" \; [, {; {( B
  57. #define ITCINTEN_SHIFT              217 x. l( [& I" C1 h
  58. #define TCCHEN_SHIFT                22
    2 O# A& f6 r& W2 k: a6 W
  59. #define ITCCHEN_SHIFT               23; X' B# w" ~- J0 S, {
  60. 6 p6 q+ ?2 X  p, o2 L
  61. static volatile int irqraised1 = 0;
    5 G% H0 [" @) q
  62. static volatile int irqraised2 = 0;
    . g0 a" M  e9 ^' a) |, E- m5 ^

  63. ! n- K9 Y  M2 p. `: [' r) T; A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z/ R2 V7 {1 G- A8 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; S9 \) t) S: f; s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 y6 [9 G, h/ {  p

  67. 0 H( N0 I# A% @8 Y7 `1 j, e
  68. dma_addr_t dmaphyssrc1 = 0;! B# t$ N1 S$ }& N$ _+ `5 u. I
  69. dma_addr_t dmaphyssrc2 = 0;
    3 o( r% X; F1 l+ A
  70. dma_addr_t dmaphysdest1 = 0;
    " ]' L, ?; z& K- o8 z! R
  71. dma_addr_t dmaphysdest2 = 0;( K) d) j8 s& f
  72. . \" S+ M3 c& w, b
  73. char *dmabufsrc1 = NULL;$ l6 E& |) _. w" Z
  74. char *dmabufsrc2 = NULL;
      g1 S- ^2 {5 X! k7 L7 R& o' Z: a6 {
  75. char *dmabufdest1 = NULL;
    4 S1 {! f# |, L. }
  76. char *dmabufdest2 = NULL;
    ! T( E0 F3 _1 y  A/ R3 G& h3 b2 H

  77. : t8 {/ Z' K1 r& L% V5 T
  78. static int acnt = 512;
    8 m' A4 ~% v3 W
  79. static int bcnt = 8;
    5 }7 S6 s# f8 J, i7 c- b
  80. static int ccnt = 8;
    ( v+ X0 Q. D8 c, A
  81. $ ~& G  D& z7 I7 r/ i; o
  82. module_param(acnt, int, S_IRUGO);* S+ I5 t+ p1 A
  83. module_param(bcnt, int, S_IRUGO);4 W9 C! k9 Q2 k; |8 O; c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( z0 o4 H! Z/ H# K& D$ r* \1 f4 Y

# J0 v- t/ L/ v8 i6 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! q2 N6 ?( O8 P7 N0 p- Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 F8 p0 l4 f9 b7 r( t; B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 D+ z0 o# S% I* y2 I  {' a" n& T6 l4 X! S2 c; _7 e. E
9 A# }& R6 ?- B+ N" P5 y0 O# R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 17:15 , Processed in 0.037836 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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