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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Z  E" b9 Y! e+ D! j
  1. [code]EDMA sample test application
    * B9 Z5 f4 _, D  c) Z
  2. /*
    * B! A( J8 d) C6 W4 |3 y2 _
  3. * edma_test.c3 y1 L) P. ?5 B+ Z$ ~2 k/ X
  4. *9 h! |3 Z. e6 U3 O
  5. * brief  EDMA3 Test Application7 I, T( l/ _5 q2 |
  6. *8 a6 ?2 V, |5 N4 R2 t; h. G  r$ j
  7. *   This file contains EDMA3 Test code.
    ; W' ?  j& G3 U( h- ?& S
  8. *
      r! p# O& N2 c% {5 x" a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 `! i! `4 E) W" p: ~. _  P6 ~/ I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Z  P! K( y. @  B6 M/ n( F, w$ `
  11. *         TO CHANGE.1 w7 H' I1 w& `2 q% |
  12. */ U! N8 g6 o1 X, p- n; ~+ l! `  F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 H/ E5 H( K( T- J+ L
  14. *
    + _* A- v: V, N, h* O  H6 r
  15. * This program is free software; you can redistribute it and/or
    3 z9 ]+ c5 ]- u' a. D- M) P
  16. * modify it under the terms of the GNU General Public License as8 U" p1 C* t7 ?! S
  17. * published by the Free Software Foundation version 2.
      q+ t, ]& b# _1 X7 G9 |: m  W: N* l
  18. *  d* V( b, i" x  v; |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 e9 M! F( Y% E* V9 r& G9 \
  20. * kind, whether express or implied; without even the implied warranty
    - H# `/ j5 N6 f9 R$ U1 a9 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- N4 D7 h3 K6 J" D' S2 ?4 a
  22. * GNU General Public License for more details.# d0 K7 l* E/ T( T# M
  23. */6 ^' |+ L1 b" ]
  24. + E3 `1 a: b0 j# N) E
  25. #include <linux/module.h>
    , A7 b# w2 t) u1 n! l8 T
  26. #include <linux/init.h>
    ( P- F, Y# E2 a. C6 R3 F/ H
  27. #include <linux/errno.h>3 u2 ^6 W( {/ L9 a$ Z1 l, R' o
  28. #include <linux/types.h>$ W' O$ }7 Y0 Z8 A- N6 ^
  29. #include <linux/interrupt.h>
    + x, t2 }" c. e, l" S8 ?
  30. #include <asm/io.h>9 p( |% E2 B/ _0 |) ]
  31. #include <linux/moduleparam.h>; N& S* d! U/ C% {" @8 Y5 q
  32. #include <linux/sysctl.h>5 O! R( l7 p5 t. C5 X
  33. #include <linux/mm.h>8 [+ U3 M" p8 W2 v. v" {
  34. #include <linux/dma-mapping.h>9 l% `: Z: d/ L  n
  35. ' U# F7 k/ Q; R) o& a2 c1 w
  36. #include <mach/memory.h>1 S; K  o- o" i! F& _& V, V% q$ t
  37. #include <mach/hardware.h>
    4 E: {. k  m' P, b; r) j% X
  38. #include <mach/irqs.h>' d1 Z* u0 e( t' s" Y8 l+ X+ E& Z
  39. #include <asm/hardware/edma.h>
    * g& }& B8 R  X$ y; {
  40. 1 A# {; d9 l3 U6 n4 o; }  g
  41. #undef EDMA3_DEBUG# `& d% `: e. Y9 R+ e) q
  42. /*#define EDMA3_DEBUG*/
    ' O3 A2 L/ n2 {; W* m. l& z+ b7 [1 q

  43. 1 N  p/ R9 r/ j% [; l5 |
  44. #ifdef EDMA3_DEBUG2 k' y. C; U7 U# j" z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* m& ]7 \6 Q) l% b& s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . H" \* u: C, R7 u# @, _# l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " @! v* c- \5 J! H- w: d3 A
  48. #else
    2 d3 E) f+ T* _3 K
  49. #define DMA_PRINTK( x... ): y. |- \& J' c4 I
  50. #define DMA_FN_IN
    : [2 s9 b& p5 r! u) Z; B6 b
  51. #define DMA_FN_OUT3 A) N1 r0 X; S3 f1 b2 R+ Y
  52. #endif& B9 i# @2 q( b) s

  53. * u8 O$ @" E+ X" [. _- ]% x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( n- R, U4 z% ^: [# D! v
  55. #define STATIC_SHIFT                3
    ! m" R6 A5 W1 p. Y
  56. #define TCINTEN_SHIFT               209 y/ \  |6 A  m, C5 `
  57. #define ITCINTEN_SHIFT              21. p: ~6 K" d6 A  m
  58. #define TCCHEN_SHIFT                22! L* z3 W. R2 B* Q0 N! S
  59. #define ITCCHEN_SHIFT               234 u$ A0 v6 g  j1 }4 T

  60. ; W$ |3 L" ~) n
  61. static volatile int irqraised1 = 0;
    9 C4 m' c/ }5 n
  62. static volatile int irqraised2 = 0;
    # m* b% X$ X% h: c4 W
  63. 8 L% L  b6 \3 `- b% k6 J% {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 o% `/ R8 I0 n1 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F5 L% w4 {" @5 k, X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . j. |+ t) d. Q2 F4 a: ]) h. M

  67. , a9 u0 ^3 c7 x2 |
  68. dma_addr_t dmaphyssrc1 = 0;0 k- K+ Z, l& f; y4 ?+ N$ T
  69. dma_addr_t dmaphyssrc2 = 0;
      b" T9 m! M9 F9 I% M3 Y# v6 [
  70. dma_addr_t dmaphysdest1 = 0;
    + d. U, H( y* x0 s1 }, ~( V1 l8 a
  71. dma_addr_t dmaphysdest2 = 0;7 h. E. s* @! r# e" _4 D: l! M
  72.   V4 ]( e6 |+ z9 o& m
  73. char *dmabufsrc1 = NULL;
      X1 M+ n# I1 Q, m9 W; ^/ F$ w
  74. char *dmabufsrc2 = NULL;
    ! e! P- s2 |8 T% ^; n3 v+ u
  75. char *dmabufdest1 = NULL;9 O) C5 C" V8 a( s1 D6 W
  76. char *dmabufdest2 = NULL;
    ! ?; n; [1 r) ?9 \
  77. 7 m$ ?5 \- D' Q8 M7 g2 I# r
  78. static int acnt = 512;+ Y* J  t! p5 R+ {) p- m
  79. static int bcnt = 8;( h2 U# T, m" ?8 P" k
  80. static int ccnt = 8;3 Q; y# e, {5 Z5 I* Y' i

  81. 5 L/ R/ L; I% N# a9 Z( O
  82. module_param(acnt, int, S_IRUGO);  `( T1 Q# Q$ X  M
  83. module_param(bcnt, int, S_IRUGO);
    6 ?, M" f: C1 K( \8 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  C% i4 m/ i  |
7 V. y& [4 o: g% v* X: {2 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 [, g. L9 R3 ?0 x+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* D7 {4 k( i/ T4 d0 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; S) u, O! g* S3 V( v# _. G

- k4 ^# Z! u! p6 F3 v. v% k: O) F
. a+ S1 i1 ?* P1 v+ K7 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-25 09:06 , Processed in 0.041149 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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