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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * }! l- ?3 w$ l! f, T: v
  1. [code]EDMA sample test application/ f' b* u8 s" B2 {. m/ H) ]
  2. /*  g9 _6 f9 G' H- t
  3. * edma_test.c
    0 Z  E) Z' e, M( R' i. M* C
  4. *4 u3 v* Q! ^; y5 n; W
  5. * brief  EDMA3 Test Application8 ^: T* H0 g4 J) \3 I
  6. *
      n6 H3 G& U1 E4 N5 a4 u; z9 w
  7. *   This file contains EDMA3 Test code.6 ?. L) d0 Y# a5 P1 u
  8. *! B% K: h  m' |; \5 j! G% Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . n4 u5 a6 n( I1 i: [8 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 R6 e2 G" k1 Y8 F& k( d0 t, W" N, D
  11. *         TO CHANGE.
    8 `# Y) V1 h! T& s! v6 j
  12. *
    ( V7 Y9 v2 h2 @2 X3 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 {! ^% W0 {# l6 @
  14. *
    ( ~+ F3 Q) J# h0 |
  15. * This program is free software; you can redistribute it and/or1 l) `2 F- y' b" G, A0 w1 f
  16. * modify it under the terms of the GNU General Public License as; c8 L' M! e7 V+ X
  17. * published by the Free Software Foundation version 2.  K2 `% j* G( E! y
  18. *+ S2 o3 W2 V9 m3 `3 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 b' u& ]4 P. a& o2 C' n
  20. * kind, whether express or implied; without even the implied warranty
    # U. P; r  v* N( ~( t. n7 ]/ U6 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& w' K7 ^, r* j2 U* Y
  22. * GNU General Public License for more details.* P% |8 E0 q! h" R
  23. */7 f" P  ~1 O. C: a) {' b2 {
  24. + i( S; V8 ^! I# n; E
  25. #include <linux/module.h>( ~7 V" C0 ~" t  h) f: ?
  26. #include <linux/init.h>0 q! Q4 _- H" [8 W9 O
  27. #include <linux/errno.h>
    ! k1 O- x! X+ o. {) i6 R  x3 s
  28. #include <linux/types.h>9 X# e3 f  n  R$ `( Z" J$ C* Q
  29. #include <linux/interrupt.h># B- k$ Y8 _/ Q( ?
  30. #include <asm/io.h>
    3 ~  t. e9 C4 ~1 W
  31. #include <linux/moduleparam.h>2 u; n5 c: C0 o& K7 F
  32. #include <linux/sysctl.h>
    8 |7 A! _% S! a; d% ?, o
  33. #include <linux/mm.h>: A! [4 X. u3 `3 Z2 A; W
  34. #include <linux/dma-mapping.h>0 E0 N4 M/ b' o! Q) o2 g, V; r
  35. 3 G- }- G: E. i0 O  u: u
  36. #include <mach/memory.h>7 r$ M1 U: o3 \" g* o5 C& F
  37. #include <mach/hardware.h>
    $ c$ X) _( v7 ^' c) _+ ^
  38. #include <mach/irqs.h>
    . C, b  p" P$ ^' y
  39. #include <asm/hardware/edma.h>, t8 t. {9 ~% M+ K$ R& L$ ?

  40. : e8 k0 W1 I" e$ K$ G
  41. #undef EDMA3_DEBUG
    : r3 }! n+ V4 }& F) G0 F
  42. /*#define EDMA3_DEBUG*/. z2 h9 v1 J( b' ~

  43. ) ~2 |# G- T3 X0 f+ N
  44. #ifdef EDMA3_DEBUG2 A1 g" j* T# N9 P+ v" v# d( R- G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 a& ]2 @6 ?( D) J: |* \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) q& s0 h) ~) u) q2 q' H& z5 T# W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 @; ]- R' D4 j! c5 @$ ]- r8 l; T
  48. #else
    ; D2 S7 g) X& _
  49. #define DMA_PRINTK( x... )
    ) P! d) ~( Y' Q+ K- z: _
  50. #define DMA_FN_IN3 o, s! ?. F4 D- m4 e. D, q% ]
  51. #define DMA_FN_OUT
    6 P6 ]# q( W% F/ t
  52. #endif/ F# W/ _+ a5 v) p. f- N( T4 f

  53. & k$ H9 }8 z6 ?0 V5 {* t1 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 f2 U' o) P# r
  55. #define STATIC_SHIFT                3
    # c* G& A# ^6 Y) X0 a" _, d) U& t
  56. #define TCINTEN_SHIFT               20
    , l  D3 s; r" |5 B1 t: ~5 g0 p" Z
  57. #define ITCINTEN_SHIFT              21% u; _7 N5 o1 c
  58. #define TCCHEN_SHIFT                22
    6 N/ \' H) _0 x5 H2 a
  59. #define ITCCHEN_SHIFT               23" t# g2 ^6 k$ g6 o* t8 Q. H
  60. 1 c. P9 ?: o. M7 F! j) |4 q
  61. static volatile int irqraised1 = 0;
    " ?4 ?! `' j9 J  W& D
  62. static volatile int irqraised2 = 0;
    ! k7 j% |/ c9 S: d4 \

  63.   {+ @9 B& {0 F7 }1 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, P: s% |4 p/ h3 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ U$ @: F, v+ t! `- \$ a% |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 n( Y# I# J# y. a

  67. 3 ^! C7 W$ [2 d# x7 b1 s
  68. dma_addr_t dmaphyssrc1 = 0;
    2 o$ q: o8 r1 k0 V/ h
  69. dma_addr_t dmaphyssrc2 = 0;
    4 X$ w6 x) s0 u+ J$ P! D6 o! A
  70. dma_addr_t dmaphysdest1 = 0;
    8 v; Y- o7 W9 k5 k
  71. dma_addr_t dmaphysdest2 = 0;
    . _% H' P" X* R# M

  72. : q* p# M6 c( ~5 V% n: `4 v8 Z& }5 O' C
  73. char *dmabufsrc1 = NULL;
    2 m! `' I+ _' y; |& b/ [
  74. char *dmabufsrc2 = NULL;1 @3 x' o6 N) \9 I
  75. char *dmabufdest1 = NULL;
    , z5 |& \! b( h, \; m" U; T
  76. char *dmabufdest2 = NULL;3 L* s# m$ [7 L  q
  77. ' [" U, X- M" F# E8 d
  78. static int acnt = 512;
    $ S  q, e3 v" c$ ~. G9 i% n+ y# |
  79. static int bcnt = 8;: M  w" A) V  _' B0 G. x
  80. static int ccnt = 8;% s. i' A2 U0 T2 C; c- L; f

  81.   ^3 H" q# P6 A2 Y/ `
  82. module_param(acnt, int, S_IRUGO);: g/ G" b/ J0 O& j1 r% Y* Z6 v
  83. module_param(bcnt, int, S_IRUGO);
    0 p2 o& \5 i& r3 @6 G! r2 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 x9 b) @# @6 U* D1 g7 k; G/ |, a! N( M3 t2 P" X2 n( f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% U7 \8 ^( @% E; Z0 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 s3 c4 ^/ @" A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% b& C! ^+ l- w) U: N6 }* V4 c

$ {6 {' L8 J' R0 R. z9 ~9 g
  A/ e. Q# ?& N- t5 d$ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 09:40 , Processed in 0.045007 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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