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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: f% r  k) m7 j8 v% W/ c
  1. [code]EDMA sample test application, R  [! d; ^8 k5 v( t' k/ r7 Z
  2. /*! ?; p- f  C& M4 o
  3. * edma_test.c
    ; W* J6 e) w( O5 P
  4. *: _) H& P% d. \# T
  5. * brief  EDMA3 Test Application# O* E, f* Y4 `
  6. *1 Y/ F  \# _  n: F. u# U, M  _
  7. *   This file contains EDMA3 Test code.
    , {4 Y9 q0 {) ^
  8. *
    3 `# g( c. \6 P- O1 p: E; b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " A0 g4 s5 }3 k2 K6 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 T+ \- b4 Y/ _1 o/ [1 U
  11. *         TO CHANGE./ ?2 B0 ]# ?: @' \
  12. *1 I" z7 D; `2 D% j% @) w1 u8 c$ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 b6 ^4 w  Z' p" P
  14. *. _5 B# A4 p. m
  15. * This program is free software; you can redistribute it and/or
    / ]3 c  s  n9 ^9 p5 ]7 C2 K
  16. * modify it under the terms of the GNU General Public License as, I) n# ~3 J: \9 g' r. F9 V) G
  17. * published by the Free Software Foundation version 2.
    0 j6 D# O& y, G2 i" j
  18. *" d  Z0 i# _3 |* F# |& V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : y; @! B  T9 p2 G! L/ w( |
  20. * kind, whether express or implied; without even the implied warranty
    . Z8 ^" Q; H1 `) L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & x& F* B' e3 p+ ^1 v8 T( r) ~
  22. * GNU General Public License for more details.
    / n+ T4 M, m+ A" _! p
  23. */8 t+ H+ K8 A" p# B
  24. ; {5 r" N% ~3 `8 Z' c- P) ]
  25. #include <linux/module.h>
    . V. V& o1 h' ?- n# a) `
  26. #include <linux/init.h>& H, ^. F* p) V0 T$ n8 O- i
  27. #include <linux/errno.h>) f0 T0 a) Q7 T1 X3 A4 _& p; y
  28. #include <linux/types.h>
    7 t9 {! `8 }) U, h' p% j: Z$ V
  29. #include <linux/interrupt.h>, \: a; J% e& [! a
  30. #include <asm/io.h>
    - j! e9 f1 e; r- g/ |
  31. #include <linux/moduleparam.h>
    - I! a- v4 }- l! n8 y
  32. #include <linux/sysctl.h>2 s; p! Q  |) l% @* _( x4 w2 {
  33. #include <linux/mm.h>
    3 k; \( N" \% r; o% H, O1 O3 _
  34. #include <linux/dma-mapping.h>. U! ~7 i$ c  ?6 N4 n( f

  35. : O2 D7 e4 Z$ f8 U7 v2 m4 p
  36. #include <mach/memory.h>
    * H% o. T( |6 s- h, M* t, U% a2 [
  37. #include <mach/hardware.h>
    4 n: q( J) [8 ^+ \9 `
  38. #include <mach/irqs.h>' y" N: b' b8 O. Y
  39. #include <asm/hardware/edma.h>/ y* @  \+ n, L4 E- V% `

  40. 3 P9 u; n! S" [9 A2 ^0 V( L) P
  41. #undef EDMA3_DEBUG
    ; O1 N9 Y% V5 \* I8 N) K+ ]- b
  42. /*#define EDMA3_DEBUG*/
    / }! O9 I7 ~4 h5 m- d: \
  43. 9 w# X6 z: H; z6 X+ a5 R6 _. u3 @- z
  44. #ifdef EDMA3_DEBUG
    7 c) R5 a& P0 o. g4 S. S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 [+ k: U6 o# y1 f0 q* [% G, |: h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ t: i0 ]( [4 K; T/ \" r0 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* \- ?! o- x( x4 C7 w6 W0 d5 m
  48. #else# w& X0 ^) G4 e) B
  49. #define DMA_PRINTK( x... )
    & O: f8 o' `; X$ G& r0 _
  50. #define DMA_FN_IN
    % u/ g( l' J8 o" n& a
  51. #define DMA_FN_OUT
    2 {* F6 Y1 _: J. K- F& t% s
  52. #endif
    9 r7 q, n. ?6 a' V7 Q; ?
  53. 8 `# B5 N. U4 ?$ F$ q% ?! ?1 e! y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . d! K2 x8 P% O6 m3 l: v, Q
  55. #define STATIC_SHIFT                3
    + \7 X, A1 X1 I  J
  56. #define TCINTEN_SHIFT               20
    ' L3 m9 o0 O5 O7 L. _3 K( G8 v2 H4 z
  57. #define ITCINTEN_SHIFT              21
    1 H4 [( m9 u* ^+ e
  58. #define TCCHEN_SHIFT                22
    % A6 T) `. Z: z4 h' v# U
  59. #define ITCCHEN_SHIFT               23- @  i6 a( w, i1 }+ x

  60. ' r: b* k8 z. k8 @. t# t
  61. static volatile int irqraised1 = 0;
    3 i% u/ M: M  F) b
  62. static volatile int irqraised2 = 0;
    " r6 H- Y: Q8 @# o' L* r$ Y

  63. 2 ]+ a: x. C& K2 D. u9 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N- i% X) C( G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O9 [8 D8 m9 T4 T1 S- e/ E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! z4 N& c) c4 O" r: F

  67. 1 ~. ]: z) P. n& a( c* O
  68. dma_addr_t dmaphyssrc1 = 0;0 \0 ~8 m/ f2 i7 x1 v* e# y3 o
  69. dma_addr_t dmaphyssrc2 = 0;4 e* \/ F9 B! Z+ _, D
  70. dma_addr_t dmaphysdest1 = 0;
    . o6 `& l; ~4 [1 {* ^, S7 G9 c
  71. dma_addr_t dmaphysdest2 = 0;
    $ V& T( |- k( W8 B* m( }/ Q

  72. / N- e9 v. t8 V7 h3 x0 s
  73. char *dmabufsrc1 = NULL;
    % i2 t, b& H2 S
  74. char *dmabufsrc2 = NULL;
    . B; f0 }$ |- T" l
  75. char *dmabufdest1 = NULL;
    ( v6 q1 m# V! K6 ~' d
  76. char *dmabufdest2 = NULL;& o* O* i$ b* T" O7 \$ G, d% u, y
  77. 0 P* U2 D3 g& g/ s6 B3 s/ h- s1 H: x
  78. static int acnt = 512;. c4 M" ~. v& Z
  79. static int bcnt = 8;
    ; u% r7 p; \9 J$ S* c' Z
  80. static int ccnt = 8;5 O* ~6 S6 O6 H1 J/ ]  q5 F3 \
  81. 8 d$ F# w  O% y6 C* _
  82. module_param(acnt, int, S_IRUGO);' g& P- O2 V) X0 G" Z1 m  j: ^
  83. module_param(bcnt, int, S_IRUGO);
    6 O: F& R8 ~8 }6 s; ~0 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 Q, T/ ~3 S( E+ ~: n6 N' |# a  |" N9 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% \* t: \" t1 B, }# u+ k' z5 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. q' s6 F9 V0 H8 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ W, Z7 S% s" h

. ?# m5 c+ [5 Z; i3 e4 H/ ?  Q& I' n/ t- I1 Y6 e4 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 00:16 , Processed in 0.039185 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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