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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : n6 n% A  e- [7 o
  1. [code]EDMA sample test application  S' ]( I) _3 ], S; X+ R
  2. /*# t# Y" r& |0 J0 ?3 [$ }! M9 ~: C
  3. * edma_test.c& _9 C  k; p. B4 ?  Q) l
  4. *& C: v: g/ s# d: T
  5. * brief  EDMA3 Test Application
    & }4 F7 m- V* U7 a8 b) o
  6. *
    ( G& L2 R; A) M2 A( ~3 V+ ^( o) T. v
  7. *   This file contains EDMA3 Test code.6 M9 p+ j) ]( T
  8. *
    ! E9 m0 d) W8 [2 Q; Y1 P+ M1 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 P& J. k) L# ]' {* ]6 `, I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 P6 E& W0 P  e
  11. *         TO CHANGE.2 j! p* a$ k$ N) E7 w
  12. *
    . P* s. M+ B. R, k% K/ l: p) _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! x; Q0 _: h% [* `, ]) G4 K
  14. *
    * b+ }, J: D5 \3 D' E7 c. H: M2 A) X' J
  15. * This program is free software; you can redistribute it and/or, F0 T+ A( c) \
  16. * modify it under the terms of the GNU General Public License as4 V: D# Y2 t; ]  [; L
  17. * published by the Free Software Foundation version 2.
    $ d  X& k, ^9 r; \
  18. */ c4 I7 H, [8 y  Q3 i; o$ ^' L; {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) B: c) t/ |6 _. z% e: @
  20. * kind, whether express or implied; without even the implied warranty4 m/ g7 X2 Q% x- n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 @! g6 X) s4 e9 I, w! t$ U
  22. * GNU General Public License for more details.1 A" G/ X. Y" w
  23. */% k4 t0 x, `1 ?9 s

  24. $ v/ T; v' \+ L& p2 Z8 k2 `
  25. #include <linux/module.h>
    2 D2 D& P3 S" t
  26. #include <linux/init.h>
    * h  h" H/ Z6 t+ ]3 h. c
  27. #include <linux/errno.h>
    ) i7 x6 n! [- h* Y) |
  28. #include <linux/types.h>$ Q# S; T6 k9 W& R1 ]: F7 V+ B
  29. #include <linux/interrupt.h>( f5 s2 l* j1 }. Q3 Q' v" h
  30. #include <asm/io.h>$ [  K2 J* \: c- ^; C0 G% @! y
  31. #include <linux/moduleparam.h># j3 A) m* Q. V  {# K2 Y
  32. #include <linux/sysctl.h>- T/ K, @8 I, Z0 T/ H
  33. #include <linux/mm.h>
    $ ?. J  |; p4 m8 T* S5 l0 h
  34. #include <linux/dma-mapping.h>! i9 Q* ?' p, B2 t! T# C2 K

  35. ' S7 [, @9 D! o; }+ [9 r
  36. #include <mach/memory.h>
    1 f& K5 \6 X) g- u* N9 c- G
  37. #include <mach/hardware.h>
    . s! \! o# Z2 Q: p, F1 L
  38. #include <mach/irqs.h>
    ) ?& [. C$ z7 n' d" f
  39. #include <asm/hardware/edma.h>
    , T& W0 t" V: o- ]$ Q

  40. 0 V" }8 N, s. K0 A% \8 q
  41. #undef EDMA3_DEBUG
    # p. g% M( X% q6 m9 |6 w( G
  42. /*#define EDMA3_DEBUG*/
    9 [0 ?7 ?: D0 B9 V

  43. : O6 O2 t1 ?# g* W9 X; q6 y+ _
  44. #ifdef EDMA3_DEBUG
    , x( q3 ~2 W  R! G+ }' {7 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & U# z1 T* w- V8 j( |6 g* b6 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* A4 B- c* B1 N8 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) F" [8 V5 B$ w2 T' [8 F$ X
  48. #else% \5 T+ j0 g/ ~& Q" D
  49. #define DMA_PRINTK( x... )
    % S' z/ X5 J  m4 v% ~, _
  50. #define DMA_FN_IN: a/ _* T" W, F- M1 K
  51. #define DMA_FN_OUT4 ^+ u/ K: v' ^' c, ~5 |" e
  52. #endif5 {- Q: P# \% e2 f8 W5 ?

  53. 3 I8 ^+ g# v  m9 R, K# t+ I  U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 i6 ^" ~( R: E
  55. #define STATIC_SHIFT                3' K; u/ U# B4 A% F
  56. #define TCINTEN_SHIFT               20
    2 J/ P1 N# U; M: O; I
  57. #define ITCINTEN_SHIFT              21
    4 U+ n9 ?0 t/ o3 {, z. Z, ^
  58. #define TCCHEN_SHIFT                22) r0 t: s  m- R6 c
  59. #define ITCCHEN_SHIFT               23
    ) N/ M0 V! @1 S, _. W% H1 J/ w7 S. P

  60. 6 o8 v/ `; J& J! a# z& A* D9 S( G" e
  61. static volatile int irqraised1 = 0;2 s' a$ h. M6 o
  62. static volatile int irqraised2 = 0;
    : R. B" E! W! @

  63. 1 ]8 W; T2 J, O! p6 |" w# V+ L( F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) {/ T% x; P& l8 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & R; c0 J4 H3 D1 u. q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ L" h/ U+ ]8 p) e5 }% _
  67. & V& c( J, N9 W$ g* O- ?
  68. dma_addr_t dmaphyssrc1 = 0;, i. I& m: K. d7 k3 x
  69. dma_addr_t dmaphyssrc2 = 0;6 X/ I/ H% z$ H4 t+ O
  70. dma_addr_t dmaphysdest1 = 0;; v4 N: F" M; x, \: v4 K
  71. dma_addr_t dmaphysdest2 = 0;3 S' Q4 v% N3 j9 B

  72. * s: ~* @1 o/ K
  73. char *dmabufsrc1 = NULL;
    + h) ~& L6 C" o9 X- _
  74. char *dmabufsrc2 = NULL;, Z# w6 J; Z. k  A5 j( ^" H$ e
  75. char *dmabufdest1 = NULL;
    % i" P5 V* p3 `4 Z: R6 F
  76. char *dmabufdest2 = NULL;+ H6 f, U7 u( l9 a- u
  77. 1 x& Y% ^2 ]. n; a- g2 H
  78. static int acnt = 512;7 ~5 q' w7 L: @$ r) k( a5 S4 t2 S
  79. static int bcnt = 8;
    ( [, o' D  W9 n5 V* F
  80. static int ccnt = 8;
    ) m4 r1 D" C7 U) s

  81. / `3 N1 B( P$ e) B' V
  82. module_param(acnt, int, S_IRUGO);
    2 W$ {* t8 r0 [
  83. module_param(bcnt, int, S_IRUGO);
    $ O8 Z! M9 |3 Y4 }" u$ n1 P( E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; {0 ^- n8 z; T7 T0 V
% y) I, w7 s- O; ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) z3 j) O# h: {' U& }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ J: P& M1 A4 G: U6 X; v5 `$ f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 C, [/ ]4 M; I# K+ q" l5 g) K
) E& K( C/ z( r; q5 F! w

$ k3 |/ o3 H- H0 Y( ~, ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 04:45 , Processed in 0.038093 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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