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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; n4 V/ t$ Y0 b, R! [* l
  1. [code]EDMA sample test application
    , {( w! |" `, y) l, r& b* A3 E
  2. /*
      U0 V, L$ x1 `' D
  3. * edma_test.c
    ; E+ a( x" }- I% `0 I
  4. *5 D  D6 M& y6 l# [" h2 f/ M. v
  5. * brief  EDMA3 Test Application7 k) U* _( @2 y
  6. *( E  Y/ P+ L' D5 g9 U" A6 E& R
  7. *   This file contains EDMA3 Test code.
    9 z+ h1 T3 ^. `% B1 V2 \+ Z
  8. *7 U9 n% V: e4 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' ?& K. u6 Z4 y5 A* ~( ^7 `5 d# X' t7 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : t3 j& i' Q* A' i* G/ z
  11. *         TO CHANGE.
    ! ]) I( |1 ~+ Q* ~: @) _
  12. *# L5 m! D2 M% J6 z8 y+ H) ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : z* S# x! i& Z) x& N) t/ l
  14. *
    1 S1 k; c- s1 ~$ F6 R* u8 `# A
  15. * This program is free software; you can redistribute it and/or: e& E5 S9 F! ^8 a+ w) Q5 ]7 S' {
  16. * modify it under the terms of the GNU General Public License as5 W" |& D$ l* z2 ?. X+ Z/ z( T
  17. * published by the Free Software Foundation version 2.; B1 Z! h7 D( A5 m5 W' D
  18. *
    2 p# ]( t6 ^8 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 f* o% o3 B3 P- |. @6 H
  20. * kind, whether express or implied; without even the implied warranty
    ! j9 j8 T) w9 j( H9 ~" r% g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; r. k# Z* K& N0 E6 ~
  22. * GNU General Public License for more details.2 z- V3 M+ W( H' u: l/ b, C
  23. */
    * n0 p# z# [* ^5 t/ {; `
  24. ! |! Z7 x9 y4 W/ A, w, X9 m7 }* G
  25. #include <linux/module.h>5 t4 o/ s  O7 x' h
  26. #include <linux/init.h>- c) c. h- }; q& _$ N9 U& V
  27. #include <linux/errno.h>" j1 H/ S! `; @# E( d
  28. #include <linux/types.h>: U( C: @+ J, N4 o
  29. #include <linux/interrupt.h>& d* q1 z& B5 |* {/ M# L% e4 Q
  30. #include <asm/io.h>
    1 }5 c+ g4 n) I: W  M
  31. #include <linux/moduleparam.h>
    % r5 H' e. |* h8 j! }1 a& t( q. J8 @
  32. #include <linux/sysctl.h>
    2 O& D: T2 l- s: Y
  33. #include <linux/mm.h>
    ( z% g3 `% @# ]
  34. #include <linux/dma-mapping.h>
    7 p  w% W$ a- Y! A! [

  35. ) a& k8 p+ p7 c; j4 |& _. o' n
  36. #include <mach/memory.h>
    & \1 H: A, }% z1 s- k% U5 R: q
  37. #include <mach/hardware.h>
    5 {9 Y+ r- d0 x/ o1 b: r
  38. #include <mach/irqs.h>1 ?6 C* b+ p% J+ g4 w( E
  39. #include <asm/hardware/edma.h>
    ; g0 y. y* A! E
  40. ; O- A, D+ e3 a, a: ?% t
  41. #undef EDMA3_DEBUG
    2 f: W, U) D0 j& o
  42. /*#define EDMA3_DEBUG*/  i6 ^! d  p; ], {1 Q- N  o, D
  43. * q( c- Y. H! c+ e& Y% G/ c* [
  44. #ifdef EDMA3_DEBUG
      M  s" |$ w* z4 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), B2 ?7 i4 Z7 M; Q: p" u* r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% V3 j: ^+ M9 L, E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% _6 k* R7 A- n; C+ f- i
  48. #else
    1 f3 \: z+ P2 B) L1 `
  49. #define DMA_PRINTK( x... )* Q4 U1 l9 }' V: L# U/ T
  50. #define DMA_FN_IN
    ! i; Q9 k- ^+ ^; P
  51. #define DMA_FN_OUT0 O/ W* F3 P, D9 G3 S/ A/ o( J
  52. #endif
    4 F' j( q, o3 R; R8 h' m2 g  ^0 D
  53. ' H3 l& p! _: G0 G4 e6 ?7 w) M5 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 U; H- ~" h: ~( B% B: {
  55. #define STATIC_SHIFT                35 d1 o, M* z; _; C$ _: o
  56. #define TCINTEN_SHIFT               20! l) J8 H3 `0 `  Q0 X  o. L+ q4 b
  57. #define ITCINTEN_SHIFT              21; y; S- q; @1 \( ]0 f
  58. #define TCCHEN_SHIFT                229 G( u& D9 x8 ~$ S$ Q
  59. #define ITCCHEN_SHIFT               23. g& V3 g) X6 l# E3 c
  60. 3 X4 s2 B. D$ V5 C6 G
  61. static volatile int irqraised1 = 0;; d1 f9 T$ `) g# a6 z
  62. static volatile int irqraised2 = 0;
    , ~$ l% E* [1 }2 D, I* c

  63. - ?( R) I) l7 W& k' U4 x, L& Z: ^) m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 I3 L6 A( A6 P9 q4 A6 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 M2 @6 w0 V! j; [% _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # r/ n7 e5 J. @( O1 p; `) K
  67. ) L) n( ^% j0 ~4 r) {9 V9 }8 X1 L
  68. dma_addr_t dmaphyssrc1 = 0;
    " h2 H6 _4 l: v, p# l8 y" r
  69. dma_addr_t dmaphyssrc2 = 0;
    8 Z4 H4 c# l/ h; _: q/ z
  70. dma_addr_t dmaphysdest1 = 0;
    7 s8 I/ {/ E  V2 q7 k. D% E
  71. dma_addr_t dmaphysdest2 = 0;
    & B  S# k7 Q2 o' F- k8 {

  72. ! M" `$ E6 Z2 d5 v; P
  73. char *dmabufsrc1 = NULL;  x' Q4 g$ w/ Q3 b4 \' U" E4 ^7 C
  74. char *dmabufsrc2 = NULL;: L/ R3 H. P1 q, l! r& s
  75. char *dmabufdest1 = NULL;
    $ P6 z2 {' C# `; Y( v% O
  76. char *dmabufdest2 = NULL;' P) S: j& q( Q& I- l  h0 `+ H' `) {

  77. 1 i* w8 m2 ~2 {  V. p. b
  78. static int acnt = 512;  ?! u4 f: S4 M
  79. static int bcnt = 8;7 ?8 {8 Z& P* J$ S, C0 Z! _
  80. static int ccnt = 8;' o. u0 i0 ]6 A, k: r

  81. ' f3 c( d% Q% D1 C+ L
  82. module_param(acnt, int, S_IRUGO);
    # C- P; t" ~) q' {4 \3 t7 V
  83. module_param(bcnt, int, S_IRUGO);
      q0 C' n& b+ d5 A7 `( \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 e3 l. {  L# j# s6 D2 p7 L# Y

( M2 S! T* C+ p# S- O. _. r8 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ `0 u% K: o  l1 w7 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ p% F, y0 [$ F8 I' f$ |8 G+ ?, c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% N" s# g! }0 u2 I# l% r' Z

& T8 Q( x% H' Z& Z- S! M5 @% c" f* G
$ G: u6 j( S* Z: @6 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 08:08 , Processed in 0.040440 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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