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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  {3 x) V; W4 ]6 M- c8 y" C% B& M
  1. [code]EDMA sample test application1 [: @2 L% k7 X7 A, N
  2. /*
    5 P$ ^9 I) e( J9 \" J$ b; }2 ?# ~
  3. * edma_test.c
    2 o' f, Y( h$ J2 A9 y
  4. *8 b2 d; _' r" ^* U
  5. * brief  EDMA3 Test Application0 F2 I! A3 D  w7 |) D
  6. *+ P2 x) D9 e0 H8 e- v: n7 S
  7. *   This file contains EDMA3 Test code.
    0 f$ s. B( O4 S0 ?/ z: E# N
  8. *" o. G1 o$ O) e1 y, f% D) A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. H2 g1 U( v# P& j; X  y% D5 o0 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 h( P# D$ [$ s: f2 @! T" I( u3 g
  11. *         TO CHANGE.' Z! m. L8 p" U* e2 L
  12. *
    6 x2 f+ c1 T& }5 L! Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * O7 z$ j: r$ v& f. c3 o
  14. *
    - e9 J/ ^: v% `( A3 m6 i! x
  15. * This program is free software; you can redistribute it and/or
    0 U/ O2 X( D! X" l* n/ _7 M4 P# e
  16. * modify it under the terms of the GNU General Public License as
      J1 q+ ?; s& J" d
  17. * published by the Free Software Foundation version 2.% ^. w6 f! C) L% h+ _9 y/ f
  18. *  v% r5 C2 n3 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % W5 @# J6 i$ ~0 Y7 D9 ]
  20. * kind, whether express or implied; without even the implied warranty% u8 B6 k( S$ x/ e2 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 L! ]+ E% ~: k: I( M6 K
  22. * GNU General Public License for more details.
      b+ ?& [% t5 G  V' U# Q0 H8 |
  23. */
    . i+ A8 i: f+ O. r4 H; E7 }

  24. 1 s) v7 o$ q( f8 o* w
  25. #include <linux/module.h>
    0 t( U, o0 t5 l! q1 d! y+ u& Z
  26. #include <linux/init.h>' D, @  ~; a  n' y8 l
  27. #include <linux/errno.h>" l* Q+ y: I/ b
  28. #include <linux/types.h>, [- q- D. R7 `$ e6 @
  29. #include <linux/interrupt.h>" k1 u$ M4 b2 P! F2 K" U
  30. #include <asm/io.h>
    9 T0 G+ R% f- {  c* D
  31. #include <linux/moduleparam.h>
    6 b# F# T6 ~6 _/ R
  32. #include <linux/sysctl.h>
      |0 X; K. s, B/ \% @* a: d
  33. #include <linux/mm.h>% F9 H3 C$ u, v) Q/ K
  34. #include <linux/dma-mapping.h>
    * W4 X9 \0 l: W
  35. 5 Z2 d. L$ V$ D7 q) K. @3 h
  36. #include <mach/memory.h>
    7 q! X! z" y8 q6 u1 K; d
  37. #include <mach/hardware.h>
    * N  ^6 g- E  p/ p3 F9 G) `7 T
  38. #include <mach/irqs.h>8 I. u! s% A) ]7 }& z
  39. #include <asm/hardware/edma.h>) w, M) E# X# Y* d1 w

  40. , y$ j$ p/ N7 ^- \6 x6 K
  41. #undef EDMA3_DEBUG. ]: Z1 l( a& A& [
  42. /*#define EDMA3_DEBUG*/# W% ^( J; G% o# Y: i0 Z

  43. ) y+ b; d5 z: T/ l9 w* W: [1 |6 k
  44. #ifdef EDMA3_DEBUG
    ) k/ @$ {4 b5 I) U' `" P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Y2 ~& @7 W. ~  Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  v0 K% M: N! Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& _9 h. C4 {  d9 c7 g  |7 i) y
  48. #else
    2 o/ ]$ t* e" f' C5 }
  49. #define DMA_PRINTK( x... )
    " c4 `% `5 }7 K6 U9 B; N
  50. #define DMA_FN_IN
    , _/ p" w0 I  R( K$ F) Z
  51. #define DMA_FN_OUT, _9 h8 q0 s! i7 J9 |( a" f; ^
  52. #endif# a: `. D6 j& y/ q

  53. ! E8 K2 w9 [( [) `/ M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " A0 F- J# b# c! @) f$ S2 O
  55. #define STATIC_SHIFT                3  M  r* l! E9 n, a
  56. #define TCINTEN_SHIFT               201 F# x8 ~4 g; Z0 K( U; Q
  57. #define ITCINTEN_SHIFT              21/ v6 E- p$ B' ~; P4 o
  58. #define TCCHEN_SHIFT                220 ^. C8 I9 G4 q1 r1 U7 n' W! o; }
  59. #define ITCCHEN_SHIFT               23
    ! x% t' h; B  x/ s. n
  60. 0 j. S8 i* |2 ~4 J! G4 K! S) Z
  61. static volatile int irqraised1 = 0;
    . ~* A+ z+ a0 ~" b6 |+ h
  62. static volatile int irqraised2 = 0;
      |( V4 q: `9 Z8 H3 o# j" ^
  63. " t$ N" V$ g" K9 e& _+ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # G: P7 P# {9 i5 i9 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L* e; I" t& A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " n2 v1 ?+ R  L) Y

  67. : Y: n4 c# }& k
  68. dma_addr_t dmaphyssrc1 = 0;$ h' v/ c3 C7 Q9 W' n- k" |; y
  69. dma_addr_t dmaphyssrc2 = 0;' W" M( t- c6 [, ]& c/ d
  70. dma_addr_t dmaphysdest1 = 0;
    & o# Y+ E5 `8 ?* p' q0 e" c
  71. dma_addr_t dmaphysdest2 = 0;
    ! q, N2 {0 g1 \" V* z
  72. ) d  K& |: v2 \# r2 G. N
  73. char *dmabufsrc1 = NULL;1 z4 N: m( j3 c( t7 M3 V
  74. char *dmabufsrc2 = NULL;
      d: c; o, ]5 k9 ]/ J* N3 ^/ G
  75. char *dmabufdest1 = NULL;; K" O! z0 I) L0 \# C) J
  76. char *dmabufdest2 = NULL;! A/ T8 \4 e( d  k; u
  77. - f1 {& I" o5 O& t4 x" ]4 b
  78. static int acnt = 512;- l2 D' f- m; V2 g! p* R6 H1 X. ^) a
  79. static int bcnt = 8;& E9 f2 W/ S/ |7 ~. w" s
  80. static int ccnt = 8;
    0 o5 P  S( Z8 i: s5 K/ d
  81. % T, w; K3 E' @& k0 J5 G
  82. module_param(acnt, int, S_IRUGO);( Y; w. q: i- K1 B  P6 w
  83. module_param(bcnt, int, S_IRUGO);6 X2 |) I8 w/ E# V0 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! i- g3 I( n8 @4 @, s" f; s7 P. d4 S2 r# v& V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- M# ?% I! ~+ c: r- D$ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 i9 E' j7 {" b2 O7 K5 q8 K! E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ]) C5 p7 B  g: `: i( S% K

, z$ ?. v' B; E- q7 m  c! z* l0 c  ~8 g6 H: a( g* u7 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 11:21 , Processed in 0.038874 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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