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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & z, v5 W, K8 x+ _  v5 i7 Y
  1. [code]EDMA sample test application
    # {) |. r* ?& k2 [/ i1 V
  2. /*
    . R# l% E/ G$ x" O: k
  3. * edma_test.c1 I, ]/ j) s% ~. W. a; f  ]
  4. *
      ^  {4 C: \* y6 K) X
  5. * brief  EDMA3 Test Application
    . q6 N! r0 D6 {* o
  6. *. f8 e* Q) I! v  r7 l
  7. *   This file contains EDMA3 Test code.5 N+ A0 n5 n" e( U" S. ~
  8. *
    . f' E! a* j4 O- a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! o2 b* x! [  X" b1 m$ M8 x: O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 Y2 O' L3 b% R. o0 @( g/ c' m
  11. *         TO CHANGE.
    & k' J* Y  Y7 g+ m* i
  12. *0 L) u3 C) x; k8 X" \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( y8 h: r; i: ~1 k: l, y
  14. *& U% g3 }9 `' D6 B8 g1 _# \: e
  15. * This program is free software; you can redistribute it and/or: k+ E3 Z' e; ~( m: v' G/ h1 Q
  16. * modify it under the terms of the GNU General Public License as
    7 R; a0 f: B: l4 r) }
  17. * published by the Free Software Foundation version 2.$ D  N. o  Q" H6 r; u- {& b
  18. *0 x1 T+ b5 _0 l2 {) ^2 X  t! E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . e& i6 z1 }" q/ ^8 `$ L+ N6 f$ Q
  20. * kind, whether express or implied; without even the implied warranty
    9 L& {# F# s0 l. Z, z* y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( L) R$ {, d+ L- u2 i
  22. * GNU General Public License for more details.- Y$ A. e; W1 e" R' S0 R) l3 x
  23. */- i+ V4 E" ]* D: d7 Y! {! @1 B+ R
  24. 3 @9 L$ K6 f8 c; I& o
  25. #include <linux/module.h>) H# u+ [8 H! H% S4 l, z6 e1 P
  26. #include <linux/init.h>" Q% w% t& ~( t
  27. #include <linux/errno.h>9 b- O5 K8 a+ \. e
  28. #include <linux/types.h>) v: z1 }$ c1 {& P( r/ u
  29. #include <linux/interrupt.h>
    : ?( }$ t" M& ^3 G9 \  c9 x
  30. #include <asm/io.h>
    " u3 X/ z! `5 E
  31. #include <linux/moduleparam.h>) R' j7 a# Q; t+ M; c
  32. #include <linux/sysctl.h>
      y& X& v4 r& H4 f
  33. #include <linux/mm.h>9 O  E& `: B! q
  34. #include <linux/dma-mapping.h>
    - `& m( c, @* m$ d3 X: k4 a
  35. ; [$ t* a1 H0 f8 V9 B
  36. #include <mach/memory.h>
    ; Z+ e5 Z7 d* ~1 ^3 j/ b
  37. #include <mach/hardware.h>! e( j) h* O" L
  38. #include <mach/irqs.h>) w) \5 W( G6 s$ a- Y
  39. #include <asm/hardware/edma.h>" Y, ~( D3 y0 o* ]& e
  40. 2 \" `+ X' n8 e  L  {5 W
  41. #undef EDMA3_DEBUG
    " R& Y( k0 q+ ]5 J/ e) \
  42. /*#define EDMA3_DEBUG*/
    ! t4 C* g  d3 g: i! D: ]
  43. 0 b$ T6 z. X+ x4 ?- b3 c6 [
  44. #ifdef EDMA3_DEBUG
    & k% B' ^" Q. O, a7 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , \8 R4 E2 V4 w1 U* j) ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : a& R9 @# ^/ D0 E9 b* C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" N, ?5 ^+ Q$ ]8 J' u5 A% L5 y
  48. #else
    / c5 p# x" v1 N# o6 h1 T1 c
  49. #define DMA_PRINTK( x... )
    ( B. C7 R& y0 ]# g
  50. #define DMA_FN_IN
    9 S: ~4 F) {4 f- I2 t  m: d
  51. #define DMA_FN_OUT* e" T# K! e4 \& n
  52. #endif1 b) X( B, Y4 W; O
  53. 6 l5 C# b+ ~' |. X  U2 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 V: o' A/ P# j8 Y% q- Q
  55. #define STATIC_SHIFT                3
    9 v) n8 Q( [3 u& P: F  T* d
  56. #define TCINTEN_SHIFT               20) `3 L% V" r8 `4 \4 }  {
  57. #define ITCINTEN_SHIFT              21
    : @$ v, I: M5 w& A3 k& [+ o
  58. #define TCCHEN_SHIFT                22
    ! H: j' k$ p. T! |5 _3 n
  59. #define ITCCHEN_SHIFT               23
    : d; o* E9 _+ \* _; ]

  60. 1 g7 ?7 s( J4 q( E9 U* V
  61. static volatile int irqraised1 = 0;
    % X7 L1 H+ [! M! A0 k2 O; @
  62. static volatile int irqraised2 = 0;
    $ M5 G) T" d) h9 ?6 k

  63. * y! W. G: p% o/ \0 F/ k* [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 J: S8 A4 t4 R" u6 d' [5 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 T3 q" g" P. m% G' i% J2 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! e6 g# W: e% K; |% N; Y5 P
  67. : w1 K, C* B  r. A
  68. dma_addr_t dmaphyssrc1 = 0;. ^2 x) Z" l" L/ j7 f
  69. dma_addr_t dmaphyssrc2 = 0;2 d" ~- u3 [; G' e6 [
  70. dma_addr_t dmaphysdest1 = 0;7 ~8 |$ B, B. ~1 H) ^$ K" S
  71. dma_addr_t dmaphysdest2 = 0;4 f# z; P* \' E) p. q" x% q( Y
  72. : R/ C1 Q, {6 |+ \5 w/ `. \% p
  73. char *dmabufsrc1 = NULL;& t# t- p. S/ S8 \
  74. char *dmabufsrc2 = NULL;
      J" o# U1 d5 I- @
  75. char *dmabufdest1 = NULL;8 K" o3 A0 F3 L0 R
  76. char *dmabufdest2 = NULL;
    ! [+ r8 P" R6 U* n) Z
  77. 2 j1 \1 x0 F! Y/ j2 u
  78. static int acnt = 512;
    2 O7 N6 _/ V' K
  79. static int bcnt = 8;" S, ^. i+ u6 H$ j. U4 i$ H3 c, J
  80. static int ccnt = 8;
    1 z; D4 l, b3 E" s
  81. # s0 U* o# j' t  h# d
  82. module_param(acnt, int, S_IRUGO);: a6 Z5 J4 x5 {) p% [9 C
  83. module_param(bcnt, int, S_IRUGO);
    ( _. }$ W" V9 D0 H  W" ^6 N/ [4 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- h1 s, C* d8 h6 J
5 s+ @7 [* m. N5 d1 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( w$ o) q7 d0 `6 r' P2 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- k, G$ k; y, ~) _4 t$ q. _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' Q  b* z: u7 V9 y7 d! m1 w7 }3 f% N/ h' c" D- X1 R6 M- C

! |9 K/ E" R* c6 @/ Y/ Z7 N0 t3 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 03:15 , Processed in 0.041136 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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