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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ R6 q( n4 B- ^
  1. [code]EDMA sample test application: ]9 ~" [0 c% O7 T5 Z+ m7 d
  2. /*! D; r/ U& t' b% e5 n, T" w
  3. * edma_test.c
    9 ^% m: f  }9 R' j
  4. *  s7 s- g& J9 a% b6 b6 I2 ?7 g% T1 \! T
  5. * brief  EDMA3 Test Application. Z, u! ?/ E  S1 g' i/ g
  6. *
    % S& s; W- `* H" U+ ?# d
  7. *   This file contains EDMA3 Test code.. x7 {* q% t8 F# j  \- V+ @
  8. *
    4 P4 R: P4 m& {# E% K  S; T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) Z' ^5 S. d! k- g/ ]3 U7 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) z( f+ O6 J  A; }3 f" I0 N5 I2 V
  11. *         TO CHANGE.
    ; N. A" S; h( E# W- a+ p
  12. *5 o9 N3 }  o  R+ @7 V  v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P2 T) [) W$ q8 q6 T" R
  14. ** g/ }3 H# L4 k/ _
  15. * This program is free software; you can redistribute it and/or5 W7 j! W$ ?! U
  16. * modify it under the terms of the GNU General Public License as
    , ^/ t+ _& ~# z- P( a7 G
  17. * published by the Free Software Foundation version 2.! ?3 D5 W6 O2 E  z
  18. *' ~; U6 L* x0 ]; i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! p5 K5 b: P* @0 d& z) j
  20. * kind, whether express or implied; without even the implied warranty
    $ v$ A8 s1 Q4 V( G. b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# x4 _, S9 [) W2 S
  22. * GNU General Public License for more details.
    ! h0 M+ c% p* c8 x! a' E
  23. */
    / b( X: u' c% L- `
  24. & h  e$ E; I! S& z
  25. #include <linux/module.h>
    3 \* s. y) a1 R& H
  26. #include <linux/init.h>
    9 W/ V4 Z% i% A, Q3 s  D
  27. #include <linux/errno.h>
    9 k, Q" p9 y8 r% r5 d5 U
  28. #include <linux/types.h>9 {& I' v% H$ Q" x. H2 Q
  29. #include <linux/interrupt.h># V* {& w# X$ {' y9 o( {
  30. #include <asm/io.h>
    # f( q" H) c: b" F# r4 f' `
  31. #include <linux/moduleparam.h>* T% N" b. R( x8 G4 A0 v
  32. #include <linux/sysctl.h>
    ; I3 k" J/ U- ?& h2 U
  33. #include <linux/mm.h>
    2 u+ m- O6 {7 R" A
  34. #include <linux/dma-mapping.h>
    8 w. Z( E1 E9 j, E; G- g; U$ z, Q

  35. 2 w& \2 W8 @+ d2 E6 B, C
  36. #include <mach/memory.h>
    - W9 R/ N) i5 E. Y
  37. #include <mach/hardware.h>
    8 k: P9 Y( `0 s5 w- ~& k5 _# x
  38. #include <mach/irqs.h>
    ! ~! O$ k8 L: p" M
  39. #include <asm/hardware/edma.h>8 N5 b$ Q6 K" p; w' K7 g' Q- ?
  40. 2 v6 ~# o7 t7 h( Z+ J
  41. #undef EDMA3_DEBUG( m! L5 G0 Z$ c+ I* r# Z9 M2 `
  42. /*#define EDMA3_DEBUG*/
    $ c/ o. Y& ~: r1 F8 P

  43. , L6 u* F4 G4 T# j3 Q
  44. #ifdef EDMA3_DEBUG# v6 _: J9 I0 J: V  R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ [+ \' ^" u* s2 |. I3 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % Z4 J9 a8 i7 d- E1 s& D7 @$ E# Z) h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 u! ], ^# O: w8 `
  48. #else  j5 `# D3 l/ m; H
  49. #define DMA_PRINTK( x... )
    5 t) v( f( O7 w  e7 v1 f' y
  50. #define DMA_FN_IN# p( f( ^+ ?3 }6 Z4 c  `8 e- I
  51. #define DMA_FN_OUT" j$ X- D/ I. I5 H3 c
  52. #endif
    6 ]2 _, M3 ~4 b. j' a/ ~3 S
  53. . ~+ G# I5 n. Y) z! B$ c6 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , z4 J9 p- _* c0 E) C
  55. #define STATIC_SHIFT                3
    # A( t8 R+ E+ _3 O
  56. #define TCINTEN_SHIFT               20
    0 _+ p, K" x8 L2 G! W' ?1 @
  57. #define ITCINTEN_SHIFT              21) ^" L, X& j, x. W8 y3 L) o: [
  58. #define TCCHEN_SHIFT                221 J# h! h! P/ T, x8 N! t; x
  59. #define ITCCHEN_SHIFT               23
    ( q  H: E) Y, k! c5 W  h

  60. . y( k, G9 E: T; K# {
  61. static volatile int irqraised1 = 0;( V' [% P( H  n6 b; B
  62. static volatile int irqraised2 = 0;
    4 {; ^! k, e8 p% R5 E+ u$ o

  63. ! v; v; g6 h# W8 P, \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! _+ a* ]; U9 p4 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . V! h5 {% Y# s2 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( y* i- W6 I9 P3 v( {% S) B
  67. + p/ p2 p2 g/ Q, S2 @
  68. dma_addr_t dmaphyssrc1 = 0;
    1 Q$ v5 q, F5 p  q
  69. dma_addr_t dmaphyssrc2 = 0;- B( e. B2 m- c2 b9 a" K0 R9 D3 p
  70. dma_addr_t dmaphysdest1 = 0;0 {4 S! C, c; [$ E
  71. dma_addr_t dmaphysdest2 = 0;7 _) p0 S# p9 j& L& l

  72. ) O% b; s, o& G0 o: S9 {9 V0 S5 s
  73. char *dmabufsrc1 = NULL;
    2 _: J! j6 r3 s) b
  74. char *dmabufsrc2 = NULL;
    : a# G$ F# A. q& M
  75. char *dmabufdest1 = NULL;& Z6 U0 R7 i4 W" u
  76. char *dmabufdest2 = NULL;# e" g% O2 m5 G

  77. ' L1 \* H) j  ]/ G4 A$ F- n
  78. static int acnt = 512;, g, B9 S5 L5 Y8 S+ T
  79. static int bcnt = 8;  K3 P( S+ r- t
  80. static int ccnt = 8;
    % O# z% x+ k" j
  81. % `0 L% E$ `5 E4 W4 g1 a
  82. module_param(acnt, int, S_IRUGO);- g7 c& B( u& r/ f6 _  t
  83. module_param(bcnt, int, S_IRUGO);
    2 Y5 p1 ?! w2 r1 Y, R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% L' f) E. E. m) Q- K! |& |" s( f6 F4 R
' \% F( X  C, I: z0 ?" c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) k& p1 ]8 L5 f0 ]+ H; e3 ~4 N- y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& F3 k( V  E; g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 g7 e9 j* J0 N$ j: X7 o& b
; r2 j; O% G3 c4 z4 I' y% l: o! A0 w2 o/ Y! a; J; g5 K4 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 16:35 , Processed in 0.038867 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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