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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( z8 I' B& E. t% L
  1. [code]EDMA sample test application1 [- c: R& @  S
  2. /*
    8 Y! o$ y/ g* }% g. k0 [. A
  3. * edma_test.c$ z( c; T  N! x( l# e
  4. *
    8 V* }. _1 k; k1 A. B6 w
  5. * brief  EDMA3 Test Application
      |, r/ T  k/ Q: ?3 t2 Z
  6. *
    8 ]4 J4 H  x0 `7 ]0 Q
  7. *   This file contains EDMA3 Test code.# f4 ]# c' }% ~+ \
  8. */ I' T8 S8 l' f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      H- t$ r6 O1 ~. e# Z# p# v' T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' F; H: H! \0 d, b  z
  11. *         TO CHANGE.) e  c1 ]1 I6 v5 p# e
  12. *( a4 B; X$ h# b# f# s" ~6 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// }' @+ U# D( ^6 S' |" I. |
  14. *) L- g9 z6 B5 W! ~5 u, i4 g
  15. * This program is free software; you can redistribute it and/or
    / M1 P# ], @' O0 j8 z( u" Y& h- ~
  16. * modify it under the terms of the GNU General Public License as& P! R1 y& l/ I3 \. w
  17. * published by the Free Software Foundation version 2.- x2 i8 |% ?2 }( |* ]
  18. *
    * R2 V) Y* T( `$ J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & i- S# ?( \+ d7 U
  20. * kind, whether express or implied; without even the implied warranty
    3 V' ?( p1 G8 [% y; U; l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. q% Y! a, n1 E3 _6 B' `% L  t5 \
  22. * GNU General Public License for more details.! C# [3 b8 a( b/ k7 k+ ?: T
  23. */
    8 O7 O6 @$ N; T0 @5 Y2 A

  24. " c- s8 e8 L& n( x6 I+ z" S
  25. #include <linux/module.h>+ s, [8 T3 o4 T1 \$ K
  26. #include <linux/init.h>3 d1 i3 k0 W6 u6 g4 q" q
  27. #include <linux/errno.h>& O  ?& d8 w* N; E! S
  28. #include <linux/types.h>
    : U/ i; U- ~' V
  29. #include <linux/interrupt.h>
    , f/ G- }8 g2 p
  30. #include <asm/io.h>
    1 e0 X7 C: e( f" O
  31. #include <linux/moduleparam.h>, @' q( v1 p2 v2 i1 Y+ E  `7 ?7 `
  32. #include <linux/sysctl.h>1 A8 s( y" b1 B
  33. #include <linux/mm.h>
    " E, F6 {+ M; A2 W% W% r
  34. #include <linux/dma-mapping.h>- o1 c3 x& f, Y' W

  35. 4 O3 G. q/ e3 k3 R: W
  36. #include <mach/memory.h>
    0 X4 E. F% P0 A  F: H7 |3 I/ k! Q: e4 ?
  37. #include <mach/hardware.h>6 i! U: V: Q* T* V+ x/ V
  38. #include <mach/irqs.h>  H* J8 P. K- O
  39. #include <asm/hardware/edma.h>5 ]6 E! k+ a8 I# l* w5 m2 D
  40. $ i8 i" o" ?  L/ d: q$ O3 a
  41. #undef EDMA3_DEBUG  v6 V3 S: R' q+ w5 j! b
  42. /*#define EDMA3_DEBUG*/
    ( J4 E" }9 [* |! i# W1 y

  43. ) v0 J  h9 X9 L) V0 N6 [( D
  44. #ifdef EDMA3_DEBUG
    : U  g5 h" m1 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& P% E7 ~  _# R; |( J" k' g2 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 x. V1 Q. Z7 Z& L7 `( e5 B9 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - Q7 |& \2 S' o& A/ ]
  48. #else
    7 u0 X1 r( i; J5 a- D% N/ e5 |
  49. #define DMA_PRINTK( x... )
      K1 E( Q+ ]2 g! q% S* O) L
  50. #define DMA_FN_IN
    : h5 B! M1 l1 R/ M5 g( N/ P' y
  51. #define DMA_FN_OUT
    + v: R8 O7 a9 R7 P
  52. #endif
    5 c/ j  M2 G7 j- j) `. n

  53. & l0 w, W# ]( z7 B. Q/ U( a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " O, t! p2 d: N* m) V
  55. #define STATIC_SHIFT                3
    6 M' f5 u5 O. q( `, i% W$ _, Q
  56. #define TCINTEN_SHIFT               20
    7 h! B5 A# \; O! ~  q
  57. #define ITCINTEN_SHIFT              21
    4 C' \7 g. r6 L) d
  58. #define TCCHEN_SHIFT                22
    ; E' O6 g1 v4 v( U# B, {
  59. #define ITCCHEN_SHIFT               238 Z% h' P. x; M3 u9 ?: o0 _
  60. ) v  R* O3 H) L/ ]8 S$ }
  61. static volatile int irqraised1 = 0;; o5 X5 Q: Y& K' R% ]
  62. static volatile int irqraised2 = 0;
    / w# _/ R7 o/ h6 z) Z

  63. + A" T& a/ t! t0 m/ Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ^: ?+ W( F0 N5 e) b4 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G+ Z& h& t8 C( [+ g8 Q9 k. d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ~6 \$ m# O6 \) v9 O
  67. & e* ]( D7 y1 F: ?& D  q( t6 f* I
  68. dma_addr_t dmaphyssrc1 = 0;
    : V7 N; H4 f. n* B7 N/ V# i6 ]% Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ' f8 C9 c: }& Z8 d% O/ y
  70. dma_addr_t dmaphysdest1 = 0;
    5 j* T5 N- @( l3 Y% {  b5 K
  71. dma_addr_t dmaphysdest2 = 0;2 j- j# \! ~7 ^  A$ K( H; D$ e9 r

  72. 0 u# X- [6 D0 s6 z9 ~
  73. char *dmabufsrc1 = NULL;0 c  k5 [& E7 [6 @/ H" M9 O
  74. char *dmabufsrc2 = NULL;
    7 {  m" Z+ @1 D& ]; V
  75. char *dmabufdest1 = NULL;1 M# c8 E( l- h; x, n
  76. char *dmabufdest2 = NULL;$ o; [2 C5 s+ {& {% |8 @
  77. " C5 a" I0 ~2 F9 O( X- K( j
  78. static int acnt = 512;6 [3 x8 z4 H" {% A5 d6 P8 F
  79. static int bcnt = 8;
    - s2 a2 _/ I* P/ c- j6 D& g
  80. static int ccnt = 8;8 \1 h( s, X  v- o5 M

  81. - B8 ]. X! r! O
  82. module_param(acnt, int, S_IRUGO);
    " v7 s2 t9 }; Y2 B3 W- j$ k/ q
  83. module_param(bcnt, int, S_IRUGO);$ ?; j; X7 s3 x; t$ n0 P5 c: U8 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 l, Q  s! r; E% o* Q  E/ s
9 k9 a. q$ a& o. e3 l0 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( O3 C7 U, _3 O, ~8 `% e  g" _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 F( E, v& L1 n3 o! ]5 j! b' n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: I9 C# Y; f  t& k
6 N8 W  z" \8 i
' i" T( t6 ^7 z" c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 16:17 , Processed in 0.039212 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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