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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% }6 @9 m, B: O1 d0 R6 E
  1. [code]EDMA sample test application! P; ?+ O- O  d1 o2 |  N
  2. /*
    - J4 A( O( t4 H' {# V1 p$ h
  3. * edma_test.c
    2 W5 z- t2 x) ~# y2 e
  4. *
    ! s% V* a! L& L2 t3 F
  5. * brief  EDMA3 Test Application( q  _, |! t9 X; m2 u  ^
  6. *7 |& s7 ~3 t% X" y) p8 X
  7. *   This file contains EDMA3 Test code.! Y, a$ r! A8 R% }$ Q9 v( f8 U; k+ o
  8. *  c& y. G# z. g& q  Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      O0 ]- b' I+ O" O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& B. Z9 F) A) t# k
  11. *         TO CHANGE.
    % w8 q5 \4 B9 I. V1 ~
  12. *
    9 l, f% H$ A4 j, F( m& ^0 \, f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 K2 _6 J# s; p
  14. *
    . E. [6 F' N- D3 n; W! A6 y
  15. * This program is free software; you can redistribute it and/or
    3 q4 Z  p& x2 j: `$ H, l1 l
  16. * modify it under the terms of the GNU General Public License as# P' Y/ I" H# ~4 ^  d  k
  17. * published by the Free Software Foundation version 2.' q6 W& z& B! m$ E, k
  18. *
    % S. \: b4 }  g2 J% K6 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 z) D" F( U* b, ~, t2 x4 f
  20. * kind, whether express or implied; without even the implied warranty
      R5 {) R1 ?8 F0 a3 O4 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 l, _# i: r, {
  22. * GNU General Public License for more details.
    3 |: `/ V8 ?; h/ V% K. R
  23. */% D1 |6 ~$ I' t' i9 q
  24. + C0 F( Q' t5 w
  25. #include <linux/module.h>5 Y$ ]- h- x& Q
  26. #include <linux/init.h>8 V/ N; y) Y( P* C; }
  27. #include <linux/errno.h>  }& Y7 h$ I3 y, a
  28. #include <linux/types.h>
    . Y% o* T8 Q& [7 Z3 O
  29. #include <linux/interrupt.h>6 ~8 t9 D& N1 c! I+ A% w
  30. #include <asm/io.h>
    : g" V2 Q. n" |# A5 H
  31. #include <linux/moduleparam.h>* o$ e) h8 T: i2 ~
  32. #include <linux/sysctl.h>; w. j% Y8 A# s# @
  33. #include <linux/mm.h>
    ) X5 l% @' t3 C- O
  34. #include <linux/dma-mapping.h>( g% a/ y9 E% ^4 T/ M7 ]" {

  35. 1 T  |! c, k! R
  36. #include <mach/memory.h>
    $ ?/ i5 e$ P" ~4 j* ?+ H
  37. #include <mach/hardware.h>
    - n: a8 N' o6 w& W
  38. #include <mach/irqs.h>5 l# {* E4 L6 L, _  F4 h
  39. #include <asm/hardware/edma.h>
      r& K/ u& t: L# h

  40. 7 U, @# ~! t! w4 O
  41. #undef EDMA3_DEBUG
    ( o9 \) g: I. |% P; R1 ~
  42. /*#define EDMA3_DEBUG*/$ e7 I  b- g/ H3 ?& _! M% X- v

  43. $ U2 h( N* s) R
  44. #ifdef EDMA3_DEBUG
    4 f/ F% L5 {2 A1 S/ Z! a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 B) n" o2 ^, {9 h2 v% L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # g" P' v- B% r% o4 p) i% S- }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& Y$ n0 `7 Q! s5 ~. i
  48. #else
    - f; L; K9 Y9 T
  49. #define DMA_PRINTK( x... )
    5 u) q% r  R/ E8 @
  50. #define DMA_FN_IN
    2 D$ M) t8 r8 ?/ C# \6 p
  51. #define DMA_FN_OUT. C3 o; g! I, T! G" U1 L
  52. #endif
    & H7 W: s9 [. |# f0 S) K4 @$ T; f

  53. ( u4 E* [2 {# g2 o7 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; q& C) C2 ~/ ?3 L  x$ Q% \
  55. #define STATIC_SHIFT                3+ \% s& Y# o+ A2 |$ Y
  56. #define TCINTEN_SHIFT               20
    / B" h. K" k0 A: A# U8 Q
  57. #define ITCINTEN_SHIFT              216 @5 ^+ ~% \6 s4 b+ c
  58. #define TCCHEN_SHIFT                22
      V0 r) h0 A, D0 D
  59. #define ITCCHEN_SHIFT               23
    , x( h4 c/ z+ d2 ?* X$ Q% [

  60. 0 t0 r! [/ p4 G) u2 _1 q
  61. static volatile int irqraised1 = 0;& B& A$ j7 }# b/ Z3 Y3 l
  62. static volatile int irqraised2 = 0;
    3 o' W7 Z) }$ o8 u! ^: I4 P* [
  63. & q9 C4 p0 |  k" j: k& b( a2 q# e2 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 E/ ?7 f  e+ E  R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K/ o, v' _3 ]/ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 h0 H7 p' o- x0 U

  67. 5 [+ R) ^( }& u4 C* `2 U* y
  68. dma_addr_t dmaphyssrc1 = 0;) u4 t2 W+ S& k7 G: n$ z3 I
  69. dma_addr_t dmaphyssrc2 = 0;
    - X) H3 t! D2 j6 [$ G
  70. dma_addr_t dmaphysdest1 = 0;7 c& q5 k% t, M' d- ^
  71. dma_addr_t dmaphysdest2 = 0;
    2 i1 w9 |# p6 ~9 i

  72. 7 G: P0 L0 r& p3 W$ B& Z
  73. char *dmabufsrc1 = NULL;
    ! ]. L& e- z- T7 n  G8 {" Q5 `( j
  74. char *dmabufsrc2 = NULL;
    8 j/ a) V: Y5 i8 j: |" M
  75. char *dmabufdest1 = NULL;
    & l( Z& Q  e* _/ [4 v; w5 Y2 ~
  76. char *dmabufdest2 = NULL;
    % W, V# b5 D$ g0 q; g# c

  77. ( V7 k* t1 \; n( T0 x% Q; J$ E
  78. static int acnt = 512;
    # d9 m% D8 ]3 Z  G5 j$ o/ ?
  79. static int bcnt = 8;
    ! q9 }( G+ n( q7 L' Y4 J( |
  80. static int ccnt = 8;
    3 v: g6 H! j( m+ q7 b" P5 {
  81. 1 T# ]' S# l& g; \9 T' }( \
  82. module_param(acnt, int, S_IRUGO);
    : U4 m5 Z- h8 k8 v
  83. module_param(bcnt, int, S_IRUGO);
    3 K# F  H, i0 w' r& I4 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ H% H2 {( I+ H; ~6 b/ E
8 S- M! i" r- q/ c: |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ j( ^$ s+ @  }3 l% ~% o( N
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% ]5 g: x+ p& n6 G' ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 F. j4 S( e4 v4 a
2 G3 e/ A: y# I1 A

2 c5 k1 {' \( d5 A% o$ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 04:40 , Processed in 0.043486 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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