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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 C& b' f" d0 D9 a9 R1 b3 G
  1. [code]EDMA sample test application) P( _- Q. x* u& @% i, h7 o* o8 `
  2. /*
    ; Z% ^% K: m. A* Q0 t5 Z
  3. * edma_test.c0 G; G2 w$ p- n% i
  4. *
    : c' a! z; ~' g2 U, h
  5. * brief  EDMA3 Test Application! \! l  T% g# T1 W* T
  6. *7 v  l/ A- r) f' N1 V
  7. *   This file contains EDMA3 Test code.
    ) D( T" H/ h/ Q; C6 [5 ~3 X( W
  8. ** u! ]1 ^3 A, @: }% A0 w* d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 d; }+ {* t- Z# `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; n% f) I0 n8 t+ x$ o
  11. *         TO CHANGE." j9 p& C2 u2 A0 k9 I8 |0 C
  12. *
    3 n6 ^" O+ W$ d6 u5 u( q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 d2 ^$ E8 ?# h' ?" q
  14. *, C, h4 T$ w7 O3 `# k" Q" o
  15. * This program is free software; you can redistribute it and/or7 P, ?, ^4 h% f. O# h  [/ j
  16. * modify it under the terms of the GNU General Public License as
    , X" r) H: p* u" s5 w2 F0 `) X
  17. * published by the Free Software Foundation version 2.
    , V! s; h# X# }8 |( q& l0 L& I7 w: t4 H
  18. */ @) p2 g; a* A. D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # H9 X; l$ ?$ G. v9 c  Q2 O2 g
  20. * kind, whether express or implied; without even the implied warranty( c/ E. m/ e9 I! E5 U7 Z$ k) r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 z- J( m: H1 ~# V, }+ U3 j
  22. * GNU General Public License for more details.
    : O$ w5 ~5 L# E
  23. */
    . d# i7 ]; m" s- |6 v2 }9 s

  24. 1 A. e5 d7 M, F7 Z) v+ y# s
  25. #include <linux/module.h>$ @; M  A. L, X5 a
  26. #include <linux/init.h>
    * @: A" x6 m1 @
  27. #include <linux/errno.h>' c4 I. o& K$ A, X! h) _' a8 T/ F( f- y
  28. #include <linux/types.h>
    7 h3 @0 W8 \! L* I$ u: ?
  29. #include <linux/interrupt.h>
    . ?) m: R0 f" M: N$ m1 G1 b6 f/ q
  30. #include <asm/io.h>6 {! W% C' e- o3 d) Y
  31. #include <linux/moduleparam.h>
    ; T; Y. K8 u# E
  32. #include <linux/sysctl.h>1 @, x( g  ?0 o! L9 s0 {8 y
  33. #include <linux/mm.h>5 v9 ]1 o0 P* @  |1 v
  34. #include <linux/dma-mapping.h>4 d" \# R; V# j9 g" x

  35. * b" [, i0 D9 i& f+ ?3 m
  36. #include <mach/memory.h>
    2 b* o4 k9 E7 {1 h
  37. #include <mach/hardware.h>
    9 R& H' U5 |3 U4 v9 b
  38. #include <mach/irqs.h>
    / k3 x9 v6 {, W, U& v
  39. #include <asm/hardware/edma.h>
    2 a7 U" a+ T6 U, |7 {+ Z
  40. + k4 O# v, l& i5 F
  41. #undef EDMA3_DEBUG5 c/ P. @, J& U" a
  42. /*#define EDMA3_DEBUG*/
    8 t- X: ]7 P0 A0 y* ^
  43. 7 o: I3 X6 i$ u8 t! |& i
  44. #ifdef EDMA3_DEBUG
      Q& W$ ~" r7 V3 v. b2 ]/ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) D% t3 |8 L5 {7 J; O/ X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 W5 I' |7 V$ ?9 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " e; x, X4 x  b. Q8 a% {
  48. #else, n/ S- @3 L5 I" K  S% T1 Q+ A8 b
  49. #define DMA_PRINTK( x... )3 O5 o" o" C: l: F5 D
  50. #define DMA_FN_IN4 f( z! C* o) V, Z
  51. #define DMA_FN_OUT( W6 n7 r3 b% a( O/ p9 P0 L
  52. #endif( i4 r* e$ J: o8 h; X5 D, _, v
  53. 5 s/ ]" ]" E# }3 X6 Q- U) H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) J+ A5 c, P" H. G/ S& t  _
  55. #define STATIC_SHIFT                3
    : J. b% p6 V3 ~$ ]) u" T9 t
  56. #define TCINTEN_SHIFT               20
    5 w2 w0 D- W( i+ K' D* n; ]/ M
  57. #define ITCINTEN_SHIFT              21/ f; Q6 A" S6 ?! S
  58. #define TCCHEN_SHIFT                22
    " _. d' v& G2 A! x' E% r- n
  59. #define ITCCHEN_SHIFT               23
    + A$ N% Z% L9 V: k
  60. 3 s3 {  J8 ?$ X! y* E* X
  61. static volatile int irqraised1 = 0;
    * H# N/ l& l; ]- F! Q4 I0 _
  62. static volatile int irqraised2 = 0;6 u4 M' l; }! l! `' C' Y0 ?! H
  63. # ^5 W" B' g6 i1 K  U  h" {  Y+ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! I$ ~  ^( {2 @( G9 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ I1 D. B/ M5 ^! W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) F9 L- J/ p2 r( i7 z' ~

  67. 6 U; c, c$ p' e/ i  |! P0 n
  68. dma_addr_t dmaphyssrc1 = 0;7 R5 }9 ]- W7 R1 h5 v
  69. dma_addr_t dmaphyssrc2 = 0;2 H9 t' v" n  w( B5 H# D
  70. dma_addr_t dmaphysdest1 = 0;' x2 i& L% V# R  ~9 F4 r
  71. dma_addr_t dmaphysdest2 = 0;/ u+ ]8 R  {# @, {/ L7 P" C% ^# r  r

  72. + g- X6 r  n2 q4 G, q  ?
  73. char *dmabufsrc1 = NULL;
    : o+ Z! E) M7 C9 n% V
  74. char *dmabufsrc2 = NULL;
    7 {7 `; s$ [$ l* ]
  75. char *dmabufdest1 = NULL;/ N% s5 J! V/ R5 V! A
  76. char *dmabufdest2 = NULL;1 u! a: t: H( s1 N& J( S$ _; I

  77. ( t& }$ c1 u  Q9 k
  78. static int acnt = 512;
    : u4 }' R( `; ]+ L( S7 T0 H
  79. static int bcnt = 8;
    7 Q; X0 @4 g8 w7 i+ H* Y9 g
  80. static int ccnt = 8;
    " G0 o9 n/ |) e
  81. 1 m/ E. g! u  _: G! L! C
  82. module_param(acnt, int, S_IRUGO);* E1 \: D) c/ Z0 a- t% O1 k. T
  83. module_param(bcnt, int, S_IRUGO);0 D5 U8 R% t2 x6 F9 ^( s% y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' I' H8 U' Y8 f& q' g' M* o% \* q, S

- z. P& I$ b! k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ]5 i1 |2 i/ p% g( f. j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 K+ P: f0 s# Q; l+ [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% [$ M6 A" \0 y/ g

. \: s8 ~5 z, q: ]' y* e4 Q5 b% i2 @; b: N, m! a, X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 20:15 , Processed in 0.044824 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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