OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & a9 z- ?: C$ Z1 ^, Q: U$ W% z
  1. [code]EDMA sample test application
    - W2 B- c5 N& U) h6 K. p- A; C" u
  2. /*
    - \4 t4 L* i& A) k
  3. * edma_test.c
    6 s2 J6 p8 v$ N
  4. *  E3 b! x9 W1 S
  5. * brief  EDMA3 Test Application
    , l- A8 S: E+ w6 Q5 B
  6. *# `* d- Z% ^. s" y+ A
  7. *   This file contains EDMA3 Test code.
    4 `2 |- N: l" F" v. n
  8. *
    & w* Q  s# s3 L: E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 c9 _/ r' {# Q4 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / t/ A  u' i( W* j$ Q* T0 C# V7 p
  11. *         TO CHANGE.
    ! @. Z. x# Y# r8 {# O
  12. *
    ' F9 M( K* M+ d2 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% k6 P6 n8 W$ K
  14. *
      c% V6 c, f) g' b# g
  15. * This program is free software; you can redistribute it and/or3 [! x$ I2 |. ?2 O. g
  16. * modify it under the terms of the GNU General Public License as
    * {2 [% C( r7 t; q; U8 B' D
  17. * published by the Free Software Foundation version 2.* I& g  y: A" X# S( N' q
  18. *
    & r, s7 _  L5 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 a+ p$ [" k2 a& m2 X
  20. * kind, whether express or implied; without even the implied warranty
    . b* |4 m: j( B2 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) q8 w. J+ k: z
  22. * GNU General Public License for more details.' u0 Z2 Q7 D! Z. D1 K5 `* y
  23. */
    . a2 F6 Z7 L8 Z6 f1 V( B$ ~

  24. " }' ~# A0 l7 ]7 i
  25. #include <linux/module.h>
    / a( J' l0 O! i1 Z: z" u
  26. #include <linux/init.h>5 e* a( {) U  W& R
  27. #include <linux/errno.h>( e0 Q2 \  b' _4 `- D3 t6 p
  28. #include <linux/types.h>
    2 P$ s0 z7 o9 x3 z% y
  29. #include <linux/interrupt.h>+ x; f. s7 w$ s" ]2 X6 J
  30. #include <asm/io.h>/ M8 K& x8 x- G& K) _2 H
  31. #include <linux/moduleparam.h>
    / V9 \5 x: }7 ~7 {2 j! A5 w; {
  32. #include <linux/sysctl.h>  ?# m3 h% c  X
  33. #include <linux/mm.h>
    / k; B- ?& r- ?8 h- p) k8 Q2 N
  34. #include <linux/dma-mapping.h>4 X4 d# g" B: @' ~  p$ Z3 |

  35. 2 T( q, ~4 o9 ~; K% t
  36. #include <mach/memory.h>
    $ _. t# h+ B+ A& h9 w1 h1 @
  37. #include <mach/hardware.h>
    ( d; N8 `+ W9 a* v2 Y: W* o
  38. #include <mach/irqs.h>
    3 ^" r2 ~; \0 H+ U
  39. #include <asm/hardware/edma.h>
    4 B( w: m3 K  }( b: j
  40. & w5 ]  ~4 D! g, X  u
  41. #undef EDMA3_DEBUG
    ! @8 ?9 a, f+ {7 y; u0 g6 T. |
  42. /*#define EDMA3_DEBUG*/' v% v  L; T( ?3 S

  43. * u( _% c' D' \7 Q! N1 [* o! ?
  44. #ifdef EDMA3_DEBUG- q& f4 {2 z3 c3 n: V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! G$ m! Q6 r2 a( z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 s4 a6 X9 H4 o- m! j0 C8 l8 R4 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 \; S4 q' {# Z( C( w
  48. #else
    : d& ?0 J. V( ^0 `; U6 l9 C. a
  49. #define DMA_PRINTK( x... )
    & Z( Q; H& n* _: w
  50. #define DMA_FN_IN$ h4 o8 I8 u1 j+ q
  51. #define DMA_FN_OUT
    9 U4 k/ ~, B5 y+ H$ {5 Q: `0 M9 q
  52. #endif5 k  q0 r) s% M  e/ y0 u1 O

  53. 3 @( o4 M; T- h6 l: j) Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 ]  m2 w' w' C: e: T4 T0 v% @
  55. #define STATIC_SHIFT                34 g. J/ j2 |" R; p  V
  56. #define TCINTEN_SHIFT               20
    ) U' y  J, m# i
  57. #define ITCINTEN_SHIFT              21
    & r/ R; o; v% |" m# }0 ~
  58. #define TCCHEN_SHIFT                22
    ; Q4 H6 q+ Z7 w& a
  59. #define ITCCHEN_SHIFT               23
    2 t+ P7 y3 B' @7 K2 j9 t7 ]
  60. ' E3 m' I( G- S; y  a) C7 t; ]
  61. static volatile int irqraised1 = 0;- k: p4 H) B% C! J9 r- }
  62. static volatile int irqraised2 = 0;3 [1 N" B7 t0 ~4 L5 b# _$ ^
  63. 7 i% K( A7 I0 g  b) \8 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) G. Y: D, o, A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 T0 w: ^7 W+ n( d: ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . H9 u  r# g/ a

  67. * F, d. r" b' ^9 H3 t/ J1 t
  68. dma_addr_t dmaphyssrc1 = 0;- e' v; @2 l/ Y* Z4 Y! u3 A
  69. dma_addr_t dmaphyssrc2 = 0;" K9 y5 i1 t- w. c4 X$ |
  70. dma_addr_t dmaphysdest1 = 0;2 J* w4 s0 y  \
  71. dma_addr_t dmaphysdest2 = 0;
    . s) R1 `( C" h0 R( ~4 y
  72.   Y! F3 m: K6 R/ C8 y: g
  73. char *dmabufsrc1 = NULL;. o7 }5 _% r/ U0 G) y
  74. char *dmabufsrc2 = NULL;! f( o+ N5 p* k5 m) m
  75. char *dmabufdest1 = NULL;3 H2 K0 M' H" [
  76. char *dmabufdest2 = NULL;
    ; a% _( p+ I7 U* @7 b6 o/ s. r

  77. 9 m4 x8 p6 w# w1 z, o
  78. static int acnt = 512;
    5 g, c% j' y$ S# Q: h7 U7 q
  79. static int bcnt = 8;
    6 w: [, d" b5 g6 {  w# v
  80. static int ccnt = 8;" \5 J7 O2 h. A5 k# b4 [# W7 l
  81. ) P. f& O0 m6 N# R* ]
  82. module_param(acnt, int, S_IRUGO);) K' I" k  T$ V! g5 e
  83. module_param(bcnt, int, S_IRUGO);
    : H* |" N4 f" |9 m: f3 y: t# W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ \" G, s; O, t2 S
  j. X: O1 @  ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Y/ y1 e+ Y. U+ M: C, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* k8 q) z4 l9 `7 u5 ^) o& J9 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 R+ y; j, M" A- c0 F3 g
0 \; W2 P5 {3 p+ w5 P, ]3 p
3 b0 o4 a" d& s+ w! c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 22:23 , Processed in 0.038958 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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