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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ J+ A) n  ?+ ^# f
  1. [code]EDMA sample test application
    , K5 i# w8 s* |2 R
  2. /*
    8 W# X/ i4 q+ K7 y1 ^7 M4 a: _9 Y
  3. * edma_test.c0 I4 ~# p$ f5 N6 S- z
  4. *  F5 ]. J/ m4 g' l% \6 g
  5. * brief  EDMA3 Test Application2 j7 o4 H8 q3 r! n! d- v
  6. *7 T) m! W6 u% a+ C; W
  7. *   This file contains EDMA3 Test code.1 ]' T, d" ]3 ]1 D) T- q" F6 m6 l
  8. *
    + R2 g2 U: J: @& `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( o5 x' {; M! s* O% J$ R7 v* L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / P& o( a+ f- m! _& {8 J( r
  11. *         TO CHANGE.: a5 }0 C$ ?& N/ k- K  Y" Z: Y/ B0 |7 @
  12. *
    . l  R5 g$ m( T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; d) w1 k+ y1 J
  14. *
    9 _4 J# s* x' r. I" N% `
  15. * This program is free software; you can redistribute it and/or
    & [# b: w, R) O3 Z1 }* z2 U
  16. * modify it under the terms of the GNU General Public License as
    3 h, Q  \1 }$ |  O- m
  17. * published by the Free Software Foundation version 2.
    # k, ?1 x% K- ~% k
  18. *9 I0 s/ N; n. C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& F" S0 `2 r$ I. U, w. b' g
  20. * kind, whether express or implied; without even the implied warranty
    & s# e3 c" T, d! T; ^3 J" l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! C( I, _" X# y! z- c2 c9 [
  22. * GNU General Public License for more details.' I" n4 K# M/ B# s3 Z
  23. */; H( H! U6 w2 t, m

  24. 1 ~# Z% j/ o& B) l$ F% ]
  25. #include <linux/module.h>4 q! A* |2 j% {( S
  26. #include <linux/init.h>
    # M- g5 O( O0 ?. D& j6 S
  27. #include <linux/errno.h>" q4 W$ G! Y3 Q6 W( W
  28. #include <linux/types.h>5 E0 v" g8 b- R8 k! W: I" a5 O7 Y
  29. #include <linux/interrupt.h>
    4 X% {4 c! t9 R) `0 p
  30. #include <asm/io.h>
    ) Z* V" Y8 |) a. x
  31. #include <linux/moduleparam.h>: q7 y" d* B3 ?8 S( I
  32. #include <linux/sysctl.h>
    * N  s( d* d- s! i6 S7 P
  33. #include <linux/mm.h>) o; G2 M8 m$ Y3 u' @
  34. #include <linux/dma-mapping.h>
    + N# [+ ~' I: j& R! N3 n& l' d% A4 I

  35. & F/ S# u- @  L
  36. #include <mach/memory.h>* Z3 J. z- x0 i& }9 q' ^
  37. #include <mach/hardware.h>
    . g4 k3 e+ [4 A0 |' m) _
  38. #include <mach/irqs.h>. K0 \6 A* K- S* D
  39. #include <asm/hardware/edma.h>
    ! H! O! I& U1 Y& p9 h6 f* J+ u
  40. $ o" T/ U% c  V
  41. #undef EDMA3_DEBUG
    1 n4 f" ]' h) X/ I) V2 B2 H% A
  42. /*#define EDMA3_DEBUG*/9 A5 `; q$ M: Q9 [. j; T
  43. " C$ f& B9 x! [% r) s" h
  44. #ifdef EDMA3_DEBUG
    2 W8 ?& m! h0 {# @* s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , w$ {2 g  j  \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Y. d3 l# ^) @0 ]. B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 Z. c1 e" ^2 m
  48. #else
      q. E: }  g. Q: K1 [, H
  49. #define DMA_PRINTK( x... )5 ]+ t) \& ?5 J" N& Q1 h& N; Z
  50. #define DMA_FN_IN
    5 R+ F5 S4 B! R/ P% c& B# K
  51. #define DMA_FN_OUT
    ' d, c3 K$ r2 i4 v5 p2 P! V2 ~% S
  52. #endif
    ; j9 F; r, f6 y/ T

  53. * M; `! R; }1 W+ S6 a& a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 {7 R2 e1 W9 f7 z
  55. #define STATIC_SHIFT                30 Z$ i% r/ Y5 C7 E
  56. #define TCINTEN_SHIFT               20
    ; ^  z# S& r1 i) U( ]8 u+ ?  W4 g4 [
  57. #define ITCINTEN_SHIFT              21
    : T$ h4 P: Z" e# i4 \' _
  58. #define TCCHEN_SHIFT                222 K& B( h# X3 H2 n. w& L5 i
  59. #define ITCCHEN_SHIFT               23
    2 a( E! [2 ]" e8 R0 b- S% ^

  60. 0 d9 ~/ u% V7 C! O9 R
  61. static volatile int irqraised1 = 0;
    1 F# l% q) q5 B9 m8 b
  62. static volatile int irqraised2 = 0;. [) w9 \. P/ M$ m+ ?
  63. ! N8 m, H5 c' ?4 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & B% w! }2 R- S& m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      R) }% I% e$ Y3 z* }* \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' K  P5 p8 H" z
  67. ! ~2 W+ b2 t& y, s4 S5 D5 G9 v- s
  68. dma_addr_t dmaphyssrc1 = 0;
    " R# i+ x; a1 j
  69. dma_addr_t dmaphyssrc2 = 0;5 Y) ^5 Q5 Z7 G' i5 G6 p7 u
  70. dma_addr_t dmaphysdest1 = 0;
    + Z( P5 {5 F: G2 P" M7 r; f
  71. dma_addr_t dmaphysdest2 = 0;
    , ?4 }3 P- {5 @  r5 t+ {& {! p4 j

  72. ) z6 u+ t* I1 h7 }4 T; _
  73. char *dmabufsrc1 = NULL;
    / r1 b6 N: l& G! ~8 K8 `5 `+ K
  74. char *dmabufsrc2 = NULL;/ D5 r; v* u6 o" s2 E/ f5 N$ f, {
  75. char *dmabufdest1 = NULL;
    0 ^  t$ b9 h* x5 S$ Q' E  ^
  76. char *dmabufdest2 = NULL;& ~5 k$ e' w- Y

  77. 9 ?$ j/ w+ O0 j8 E( j, b
  78. static int acnt = 512;
    . e( A$ @0 Z, O( T9 V
  79. static int bcnt = 8;& H4 [: t! T1 u: j4 f* H
  80. static int ccnt = 8;
    8 d' M& R; |/ `4 Q$ i  `

  81. 7 h  B6 |: {+ M  z- F6 E
  82. module_param(acnt, int, S_IRUGO);' h3 w* ?6 Q( p" ^. c
  83. module_param(bcnt, int, S_IRUGO);6 \; ]# |: |( D  ^  ~! a$ X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! G& J# p& r8 f/ p9 R6 y% r7 ^/ Z
5 [% w5 V& ~; M1 ?9 {" q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) u3 }7 w" T6 W' c8 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. ^6 b9 G% X: O' t& o' \: I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 G- E5 j. Z3 g% D6 U, w- m4 h
* w8 x! Y  {+ f3 U( S' A0 M3 k

7 s4 o4 X+ H( q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 16:03 , Processed in 0.039343 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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