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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  W8 k. Z# p$ W) y; d
  1. [code]EDMA sample test application: Y: n# C5 j) _, {$ ^
  2. /*
    . C; ?: u+ U6 c( S( M
  3. * edma_test.c2 X& t- o- C- [+ _0 [; ~) T5 a3 @9 E1 {
  4. *
    ( p, V* D  I9 q( Z
  5. * brief  EDMA3 Test Application& r! ~) M! H% ~4 ]
  6. *
    * i% G! U6 C# o9 ^
  7. *   This file contains EDMA3 Test code.
      ], [0 F' l+ Z# k" G, f
  8. *, K. C1 }1 y2 S# I' E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" s% G$ r1 w: K. z! b' f  V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / d. G9 A5 \3 ]$ p% t1 [$ T
  11. *         TO CHANGE., s3 j1 M/ @; j# g" W# F8 B
  12. *
    3 m& j( @9 k8 I" M; x6 @' ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  M3 Y; U, l; l2 ?9 U3 c, y; l
  14. */ j4 Z6 a5 C6 u
  15. * This program is free software; you can redistribute it and/or
    % H  J0 l/ ]6 X( x& V4 i
  16. * modify it under the terms of the GNU General Public License as6 [" J  I5 v  v: q% d
  17. * published by the Free Software Foundation version 2.
    0 Z1 Z4 [# e6 K; T. m8 X+ K; V
  18. *
    ) X& T$ N' }6 Z0 w" ?0 q* x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; }* A8 b  S% j9 c
  20. * kind, whether express or implied; without even the implied warranty, `! }# H- m2 J0 O5 G! }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 h* ~' k1 j+ \5 T
  22. * GNU General Public License for more details.
    % Q% J$ o( m" `9 b+ U( M
  23. */; R. N# {4 R4 _

  24. 1 q' l0 \% T3 c9 x7 T& C
  25. #include <linux/module.h>
    ! o) b2 f% \! _# R0 H3 s
  26. #include <linux/init.h>+ W" y' s* k; f4 y; }7 H1 t
  27. #include <linux/errno.h>) H" g+ Y5 A3 w/ ~
  28. #include <linux/types.h>  D# K3 L/ l$ a/ a5 F% }) P
  29. #include <linux/interrupt.h>
    4 y8 d. s; W7 A
  30. #include <asm/io.h>
    ; x6 s/ v  ]% q
  31. #include <linux/moduleparam.h>
      v; O8 J2 l' R3 k. p9 ?: ~
  32. #include <linux/sysctl.h>! ~0 w% f  D, P
  33. #include <linux/mm.h>
    , _+ f& o8 U5 z9 B) U
  34. #include <linux/dma-mapping.h>
    * q4 ^' u7 c4 `5 K
  35. : c; T7 p' F; W. m$ ]& E+ s, M8 e
  36. #include <mach/memory.h>! Y. V8 G8 u$ K
  37. #include <mach/hardware.h>
    7 s: Y  N# g' {7 A* `
  38. #include <mach/irqs.h>
    " V5 j' w6 [% A+ T4 d
  39. #include <asm/hardware/edma.h>- ~1 g  X" V/ N4 s' `( _

  40. ) i+ g, S/ l) G& d; A
  41. #undef EDMA3_DEBUG0 |1 }- j4 |6 ]
  42. /*#define EDMA3_DEBUG*/
    1 r2 o0 ]2 z) Q6 v, n

  43. 4 U1 H) R4 y7 V  E0 m* J$ ]
  44. #ifdef EDMA3_DEBUG1 }8 |" G4 r6 `$ p# S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ^: h' F" t5 v7 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 P2 a$ p5 X# F/ n3 k6 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ `2 j; a8 K) G7 \# `* e' ~
  48. #else8 }6 F/ s5 @% n! _$ e5 q. ]0 O
  49. #define DMA_PRINTK( x... )$ y6 a3 W& m2 \( ^- P
  50. #define DMA_FN_IN
    8 O* y1 j& F0 r7 t
  51. #define DMA_FN_OUT# c& Z; p: N1 m, `1 b
  52. #endif
    ! W* i0 g$ f7 g6 {; z" ]
  53. . a3 S5 W* S: a2 B# }3 s0 @  X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , M- E9 H5 u' O0 ~& P, S; q
  55. #define STATIC_SHIFT                3
    / Q' c0 w) h# E. T$ K! |/ ?
  56. #define TCINTEN_SHIFT               20
    3 P) G6 q3 @" d; z8 F0 X$ Y" ?$ V
  57. #define ITCINTEN_SHIFT              21- o! f, s& F' }+ b7 r3 l
  58. #define TCCHEN_SHIFT                22
    3 Q7 q' b; q3 H8 c- H
  59. #define ITCCHEN_SHIFT               23* ]' I4 B0 r6 o' E5 b

  60. * c; u2 P5 I* P7 t* v8 a
  61. static volatile int irqraised1 = 0;# q4 W. z; q# u9 A4 c
  62. static volatile int irqraised2 = 0;$ B# D3 v0 f8 V7 ?" @
  63. / Q& ]3 R7 W% H2 ^9 y, }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 j& |0 z/ z$ [7 c+ L2 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L6 D6 T% a; T7 m# J6 \; U( c1 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 E1 ^5 E. @1 E8 i
  67. % Z! t/ V0 r, q7 ]' B8 M7 a
  68. dma_addr_t dmaphyssrc1 = 0;" ^: o, F) |" z. T: S
  69. dma_addr_t dmaphyssrc2 = 0;
    - P4 W* t. k( u8 ?: b* i5 m
  70. dma_addr_t dmaphysdest1 = 0;
    5 r& \5 W* e) m! K5 J6 K) }, a
  71. dma_addr_t dmaphysdest2 = 0;& C& ]0 R/ m. W  ?

  72. / m7 ^- l- ~: P/ ~, A. }
  73. char *dmabufsrc1 = NULL;& z) N, @$ o9 l* i7 L
  74. char *dmabufsrc2 = NULL;
    , E1 _" {& g  p1 |  e0 [
  75. char *dmabufdest1 = NULL;. e' _$ C0 O% `  B' U" g+ `
  76. char *dmabufdest2 = NULL;
    0 e  L/ J# [  l# P

  77. & E* g% p/ j# P  I
  78. static int acnt = 512;
    1 E: d# R4 E( h2 C
  79. static int bcnt = 8;
    8 V, v  A9 y3 g% d( R; l; X* H4 T
  80. static int ccnt = 8;* K+ Q7 u& F& |0 M* w8 g

  81. $ {% @% w+ }8 r; N, M- K  \
  82. module_param(acnt, int, S_IRUGO);8 F0 C) }$ P3 ]* g' r, L- k
  83. module_param(bcnt, int, S_IRUGO);; h! |7 L8 x1 k% C4 K# t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' D  \% u5 ]6 F9 d! M- m& t) u: L/ R/ W  Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Q2 {4 J# U/ \; p+ ?7 @7 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& y6 k$ y: n9 A& U; n' c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 u% O: ?+ f+ B, S: N% U" R4 D6 n, L1 s9 ]% P
1 E3 b- N; R6 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 23:29 , Processed in 0.041765 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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