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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 x! @2 A2 y4 D; H6 t9 M) Y
  1. [code]EDMA sample test application9 v  }3 n  v( O5 K3 E
  2. /*2 J( N' C# |) S" c
  3. * edma_test.c% {" s: Z8 j. M3 G+ J7 Z  i
  4. *6 n2 p) }- |3 m$ v
  5. * brief  EDMA3 Test Application5 Z) m5 j; v0 K9 N8 @
  6. *
    2 l( n% X3 v" s  Q- d: E
  7. *   This file contains EDMA3 Test code.4 n' F/ g& X5 I3 j+ a8 A" X* A
  8. *% g) G8 k6 c3 P) G& \3 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 C# f% K9 j0 D0 a; z0 s' N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Z1 R; V* U  {- L
  11. *         TO CHANGE.
    9 N( S3 f+ j& W4 ?/ b
  12. *
    4 |: n. f8 l. n0 q' @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! ~1 c' M- [7 S  `, S
  14. *
    0 q/ ]7 i; D! b9 L$ J6 A& X% x# q
  15. * This program is free software; you can redistribute it and/or
    3 p( a0 P4 p2 E! K" {
  16. * modify it under the terms of the GNU General Public License as
    ' G6 h0 E) C5 Y4 L2 P
  17. * published by the Free Software Foundation version 2.; u7 B) f9 ?$ b* h, k8 ]' [& g7 {
  18. *
    5 p+ T* T* h. F2 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      W' |2 J  ~9 q& c+ V/ F" ^' e
  20. * kind, whether express or implied; without even the implied warranty
    ! [/ w, V' R9 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 g( o! ]2 G" z. _  v3 K0 F  a
  22. * GNU General Public License for more details.
    , h! t5 T" S  o3 W
  23. */; p1 d, C+ O; m
  24. 0 Z/ [! k# o6 V8 }) i8 j  |8 m
  25. #include <linux/module.h>1 G( l/ U) p* @. ?$ `
  26. #include <linux/init.h>( r: G9 J' q! Q, J/ r2 U
  27. #include <linux/errno.h>, ]4 ^& P0 Q, f/ s4 U' Q
  28. #include <linux/types.h>* s* p- W5 d" V5 C  C# ^
  29. #include <linux/interrupt.h>) z; [- L2 D  Q' a/ t0 _
  30. #include <asm/io.h>
    5 d# F# P. e9 e5 z) M4 G3 f
  31. #include <linux/moduleparam.h>
    5 v" a& ^9 b& h/ P. `& d: C
  32. #include <linux/sysctl.h>4 f) T" y2 U6 ~2 n# S1 h9 P% ?
  33. #include <linux/mm.h>
    . J9 N) y( W) x$ _1 D, y
  34. #include <linux/dma-mapping.h>
    5 O1 R2 f7 x" Y

  35. 7 r0 P- D8 j2 A% [  b: n4 i- N
  36. #include <mach/memory.h>
    * g* G4 Q# R: q3 i& S3 X
  37. #include <mach/hardware.h>" w7 i- ]+ t6 n: E
  38. #include <mach/irqs.h>1 @1 n+ I/ u7 [
  39. #include <asm/hardware/edma.h>
    6 H, |6 m9 T" x, O# K5 o
  40. ! q4 _# H% l1 B- ^7 q) c
  41. #undef EDMA3_DEBUG5 J7 U6 `! ~) C+ U2 a
  42. /*#define EDMA3_DEBUG*/
    4 i  `* q- `( o* C
  43. 2 l( @( n' ^  c& u
  44. #ifdef EDMA3_DEBUG+ M9 I, \% @+ F( h" q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) r" F! H4 N9 W! ]0 {# e4 x& n; j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ t$ f* G" ]6 h0 R: H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # V; U9 ]* ^) a- N" ]/ c% p- k
  48. #else
    4 c, }: C+ @9 l$ W) q) r
  49. #define DMA_PRINTK( x... )9 |5 d4 W' N) X
  50. #define DMA_FN_IN
    8 [2 C. v/ @4 s! l7 r. H
  51. #define DMA_FN_OUT4 j: l, i8 \4 j! }
  52. #endif, Z# {' d5 V; ^& ~) t, C' r/ n

  53. , A/ a+ w- _0 J/ O" P4 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% Z/ X6 r( ]" C+ J. p
  55. #define STATIC_SHIFT                3
    2 F" t5 k* Y* @# e0 [/ g  S
  56. #define TCINTEN_SHIFT               20
    7 d$ G9 }( ]( H+ O; I+ R, d# B$ Y- R
  57. #define ITCINTEN_SHIFT              21* l% W# X* Q0 `  j3 v
  58. #define TCCHEN_SHIFT                22
    ) y8 n7 s& \( c6 l8 _, k+ a
  59. #define ITCCHEN_SHIFT               23$ z- G: j' m9 x, r
  60. 4 n' U# w! ]3 H8 U
  61. static volatile int irqraised1 = 0;
    ' F# D9 }% k1 A
  62. static volatile int irqraised2 = 0;
    * u3 P& D5 i/ c. M/ x7 T

  63. ; b( B& y, _2 c- x) y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & U# o. {0 @. Q. b, ?* P* Q2 Q! e0 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 L% w& _/ G* M% T% y# P3 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 \+ r" J5 `: A! Y

  67. ) q7 t4 x  s+ {
  68. dma_addr_t dmaphyssrc1 = 0;* V+ l3 T; D3 g7 t- ]5 n# [
  69. dma_addr_t dmaphyssrc2 = 0;
      c7 @* T, B& \; `# G2 p, C( }
  70. dma_addr_t dmaphysdest1 = 0;4 Z4 F8 }1 M* L3 B
  71. dma_addr_t dmaphysdest2 = 0;
    & M7 a/ ~; W& }+ U. _
  72. 0 j8 V6 |, r- h* L; Z* n
  73. char *dmabufsrc1 = NULL;
    $ _0 s/ k5 \7 i& p8 B
  74. char *dmabufsrc2 = NULL;
    ; p$ o7 \1 a5 Y+ B5 p+ O
  75. char *dmabufdest1 = NULL;* f3 S9 W, d6 z- a
  76. char *dmabufdest2 = NULL;7 [; p# y4 D" R! ]

  77. 2 L5 G$ y4 P  l: G( ?1 x
  78. static int acnt = 512;
    : G+ r# ^" T2 b
  79. static int bcnt = 8;
    7 }0 m' O& m4 Q
  80. static int ccnt = 8;( K7 C1 _) a' _5 ^; U2 @, c3 }. k5 z

  81. " r$ ?9 f6 `) J, {+ i8 n* q
  82. module_param(acnt, int, S_IRUGO);7 H1 V+ @% r2 }$ D: B: P
  83. module_param(bcnt, int, S_IRUGO);3 X5 ]" R/ q5 }0 i1 U/ j( R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 g& Y* s; x* `" x$ W8 `

0 N, ~9 y( |: ]# l& X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) G; g  A4 U' Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ o& O4 j% ~/ ?% h) j  r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! V- W, \8 n! n8 a: E* ]
% G# J- j2 m# f. D5 Z/ u
: O3 j* J) A3 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 01:34 , Processed in 0.065310 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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