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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # N9 H- ?: _0 _- J. o7 ~  \- T' L& [! a( S
  1. [code]EDMA sample test application
    ' s+ n) i/ O  ?4 r, }/ ^2 i
  2. /*
    + I- m* e* B. h
  3. * edma_test.c
    $ b9 m5 \$ {9 I- u
  4. *
    0 @7 B$ X' k) q  B* A$ |, w
  5. * brief  EDMA3 Test Application
    7 b# U8 q0 E. {1 S2 N+ u
  6. *6 N; O) U; n9 P9 Y, [$ @; o) t
  7. *   This file contains EDMA3 Test code.! C% }: ~8 k( O" G) N, Z3 B% J) B
  8. *: y4 k. ?' |$ W" W; _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% L+ @; d+ P# r- [4 a# m& ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& D" j% N) o8 `% V5 }
  11. *         TO CHANGE.5 M1 e) {  Y% u8 |) q+ n
  12. *
    # u2 ^! T6 s' A& S* u6 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! x$ P  [( k8 B
  14. *( {( R- v, A4 D- e' Z
  15. * This program is free software; you can redistribute it and/or
    : n/ p. R* c# ]6 Z1 R
  16. * modify it under the terms of the GNU General Public License as0 x, p* D: N+ G/ K  g5 U
  17. * published by the Free Software Foundation version 2.' A1 n9 v' ~! f$ \
  18. *
    ! a* Y) H  T% `; E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 t; J2 O3 _. q& |8 ]8 \
  20. * kind, whether express or implied; without even the implied warranty" P& u# N7 l! |, g% u- p# Z5 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 i6 z6 f5 a# M# v- O4 u
  22. * GNU General Public License for more details.
    2 T; Z: p$ [7 n" K! s" c
  23. */
    ( K- f4 g# {8 s. ~  }
  24. $ J! i+ _8 g$ X% ~
  25. #include <linux/module.h>
    % F, w5 c, K2 {/ G# r
  26. #include <linux/init.h>$ e) S' d. H; q0 A: ~- l+ J( r
  27. #include <linux/errno.h>
    & {# `  {# ~0 H, F" r7 b' q) K
  28. #include <linux/types.h>
    3 `/ W. I: Q* h. L+ I3 `3 A
  29. #include <linux/interrupt.h>
    6 a" W7 |1 w$ C# x" L/ p( \; B$ v
  30. #include <asm/io.h>
    + ?% R/ h. _9 d
  31. #include <linux/moduleparam.h>* }' D% n7 _+ C* m4 q/ j! J/ _
  32. #include <linux/sysctl.h>
    * U: ^0 e5 Z& |' ^9 {
  33. #include <linux/mm.h>$ \" J2 Y, u& X5 W$ b+ _
  34. #include <linux/dma-mapping.h>
    7 @# Y( ^- L3 I7 a

  35. - ^3 Z1 ^9 F( p% r: d
  36. #include <mach/memory.h>
    ' P  Y5 ^" w. S8 G* r3 L5 y# r
  37. #include <mach/hardware.h>, g  _* F1 Y3 w8 `7 X& i) N" \5 t
  38. #include <mach/irqs.h>' _6 [5 w7 z: V9 A
  39. #include <asm/hardware/edma.h>
    7 B0 s2 Z  C! M, ~; x' g

  40. 9 n6 d! A9 h1 P
  41. #undef EDMA3_DEBUG
    " B4 V# Z+ V: i
  42. /*#define EDMA3_DEBUG*/1 `- \! W5 s  w7 E: N# x$ n' J* m* [
  43. " K8 x, u6 ?' N
  44. #ifdef EDMA3_DEBUG
    , ~8 ]# K; ]3 D+ B! T2 q2 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ^# q3 `* F3 o, W* x5 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): @! R+ Y( k/ Z4 b+ g% M) f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% U! N& O7 I5 }+ c: Y
  48. #else7 G5 S( I. \" L# z! T* w+ P
  49. #define DMA_PRINTK( x... ). q. p9 C4 D1 O& a
  50. #define DMA_FN_IN1 j& ^1 N7 j- k2 R* M" X
  51. #define DMA_FN_OUT
    1 N8 x5 R$ i0 x7 i/ j
  52. #endif
    9 {* U+ I9 J+ d3 w  D& Q" ]
  53. : Z6 ~/ h% P  P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 v& {3 z+ n8 K0 E2 `8 r! Y1 p
  55. #define STATIC_SHIFT                3* \2 w2 O% g$ L( r8 v# g
  56. #define TCINTEN_SHIFT               20
    - v  f0 d" Z% ]1 d3 }! T
  57. #define ITCINTEN_SHIFT              21) f3 {+ S/ A1 u9 h# h; Z1 s  |
  58. #define TCCHEN_SHIFT                22
    5 T/ n% L& k$ n1 C- M* D3 Q8 K: H
  59. #define ITCCHEN_SHIFT               23
      Y* U+ X' }/ b- W7 d: @: Z

  60. $ ]0 u0 I( s& S6 e8 c- o2 V- F  S
  61. static volatile int irqraised1 = 0;
    $ V8 U) j  o& i) e* N  h
  62. static volatile int irqraised2 = 0;
    8 s: {+ {! O$ A3 m3 {7 u
  63. 4 X! W: |! S/ x. v- W: D! h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ?6 [$ e$ G, u+ V7 F3 b3 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( \; s  _& H  w- c' k- R% r' x5 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y9 X+ d0 A3 c

  67. + Z; H1 x. c! U* \
  68. dma_addr_t dmaphyssrc1 = 0;9 t; d& J' ~( P9 F+ _
  69. dma_addr_t dmaphyssrc2 = 0;% ^5 J! ^" c( _$ U( X, {
  70. dma_addr_t dmaphysdest1 = 0;& w  ^5 Y1 K1 B& p' p4 P- s7 e  l" Z
  71. dma_addr_t dmaphysdest2 = 0;% a: V6 }3 H# b5 g* M

  72.   I* e; U; u4 N$ G) g
  73. char *dmabufsrc1 = NULL;
    " E& }" _% k& {2 D5 r& P- m
  74. char *dmabufsrc2 = NULL;
    $ V  w% P4 N% l/ _1 G# h
  75. char *dmabufdest1 = NULL;
    * n" `) C! r$ ?2 G3 N
  76. char *dmabufdest2 = NULL;. R% }" o1 i" y% z: K' O

  77. 6 {& L" n5 I( j9 W3 L2 d! w0 |9 c
  78. static int acnt = 512;1 @! H6 K$ X3 A  B! h
  79. static int bcnt = 8;
    & b- B: d5 u# M! i! C  \
  80. static int ccnt = 8;) O1 a. a7 C! J$ ]

  81. 3 N! e# z( B- x; G
  82. module_param(acnt, int, S_IRUGO);
    7 C: e* P4 d7 |- J! ?
  83. module_param(bcnt, int, S_IRUGO);$ c1 d6 Q6 r+ }2 q- q1 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ i3 U1 o: D5 T0 Z

% b/ V/ z0 {8 n4 ]* u% ?# @/ n. s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T- W* c. }$ i+ H# [5 H3 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: }( R! p: g6 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 E5 h- C8 s/ X" k6 c0 }& u
! G, _5 m: l9 @3 V& F

7 l8 x2 m. s9 j6 r0 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 01:16 , Processed in 0.044959 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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