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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! f1 w) W" o0 o( J
  1. [code]EDMA sample test application
    3 i7 O! G  F* @5 j5 i, v4 f
  2. /*! |# c. V. R5 O: l
  3. * edma_test.c
      u4 `- _7 B7 h6 h0 Z" a
  4. *# C! a- @4 i9 v" g, v3 \
  5. * brief  EDMA3 Test Application: l5 `+ A9 F* p, Y) m: F0 M) O
  6. *
    8 f; W, i5 `0 B6 q9 W2 i, v7 t  l
  7. *   This file contains EDMA3 Test code., X8 W9 u/ w* R
  8. *
    . f6 N$ j+ S: D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" z; a# {6 y3 K# q4 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% F) j, @! ~) |3 g7 J/ k% N
  11. *         TO CHANGE.5 Z& j% o1 Y1 g2 f  t3 D# J
  12. *
    ( j1 O9 ^4 s  {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  I$ B, ~$ f5 l, A. A2 _
  14. *
    ) f* l) p2 S5 e/ B$ A) R
  15. * This program is free software; you can redistribute it and/or6 W9 U3 ]. o6 Y0 H
  16. * modify it under the terms of the GNU General Public License as
    : ~" x7 X$ ]3 l; f! I/ O8 j
  17. * published by the Free Software Foundation version 2.4 I" D) M4 m! |$ V) Y
  18. *
    ) _& d% N3 I8 V0 b& o4 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 G2 e( z8 |8 v& J" D# b
  20. * kind, whether express or implied; without even the implied warranty
    9 `& s: c: i, N& O. z+ d& ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 ~2 }  k3 x+ m- T! V
  22. * GNU General Public License for more details.
    ) S& `# i. e! x. n
  23. */
    3 [# ~5 j6 n  m2 E
  24.   [2 e6 r+ E% g6 C
  25. #include <linux/module.h>
    & [: I* a" `$ H% p
  26. #include <linux/init.h>$ |1 U; J9 f  C3 G' @. S& C# ?
  27. #include <linux/errno.h>
    ' M  |; T- G" W# A
  28. #include <linux/types.h>
    0 j4 u8 }  l) T& B
  29. #include <linux/interrupt.h>
    " g, r+ Z3 f' P. [
  30. #include <asm/io.h>1 s6 u3 Z' I7 Y$ F5 z$ B
  31. #include <linux/moduleparam.h>
    + Y/ z% Z/ X! R3 G) E. M1 @. ^
  32. #include <linux/sysctl.h>
    % a) @  w% a4 T9 m! g" m
  33. #include <linux/mm.h>
    ! P9 q5 b( v  @* o) ?
  34. #include <linux/dma-mapping.h>
    " W8 R. ?' z- K

  35. 0 |4 L) h4 }: n4 }
  36. #include <mach/memory.h>) L  l2 j+ M" Q5 C* x2 C5 X
  37. #include <mach/hardware.h>3 o" h) L7 Z! F4 h
  38. #include <mach/irqs.h>
    5 \9 K. k4 o; J: v  u3 S& m
  39. #include <asm/hardware/edma.h>2 g4 M$ b8 K) W& r2 `
  40. ( a( B8 N( V, D4 [# \4 ?
  41. #undef EDMA3_DEBUG
    6 v8 L$ X0 |% _1 t9 N/ P
  42. /*#define EDMA3_DEBUG*/
    ) ~) E; l2 a1 ^6 w4 a
  43. ! J9 e/ [0 V( `; J8 k( N
  44. #ifdef EDMA3_DEBUG& C$ x: l& K, n4 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 l  ~& J6 n$ [; W# d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ u! ?  @  k, A- g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 c) Q, w7 u5 t+ a/ S3 A$ U
  48. #else
    " S/ A! H: P1 v( s# M
  49. #define DMA_PRINTK( x... )
    # W0 o6 J/ U1 y
  50. #define DMA_FN_IN, l/ q' v4 n! R0 Y5 V
  51. #define DMA_FN_OUT4 ?+ Q) u, R; s5 X" S1 Q
  52. #endif7 ~* {$ b9 F" Y- `- k
  53. ! H. ?9 u' W7 \- b4 A' }4 n1 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# I) j% {% c9 Q. o4 B
  55. #define STATIC_SHIFT                3. n9 a7 m0 }6 E8 d
  56. #define TCINTEN_SHIFT               20
    + F, ^7 g* x. \% {. m* E; t) B5 p1 q
  57. #define ITCINTEN_SHIFT              21
    ( X5 N5 V' M  `. w* ~
  58. #define TCCHEN_SHIFT                22$ ~8 r+ r' R- M& B/ P; G
  59. #define ITCCHEN_SHIFT               238 K; d$ \2 F/ _' W
  60.   d7 L; B0 \5 y& Z2 w" O! `
  61. static volatile int irqraised1 = 0;
      ]; y0 M* y: ]  _
  62. static volatile int irqraised2 = 0;; n4 [& O& Q  Q( u( {2 h8 D

  63. ; ?: n- R1 Q1 O2 g1 H& T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {5 P) C% U, Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E$ T" f2 [  z' i( _5 Q' m4 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 X6 C# w3 \) S, t( [
  67. + Y5 z' |  i6 o8 d- t
  68. dma_addr_t dmaphyssrc1 = 0;- C1 U  Y" ~. m9 X3 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    ) j5 f! e- r! v5 z3 r8 w' ~6 W
  70. dma_addr_t dmaphysdest1 = 0;
    5 y1 c) B$ X' R$ j9 N& Z
  71. dma_addr_t dmaphysdest2 = 0;
    9 t! [8 n% J3 m5 t; ]( T; u
  72. / \7 J( z4 M3 \5 k9 m$ ~
  73. char *dmabufsrc1 = NULL;) `2 n5 d- y% ]% Q0 P
  74. char *dmabufsrc2 = NULL;0 x/ ^6 F* t, Q! t- m* G
  75. char *dmabufdest1 = NULL;$ S5 k( |/ v: Z
  76. char *dmabufdest2 = NULL;
    4 o: E9 O7 y' o- c! y3 u5 N
  77. + b# y  r( S# X8 ~. Z. r. e' @
  78. static int acnt = 512;
    5 I) E& k! X' }+ }- K
  79. static int bcnt = 8;
    0 _9 E2 g& T/ P: t- o
  80. static int ccnt = 8;
    " d  M5 ~0 h  d' _' n
  81. 7 n, c! w" L5 T* s# c
  82. module_param(acnt, int, S_IRUGO);
    ) a3 K3 b) z0 ~3 \0 X9 Y
  83. module_param(bcnt, int, S_IRUGO);
    & u3 T9 S7 |% d2 `- g! H+ |; k7 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- x2 S3 j6 l4 d6 {, \
9 K/ Y! J4 G. k* x0 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% m7 l/ d( V/ t% `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; U0 C; `) c$ Z: X  L( s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* O6 v; l2 z9 }+ V- M/ X* l+ m! E

! \" ~" @$ P8 D5 {; a4 ~8 `8 O5 W/ D; o- B8 Y3 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-8 11:19 , Processed in 0.040680 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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