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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 ?- A! k1 M7 b! B% y6 \; p" R
  1. [code]EDMA sample test application
    " {5 t0 Y( ?% x* V" c
  2. /*
    - r) O# p1 j/ E, a: t; b# n7 Q: N
  3. * edma_test.c: }  U- p. h* w. O7 }  _
  4. *
    , x. ]2 O; M- [9 I" \
  5. * brief  EDMA3 Test Application
    + X% Q2 \9 e/ x  s
  6. *! Q3 |7 A. t/ ?1 [, e
  7. *   This file contains EDMA3 Test code.
    # ^* _3 o  w' z* B# y/ ]; Y( V
  8. *+ {$ e: A$ y1 h6 w& z0 o. C) D  N3 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' p1 J: I! ^" M. ^# R( z/ t  u; E) Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 u- K0 z7 ~, B
  11. *         TO CHANGE.) Z" _0 A9 q$ G. C1 ]
  12. *$ z2 K1 _9 v* w0 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      r  f) z) U3 Z1 @& |
  14. *
    6 P2 _( ?4 j9 y, \
  15. * This program is free software; you can redistribute it and/or( T- P- _3 N& i3 {3 I
  16. * modify it under the terms of the GNU General Public License as
    ( E  g* |) C9 y( m
  17. * published by the Free Software Foundation version 2.
    ' B% H( T# a( H. |
  18. *
    8 P3 s& E  i; l' d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 Y8 e2 x6 z+ c0 r4 h9 y
  20. * kind, whether express or implied; without even the implied warranty
    $ F7 Z$ P( G) ]% u0 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 s& ]- o2 @/ H. Z5 }
  22. * GNU General Public License for more details.* I, ]& D4 Q( ~. P. Y9 e# L; t7 Q2 T
  23. */
    & t6 C# j6 A+ Q; C6 g. d4 r% M

  24. 3 N+ d8 N5 a9 v& Y1 M( M( i
  25. #include <linux/module.h>
    0 R7 v2 z0 R" I5 j: s6 z; I
  26. #include <linux/init.h>0 ~# t/ G/ G) ~8 F) V5 i
  27. #include <linux/errno.h>
    1 ?3 B) a! }: y$ X. b4 o& l5 ~
  28. #include <linux/types.h>0 r0 z" m- Q6 ]& _5 g6 w+ V) x
  29. #include <linux/interrupt.h>* {& i, E1 n2 g2 `2 `
  30. #include <asm/io.h>4 K$ S3 a: K5 f3 A; p% ^
  31. #include <linux/moduleparam.h>, [" H; }5 i1 R# U4 `' p
  32. #include <linux/sysctl.h>7 N; c; ]. e2 y7 t" M
  33. #include <linux/mm.h>' d4 M% f8 X( ~8 N3 \8 j- p
  34. #include <linux/dma-mapping.h>: n& G7 |6 ]' P: f& K% |
  35. 0 X* U) t9 [6 a/ ^
  36. #include <mach/memory.h>6 T! b/ Y# |# u# i+ H% r, }# I
  37. #include <mach/hardware.h>: y/ q, e& p) p# {
  38. #include <mach/irqs.h>
    3 H4 |- l1 Q7 P3 v' j. G. `
  39. #include <asm/hardware/edma.h>6 T( j! ]- ]! \- q+ `8 I. Z) R

  40. 0 U9 W0 _# A- o
  41. #undef EDMA3_DEBUG
    ' T+ l- K$ T! _& f: R% @
  42. /*#define EDMA3_DEBUG*/
    - q2 H& D' a( y- v  r: c7 T
  43. : N. f4 V# ~/ i9 _
  44. #ifdef EDMA3_DEBUG
    0 O' d& N+ S% b! @7 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . x9 [4 ^/ M3 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 ^! G) M$ n3 q/ u7 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). \/ O! W; G: y
  48. #else
      l8 N. H3 A) Y/ z# V4 O
  49. #define DMA_PRINTK( x... )
    1 p1 G5 I4 A! a7 H% X
  50. #define DMA_FN_IN
    ) E. x& W3 X/ q. F* E2 N8 Z4 _
  51. #define DMA_FN_OUT
    ! B( M0 T5 ]! c) t% R% y% h3 U3 ~# b
  52. #endif- E! g) t- @# z
  53. 6 `9 S$ `5 z! U& ?& O- t2 l/ g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# @1 V% ^/ {8 s
  55. #define STATIC_SHIFT                3" I& p* p, n+ l" M- g0 r: ?
  56. #define TCINTEN_SHIFT               20$ E' e5 j. [! s+ r/ S+ B
  57. #define ITCINTEN_SHIFT              21: S& Q9 T1 a. B" d6 I* Z
  58. #define TCCHEN_SHIFT                22( X2 I5 K7 g" D/ M6 S( i
  59. #define ITCCHEN_SHIFT               23/ ~) z6 I) w: g
  60. ' h9 D* T/ T1 n8 [9 `( j% A
  61. static volatile int irqraised1 = 0;$ p5 [& @8 d/ p! L- P9 }8 w
  62. static volatile int irqraised2 = 0;0 U/ i; ]1 l. {9 v; k- _7 u

  63. 3 _& \& G: B" u" U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # h' ?) A- `- _- s0 _5 u; e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 s( A3 R# a' Q" e3 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 K7 Q& l0 E1 i; j5 s. q  k+ g

  67. $ g3 r7 _3 }/ u- a
  68. dma_addr_t dmaphyssrc1 = 0;2 Q- R# r+ U8 h* W3 P( F2 \2 B" Q
  69. dma_addr_t dmaphyssrc2 = 0;; E1 C1 v! K& g  z8 z
  70. dma_addr_t dmaphysdest1 = 0;
    1 l9 _4 r6 Y) D! L& {0 B
  71. dma_addr_t dmaphysdest2 = 0;- x1 s; z0 Y( }# F$ f% f  n* I: O

  72. " a& f  o& o5 m* B4 B
  73. char *dmabufsrc1 = NULL;% R: L& n: B& O* h5 h9 V
  74. char *dmabufsrc2 = NULL;" W. d0 O! |* W, f
  75. char *dmabufdest1 = NULL;& E1 `/ m( c8 k$ E- S2 ~2 Z
  76. char *dmabufdest2 = NULL;1 R( G7 A- C  T. r. l

  77. - s' ?8 O8 {8 \( X; d
  78. static int acnt = 512;4 t! X& U7 Z9 ?) a. f$ t" G6 u. I
  79. static int bcnt = 8;$ X& S  o1 `: C! g4 Q( g5 Z1 `
  80. static int ccnt = 8;' n/ ?+ x1 r: Z; g( w
  81. % g- T  ?( g, v: r; C# a+ I
  82. module_param(acnt, int, S_IRUGO);
    ( [4 ^; r, |1 Z/ ^$ b! X
  83. module_param(bcnt, int, S_IRUGO);
    * u) @4 S2 ^3 `( v" H& e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! @# x! Q. _! T. \( @  M

" Z( c' c/ }# v! e9 c. p8 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 P' f2 o$ l) T- e, [- S- ~" B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) L( g# i, }. r5 V$ w+ F" \* d- {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* F& u- A/ H( ~
, Q" v; G6 z+ n1 \  f# z7 b& m  r9 a: R/ d' x9 ?$ o3 A$ d( i' j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 15:06 , Processed in 0.041250 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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