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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & k, l2 G# A0 ^, U5 `4 j
  1. [code]EDMA sample test application4 x. @% _  @1 x5 U; i) O1 P6 k( s: \8 I
  2. /*- S2 T- t2 Q" L  w2 i
  3. * edma_test.c; W% R7 {- x! B3 K: v  J6 s
  4. *! @& q& I% i% N8 v, O2 M
  5. * brief  EDMA3 Test Application
    8 F+ G' X% u1 ]0 R
  6. *' @0 ^  Q% `! F( k
  7. *   This file contains EDMA3 Test code.( V. j. m; C" H" `+ H( D1 p
  8. *. t% ?  ?* y6 N- i8 L; c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 N( h: e& [, |1 x6 \* [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % }$ U) ]( a4 E) }) _, }, ]% V2 x
  11. *         TO CHANGE.$ O+ c- ]- [9 c6 x( s
  12. *( a. d3 x) W, d3 U1 u: Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- P& ], }2 Q1 ]3 ]7 V( Q
  14. *
    4 Z6 U+ ]+ }8 M+ I! W
  15. * This program is free software; you can redistribute it and/or2 N* z, U2 a# Z
  16. * modify it under the terms of the GNU General Public License as
    - U4 f3 `1 q- d. b9 h/ t
  17. * published by the Free Software Foundation version 2.( @% t( R( }3 P  j4 ~' r1 S
  18. *
    " l- c# I7 V- @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) [6 f& K0 h0 b* e
  20. * kind, whether express or implied; without even the implied warranty
    ) G9 T& M& B% I* a- |6 R* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 @: O$ m! M+ y. D7 z
  22. * GNU General Public License for more details.
    - V! K( w( I; R$ b+ g# V
  23. */' H" ~  X3 A( }; `. ]; x/ W$ u0 a

  24. 4 O3 B! X+ E. N( g3 T! I
  25. #include <linux/module.h>2 z* f5 \. C5 ]! D! y/ M
  26. #include <linux/init.h>
    . P6 a! }9 B6 K6 `  J& [
  27. #include <linux/errno.h>- W% I2 s8 f% J. W4 `2 H7 C
  28. #include <linux/types.h>
    - X$ l: k' P' j- o) ]5 ]0 q
  29. #include <linux/interrupt.h>* M! \2 Z  M. k2 ?  a" F
  30. #include <asm/io.h>
    ( c0 Q9 c" W* [! S6 j' a
  31. #include <linux/moduleparam.h>0 ]* _) [2 g0 c  Q
  32. #include <linux/sysctl.h>
    : k  f0 r+ V- M! a, I  k2 |. P
  33. #include <linux/mm.h>, r8 y# g. J$ o% c: u9 y/ t  f* I
  34. #include <linux/dma-mapping.h>
    5 o' ]; _/ z" L2 W' X; \

  35. ) @( [1 ]6 s+ d# w
  36. #include <mach/memory.h>
    ; B3 ], Z& _/ @
  37. #include <mach/hardware.h>2 C. b7 H  _$ ~3 O, f" a7 [
  38. #include <mach/irqs.h>- y% W9 u" j* D- }! A; ]* @
  39. #include <asm/hardware/edma.h>
    8 L- b& O. j$ W4 D

  40. , r" |, _4 B6 E: o$ U
  41. #undef EDMA3_DEBUG
    , d7 N. ?1 b( I4 p% _& G4 x
  42. /*#define EDMA3_DEBUG*/9 N6 P! y! L8 e/ ^4 w
  43. % a9 V9 _# R$ {' e
  44. #ifdef EDMA3_DEBUG$ U0 x$ j9 r3 t" j9 p+ a2 V+ t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 s1 g, B% V  G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % Y6 E  Y1 C2 e/ Y" l9 ^2 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! b. a* q* D& q4 h9 ~( B: W: P
  48. #else8 P( S1 l/ c; X. Q5 \* y) |" U2 {/ c
  49. #define DMA_PRINTK( x... )* N5 _9 Z) `3 b1 A  P
  50. #define DMA_FN_IN
    7 f" @' @6 ]7 C3 `) V
  51. #define DMA_FN_OUT
    , I; X6 ^! E* ^# q4 _+ P5 k
  52. #endif6 n( f. l& K+ q- B

  53. ' @- [0 k8 R8 J$ Z) E0 P+ B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), t, G# a  H! I) G, n9 B6 S" i
  55. #define STATIC_SHIFT                38 W: p) Q9 m3 i  `5 u7 c
  56. #define TCINTEN_SHIFT               20; O2 T( ^8 M# y6 b5 ?' S
  57. #define ITCINTEN_SHIFT              218 ^# y  n0 S7 M! e7 w& @5 L
  58. #define TCCHEN_SHIFT                22
    , N. P! Z/ @; K! T7 ^, M; \
  59. #define ITCCHEN_SHIFT               23
    & L* _4 k- i1 j9 Z. _$ C

  60. " Q" R8 I3 x; R- y+ g8 T, n+ g: k! H
  61. static volatile int irqraised1 = 0;+ e2 ^8 m! }8 ?1 h3 T- ^# s
  62. static volatile int irqraised2 = 0;
    % A2 @2 S. Y9 Y' n2 D, X" x

  63. / s" s3 d# ?" b* [  w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - u2 P+ r. W5 R$ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, O- v) d. P/ q4 k1 _5 c. M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& l# p  Y! K4 l: `8 [2 k" ]
  67. 8 N0 p2 a8 }, J" V- V
  68. dma_addr_t dmaphyssrc1 = 0;7 q& r6 u, C) _. {
  69. dma_addr_t dmaphyssrc2 = 0;
    0 k' {. F0 f% N, L- w, Q' H
  70. dma_addr_t dmaphysdest1 = 0;. a1 \: W( p: r, x
  71. dma_addr_t dmaphysdest2 = 0;& s; e# S  v" T0 f" u; B
  72. ( w+ U0 U4 Y. ?" Y
  73. char *dmabufsrc1 = NULL;3 t% z5 F/ S4 v: X# a; F( D" X
  74. char *dmabufsrc2 = NULL;
    6 H) r) @8 ?: B* \3 C# A9 f
  75. char *dmabufdest1 = NULL;  [7 {$ C+ e: J8 b' Q" s  i
  76. char *dmabufdest2 = NULL;1 s: x. h5 J. D3 G" K+ T

  77. ( U- I& B( W" M
  78. static int acnt = 512;3 M: Z  I7 n1 ^  f
  79. static int bcnt = 8;# s3 l: V$ Z9 B- U5 W
  80. static int ccnt = 8;
    : e1 B  k- M* B6 N, x

  81. - w6 W0 l$ o" `+ a
  82. module_param(acnt, int, S_IRUGO);% n# D0 T% U- T' E( }8 z( N; c
  83. module_param(bcnt, int, S_IRUGO);% _. a% v, d" M( j+ i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) y/ A- X- V9 @" n

" j- t0 f6 J% T! i% R/ N2 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 @, ?9 S5 u) [$ Q  z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- W2 B  `+ C8 G( ~. y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. w, V2 o+ {& y8 H  g/ g! X( @; t6 `
+ H% w/ G& O% T6 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 10:21 , Processed in 0.038635 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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