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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 ?) |' f6 q1 T: q9 T& E
  1. [code]EDMA sample test application
    2 A+ v  s$ R1 w1 {- Q" T
  2. /*
    + l+ _' L. Z" U( f0 F) D( G8 V
  3. * edma_test.c
    5 H% R! Q: [/ \7 O+ }: o
  4. *: L; J8 I: s5 j- b
  5. * brief  EDMA3 Test Application
    3 S$ _" Z1 t2 Q/ A
  6. *
    ) D( F  W& p+ x5 N- J& D* m
  7. *   This file contains EDMA3 Test code.7 @9 j& P& h/ l/ o4 a( g2 `* g
  8. *. K2 j! T8 n8 d! f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' P$ b- g9 W* y. L5 M& U0 ^0 }6 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 N+ V% [. P) t0 C5 V3 E- O
  11. *         TO CHANGE.
    6 B0 O' k! S6 g/ D5 Z3 x
  12. *
    4 G  }, d" T$ l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( r* z8 ?* R7 `% b* N9 {& d
  14. ** E# |0 I8 x" c3 e
  15. * This program is free software; you can redistribute it and/or3 J7 c1 ~9 ^. V7 H
  16. * modify it under the terms of the GNU General Public License as3 s! P1 P: ]$ @8 r7 c3 B* f! |! w
  17. * published by the Free Software Foundation version 2.
    . |4 |) M% e- q  U0 g+ w0 g
  18. *
    * g+ a3 Z# M7 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ^* J! c/ P& V3 d5 F( q: |$ y
  20. * kind, whether express or implied; without even the implied warranty: r4 F1 F9 e! }4 c# o% G6 F3 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . Q0 @+ v$ t4 T& a3 t0 y: J0 Z
  22. * GNU General Public License for more details.
    2 U  [& b: P! H+ |3 }  q, B% B
  23. */
    3 p  j! k0 o' t  l6 L

  24. " v4 R& s' Y; L" t4 G  m" v
  25. #include <linux/module.h>
    ( e* [$ M, K1 q5 r$ T  _( e
  26. #include <linux/init.h>
    - ]5 k% B( @! V) O
  27. #include <linux/errno.h>6 f4 z- M; M$ q" A- D
  28. #include <linux/types.h>
    7 m6 t- J/ D0 w" W1 I/ g
  29. #include <linux/interrupt.h>
    8 A+ O/ R- r9 E$ H4 h- D, L  b
  30. #include <asm/io.h>
    ' E0 t8 f7 k# `% ?7 h" g
  31. #include <linux/moduleparam.h>$ d- [/ e) L# {
  32. #include <linux/sysctl.h>* N5 `8 \# G& \7 Q2 M* p
  33. #include <linux/mm.h>
    " C. N! b2 ]5 L( D2 w, |6 N
  34. #include <linux/dma-mapping.h>7 L& R/ t' ?) ^( j6 ^3 n2 c

  35. & y0 G7 p: e+ \& c% O
  36. #include <mach/memory.h>5 i( R" Z5 e5 j
  37. #include <mach/hardware.h>
      R) W, N% _3 I; n
  38. #include <mach/irqs.h>
    6 T' E# P0 Q" p6 |- l3 M* ]
  39. #include <asm/hardware/edma.h>% k1 F. ~& Z; P) t0 z) G4 p% v
  40. 9 _2 I3 B0 u+ Y4 A* g/ U% R
  41. #undef EDMA3_DEBUG; N/ s3 _) ]5 N7 \1 \: }' B
  42. /*#define EDMA3_DEBUG*/
      T6 X+ J9 a1 K. p7 b

  43. 8 r% w5 X- h3 d) W0 ^, _7 u
  44. #ifdef EDMA3_DEBUG# [7 e) H& D7 w; n. A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; R0 N+ b- F" k  K# p( q6 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) z* f2 K9 \# P' @8 |/ `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 n3 ]7 b7 \4 z- K9 s; f$ v$ y
  48. #else" L  J2 j3 h& l8 K# J
  49. #define DMA_PRINTK( x... )
    - m% W2 V2 C8 ?6 I; Z3 J2 Z5 _
  50. #define DMA_FN_IN) \  {! U( A. `/ Z7 s: F
  51. #define DMA_FN_OUT7 j1 I! U- s+ P. o1 L
  52. #endif+ s4 o$ y3 K  B" U8 V
  53. ) z) H, s* a. R! E, f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 m2 g% N) V2 E0 }/ }
  55. #define STATIC_SHIFT                3
    % I9 M# s6 r- ~* S. F3 ]
  56. #define TCINTEN_SHIFT               20* u' y. M( M% ~& L! P/ a: ^8 g
  57. #define ITCINTEN_SHIFT              21
    & k$ T9 c0 l5 @# [
  58. #define TCCHEN_SHIFT                22; O$ u5 S( c; N, F& |
  59. #define ITCCHEN_SHIFT               23
    ) g/ I4 @  {2 L; c% E1 _

  60. + @7 ^7 M$ {, b" p% O1 r
  61. static volatile int irqraised1 = 0;
    + N% I1 L) T0 H. [& S9 h4 W
  62. static volatile int irqraised2 = 0;
    8 t4 @( G$ i" y( p% V
  63. 3 z4 w' ]9 B* e3 [5 A9 u& {+ {2 b: r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 w& g& i1 }/ h; t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; V  u2 l: T3 Z/ }8 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c, I* d. j9 ?: Q* n; D

  67. + E" t: d" n( v$ X
  68. dma_addr_t dmaphyssrc1 = 0;, s3 O- i, V# R- z: }5 `' ~. L
  69. dma_addr_t dmaphyssrc2 = 0;. V: r; L" h9 w) Q, s3 A' k2 {
  70. dma_addr_t dmaphysdest1 = 0;1 b( W% {2 t$ {. F$ x
  71. dma_addr_t dmaphysdest2 = 0;1 p+ N' g& t) I3 M

  72. 8 i9 n) n" Y) o
  73. char *dmabufsrc1 = NULL;6 i3 ~3 t% o" a# N" Y
  74. char *dmabufsrc2 = NULL;; I+ ]6 Y* M4 ~: F3 f" f
  75. char *dmabufdest1 = NULL;, [% O2 k7 \' N) d8 u
  76. char *dmabufdest2 = NULL;
    2 @6 \3 ~/ [& a- O% t. q- o# r
  77. / @8 F3 b% r. V* z2 C
  78. static int acnt = 512;
    ; p& t# X. r+ p/ f1 Q  S
  79. static int bcnt = 8;8 |- M! F( Q" ]8 j
  80. static int ccnt = 8;
    % w/ Z, t8 A3 D3 r) v9 I" v) N  t
  81. ; B2 e9 Z2 z$ I* f
  82. module_param(acnt, int, S_IRUGO);
    ! e1 ~" ~4 t- |" Y; _6 o% S
  83. module_param(bcnt, int, S_IRUGO);4 s) \2 z0 r, q0 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 t# Y* {' ?/ P2 L2 Y5 f
+ ~0 ^' K$ X, S& S: v; J4 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 c( N6 z" Q! E1 E' b) f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 B1 n5 G, _  m: k5 M1 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 n2 i3 B8 s& k
. I4 c/ `! ?3 H& L, w
2 f, v( {: i' i8 ]# [( X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 10:12 , Processed in 0.046314 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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