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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 h& m) f2 V$ y; }. Y- V7 J
  1. [code]EDMA sample test application
    : Q2 X7 P4 Q, o& R! N: X
  2. /*
    7 q9 r, v9 B! P4 j. F
  3. * edma_test.c* J! x9 p  }8 s7 ^5 r. V2 K/ X
  4. *% K0 F( H. e0 s( ]2 _
  5. * brief  EDMA3 Test Application
    # v5 d1 R' d! x3 J7 f' F
  6. *+ w3 S% h6 u5 f  D: @) G4 L
  7. *   This file contains EDMA3 Test code." P- S: x  i7 I7 j, g& _7 R
  8. *
    1 @, e0 i, D2 D' G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 M/ Z. j8 h. [* @; e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , J$ f. j( R4 }: ~, i9 `8 [" w
  11. *         TO CHANGE.
    9 q- s% \- V, l5 x, C
  12. *0 b- [/ R1 {$ T- @# l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& m7 g$ d( G/ F9 G0 A) E
  14. *
      W/ B8 S2 U! e: B
  15. * This program is free software; you can redistribute it and/or% G" l5 g$ t: i5 }
  16. * modify it under the terms of the GNU General Public License as# z  R9 {, T$ h+ K, s
  17. * published by the Free Software Foundation version 2./ ]/ j4 i7 Z: K# N/ w* q
  18. *9 n: L6 m" E# n: l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- y* k' I7 ?9 `- h5 K5 W
  20. * kind, whether express or implied; without even the implied warranty
    ( a8 h7 z# U$ _0 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- r* ?. C/ ]* D) J) F3 T+ M5 V! c
  22. * GNU General Public License for more details.
    , l! p3 ^8 g7 `, c; T5 U5 d# L: ^
  23. */
    ; p6 S/ T' `" I& z$ {

  24. * h9 Y$ G5 e0 J- q$ V8 N: Q
  25. #include <linux/module.h>: W- S2 ?5 n; _) p6 t" k1 D+ M  u" d, l
  26. #include <linux/init.h>. C7 X! T$ u7 Q5 c/ c" r" z
  27. #include <linux/errno.h>
    ( a2 ]7 U5 ~3 N5 C; B( a  T" c6 G
  28. #include <linux/types.h>8 B' F' D: U% H- q1 w! `( I& ]
  29. #include <linux/interrupt.h>
    6 i" f4 c1 }/ n. g: S! l
  30. #include <asm/io.h>, F; w9 S. T- f. C) A, B# l+ Z
  31. #include <linux/moduleparam.h>
    ! a! h2 H3 D  k9 j! U* w# f
  32. #include <linux/sysctl.h>% p- o0 K0 p& s4 w8 r/ d5 x
  33. #include <linux/mm.h>
    2 W! {  v& p+ S7 i
  34. #include <linux/dma-mapping.h>
    & B# P" y8 V" z

  35. % x0 K/ m3 ^3 L3 K4 y) F
  36. #include <mach/memory.h>
    . Z- p2 U0 @! s: s
  37. #include <mach/hardware.h>
    & L% ]* r  w' U/ h
  38. #include <mach/irqs.h>
    9 x9 }9 T/ b. Y4 E
  39. #include <asm/hardware/edma.h>7 Z7 p4 R! s# `2 j( W& ]

  40. 9 n6 f0 I  \, X1 n# r
  41. #undef EDMA3_DEBUG2 r$ {9 S2 Y/ E+ y/ I
  42. /*#define EDMA3_DEBUG*/9 S  W% y2 y8 {3 r" f
  43. ; B9 w: z  R+ e4 g- d6 h
  44. #ifdef EDMA3_DEBUG( F1 M) p/ G* C) O: ]0 \( s' D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ V4 x! }$ m; A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : \. b7 w# A" [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 f2 b8 Q5 h6 W6 O7 V' t( e  Q7 Y1 d
  48. #else
    0 U  S: ^6 P5 G" |' I9 ~
  49. #define DMA_PRINTK( x... ); \6 i# m( S8 e6 c' E
  50. #define DMA_FN_IN
    9 t, Y# \- l4 F0 x" T$ x/ h
  51. #define DMA_FN_OUT
    # B( M8 H( s& r/ }1 Q4 ]
  52. #endif& C7 C  }& X3 |) w: d
  53. 9 [7 o. o  h* i; ^+ T# d" P  h' D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % m9 N. f, |6 w, ]; `- I3 Z
  55. #define STATIC_SHIFT                31 G; H8 {0 G: K- k& f
  56. #define TCINTEN_SHIFT               20
    2 g9 T1 c8 J" R# O
  57. #define ITCINTEN_SHIFT              21
    ) Z, \/ S6 E9 I; P3 M; ]
  58. #define TCCHEN_SHIFT                22- y/ N0 R8 A; B/ t
  59. #define ITCCHEN_SHIFT               234 V+ T- w0 X1 `' x9 y, {0 ]9 ?' E

  60. , X& l( I' ]% C* _
  61. static volatile int irqraised1 = 0;
    : x0 D. e# d0 F* r, }2 r' H3 z
  62. static volatile int irqraised2 = 0;( m5 f, w, B& f

  63. 9 F; _9 j6 W6 W! Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - F/ ~$ J' M6 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; D* |5 N( C6 Y5 u0 ?& V, ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z0 U, `0 i5 v
  67. 4 l! K/ E5 L$ z% H. s
  68. dma_addr_t dmaphyssrc1 = 0;
    : Y) H, O% v/ x5 r6 g
  69. dma_addr_t dmaphyssrc2 = 0;
    8 y8 c: {2 q! K- z/ z' ^' P
  70. dma_addr_t dmaphysdest1 = 0;2 ?1 v- C0 S; q9 M! \- a
  71. dma_addr_t dmaphysdest2 = 0;
    0 {$ T) B7 W  K3 j' h' d% k1 i" |9 t
  72. , ?% J% g8 l9 T+ [
  73. char *dmabufsrc1 = NULL;5 N/ w( S" t# F/ x0 b
  74. char *dmabufsrc2 = NULL;
    7 B; W" Z# f& D! P: X/ P; ~
  75. char *dmabufdest1 = NULL;4 z9 p# @* H  Y. }
  76. char *dmabufdest2 = NULL;5 f' Y5 R& g" u0 ~" h3 m$ \

  77. $ p% {$ H: V6 p5 u9 U
  78. static int acnt = 512;
    / w9 j5 g* n" y) }# `
  79. static int bcnt = 8;
    ) A! d) m. S3 r0 ^) M
  80. static int ccnt = 8;
    7 i: a/ ^- N% w' G; d

  81. 7 @! |1 L6 D. |+ G0 v
  82. module_param(acnt, int, S_IRUGO);
    / W' @- M1 v8 T0 I- g  a' \
  83. module_param(bcnt, int, S_IRUGO);6 c4 N0 y  t7 k; Z; T+ R. g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  K/ ^1 T% R0 r# r8 }# H& X6 |' \9 S2 A! |' H5 W, @* o& e5 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! ]2 A+ _! [' e4 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  s+ L" O! R3 Y( e& u3 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 F/ o5 |( t1 O3 N: }$ Q( [$ v# {0 S6 H3 K/ J* B

) ~  h. e$ ~. v4 S& L6 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 15:23 , Processed in 0.041820 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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