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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ^- `* t! f# ^; D: Q" V
  1. [code]EDMA sample test application% e- S  D! C" J& E
  2. /*
    ( Y9 i# [+ t' ]6 q3 o
  3. * edma_test.c/ ^* D9 r: Q- v. B; J% v
  4. *) i/ I" Q4 u7 {1 h0 U
  5. * brief  EDMA3 Test Application; Q$ x. v: F' N$ U" |5 O4 j% l! x
  6. *
    $ D+ A/ ~8 P! k0 o
  7. *   This file contains EDMA3 Test code.
    2 a' B- `: a8 _) M/ Z' J
  8. *8 G2 T1 O& @: N5 j' R5 `7 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 Z7 D% e" U- X8 Y, O' k2 C  n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 S* \' H6 D, _8 [
  11. *         TO CHANGE.& ~7 {- m. V+ z/ b$ V7 h; z
  12. *$ t, g& V; z& h$ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 e/ M. p/ h. G! {8 X$ K: Z
  14. *
    * h5 I2 A0 Y) z% A
  15. * This program is free software; you can redistribute it and/or
    , E/ Z7 x3 N  P5 V$ t/ `& h3 H1 z
  16. * modify it under the terms of the GNU General Public License as
    6 z6 H* ^1 k1 ^. s* M3 A
  17. * published by the Free Software Foundation version 2.
    ! p5 r# ~7 ^) g% k! Q
  18. *8 ~; L1 n& r+ h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + ~1 d& Y- o  m+ w- b- y
  20. * kind, whether express or implied; without even the implied warranty3 a1 l5 {5 @1 a' {2 p* j1 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( Y, v3 N& ^0 L9 R0 ~, m
  22. * GNU General Public License for more details.
    8 [# \1 |0 c: @# U0 X9 k0 c
  23. */
    * P( K8 S. s0 L
  24. 1 h! M# {: a( L6 l! F
  25. #include <linux/module.h>
    & x1 m3 m7 z6 ^/ b! i) X
  26. #include <linux/init.h>8 l- h" o2 {, H; ^$ v% _$ W
  27. #include <linux/errno.h>8 [/ k7 l, @4 @$ W
  28. #include <linux/types.h>
    ! G$ J+ X4 |2 r, b
  29. #include <linux/interrupt.h>( j9 s8 R4 `7 N2 |7 O+ |, n3 E
  30. #include <asm/io.h>" N  L; H' p, Z& f4 O, V  V% D
  31. #include <linux/moduleparam.h>, c+ q! q# `" x
  32. #include <linux/sysctl.h>
    2 W1 q' A) ?- d0 X3 W+ D
  33. #include <linux/mm.h>
    * u4 n  A0 R8 z" l5 L- V
  34. #include <linux/dma-mapping.h>% d! O+ {$ l' P% K

  35. # N' ~0 V! D) b
  36. #include <mach/memory.h>
    . S) v- N7 y) o
  37. #include <mach/hardware.h>
    * O4 @' B1 K1 B! C
  38. #include <mach/irqs.h>
    ) ]* M% j& L6 p# e6 i# V, e- n
  39. #include <asm/hardware/edma.h>% z# Y2 h0 ?/ ]1 V% g" ~
  40. . X$ H' M. L" C+ T6 g3 O5 g
  41. #undef EDMA3_DEBUG
    " _# j2 I5 o* L; ?. J; M& e
  42. /*#define EDMA3_DEBUG*/' R  u( Q* G2 ]; M5 J. |( x1 G
  43. & B5 }+ @2 V" T) j: c
  44. #ifdef EDMA3_DEBUG
    5 p% Q4 ]  I' i9 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 x+ C. b0 U  z$ s4 ~) i2 Q# h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' j. ^1 {6 D+ B  ?& |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 B5 F8 K4 w5 ~
  48. #else
    . ~" P% g* V: D; y. S$ R
  49. #define DMA_PRINTK( x... )! b/ t* d! @2 v, }. \  U
  50. #define DMA_FN_IN- d. ~: ]5 H# j% ]- ]
  51. #define DMA_FN_OUT6 e% A" W; ?$ G$ }
  52. #endif
    4 x$ U  B2 g' R) E7 _4 D4 l
  53. , O3 I% n8 S; @5 b  d0 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ g8 e- T( q6 B  t) @9 k% C) y+ ]! k
  55. #define STATIC_SHIFT                30 \$ D8 t$ _4 v. a
  56. #define TCINTEN_SHIFT               20
    5 m2 O: q9 ~4 h6 N
  57. #define ITCINTEN_SHIFT              21, @/ ]( K1 f  b) D: A, {: h4 h
  58. #define TCCHEN_SHIFT                228 U9 l! b: R, X4 L6 e/ {
  59. #define ITCCHEN_SHIFT               23" a2 u1 g) X+ v5 q' t7 t
  60.   J5 S# h1 J, a2 s; Z$ ]* `. L+ H
  61. static volatile int irqraised1 = 0;
    , x3 o8 w) O% _! Z$ K
  62. static volatile int irqraised2 = 0;/ {  l+ n. h/ ]+ d/ d! X
  63. " Z) F$ l6 w# [; {' t0 g1 X/ M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & X# O+ M, t+ Z7 A6 ?4 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , F/ S( b* u5 P. q: |6 m8 }- ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, c/ t3 z6 S1 S1 Z* _8 ^+ k/ l7 X
  67. ! o1 \; U. ?$ f3 l) S( y) }1 d+ l
  68. dma_addr_t dmaphyssrc1 = 0;- p; k4 a' ?' S# Q& W
  69. dma_addr_t dmaphyssrc2 = 0;
    " j7 F: X' Q6 z- }$ ~3 j4 A, F
  70. dma_addr_t dmaphysdest1 = 0;$ x/ A* ]! h# T
  71. dma_addr_t dmaphysdest2 = 0;
    , h& A  a) Y% q4 T3 U" S. Q! ]
  72. 5 ~: z/ I3 W: \
  73. char *dmabufsrc1 = NULL;$ m# t1 v/ l% j5 z& S! ^. _5 x
  74. char *dmabufsrc2 = NULL;
    ' G4 y7 \- l" X
  75. char *dmabufdest1 = NULL;: D) Z+ Y1 s6 R! T
  76. char *dmabufdest2 = NULL;+ w9 U7 T: @  o* w5 ]. O1 G  L
  77. - ]+ f6 D9 s- Z: g! h& `7 a2 T/ L
  78. static int acnt = 512;
    5 E% o7 a. P  r4 S
  79. static int bcnt = 8;2 B) G8 q8 |  b3 ]4 `5 ~8 x
  80. static int ccnt = 8;
    6 e  Q/ z! a% \, c/ A+ i
  81.   R7 B& w% p: Y! a, U; ~8 |) ]  Z9 I
  82. module_param(acnt, int, S_IRUGO);
    ! e( U/ i' `1 z0 x! ^& }$ H! N
  83. module_param(bcnt, int, S_IRUGO);
    - A3 ?+ k; L6 x& ~7 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( Z# g. `' g% ?5 b' s
6 l7 h6 i; ^/ N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; }. i! ]! K* ?- ?! D* {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& V% ^: p+ h% Z. r- Y6 |% u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T, L8 f# C" [" i1 h# D, H: v* `( I4 ^; g
* i& Z9 ^2 ^; {8 e$ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 19:57 , Processed in 0.054534 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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