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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ?3 _) s6 I3 T6 s0 H2 F2 V
  1. [code]EDMA sample test application' L# K2 L' `- x# X& e' I" e% G0 q
  2. /*
    : R* z- s: f) Q" H1 \
  3. * edma_test.c
      i( u% \# n! l. q- \9 k
  4. *
    ) X/ C' V; z  p) m2 a
  5. * brief  EDMA3 Test Application
    ' Y  E3 B% k7 ?3 m3 M3 L
  6. *% O1 m5 ?+ ]" o; N2 C
  7. *   This file contains EDMA3 Test code.8 l- l$ @  k/ q( i) D/ U( D
  8. *
    & l) R  e! q  w: P+ z' _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! P. V1 Y* _+ F# }6 v7 A- x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + r5 |+ ^7 ^; U+ I+ H' U% `
  11. *         TO CHANGE.3 L+ ]) G$ v! |, Q
  12. *
    8 O& x: B. }; p* F; g) M5 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! Z5 Q1 T( N  |- r0 I) @1 H
  14. *
    & q: j8 D* j8 P4 @) }8 M. t0 [; S
  15. * This program is free software; you can redistribute it and/or
      I: V; X2 B$ _" ?
  16. * modify it under the terms of the GNU General Public License as# y( w: {( D1 J1 ^6 n
  17. * published by the Free Software Foundation version 2.
    + W. T8 a4 b& ~. i4 Z
  18. *
    / k9 M! [. {+ A8 T( c: S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % t# b3 x. j3 t; e
  20. * kind, whether express or implied; without even the implied warranty1 H4 R/ @, ^4 P2 R/ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # d! v) q2 v3 Q: ^% m9 i  M
  22. * GNU General Public License for more details.1 K9 }8 K9 V$ A. S
  23. */
    * g1 T! Q, X' \7 d. P( k; r" h
  24. : O4 ?1 @% ?, k5 u- N
  25. #include <linux/module.h>
    / I! d' L. [+ c, N; |6 j/ M9 o
  26. #include <linux/init.h>% k1 D& }: w* W" i! ?3 q
  27. #include <linux/errno.h>
    4 N+ W6 Q5 N( n. d
  28. #include <linux/types.h>
    % F5 L) b1 V4 {! w3 H1 e
  29. #include <linux/interrupt.h>' \  {+ b6 s/ _6 H8 J& q: |
  30. #include <asm/io.h>
    * {  j/ g8 s1 j4 [6 u
  31. #include <linux/moduleparam.h>
    . e" U0 y7 h/ I7 Y7 Y; A
  32. #include <linux/sysctl.h>9 Z5 `2 A5 J3 ?; [" F6 S1 Q
  33. #include <linux/mm.h>
    5 I1 N8 f0 B0 ]& C' {
  34. #include <linux/dma-mapping.h>
    . w$ G4 w" M2 t3 I$ Y
  35. ; W: F: p% [  `0 D6 I
  36. #include <mach/memory.h>
    ; }5 u1 N1 x( Z6 M( }
  37. #include <mach/hardware.h>
    ) w2 j6 b6 y9 L- Q1 M% h# _
  38. #include <mach/irqs.h>
      B3 |- o. J. q4 b
  39. #include <asm/hardware/edma.h>
    ' j/ J( K4 _0 `- r+ R
  40. * N: t/ s' Y/ f# L9 }$ a
  41. #undef EDMA3_DEBUG
    5 M5 q- q  F% ?& p: o! _0 f
  42. /*#define EDMA3_DEBUG*/
    $ r3 T4 x/ g2 n+ i2 Q

  43. 2 n" n/ u$ L+ g) c9 x/ d/ ^3 ?7 O7 Z
  44. #ifdef EDMA3_DEBUG
    * f" ~" S" `0 z, Q1 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 ~% N5 m- W& I; v8 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 R% j" {4 I4 ^5 }2 a4 l: i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' J* @. p; c& e- Q5 X
  48. #else
    & T0 @# e( q' M. p4 N
  49. #define DMA_PRINTK( x... )
    2 s! x7 K8 s, E! Z5 W2 g; Z
  50. #define DMA_FN_IN3 f  b5 Y( V% w' {
  51. #define DMA_FN_OUT; G" ^. E% D4 q+ Z0 _$ B9 j
  52. #endif7 `. T# P( u5 d- Q7 L) H- A

  53. % s1 M0 U) A) J' C6 b/ n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 J' `7 h1 G/ ~/ f7 O
  55. #define STATIC_SHIFT                37 m- M1 P; `! x" w
  56. #define TCINTEN_SHIFT               20
    ! ]3 h" G5 t2 g% N+ h) u" a* B4 ~
  57. #define ITCINTEN_SHIFT              21: u' ~  w8 r: b8 c! p  }/ N, G
  58. #define TCCHEN_SHIFT                22  K0 X( d7 \% c# {5 H
  59. #define ITCCHEN_SHIFT               238 D6 }- V% Q" A% N/ q4 J9 }' |0 o. b
  60. 4 ?/ z) m" _3 k4 j5 w
  61. static volatile int irqraised1 = 0;; H$ e9 x! f/ D/ z7 B/ L; H
  62. static volatile int irqraised2 = 0;
    ) G' s. Q9 @. v0 W: o% E

  63. 6 m+ L; w: T" S( j. r# q# F' @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " h  e5 n, s6 G( R9 y4 @; z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! q% ^4 E! N; b: B2 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ X" J: e) G8 y2 R
  67.   l( E8 h" O" Q* V8 W$ j9 C, V  e
  68. dma_addr_t dmaphyssrc1 = 0;1 u6 }& c2 V& E, |" z% i
  69. dma_addr_t dmaphyssrc2 = 0;! E! d) Q# G9 A3 [. O
  70. dma_addr_t dmaphysdest1 = 0;" c( M  E* M0 y; I# c/ E
  71. dma_addr_t dmaphysdest2 = 0;% K$ X; z6 N: a  o' J

  72. 1 q$ M0 w4 h, u( b" p, H
  73. char *dmabufsrc1 = NULL;
    . ?# _( j2 T8 L, d$ f
  74. char *dmabufsrc2 = NULL;! n6 V6 W; t/ f# m
  75. char *dmabufdest1 = NULL;/ e3 p6 s: m, \: W' ^% z: b
  76. char *dmabufdest2 = NULL;
    $ D  H) E9 S, W8 X  r3 ]5 U0 m

  77. 9 @# p) {0 a- L9 x( o0 v4 i
  78. static int acnt = 512;
    ) r3 U3 F1 O: n: O
  79. static int bcnt = 8;) E# J) v* r  @+ D/ s
  80. static int ccnt = 8;
    4 e7 P" D* k( P
  81. 0 l" u0 H% u( x- p2 O! q
  82. module_param(acnt, int, S_IRUGO);
    & a. j* U7 i' Z8 r+ B4 R
  83. module_param(bcnt, int, S_IRUGO);
    ' g$ C2 `0 s+ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& C$ F$ _/ p" E' L: m$ z

( Q0 s7 g6 f$ l& M: M' N# s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ f6 e! ~4 c1 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 D( j+ A0 Z8 k" H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% r+ Z1 t( L1 ?( L1 p+ ?
6 `) B: d7 V8 _! d. M1 _

( x( w6 J% i+ y! J3 k* d) c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 14:42 , Processed in 0.040432 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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