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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 n1 X  T0 L) h" ]% `. ]$ W
  1. [code]EDMA sample test application
    ; K4 [8 ^$ V4 b; _& F6 ]
  2. /*2 @7 n5 [/ N/ ~
  3. * edma_test.c
    ( J1 t. S% A. I1 n8 z
  4. *
    9 _" V4 G* _* M5 o8 C
  5. * brief  EDMA3 Test Application
    , T# }: r. w+ y) V+ a# G" D
  6. *3 @0 K: l9 u* P4 E& j
  7. *   This file contains EDMA3 Test code./ e0 a& v, h5 _( ^' o% X
  8. *+ c8 e8 n- W0 p  y6 T1 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + |: f' s+ V" |$ w& |8 [- E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 P2 K- p6 o$ q" h0 i6 h
  11. *         TO CHANGE.4 Q) I9 N$ j- t' t9 @+ F
  12. *. v' ]6 ?2 \, z$ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 u+ K% [$ J5 v: H/ |' u
  14. *
    0 u9 \- c/ d0 c! w, \: p
  15. * This program is free software; you can redistribute it and/or6 v% ?- D* Z$ N
  16. * modify it under the terms of the GNU General Public License as
    & E1 W7 E, B! z% o. l& q* \% s1 |
  17. * published by the Free Software Foundation version 2.
    # B9 E1 u/ q8 K6 ~' U+ s
  18. *: I4 l5 {: `2 H/ a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% U+ y+ V# p( [# P7 l' ]
  20. * kind, whether express or implied; without even the implied warranty& }* ~( ^, b4 Q5 P* z7 N4 |5 D. _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 }3 c" V* W$ T+ R
  22. * GNU General Public License for more details.
    5 Z3 D) o9 Y# m
  23. */* E# V$ Z, A* m4 _9 p7 T5 }- p2 ~
  24. 2 `; D. m. s: t+ N
  25. #include <linux/module.h>
    6 \  M7 K. x7 `! {+ |" P$ V
  26. #include <linux/init.h>
    / W% ]8 S9 A4 |& Y/ F" e( T5 h# ^
  27. #include <linux/errno.h>1 ^: X( [, k% M
  28. #include <linux/types.h>3 Z1 T; {* e* N+ N* l
  29. #include <linux/interrupt.h>
    ) U9 o% e" u1 H8 B& i- a
  30. #include <asm/io.h>
    $ L, R3 K4 e' c2 _
  31. #include <linux/moduleparam.h>
    5 H/ C; A8 V0 y2 C( F1 }0 T* a
  32. #include <linux/sysctl.h>: q$ J) f% i4 t' y/ `
  33. #include <linux/mm.h>& _" S) Z# Q4 K* v6 f$ x& f& w
  34. #include <linux/dma-mapping.h>; B' v. T! S. x: t& Z' h5 o

  35. ( t/ L( V3 `: m! G0 y
  36. #include <mach/memory.h>5 @5 Y" C" J+ w! J: w
  37. #include <mach/hardware.h>
    " y! s( a' }, i2 R5 b! y
  38. #include <mach/irqs.h>$ M( }! y9 l( K! S" L
  39. #include <asm/hardware/edma.h>
    . K4 ^2 j* s8 Z, Q3 F

  40. 9 U6 v  c0 b! x  ^* p3 f' S
  41. #undef EDMA3_DEBUG
    $ b0 ~! i; \, r0 c5 K# o' E+ v
  42. /*#define EDMA3_DEBUG*/
    1 L4 y& X' ]& P* j5 |

  43. , U5 _' H2 z7 z1 s: E$ H  V& {
  44. #ifdef EDMA3_DEBUG$ V: C& }. }/ P! S; `+ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 x4 S8 ?& Q& s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 U2 e; w; J6 j6 t, h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); u5 Q6 M0 u) l
  48. #else' O9 H+ h* I! H$ w( C& E0 ?: x
  49. #define DMA_PRINTK( x... )6 s% P0 O# \6 T# f9 L
  50. #define DMA_FN_IN
    . z' t8 H# c. [2 ^
  51. #define DMA_FN_OUT
    ; }9 P& C& ~4 N% ]  [5 g' j8 k$ [
  52. #endif
    6 F, ~+ |0 [: x1 R& L4 Q

  53. ) _4 B8 U4 O  j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # Z2 M6 l8 l7 o# }4 k; U
  55. #define STATIC_SHIFT                3
    3 J: W; ~! L+ T. c2 |! N
  56. #define TCINTEN_SHIFT               20
    0 o: G6 {4 m' @3 q  E& e
  57. #define ITCINTEN_SHIFT              21
    " Z) m4 a$ F* b% ^& o
  58. #define TCCHEN_SHIFT                220 r; o0 p/ q3 r4 B$ F* ~4 Z
  59. #define ITCCHEN_SHIFT               23
    4 u( l0 G2 H0 n3 ^3 T" Y; L
  60. # e% Z, W; a& ~4 Z+ I- b9 D1 V6 Y
  61. static volatile int irqraised1 = 0;  m% |. }" T  m% K0 k2 W
  62. static volatile int irqraised2 = 0;
    ; w9 P# E+ |: F

  63. 5 O! v. Y; H" y' D( J0 W0 @; K4 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N$ t3 T+ A* e1 u& m8 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . @  M. M, z0 M' i5 R  e. c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g5 F# o" m, J! Z
  67. & b0 J4 E5 y5 H7 k" V5 `8 j
  68. dma_addr_t dmaphyssrc1 = 0;
    % \+ N3 v( t) E# X% Y
  69. dma_addr_t dmaphyssrc2 = 0;) a& a, q  W4 d& ]
  70. dma_addr_t dmaphysdest1 = 0;! p: V9 ^: p# k9 d$ c, X
  71. dma_addr_t dmaphysdest2 = 0;4 }" M& r; {7 D1 K
  72. 5 r; v0 g8 W/ h, `" L; W: [$ i( ?6 `
  73. char *dmabufsrc1 = NULL;2 F5 l% S3 \) x5 ?
  74. char *dmabufsrc2 = NULL;
    ! z' G' v" P- x; c; h/ R  d: O4 M0 I
  75. char *dmabufdest1 = NULL;
    & N) U' M0 W8 `- P  C, @# E" v' w" Y% P
  76. char *dmabufdest2 = NULL;
    ) [8 [4 C3 }% ^0 Z- s9 _8 `' b
  77. , v! \9 `+ b" H3 C
  78. static int acnt = 512;3 y% w/ H8 \& x# Z9 C" y
  79. static int bcnt = 8;4 k) b# `2 f8 C/ w
  80. static int ccnt = 8;
      o& @% k$ o+ P

  81. * B7 S" e) |9 k; W$ \1 h3 [: _% |
  82. module_param(acnt, int, S_IRUGO);9 ~2 [/ H1 Z" a1 x8 h7 h
  83. module_param(bcnt, int, S_IRUGO);
    ! `# R% Q# P' l' @9 S- l# i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 a* A' Y0 x! k- m7 L. z" B2 V+ I) Y  G2 `) U! l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; x2 U; |+ [2 P0 N) S& T# yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* m: X  x2 o, c6 k! b0 r* I# y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" Y6 S# E, ]+ f, S' F; R( f
, ?2 K1 z- O1 @- K  G6 s  i
+ r7 ]7 D. p7 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-17 11:12 , Processed in 0.039717 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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