OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 M+ \& }# v# T) G0 u
  1. [code]EDMA sample test application
    " ~) Q8 C, W2 `
  2. /*
    * O4 |/ U( y/ H
  3. * edma_test.c
    & v# [. z% h' O% Y: A( _- i( W
  4. *
    1 c6 P2 ^# m  D7 P# ^- E
  5. * brief  EDMA3 Test Application
    $ R7 G' Y4 a: Q4 Q, k1 S  W4 R) A6 K
  6. *# g# \) d  U! N
  7. *   This file contains EDMA3 Test code.  d* V6 f( F) v& I$ [; g6 L
  8. *
    2 A! c3 v+ K- \: b8 A% {+ L1 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ]' D* ~3 L6 w# `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 X% i- ~* p0 y) |$ K$ l
  11. *         TO CHANGE.) I; o% u+ [3 U' M
  12. *
    7 n% s& V, T( }) P( a8 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Y* y4 n9 R) i$ ^4 y; s/ h
  14. *
    ' }- x- g/ D9 L# ~" W4 D9 @0 a6 l
  15. * This program is free software; you can redistribute it and/or
    5 Q8 ?3 E! `% `+ w$ E
  16. * modify it under the terms of the GNU General Public License as. ?! `( z% u& q
  17. * published by the Free Software Foundation version 2.4 `* q" M5 }0 c( I& g  @& V; C* D
  18. *% j9 p* Q4 F* K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! W% h+ z9 }6 \& [. B
  20. * kind, whether express or implied; without even the implied warranty+ x9 O1 b; r3 ?0 p. N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ D. X9 B! ]) L0 m! }
  22. * GNU General Public License for more details.
    3 U% ^2 c8 y1 l% ]
  23. *// a6 q- t% g! y  E9 E
  24. 2 L6 P- `. l) X/ X9 @
  25. #include <linux/module.h>
    0 ^- J' I# Y9 b. U! L* g" G
  26. #include <linux/init.h>, ?$ d" K; \, K! I. o0 b
  27. #include <linux/errno.h>) ]# s* k$ f! v# o/ s2 \5 U
  28. #include <linux/types.h>6 s% ]& G; L( C
  29. #include <linux/interrupt.h>2 B" C0 N% `9 G4 J# i# `
  30. #include <asm/io.h>
    - g3 D# M6 x) |, K4 {0 n
  31. #include <linux/moduleparam.h>( j9 E" }; V' K% \2 d
  32. #include <linux/sysctl.h>
    9 B" l5 x' j1 r8 N
  33. #include <linux/mm.h>
    ; H( A0 i8 @- t+ C0 \* t! z; m3 l
  34. #include <linux/dma-mapping.h>
    0 u; S3 O: W5 i4 L; K! K

  35. " f: T1 |# `7 ]7 A: w
  36. #include <mach/memory.h>/ M+ y- _" u6 t4 h) c/ }2 c
  37. #include <mach/hardware.h>. Y7 H0 o& m- H: ]
  38. #include <mach/irqs.h>- v% a3 B% m( B4 H% M8 k8 h4 u
  39. #include <asm/hardware/edma.h>9 t* \0 N9 n! ]6 @1 j, Q
  40. 5 v& k' Z1 d5 M4 L& @# b
  41. #undef EDMA3_DEBUG8 X$ Z0 k. z- l7 |# v3 a3 V
  42. /*#define EDMA3_DEBUG*/
    # s$ N$ B4 U6 l1 s& g2 w' C
  43. % G5 ]3 h- F% d9 t
  44. #ifdef EDMA3_DEBUG) J  N7 T* f- h, S* {$ |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      A/ F. L- `9 G+ y" f7 b9 J: r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - S; Y  w0 f2 F/ |5 }( Y, H: X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , w* Y- `7 e+ i
  48. #else& M4 d( J! @, f8 ?
  49. #define DMA_PRINTK( x... )! l( p6 @' R! L
  50. #define DMA_FN_IN" T6 u7 Z; D8 a; R
  51. #define DMA_FN_OUT& B5 A6 O3 S5 o) z/ b3 d
  52. #endif! [; f% a- S& w

  53. * X- W# ~2 o: v1 K1 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) L( J" u, [1 X
  55. #define STATIC_SHIFT                38 o; s& D! t1 X: o' ]6 M: Y
  56. #define TCINTEN_SHIFT               20* s( K( G& S% b- T; r* K' C7 J" {
  57. #define ITCINTEN_SHIFT              21. d* l* F" M4 D
  58. #define TCCHEN_SHIFT                22
    8 ~; K6 s4 Y% r" j2 _$ @
  59. #define ITCCHEN_SHIFT               232 q6 l: B2 e4 o$ ^1 `
  60. ) o1 s6 Q8 \0 l" K6 w
  61. static volatile int irqraised1 = 0;
    & ^7 o( f* D( C
  62. static volatile int irqraised2 = 0;- ^& {+ y4 @2 T, ~+ y

  63. * p% ^! y  M9 w2 _# A8 G; a5 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ I0 n! m; g( n9 ?. Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , A  h7 b" z% Y8 A$ k% X" d+ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 R+ z0 Y  S4 P( }

  67. * f8 K4 v) \; H( R8 d
  68. dma_addr_t dmaphyssrc1 = 0;) p, J8 |& u3 C3 Y( p! j4 a& @
  69. dma_addr_t dmaphyssrc2 = 0;
    ' \2 `8 G, B+ a$ |+ ^3 R& p, d
  70. dma_addr_t dmaphysdest1 = 0;
    % ], z: u- m- H1 l, H
  71. dma_addr_t dmaphysdest2 = 0;
    # ^! I! J3 E$ h+ n/ G/ v$ j' B9 Z) X
  72. $ M* i& U4 t5 |9 d6 T1 r7 P5 A+ \! \
  73. char *dmabufsrc1 = NULL;* }# h8 T, }6 Z0 }
  74. char *dmabufsrc2 = NULL;; d3 ?1 _* I. o1 a  l, N; o( X
  75. char *dmabufdest1 = NULL;+ M. E% y& p! Z" u8 O# u
  76. char *dmabufdest2 = NULL;
    ' b$ e, I4 n% S% v

  77. 0 i/ p# C7 x& y# S6 c+ r8 S+ O
  78. static int acnt = 512;2 I1 n/ I' L. ?3 ~' Z
  79. static int bcnt = 8;! U6 |# K, a8 _. \/ P
  80. static int ccnt = 8;0 ^4 \8 `, H. X7 {7 |7 w2 ]. \' r
  81. 2 T# m1 k( C5 B8 G1 O5 d
  82. module_param(acnt, int, S_IRUGO);% N2 \+ B: J: C' N* ^
  83. module_param(bcnt, int, S_IRUGO);
    8 ?/ k: R) ~' X6 G4 ^' i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# ^. C  Y* j  Z1 }- |- ^& d! n" y
5 |: d9 P# h! d  m- i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ ~! ?1 C6 S4 _8 M; ?8 z
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 X, X4 s3 U6 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 J) p4 f5 q( c- g, K0 n# P
0 u1 f$ `( {$ s0 c: L

/ R* H6 X* L( q! F" ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 03:04 , Processed in 0.035862 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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