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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 r* W, [2 Q9 J6 ?' ?
  1. [code]EDMA sample test application4 ?0 u6 B( B* M" e
  2. /*
    2 f, C1 |" E" m; U) v
  3. * edma_test.c
    / l$ {. U, O9 ?/ ^
  4. *# l2 Y1 r7 I- n7 t: M8 f
  5. * brief  EDMA3 Test Application
    1 ]9 `6 C& x4 f% l
  6. *- w" g6 R3 Q+ l) @2 U, r' Z3 j2 v" W
  7. *   This file contains EDMA3 Test code.* N1 b# U+ F: r7 ^* V( t1 `! m) J+ x
  8. *2 X/ D1 }, k  a# b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / U- J  ?8 M/ A8 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. s1 H" s- u9 h% t
  11. *         TO CHANGE.
    ' n& e+ ?$ s, ^) P! u5 w, _: _' c9 Q
  12. *
    ; f' r& d& |# q! P$ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  Y6 L& p# L- X
  14. *
    9 I- G+ c3 B8 w6 w8 `- ^% W
  15. * This program is free software; you can redistribute it and/or
      O  i% g1 ?. d! V2 O, U
  16. * modify it under the terms of the GNU General Public License as
    2 ?0 W3 u; {! Q# ^, G
  17. * published by the Free Software Foundation version 2.
    * G8 [5 U$ S3 Q
  18. *
    7 i- Y2 x! ^# c5 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 i$ p; h$ F5 u- n3 ~5 e/ p) Y
  20. * kind, whether express or implied; without even the implied warranty. n# b& \3 D) V/ V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , V$ V. Z8 e% ]- D- H, M4 p8 [
  22. * GNU General Public License for more details.
    " \& r; Q( G- f* _1 G7 D
  23. */
    " p9 Z, H" i- E

  24. 2 P, o; K0 k9 W8 h+ l( |. S& l
  25. #include <linux/module.h>. H7 J8 O, k  W5 U& R: W, i
  26. #include <linux/init.h>+ ~! X5 z' C; {( s# k+ a
  27. #include <linux/errno.h>
    6 l  M6 k- p+ M" H0 u. ~' S3 _
  28. #include <linux/types.h>
    ( |# r; y, [* D; v! a+ G
  29. #include <linux/interrupt.h>
    7 s3 S9 e4 V6 v* H) O' L) B
  30. #include <asm/io.h>' X- F3 V' `' d% q4 J: e; Q4 r
  31. #include <linux/moduleparam.h>
    , R0 A# P0 ?5 g' P2 J" ^  s% \9 O
  32. #include <linux/sysctl.h>
      [0 D3 c$ P. b; u# \7 k. G1 O) u/ v3 c
  33. #include <linux/mm.h>4 r0 x. ~, I" Z* X' _1 Q8 x- q
  34. #include <linux/dma-mapping.h>
    & o, J6 C3 |" q# k, p- A$ w0 t" f: j

  35. ) T9 P- t% X8 i
  36. #include <mach/memory.h>
    ! W8 w, Q/ b- u+ A0 D1 w7 P& @
  37. #include <mach/hardware.h>$ v# C$ h  r: V, n3 m
  38. #include <mach/irqs.h>9 u3 K: R( k3 Z+ V
  39. #include <asm/hardware/edma.h>/ y* c% ^5 W! h: c3 q

  40. - P+ L, C# l( G8 I& @
  41. #undef EDMA3_DEBUG
    6 H" P( t0 s3 ~9 |) ^1 p1 e: @
  42. /*#define EDMA3_DEBUG*/
    / J/ H0 X, Y0 e2 Z

  43. ; e) F" y& g& F# z6 F( y+ U$ M
  44. #ifdef EDMA3_DEBUG
    3 ?8 m" z$ `$ o( X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 @) t  @, ]6 L8 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# F" L- ]5 }* ?$ p, O  F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& y, H& m8 I1 T
  48. #else' F) a0 L, b9 U; u2 |" s
  49. #define DMA_PRINTK( x... )
    - \( i% s" g7 m: F+ P5 ?  ?0 n
  50. #define DMA_FN_IN
    : C3 H& F5 _$ b+ W. E$ W; ]6 R. W# b
  51. #define DMA_FN_OUT
    ! F% I- F' t( H6 g! O
  52. #endif
    9 P& u: Z- ]1 J. M& V& {+ B1 L

  53. 5 k. ~0 P8 D1 `% j# D9 w( q) x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 L# `5 r7 y: v  n
  55. #define STATIC_SHIFT                3
    : a* W% J4 [, F: O0 y+ b
  56. #define TCINTEN_SHIFT               20
    4 R2 x7 J3 X; N
  57. #define ITCINTEN_SHIFT              21' j8 b8 q! w! O1 i
  58. #define TCCHEN_SHIFT                228 E; ]! Y/ I) g! U! V! a
  59. #define ITCCHEN_SHIFT               23
    ' m* Y" f9 u* v
  60. % @& Y% }9 R; P7 Q7 V/ ]
  61. static volatile int irqraised1 = 0;2 Q8 I. \# \. K4 ^& B: a7 q
  62. static volatile int irqraised2 = 0;
    1 [# X% @' H7 W* g4 h) h8 E" y

  63. : S2 T( m& ?' j6 v4 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 u$ [' V( r0 h% ~7 [+ x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 j4 |( ^  e; J6 z4 `, T# [4 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w  l/ x) X) e2 |/ E+ ]* k; ~3 `

  67. 5 A( q3 ?$ @2 q0 a% N$ A3 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    * {3 Q- r* M9 a! c$ D
  69. dma_addr_t dmaphyssrc2 = 0;5 o8 M% m$ F% T) E! h( a
  70. dma_addr_t dmaphysdest1 = 0;
    & U+ ~9 w% R; t& x! h" |( g) i
  71. dma_addr_t dmaphysdest2 = 0;
    / [" \) u( C$ K; M: ]/ n: h
  72. % X# v, c* E- E- I6 [0 y, `2 g- W8 Z
  73. char *dmabufsrc1 = NULL;
    - H' V% p8 y& K9 \, [7 }& e
  74. char *dmabufsrc2 = NULL;2 J0 f. I% M" \/ C0 z! }& j! v- Y+ z
  75. char *dmabufdest1 = NULL;2 n) b' `- ^0 \. U) l- d% s/ i2 ~
  76. char *dmabufdest2 = NULL;
    3 `; h. H3 b, s9 G* Y. U  d
  77. ' Y7 c. d, d9 y3 i
  78. static int acnt = 512;; V, X0 I" p( X* h( E8 t  E
  79. static int bcnt = 8;
    ' D$ _' L. ?) `  C+ y0 ]  l; [
  80. static int ccnt = 8;
    6 a& w' ?- i) j1 K, d

  81. ! t; x# F( N, I
  82. module_param(acnt, int, S_IRUGO);
    ) _+ e' f2 [) G- p
  83. module_param(bcnt, int, S_IRUGO);2 L5 \5 {0 C* Z. a9 Y7 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; G2 d) S4 z5 B  ]0 k1 c& k1 n" h- `
; L: J# Z6 ^. ?) v& e1 R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, B' U0 e6 `; a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% l, l7 _. W5 k+ ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 W- X$ ], b% g, T& Z
& v( }" M" S6 B- o( A+ [9 Z
8 d! E$ p% z) A! P# G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 04:50 , Processed in 0.041523 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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