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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 @, w% y- n: M* q2 S
  1. [code]EDMA sample test application
    8 N$ n  e! c. U5 _. l
  2. /*
    0 J6 J9 p" w% w+ |$ S
  3. * edma_test.c- h& V1 ?( z' b8 p& J9 }+ z
  4. *- Z: |: l, `( M( j
  5. * brief  EDMA3 Test Application+ v8 @0 w6 O4 ?/ ]9 u2 F
  6. *$ K' e/ K  l8 j' n
  7. *   This file contains EDMA3 Test code.
    ; f1 j$ o5 c- l( x8 ~& V% x9 d
  8. *7 u! f  l6 ?# r" ?4 R4 h1 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 _1 |1 G0 |9 f# m; D$ R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , _8 l) ]% w- L) a% R/ {6 a
  11. *         TO CHANGE.% V( V1 b3 W( ?8 ]  r
  12. *
    + k3 s+ I% Y; D6 \( U9 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + _5 ?) A7 B3 v
  14. ** [* @9 E+ v1 [4 w# W0 A
  15. * This program is free software; you can redistribute it and/or+ v. V1 f# n9 C5 A
  16. * modify it under the terms of the GNU General Public License as
    ( _5 k, B$ l( j4 d& M% u/ e
  17. * published by the Free Software Foundation version 2.! ]1 G- \3 s8 J, e3 R0 N# X
  18. *$ y* ]; D( a( G& L* H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / V) T- L4 @7 O
  20. * kind, whether express or implied; without even the implied warranty
    * W3 A; E- a* O/ X( e$ j$ X& V+ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : m- ^! I- A5 w# P
  22. * GNU General Public License for more details.( e; g( S( N4 Z$ i  X4 J3 ~0 Q
  23. */
    / p" c- l) G8 G1 Y
  24. : [2 l9 [. u6 Z) V# i$ `
  25. #include <linux/module.h>  l+ b2 k# z' ]3 d
  26. #include <linux/init.h>" [+ f- N! B+ E; ^3 V% a* [1 j
  27. #include <linux/errno.h>+ Z: D4 `' ~$ T: v2 }9 ]. b
  28. #include <linux/types.h>8 |8 O0 R! k8 A, I+ G# ~1 C! }6 w
  29. #include <linux/interrupt.h>5 w7 Y9 e( P/ r
  30. #include <asm/io.h>0 E  r: H, ]( q: w9 x
  31. #include <linux/moduleparam.h>0 x! V7 w& ?2 P0 J/ X4 e$ r; [: s
  32. #include <linux/sysctl.h>* I( B3 h7 a- f) t
  33. #include <linux/mm.h>
    3 a# s1 _8 L" k8 J
  34. #include <linux/dma-mapping.h>
    6 U" \9 I7 B. M) I/ U

  35. & m5 `. M6 n: Y
  36. #include <mach/memory.h>" ~/ I' c# K" s, f
  37. #include <mach/hardware.h>
    & K& D( @: t0 N+ o9 z" `7 m% o; I
  38. #include <mach/irqs.h>" V" s  K& M5 y8 z/ _
  39. #include <asm/hardware/edma.h>
    0 }, O% O  e# T4 f7 E1 M' p0 \
  40. 2 ]6 @  \' s6 M* {! l- F6 q4 Q: s
  41. #undef EDMA3_DEBUG
    ) ?  w( i! Y5 O! \9 c
  42. /*#define EDMA3_DEBUG*// H3 S& ~" z& s0 L

  43. 9 @8 R9 h  L5 `, P
  44. #ifdef EDMA3_DEBUG
    ) p! H& G3 B; O1 u: c7 k5 J2 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 z; X% s% l$ W# z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! H; q; H! n7 R, U' R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - X) X+ }+ @" u) `+ Y5 l: X
  48. #else
    ' M! k( R/ x* }% q$ h6 E+ b3 _+ q
  49. #define DMA_PRINTK( x... )
    9 `% O0 Z) P5 S6 \* U. l# p4 |5 n
  50. #define DMA_FN_IN
    % `. Q* Y1 T3 i4 h, b7 }3 d
  51. #define DMA_FN_OUT3 ?  J  L, E$ a+ J" T2 j
  52. #endif+ S; o7 x! b( Q

  53. ( C& {4 F9 C2 j' j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . Q) R  _6 f: h8 C9 r
  55. #define STATIC_SHIFT                3
    4 C" w# n" P5 f' E& o; Z
  56. #define TCINTEN_SHIFT               20
      U& B1 }% O1 f2 y% [1 B
  57. #define ITCINTEN_SHIFT              21( X( q& O/ o; z' M. t/ N* f
  58. #define TCCHEN_SHIFT                22
    0 |; N7 [' Y( i0 _6 l/ E
  59. #define ITCCHEN_SHIFT               23
    , r, I" D5 d' s6 a) k  E* E

  60. 1 _) x, \' H( }
  61. static volatile int irqraised1 = 0;+ I+ T( @7 q! C+ }6 G1 u
  62. static volatile int irqraised2 = 0;
    2 m5 B9 W6 ]9 C
  63. $ |$ Q7 O$ Y3 R- {- ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 M9 c; o/ s+ V3 Y9 y& n* w, }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l# O+ Q! X4 c. Z$ X3 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ~! u$ v* H  [! s) D" r0 ^

  67. % y8 C' ~1 g! F+ n# B2 K2 \& M
  68. dma_addr_t dmaphyssrc1 = 0;2 @4 R1 j3 _, ]# K
  69. dma_addr_t dmaphyssrc2 = 0;/ j" y1 ?! k1 ]- t1 A& Z! f
  70. dma_addr_t dmaphysdest1 = 0;8 a0 G3 [8 K  Q8 U: J: l& F! C, g; w
  71. dma_addr_t dmaphysdest2 = 0;: p5 G) J" @5 M% b

  72. 1 X0 _2 z0 I$ I- e  D0 K; B/ j
  73. char *dmabufsrc1 = NULL;
    5 Y$ [/ q) D+ J$ C  U
  74. char *dmabufsrc2 = NULL;% M! e/ W2 |1 ]) A3 L
  75. char *dmabufdest1 = NULL;& `& K: `6 y% Z& U0 c" b/ E
  76. char *dmabufdest2 = NULL;! |) m+ q# S1 t, }$ m  x

  77. 2 M4 h8 R1 T$ n% j
  78. static int acnt = 512;7 M! o! |( f" x1 F- {5 [0 _# `
  79. static int bcnt = 8;
    1 j) E  w5 x  O! ?
  80. static int ccnt = 8;
    % k9 t( B3 K  J0 X
  81. ' s% X  f9 z2 e# j
  82. module_param(acnt, int, S_IRUGO);
    # ?9 V) ^- T: ]- I
  83. module_param(bcnt, int, S_IRUGO);0 s$ q( v) q/ J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& J+ Z0 ]1 [2 D4 y# U0 o5 T

$ o  B4 T1 \7 t2 I  m4 `0 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% y) A6 d0 J/ H  w' Z! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( R* E5 g+ T4 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X. B* v5 R" S- e
. J6 ?- z8 c% g0 V$ t! g0 }9 I/ b8 n# Z, s) z% u8 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-3 09:03 , Processed in 0.044229 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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