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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " D9 T9 u6 K+ h1 U7 ~  S* }
  1. [code]EDMA sample test application
    ! M7 \$ k3 K0 y( l: v0 p8 n$ B5 q3 i/ C
  2. /*
    $ L  s. _3 u/ B' K, C
  3. * edma_test.c
    % v+ p% V6 n: `' R# U1 A! ^
  4. *
      V! C0 U2 r7 [! h% H& V
  5. * brief  EDMA3 Test Application
    & O6 W. O; J+ R/ B
  6. *
    ) g& N0 h1 m/ K. S8 S
  7. *   This file contains EDMA3 Test code.
    , a) n+ o$ ^& M: j/ Z4 i
  8. *
    ( q+ s2 ~6 g' a  A# }$ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 P3 U# |5 `' I2 C! U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ r% t9 q# w) h- n
  11. *         TO CHANGE.8 O: a7 B* m5 N8 T
  12. *8 ~7 {; j; N' P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - ~3 d' B# d/ @, v
  14. *# O9 U) ~+ H+ w! S- j
  15. * This program is free software; you can redistribute it and/or
    , [+ r& V2 a. k
  16. * modify it under the terms of the GNU General Public License as8 n$ N- V, y, y
  17. * published by the Free Software Foundation version 2.; t# ]& _$ [6 k! X$ z
  18. *
    3 E) r+ E( u# t7 u2 \) w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ?# n2 T. K0 p0 p2 ~
  20. * kind, whether express or implied; without even the implied warranty- R+ Y/ v2 b8 z1 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 R0 a- h: N; T
  22. * GNU General Public License for more details.8 R6 w" ~& R) b) x3 O
  23. */: C! M8 w4 s+ C$ [; f: Y. k5 _  b, Y

  24. 0 S" _& j: S' Q9 v
  25. #include <linux/module.h>9 N, g, B' Y' {8 c2 v$ b) i8 W7 X
  26. #include <linux/init.h>
    8 b% w# \1 |  }- S1 }& [0 r
  27. #include <linux/errno.h>) E5 R+ }, O0 @
  28. #include <linux/types.h>- j7 O" R$ ]: o1 k* A
  29. #include <linux/interrupt.h>
    & C! Z5 c' x& N8 s6 J) K
  30. #include <asm/io.h>
    4 Q$ I5 p. N4 ]" s: i4 K
  31. #include <linux/moduleparam.h>
    0 c  d% Y/ z: p: z/ r# L7 V
  32. #include <linux/sysctl.h>
    9 G  B% Z/ ]# K
  33. #include <linux/mm.h>
    6 S' ^& [) n$ O& ?5 R- s
  34. #include <linux/dma-mapping.h>
    % `, V7 m8 b) m
  35. / |9 _1 g6 q0 f8 y6 g- y7 b
  36. #include <mach/memory.h>4 P) R0 J9 |% D, V7 I
  37. #include <mach/hardware.h>
    $ g% B. }1 z  W" C+ P6 Q, P
  38. #include <mach/irqs.h>
    6 T! }- l) R% D2 U9 [
  39. #include <asm/hardware/edma.h>8 P% f& G) i8 |6 r
  40. 5 S% s/ x. v% `4 l
  41. #undef EDMA3_DEBUG
    & @5 G4 ^" m5 M6 X0 N
  42. /*#define EDMA3_DEBUG*/- U- M8 v  q2 d* E

  43. + W3 ?9 G( u8 f% T' s
  44. #ifdef EDMA3_DEBUG" T! C7 t! _( j' x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 n! C# V( C5 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * v% U6 s: p& t/ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), |& ]/ B. y2 ?( a2 q9 o  J
  48. #else
    - b! G; k& }0 K1 A. e/ v7 l
  49. #define DMA_PRINTK( x... )
    2 L* G6 H: `) B
  50. #define DMA_FN_IN
    / m7 ^0 c6 V3 j9 s& b
  51. #define DMA_FN_OUT2 e0 g1 U1 H( z. m( M7 a
  52. #endif
    , {  B& ?( L2 b9 h
  53. 9 e/ }  F6 K5 Z  n3 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 d6 S3 t5 u5 W6 S. O+ }; k
  55. #define STATIC_SHIFT                33 w% a5 l5 ]  P& m. y5 l1 i
  56. #define TCINTEN_SHIFT               20
    ( S/ f5 w- o) y( _% ^' g  s
  57. #define ITCINTEN_SHIFT              21
    2 T( d# ^# n( E; J4 M; r  @
  58. #define TCCHEN_SHIFT                22: ~, t% o% b5 `& \5 X2 x  ^
  59. #define ITCCHEN_SHIFT               23
    9 L" S1 I: u$ S% e- F9 I0 t7 h

  60. & n5 Y' y: g2 T1 h* k( V- x7 _
  61. static volatile int irqraised1 = 0;
    5 @2 S" D  a( |1 ~8 U8 I) e8 m
  62. static volatile int irqraised2 = 0;3 P9 g" l" I( s# E1 c/ G* u

  63. " H% f# S* o- o% M+ B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Y" N" s! t/ v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - I  o4 D& P$ t( A1 ?  @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S* ~0 [% T' g$ j1 r: O' Z8 X! w
  67. 7 \9 i& W  S8 R) K, X3 F0 B
  68. dma_addr_t dmaphyssrc1 = 0;
    ! \- _$ V0 w0 |
  69. dma_addr_t dmaphyssrc2 = 0;
    " }+ c3 d! w3 b% v3 B
  70. dma_addr_t dmaphysdest1 = 0;8 c) w0 a- |0 p5 N
  71. dma_addr_t dmaphysdest2 = 0;
    % C- o7 c' M2 u5 J( Z6 W. J- d% P

  72. + w4 M2 d. u9 _2 @
  73. char *dmabufsrc1 = NULL;7 y% \+ p* D& _7 J9 P
  74. char *dmabufsrc2 = NULL;
    , }& W4 R9 ?% q3 M/ d2 o/ L
  75. char *dmabufdest1 = NULL;8 K' w  Y# M5 ^7 }; C
  76. char *dmabufdest2 = NULL;
    " t% }2 j2 G' `( p

  77. # m8 z! D2 w2 G1 b( F
  78. static int acnt = 512;
    $ \/ F5 l, v( k9 `; q, [5 h+ p$ c
  79. static int bcnt = 8;/ T" W1 b+ {; c+ h/ c
  80. static int ccnt = 8;
    4 d2 z! l% x+ u, h0 Q& c' V' d
  81. ! \, c0 E" `$ P1 h6 u
  82. module_param(acnt, int, S_IRUGO);* ]+ w% Y& S, M( Z: s, O( u% o& D
  83. module_param(bcnt, int, S_IRUGO);9 Y1 j4 F: @# j5 O) z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 Y7 |5 k  w7 F6 m" }% y
4 t* \& B% D6 n3 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) v  a' \, B  s4 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 C9 x7 E, H  x# |" s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; r7 U, @& x1 [9 i
- U  m9 z8 ~9 ]5 J9 E4 i% T/ x
4 ?1 ~3 \, T' O* @2 a* B/ p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 16:32 , Processed in 0.040056 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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