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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + z4 R7 o% g9 E& G1 ^
  1. [code]EDMA sample test application
    ' O3 T7 o, {9 N
  2. /*+ f: p9 f8 N7 S' m. M6 Z
  3. * edma_test.c& `: \/ U* h) E, i9 x( y4 R
  4. *
    5 D5 C# \  q# ?$ g7 ~
  5. * brief  EDMA3 Test Application9 F4 O9 a0 l, n: }9 G2 D6 {: x
  6. *, a; {0 }3 w2 ]% o  F. R
  7. *   This file contains EDMA3 Test code.! n) l; u( `" L! |. E: e' F
  8. *4 E" K* g, T; P8 G' F4 z1 I+ g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" n8 H0 |( S. \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, X7 E* J. x/ s
  11. *         TO CHANGE.
    , R- f/ l, }% e
  12. *. f. B; d! M3 H7 z( R! I# s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( M2 _6 F' h, A
  14. *
      E2 \' ~, O4 z1 W6 |/ b0 U
  15. * This program is free software; you can redistribute it and/or
    7 ~& a  D$ f' s" ?7 i" _
  16. * modify it under the terms of the GNU General Public License as
    0 @# P8 x8 z) B# |8 r$ ~
  17. * published by the Free Software Foundation version 2.
    # v! E) A/ p. ?2 H4 ?9 N4 K! X) i
  18. */ P9 l5 ~$ w: F3 C% n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 e+ H' }2 P0 v# X
  20. * kind, whether express or implied; without even the implied warranty  U& D: W/ R# @0 t% b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- |, t: c+ u  s1 \- n
  22. * GNU General Public License for more details.
    0 E; _  B; @  S- P
  23. */" R! K( L) _4 H% g, F

  24. & |5 F3 a7 ]- \/ k
  25. #include <linux/module.h>% H. X' P1 p2 ?8 e! d% J
  26. #include <linux/init.h>
    ; @. X! V( H' P  Z6 g! I
  27. #include <linux/errno.h>3 ~: ~0 l- g) T* L- F9 M
  28. #include <linux/types.h>" ^, Q4 v! w. ?" Z
  29. #include <linux/interrupt.h>
    ! C# E4 x# r6 H. }+ T/ [
  30. #include <asm/io.h>. x1 V0 r& q% t* M% \
  31. #include <linux/moduleparam.h>
    9 n+ g8 e4 D' R3 H( ?6 B
  32. #include <linux/sysctl.h>
    6 J. V+ T; w* `# y5 {
  33. #include <linux/mm.h>0 i' M" y, F/ o* v  ~7 L
  34. #include <linux/dma-mapping.h>
    2 J, m  ]5 M7 `. ?( G$ t" @

  35. 5 l5 I* }9 ^3 z6 t3 N  K6 g
  36. #include <mach/memory.h>% X3 _6 ~: g* m! O5 c2 |
  37. #include <mach/hardware.h>" T( F, L: Z. h3 x) }8 `
  38. #include <mach/irqs.h>
    % ^' Y. s6 ]/ i) s- K
  39. #include <asm/hardware/edma.h>
    + @: h: {  L. y" f

  40. . K! k3 R5 L1 A$ h, A& d( B& \. s
  41. #undef EDMA3_DEBUG" ?) [! q; `6 S- i8 Y: s3 w
  42. /*#define EDMA3_DEBUG*/
    , L' P5 g" r/ |" E. V9 z9 K
  43. ; n' Q1 D; @0 U% N$ F7 @
  44. #ifdef EDMA3_DEBUG
    1 y' D- C8 a- ~7 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' f) B8 d0 E: V. O1 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 Q# l; a/ d1 e& U3 w4 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 W5 b3 f/ e; x7 k3 D( e, {& s" G$ h
  48. #else
    $ ]! i% _) k- m. W* @0 G  c
  49. #define DMA_PRINTK( x... )6 t' `1 k* M9 Q; N, r9 P* s% @( f
  50. #define DMA_FN_IN  q/ ~2 {" R- F- y
  51. #define DMA_FN_OUT
    ' s/ ^* m% H; O1 U7 W' \9 H: g9 M6 N
  52. #endif9 T, p* v) m1 R* d' |

  53. $ U- j' l' r; T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& B' n. g  a! b
  55. #define STATIC_SHIFT                33 R- {* O0 I' V2 l' J% [' U
  56. #define TCINTEN_SHIFT               20
    / \( Z2 L6 O" x) i0 I7 k% Y
  57. #define ITCINTEN_SHIFT              21
    2 N7 @. q, I6 ^/ Y
  58. #define TCCHEN_SHIFT                22* u5 ^# Q( ?9 u& i' P9 \
  59. #define ITCCHEN_SHIFT               23
    1 E8 S6 c" y4 M9 P
  60.   I. d7 Z) T$ r1 Z4 s
  61. static volatile int irqraised1 = 0;9 n" y$ Y; p" F& }' S
  62. static volatile int irqraised2 = 0;
    $ H. N/ s. x' [+ \" y2 s: g. e! f) |
  63. # H8 N! I. u  d" t5 c8 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( H% s: }/ P+ q! G; s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }3 d2 ^) ~! N2 Q/ E. N4 j0 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : t2 f, n, |# Q# Q! l% b! `

  67. . f) U1 i& I# Z, U& ?; i
  68. dma_addr_t dmaphyssrc1 = 0;
    ! x* p3 E( O0 h+ Z$ B# P( `
  69. dma_addr_t dmaphyssrc2 = 0;
    $ v0 }* z8 X  }& R7 Y- R5 @5 B3 l
  70. dma_addr_t dmaphysdest1 = 0;3 O: ]; e% k- c
  71. dma_addr_t dmaphysdest2 = 0;
    ! X- V0 ^6 L+ j' F6 _! k

  72. 1 F0 ?  N: F! F
  73. char *dmabufsrc1 = NULL;' L7 n& w! i3 J: h. J/ B
  74. char *dmabufsrc2 = NULL;4 A' L0 E# x% V* P9 h9 H
  75. char *dmabufdest1 = NULL;. W' C5 V: }  ^# S; o) X) {! K
  76. char *dmabufdest2 = NULL;! K* U' q' T5 y

  77. 8 j3 s! z2 [* Y# C
  78. static int acnt = 512;( L/ j8 J3 A- \1 |1 \6 \
  79. static int bcnt = 8;
    ; E5 t: ~" C9 i  i, W- k3 {  X& b
  80. static int ccnt = 8;
    * Y8 U% F4 o+ _! @- _2 O% A

  81. - P* T6 B! I) H  p* Z
  82. module_param(acnt, int, S_IRUGO);0 p/ @8 j$ Y' n4 t- u3 e2 z
  83. module_param(bcnt, int, S_IRUGO);
    5 _! p) }9 k4 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 R- V7 m7 C% l' ?# j
. s3 k9 T. r8 p6 i7 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. e& ~2 Y) R9 q) {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# O5 O$ B0 b( I# u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 I# @  p0 ?$ \* Q: C4 m& P: y/ q3 a! j! w0 j

5 F! d9 d9 m# `- a$ i4 F& ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 19:04 , Processed in 0.038985 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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