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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & |( @3 }, w  A! z1 C
  1. [code]EDMA sample test application8 B' Z4 c+ }. ?5 E2 j
  2. /*) L; K. o, f- h/ ]: V3 q4 C
  3. * edma_test.c) P: M+ N: g: q
  4. *( l+ a( B& T& W4 F$ R
  5. * brief  EDMA3 Test Application
    / S" H& }: P. U- n8 S$ R
  6. *% k% q- R8 ]8 `5 U
  7. *   This file contains EDMA3 Test code.
      ]! U9 {4 [+ f- n2 f
  8. *
    ! A' o# W6 \4 i* Q" I, \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 ^' ?2 z  Q' t+ E7 l- H% G7 ~4 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ P  Z/ b& x1 l7 F; \6 M
  11. *         TO CHANGE.
    . q& P0 X( ?* v
  12. *
    : E, {8 \/ A; f, H- p5 B. D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& f7 x4 U; b' O" c7 c5 s2 R
  14. *! s3 E* Q0 D# Z( d* n7 T
  15. * This program is free software; you can redistribute it and/or
    ( g# F6 D0 b/ F' _. }9 b5 c; M
  16. * modify it under the terms of the GNU General Public License as
    ) k2 P, t7 _% t& D5 p4 J, O2 ^9 V, }
  17. * published by the Free Software Foundation version 2.9 W3 z. ^8 ~* P: H. L3 v
  18. *
    $ @. E4 Y8 j) t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + q8 K* z, H3 B4 Q6 \5 U+ o8 a
  20. * kind, whether express or implied; without even the implied warranty' t1 R9 @( g0 U  _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ o# Q) i4 @. `4 I
  22. * GNU General Public License for more details.# O* G; ~8 |. ^8 C/ I6 \
  23. */
    - f2 H+ u' Y% l% e$ X/ J

  24. ' v0 _) ^7 W8 ?7 {
  25. #include <linux/module.h>
    : K% r2 z& L" {8 _# W# z
  26. #include <linux/init.h>
    3 F) w5 P$ X! t/ k0 {- n
  27. #include <linux/errno.h>1 j  z. V2 @/ v. `1 z! e' Z' J
  28. #include <linux/types.h>
      B3 k5 p. T, }
  29. #include <linux/interrupt.h>
      [0 ]/ y+ y  q* U, H. Y$ ]
  30. #include <asm/io.h>
    + Y1 ?4 z* ^  ?  X
  31. #include <linux/moduleparam.h>
    8 O) M7 q9 P/ J( M! k1 O' g
  32. #include <linux/sysctl.h>( w: B# {4 y2 Y
  33. #include <linux/mm.h>
    2 ^# ]; f! d) {9 L' }
  34. #include <linux/dma-mapping.h>7 _: z" P5 W; I# F% e' ~

  35. 0 I1 a6 A' D7 l3 n
  36. #include <mach/memory.h>
    & o  Q" K4 F; S9 N4 b3 D
  37. #include <mach/hardware.h>
    , ?1 f: l9 b: U: [8 ?
  38. #include <mach/irqs.h>+ T9 J5 s. K# A
  39. #include <asm/hardware/edma.h>5 p* k4 d) H1 \% y) a

  40. : A% `" X8 H4 y- {
  41. #undef EDMA3_DEBUG. B4 Y- I5 u9 E, U" a
  42. /*#define EDMA3_DEBUG*/1 ^* r. S( O3 \+ R. V- m) |! r- y8 A
  43. 3 a* s7 o1 x) H) P8 j
  44. #ifdef EDMA3_DEBUG7 u( z$ x' W- k0 f9 z+ h0 r- W6 }4 Y- t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( X6 H  O: P* _. b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' J- A. _. ^) z+ \) i5 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 I& S. P. {+ Q1 h
  48. #else; ]  z' {( S, L- [1 L$ p
  49. #define DMA_PRINTK( x... )& C" d2 s9 R6 ~  n! \; A
  50. #define DMA_FN_IN
    . F3 D9 D  M2 H" E) M
  51. #define DMA_FN_OUT
    5 p2 {& c7 z( C# `3 A. H
  52. #endif, R  B2 i# \% }1 q

  53. , s" J  [% O3 H4 h" G/ D. j7 H, o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 U" O. ^) ?' K% }3 D. m
  55. #define STATIC_SHIFT                3
    9 j. u  O/ E3 H& V3 H7 R) ]5 w
  56. #define TCINTEN_SHIFT               200 S& k! H0 l( ~, X( B
  57. #define ITCINTEN_SHIFT              21
    0 E' c" s, w, f7 k: c
  58. #define TCCHEN_SHIFT                22
    8 I* d( y3 ^, i/ A! d1 D2 Q1 s
  59. #define ITCCHEN_SHIFT               23
    / f6 a# E' n8 n6 ^7 G" J+ c
  60. 4 K5 K  [. R! y4 S* s
  61. static volatile int irqraised1 = 0;
    5 o( e* J9 p- q+ r7 W  d! o( h
  62. static volatile int irqraised2 = 0;3 a; @. x' {* t0 c2 A, Q  `, N  ]  k
  63. + S7 @1 P* q- e  j; R! x2 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ?8 M9 I6 h7 c1 ?5 \- W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [) V* g4 m( Z- _' d# @1 [- d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R" V  |7 y- g  c5 g
  67. " L% L9 O% G* M9 K
  68. dma_addr_t dmaphyssrc1 = 0;( |' a/ f* T! ~! q3 K0 _4 }
  69. dma_addr_t dmaphyssrc2 = 0;
    7 Y" [, s% X+ p' `  ]# q
  70. dma_addr_t dmaphysdest1 = 0;( Z  k6 G: O( X5 F, W
  71. dma_addr_t dmaphysdest2 = 0;( ]& @* C: W* E7 _7 E* z

  72. + i/ t  U7 M0 u7 L7 c
  73. char *dmabufsrc1 = NULL;0 k) ?& ~  a) K1 V" j
  74. char *dmabufsrc2 = NULL;. D5 ^+ [# v1 q4 y% A# Q
  75. char *dmabufdest1 = NULL;
    ( W% x: j6 l; [3 {' Q: l
  76. char *dmabufdest2 = NULL;
    ' F8 L$ P, [: p

  77. 0 t5 ?1 ]  e- [: c0 T+ P
  78. static int acnt = 512;
    0 E& _8 e9 {7 r6 N0 Y. \
  79. static int bcnt = 8;
    - \! H, N- y& D* y1 T4 L$ X
  80. static int ccnt = 8;# p" {  U4 U5 H) e6 }

  81. . G4 J. P2 i3 W
  82. module_param(acnt, int, S_IRUGO);
    5 u% C1 y( b- s2 H2 e4 d0 n
  83. module_param(bcnt, int, S_IRUGO);
    1 M, ~3 |. U2 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& L. Y5 p5 @- G8 A* B& t$ b
' ~& e: m+ D4 r( }. T! r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ~% h; ^6 m+ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; m- F5 d3 f$ g, N" S9 a6 A$ I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 `3 q7 l" F5 v4 I

% l- q: [1 ~8 Z8 ^' r" w& N/ y! ]; `: @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 08:06 , Processed in 0.037036 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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