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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 d! A5 L0 }, ~  t9 W
  1. [code]EDMA sample test application
    4 N0 u3 Z9 d" l+ T
  2. /*! T& }+ J0 F' u# D. C( a& i
  3. * edma_test.c  J) V  W' v8 u0 \1 Y
  4. *) ]' n. y; q" E6 W, q( |* K- \* n5 ]
  5. * brief  EDMA3 Test Application
    " g6 |& ?  f% |# u
  6. *
    ! m  E9 |" {( q7 M: c- w* w
  7. *   This file contains EDMA3 Test code.7 K6 ?9 J7 w$ j( T$ v/ O7 w' {
  8. *
    ; d+ |. ?) Y8 Q9 G, e! g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 [( @) S" c+ g/ D- M# V9 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ |4 n0 H1 U% G* Z
  11. *         TO CHANGE., H: P& T( E, D! v& b3 a
  12. */ ]" Q6 T# @' ]. @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 _9 F6 v* o2 p) }6 s
  14. *- f) d0 @+ K% K! q+ E9 M# ?. {# O
  15. * This program is free software; you can redistribute it and/or
    ; K1 ?4 n& m& _3 P- H: X0 m4 r6 r
  16. * modify it under the terms of the GNU General Public License as
    1 J! z; V* h; N1 r' Y: D
  17. * published by the Free Software Foundation version 2.
    9 W- h0 r* ?2 {: O7 |7 x" K$ Z
  18. *
    ( P3 U, Q, ]6 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 H! E6 X3 O" V# x6 q0 O$ x
  20. * kind, whether express or implied; without even the implied warranty+ F: r% k3 F( d: @: q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * m/ o, `' B- i) \$ p
  22. * GNU General Public License for more details.
    ) i- i+ Z0 n* N
  23. */8 m( l' J6 ]' M% f( j) s! z

  24. % G1 ]. P' C) m! n. C1 L
  25. #include <linux/module.h>
    & E$ I9 g  x8 o0 t3 r
  26. #include <linux/init.h>
    ) p- X# ?3 D- P& N4 P
  27. #include <linux/errno.h>
    # W% @+ f9 r# p% }$ N
  28. #include <linux/types.h>
    6 E/ |* S$ k+ l
  29. #include <linux/interrupt.h>
    4 ?% R8 E# O  [
  30. #include <asm/io.h>
    3 S1 y  H  e$ I" z
  31. #include <linux/moduleparam.h>
    8 k9 r: t0 s# Z& b/ g% |
  32. #include <linux/sysctl.h>
    6 H$ S1 {; Z2 N, @
  33. #include <linux/mm.h>
    2 \) Z5 G- R! R1 ?0 m4 l
  34. #include <linux/dma-mapping.h>
    1 c; O; P- ^2 l+ U/ _

  35. ( K; S8 w3 X: Y& `, o  z) f; A
  36. #include <mach/memory.h>
    0 y7 m& A+ z8 S2 E0 E$ l( X
  37. #include <mach/hardware.h>
    ' f+ W3 I, w. z1 V) {! B  |
  38. #include <mach/irqs.h>
    ) H' I& k" B0 t- u
  39. #include <asm/hardware/edma.h>! ?" |9 m: m2 D! J% F
  40. ; L3 f. k6 C0 w
  41. #undef EDMA3_DEBUG) h  f2 a5 ?, L. p5 Y1 d
  42. /*#define EDMA3_DEBUG*/
    4 w8 n0 \( y# P/ v* F

  43. 2 Y6 b" @1 E, c" K1 G
  44. #ifdef EDMA3_DEBUG3 j. t1 T- Y' j, y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! j, K8 U9 g* W6 y5 L2 |/ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 ~' L& e1 p; L; }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 o% s8 `; [( @
  48. #else6 |; Z/ ^2 x% t: E+ {( f
  49. #define DMA_PRINTK( x... ). Q# e  g% {2 u! ^. F8 p
  50. #define DMA_FN_IN
    ! n7 z8 e# F$ {  v$ L& \2 y
  51. #define DMA_FN_OUT" Y' n3 `  e2 y' t5 a$ Q
  52. #endif
    ' _8 P7 e5 a6 Q! _/ D

  53. 8 I" p: U" G: s2 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 V( |2 D' \8 H6 @' {4 W
  55. #define STATIC_SHIFT                3
    8 s" Q/ s% u$ `1 J7 e' N" m
  56. #define TCINTEN_SHIFT               204 r4 I% ~. U5 S3 v, i4 U& c0 Y+ V* k
  57. #define ITCINTEN_SHIFT              21, _) {0 b+ v: q% s( P7 S4 x0 q5 X
  58. #define TCCHEN_SHIFT                22( X4 Q1 v' l7 q6 k; Z7 M
  59. #define ITCCHEN_SHIFT               23$ ]. B4 N4 v9 m  v) C  ]/ w7 a

  60. ( f) Q. I* G  ~
  61. static volatile int irqraised1 = 0;9 ^5 e2 h) V( C) ?5 I5 U! [
  62. static volatile int irqraised2 = 0;6 X8 i2 {4 L" M4 D
  63. " e5 i8 Y( v6 `  t7 N3 p# u& U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' w' }, k0 O! a" W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N! i* z9 n7 R6 f% J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * F/ \! M: m2 B0 p
  67. & u/ x- ]: u5 w: Q1 b
  68. dma_addr_t dmaphyssrc1 = 0;) l( M2 T! @! ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ) }5 n: N/ C7 H$ i
  70. dma_addr_t dmaphysdest1 = 0;  ^; g0 K+ T/ s0 w4 a: W5 w' V
  71. dma_addr_t dmaphysdest2 = 0;
    3 Q" V9 G& n2 [: j9 ]) f
  72. ' b4 z, f! o5 `4 t, t/ N
  73. char *dmabufsrc1 = NULL;
    0 s; R% [5 y' L+ f2 i1 l% e1 ]
  74. char *dmabufsrc2 = NULL;
    # h% @/ }5 V2 Y! [4 H8 p2 ^4 N
  75. char *dmabufdest1 = NULL;
    3 ]5 f1 l. f/ T/ C0 p! ]
  76. char *dmabufdest2 = NULL;
    % j5 C9 R+ c5 [- T

  77.   i/ f2 s7 Q/ {7 {' P4 Z- f: A
  78. static int acnt = 512;% V- F' s; Q# V$ ~  f
  79. static int bcnt = 8;1 ^, W  S- {- v
  80. static int ccnt = 8;
    / X$ k* L4 Z! b! e+ y* n& e

  81. . }9 F( K' H2 ~% t) W
  82. module_param(acnt, int, S_IRUGO);" d0 Z" Z" B) f. i% ^8 z
  83. module_param(bcnt, int, S_IRUGO);
    . h* p: T2 h2 j: N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- C3 X8 y- R- s8 _, V4 K% [' i2 P- j5 |* Q* }2 [- ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ?% W* o6 i- B4 @  [0 a4 I7 }3 m" J- n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) T$ f$ u5 l" B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 v5 H4 z0 ?( Z) x
; i: J' B% h7 |
, `" N& B3 m! Q  S* T7 ?* x* ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 11:21 , Processed in 0.039549 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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