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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 H9 h# k) [0 N! f2 C: ^7 o
  1. [code]EDMA sample test application
    % H! U( B3 t' B/ L; t6 B( k5 c5 l
  2. /*
    7 s# t/ ^: p& a! _/ S
  3. * edma_test.c
    - E5 X( P, C) x, _. j  d! }
  4. *
    3 P  s  a; }- g' v6 P
  5. * brief  EDMA3 Test Application" X! i" i* d8 @: D* ~. B
  6. *
    $ M. e0 Q# }4 f- D; M/ h3 ?
  7. *   This file contains EDMA3 Test code.& n# b% c4 r/ a; N4 b1 E5 M- i
  8. *6 k" [) {' g) t7 U. G) E  q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z! x5 R! W3 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: f4 O# G% _6 j/ _1 m
  11. *         TO CHANGE.
    & K) z  Q: \) x
  12. *) n$ N0 q7 @: q; u2 X. [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 a9 E% M* u: S: e" m7 Y
  14. *
    0 D, n/ @4 G9 h  U
  15. * This program is free software; you can redistribute it and/or
    * f2 h1 m9 D0 U2 ~& v
  16. * modify it under the terms of the GNU General Public License as
    / i! v4 R0 l$ P7 n5 q
  17. * published by the Free Software Foundation version 2.
    " f3 x2 O# g8 J/ Y4 T+ `' n
  18. *& f/ `5 D0 M/ f  Q* |7 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 V- c/ R! v+ a" T: c
  20. * kind, whether express or implied; without even the implied warranty
    ( B: P# p' v3 p3 \7 x3 _% `9 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' v& P6 i& p( H( u% |; `
  22. * GNU General Public License for more details.
    ! ?* s5 J# g# U4 [( E9 E$ |. t
  23. */
    ( ]6 D" H& A% F9 H$ Z" V# T$ I# V! j

  24. - _0 h4 x! z( M" O' u
  25. #include <linux/module.h>) e1 z. \( Q+ n. N2 Z
  26. #include <linux/init.h>
    ( @( `, x; H. B" Y+ S/ B
  27. #include <linux/errno.h>5 H5 @0 K0 O( T. j& a4 B
  28. #include <linux/types.h>1 _5 J4 j1 j4 r4 B" }- p% `4 ~0 O
  29. #include <linux/interrupt.h>) @  b1 K+ \7 i/ v( H
  30. #include <asm/io.h>% q; Q5 D, g% E; ]! E3 T
  31. #include <linux/moduleparam.h>
    2 W( R" Z( y0 K$ g  S, k
  32. #include <linux/sysctl.h>8 p  ^) f6 _4 b, Q% Z1 H
  33. #include <linux/mm.h>
    # V1 r+ f! N1 O! X$ c
  34. #include <linux/dma-mapping.h>! s9 J2 S! D( h9 A+ U

  35. % ]( d/ _$ V) B* B- ~' b
  36. #include <mach/memory.h>4 g# o) b) m; \, Y
  37. #include <mach/hardware.h>8 W3 r: @+ F6 z
  38. #include <mach/irqs.h>: B+ B) `; @( |1 e( |8 ~) B
  39. #include <asm/hardware/edma.h>
    * U- S# I: H) s
  40. 6 M% g5 z' u6 _: f
  41. #undef EDMA3_DEBUG' ]. V5 J2 G! K( s0 K; e/ s
  42. /*#define EDMA3_DEBUG*/
    1 T. q! {7 O1 C, F2 I4 e9 X5 k
  43. 1 i9 X! S( x8 p9 @
  44. #ifdef EDMA3_DEBUG, m/ _, t% D/ b; t8 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 c2 z5 v; H$ s1 l2 n. R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  [( l2 C, g" F  ]1 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R7 u) S! K9 u! J/ t8 \  w
  48. #else
    0 [2 W& _- D, G' X# V5 |1 ^
  49. #define DMA_PRINTK( x... )2 a1 |; l2 W2 A' Y: V
  50. #define DMA_FN_IN
    . a' t/ ?9 a; C7 E( R
  51. #define DMA_FN_OUT9 \, T& N7 Q8 V. C. Z5 |
  52. #endif8 c* l$ Y9 g$ V, L( @: l
  53. $ i1 i& O0 A: @" S+ q% q% Q0 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      w3 w/ Q7 j8 U  X" S8 N# r6 z
  55. #define STATIC_SHIFT                3
    * C( D' H6 s3 Z: A9 S
  56. #define TCINTEN_SHIFT               20
    . o6 P6 F! H6 z% ~" W: H
  57. #define ITCINTEN_SHIFT              219 M. q) m  J+ i6 X8 Z+ F
  58. #define TCCHEN_SHIFT                22) _: O3 _4 j. @3 ]( S! m6 T  p; r
  59. #define ITCCHEN_SHIFT               231 |. D* _# {8 N2 _2 r* i

  60. " U. z7 f( Q/ c% S/ l5 S
  61. static volatile int irqraised1 = 0;7 A. W) o# U; I8 h' d2 [
  62. static volatile int irqraised2 = 0;# A4 e5 z" v) `

  63. 4 q1 I" W! X9 q, T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ^" K# n; W* ~$ t7 w7 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 t: p, V4 T; Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ?5 ~5 _# t# \( j7 y  z
  67. . \3 `( D% X8 r& A" J5 p* z
  68. dma_addr_t dmaphyssrc1 = 0;2 `5 S! V! q  f: R: B
  69. dma_addr_t dmaphyssrc2 = 0;3 I1 X2 V' b1 q; O# ]
  70. dma_addr_t dmaphysdest1 = 0;
    5 ]8 i" ?1 f. b$ _2 d
  71. dma_addr_t dmaphysdest2 = 0;
    ; J# J  U  F. W
  72.   K* O6 c  c$ P' Q9 M
  73. char *dmabufsrc1 = NULL;
    7 q1 K0 \8 G! H5 L4 U: C* z+ Z
  74. char *dmabufsrc2 = NULL;
    : [0 p) z$ U. X" [; B
  75. char *dmabufdest1 = NULL;  `$ s' U- X' E3 D  j' l2 t
  76. char *dmabufdest2 = NULL;
    2 P( B2 R8 h" A
  77.   ]. A( f3 p7 k5 q6 X
  78. static int acnt = 512;
    . a0 y% @+ w  h' e
  79. static int bcnt = 8;
    8 e; [! j" Z1 m, R# P+ {/ N; h
  80. static int ccnt = 8;
    5 P) |2 l  T) p8 Y6 y9 A
  81. - A" ~0 \* _, Y9 p
  82. module_param(acnt, int, S_IRUGO);
    & ]. w( ]& C7 h( Q
  83. module_param(bcnt, int, S_IRUGO);
    - H( l/ H2 Z5 M' i: H2 P- d: j" O8 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( A9 ~! d  ^% H+ i' ]( H

! X8 x$ X5 M7 g& [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( z$ ^% A* J2 w+ v) [) carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- v- T' `$ `( V6 V; Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 b. F9 \' L. P" e$ U2 l2 [# j$ c8 c1 `# Z8 T

9 u; B5 v5 |  H% H6 A1 W  b$ ~6 U. }& F4 \0 t% |' g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 17:07 , Processed in 0.040337 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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