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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 D. S0 M7 m1 c( Q" S- [8 t
  1. [code]EDMA sample test application
    5 @. P" g9 ^1 U; ]+ Q( {3 i! l1 P- i4 D
  2. /*2 M1 f' w: x- t+ n1 `( J
  3. * edma_test.c+ p8 Q  o) f' \) V! ?$ Q; b7 e
  4. *
    ' N4 s3 I0 D  s! `" g
  5. * brief  EDMA3 Test Application
    # u' z8 l" ~6 v
  6. *
    0 F, o9 ~3 V1 R0 Q6 S
  7. *   This file contains EDMA3 Test code.* c# ]# @4 V. d$ x$ o
  8. *; c+ q  o% |/ C) U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) O& `0 A- D1 z1 _$ r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! i9 Q8 `" H% ]: K, t
  11. *         TO CHANGE.
    9 j/ }2 p8 }5 L) X- Z
  12. *
    7 M6 i6 ^; _1 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ ^6 a6 P: H  _9 u0 W
  14. *
    0 y; b) m/ L! K' g9 J
  15. * This program is free software; you can redistribute it and/or
      w4 U: v4 r& u. {" X, n
  16. * modify it under the terms of the GNU General Public License as
    , |& r) I) |0 \+ S5 r
  17. * published by the Free Software Foundation version 2.2 Z* z/ S- G# c8 ^6 k8 d6 m
  18. *
    # H; S+ X4 d. t, Z$ R% J( q# I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 _" y/ \$ c, P; k* @& Q
  20. * kind, whether express or implied; without even the implied warranty
    . b) k  o* C* ?8 q7 o8 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 U% d' j6 s4 n& c2 m4 U; {
  22. * GNU General Public License for more details.
    3 b8 M6 F; K  s* w! i& R3 I0 N
  23. */
    6 O: K8 a! Y# X3 [6 }9 f; S

  24. . A/ t. ?& K/ C
  25. #include <linux/module.h>
    * `, Q1 c) C: W5 @7 E
  26. #include <linux/init.h>
    2 t, m% d, H( C1 P5 x& B+ `! e
  27. #include <linux/errno.h>
    ) U. l- Z0 o, ^; ?) m: q
  28. #include <linux/types.h>
    7 e  c7 A  M; Z& `4 l
  29. #include <linux/interrupt.h>
    3 \# J4 e  K# S3 ?" O1 k5 W1 [
  30. #include <asm/io.h>- u% D5 @' E0 k% I! B# I
  31. #include <linux/moduleparam.h>; z( b9 S4 I+ `" V" Z) G5 s% o
  32. #include <linux/sysctl.h>9 y6 {; F; q( h  |' y
  33. #include <linux/mm.h>! T( V( U1 l/ @- P: C
  34. #include <linux/dma-mapping.h>
    2 K$ D: I9 C) ?# l" k8 S3 m

  35. ; O# Z: h4 h  q0 K/ F- T  d" ^
  36. #include <mach/memory.h>( K8 M1 U0 R% }  F1 Y- t
  37. #include <mach/hardware.h>" S' F( l* F/ F* t& j5 k
  38. #include <mach/irqs.h>
    . C5 Y3 G  I' }# W( W+ t
  39. #include <asm/hardware/edma.h>
    . m, a  n3 P! A, r, m3 `" B

  40. ; G; K! \* Q2 W. D
  41. #undef EDMA3_DEBUG( a7 D+ Q7 L7 o: k
  42. /*#define EDMA3_DEBUG*/
    ( m( q. I) u1 \2 g! n( e
  43. * G6 n. T3 P" E. H
  44. #ifdef EDMA3_DEBUG; U1 j9 d+ B8 S6 l/ _4 ^6 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ p' Q% i# n) U, m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  E% U; L  |4 W+ v- v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& {: P& d" _9 J
  48. #else
    $ J% c8 e! e  X' S2 h
  49. #define DMA_PRINTK( x... )
    ! X7 w" `% r8 {8 `$ m- R" x
  50. #define DMA_FN_IN5 ?/ W. {8 R6 G/ c" s0 f
  51. #define DMA_FN_OUT0 f3 g& ?- L6 E. v, `
  52. #endif7 I2 Z+ l5 X8 f4 f; p' z* I

  53. - Z& u" _5 v, t6 f4 ?0 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . W& ?- c9 W5 ]! X+ f1 \
  55. #define STATIC_SHIFT                3
    , p" p2 z6 \+ D( |% s% N8 X7 b. }) |: {
  56. #define TCINTEN_SHIFT               20
    2 B7 P0 t9 B; b% h/ g6 S. o
  57. #define ITCINTEN_SHIFT              218 c+ C* c" b  a
  58. #define TCCHEN_SHIFT                22( [! Y+ U3 c; s- z
  59. #define ITCCHEN_SHIFT               23
    ! G! P( Y* \7 w3 E
  60. 0 J. Z$ G: d! f0 s
  61. static volatile int irqraised1 = 0;( w  X7 `+ U8 L3 |' h8 e; V6 T5 i$ H
  62. static volatile int irqraised2 = 0;; O7 W$ k9 w; y/ J- K! x) m

  63. 6 g1 E" ]- r, y7 Q5 y6 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ d0 `" F7 w, }8 _3 x3 I( \% ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : O3 t- m9 V1 X3 b0 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 }) Q5 `+ f4 Y# x# o
  67. - c8 n7 d5 P( s
  68. dma_addr_t dmaphyssrc1 = 0;
    ( ]$ ]# c" w* u; I$ K! f
  69. dma_addr_t dmaphyssrc2 = 0;
    1 S2 t" v$ F' s+ E3 l! F( t
  70. dma_addr_t dmaphysdest1 = 0;3 l4 H: ~5 x/ ]3 \
  71. dma_addr_t dmaphysdest2 = 0;- z# H* s) L/ T  `- M4 t+ ^  r1 B4 p

  72. # ]6 k2 }8 [. B* r; E( x4 l4 b' m
  73. char *dmabufsrc1 = NULL;+ }6 y0 s$ C- f% d2 i4 ]
  74. char *dmabufsrc2 = NULL;) y9 a* ?* @: _" R
  75. char *dmabufdest1 = NULL;/ Y2 R& @' T) a. @3 U
  76. char *dmabufdest2 = NULL;
    " U0 J0 \" `+ Z( S2 _) v7 g# n

  77. 0 X3 R( T  K5 Y! v3 A
  78. static int acnt = 512;- A0 h/ f! h3 _  Q0 s: m9 @
  79. static int bcnt = 8;* U6 q# {- P+ a1 W6 f
  80. static int ccnt = 8;3 I7 F2 Y" ]: S
  81. . l. P6 a1 S% b- X3 l4 ^. q1 u
  82. module_param(acnt, int, S_IRUGO);5 C( l* [  G2 {5 e8 t& |
  83. module_param(bcnt, int, S_IRUGO);# }& E2 ?- v; s  A5 M5 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! N6 E' F( G* Y; y, s. a/ W8 [8 X: a2 \9 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& {, d! z# ?( l, m8 z: e* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 |+ j/ u) \2 ^! Z$ O& y  ^; m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ?: ~/ O, W; k, \6 H
8 `! Y7 @( A- i3 K, c5 e0 \& y- o2 A9 S8 P, e2 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-1 18:02 , Processed in 0.039678 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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