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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 Q9 h" L4 J3 L/ f9 P% j: ?/ ~
  1. [code]EDMA sample test application
    8 P9 i9 F& l$ n  W5 W
  2. /*
    0 |0 |8 z' E8 a0 _1 I3 A
  3. * edma_test.c
    % V' \! m0 X% Q# F$ t
  4. *. P9 C6 H& d6 e) L& R8 D
  5. * brief  EDMA3 Test Application
    # @# w' Y. y  Z) X3 v
  6. */ D( r8 D$ [$ x  M& f
  7. *   This file contains EDMA3 Test code.
    ' K9 A& y) N8 F5 J* W% V4 S, x
  8. *
    6 O  x$ O+ i" B# T2 w5 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + Y, d$ O6 M0 d, J7 x3 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( s# I" m/ Z/ A6 d
  11. *         TO CHANGE.% R' i- g( ]# `7 Y0 o! p9 |- V2 d
  12. *  ^  J7 d2 S9 j  D6 S# R* T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' G! }+ Q- z& S* [- F* `. f7 M/ q! N
  14. *8 `/ U6 B- w2 ^3 f3 e# @; o1 \  k8 Y" ]
  15. * This program is free software; you can redistribute it and/or
    1 g' _& O1 g& ~) b0 @* ^* [  h- _
  16. * modify it under the terms of the GNU General Public License as+ ]. [; I9 \6 v, v  z- r
  17. * published by the Free Software Foundation version 2.
    , z) \2 i8 @2 Z3 R8 A
  18. */ T. L3 K+ V( e2 _3 q2 T5 h( q8 C. Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & |* M1 x; D+ a3 i5 q; k* A) P
  20. * kind, whether express or implied; without even the implied warranty
    ' t8 W* h* c: B# C# H) R  h5 b  u1 P2 X* i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ B# W4 _) U7 L2 f  k4 D3 C
  22. * GNU General Public License for more details.
    $ k3 ^" w( d+ O/ B) D
  23. */8 M# ^! J5 y" u3 O: Z3 }) X: D4 ~# T$ h

  24. * z' |, e$ G- w0 o
  25. #include <linux/module.h># s8 {8 i1 Y# J: }
  26. #include <linux/init.h>: s5 `- y2 T+ l. t' [2 Z9 f
  27. #include <linux/errno.h>
    ( U& S( X. Q4 ~$ e5 W) A
  28. #include <linux/types.h>8 g, @3 W( G( v# l8 b
  29. #include <linux/interrupt.h>) |3 G6 B0 \  c* E. |& S" \
  30. #include <asm/io.h>
    ( f  M1 B7 q8 q7 z: Q/ t6 b
  31. #include <linux/moduleparam.h>% Z6 O" U2 X/ l8 i1 z
  32. #include <linux/sysctl.h>4 g! T# G# L" X3 y- x, U
  33. #include <linux/mm.h># o2 [, k1 H# L" h4 S0 b" `
  34. #include <linux/dma-mapping.h>
    1 z4 d4 a4 x  o" b3 `8 q$ I

  35. & g( x* d0 ]! P
  36. #include <mach/memory.h>
    7 v4 ?# |- w2 M# Z0 @
  37. #include <mach/hardware.h>
    % T: p+ J0 a8 ^" o- L  Y& @
  38. #include <mach/irqs.h>* C0 k- e) O& q% [
  39. #include <asm/hardware/edma.h>
    2 b) Z3 h3 P6 _+ [

  40. " q( h8 l9 Y3 V
  41. #undef EDMA3_DEBUG
      t, Z" F; P1 ?, l7 R/ A% Z0 v
  42. /*#define EDMA3_DEBUG*/
    + U8 o5 E$ l+ n7 j% N# x  K- B! `
  43. + @- i. {& i4 w8 N) b% E
  44. #ifdef EDMA3_DEBUG
    5 V: k$ h+ w$ J" [7 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 S' Y; Y/ k( B- {! e" p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* @. U9 Z  I) X) D! H8 r$ `7 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * ^) K, F: j: `
  48. #else
    ! P* ?7 \- ^1 y1 G
  49. #define DMA_PRINTK( x... )
    0 c9 ]& }& ?* x4 d* {- n7 T
  50. #define DMA_FN_IN
    $ ?3 S4 m' }: ^8 S: z) z2 h! J. D
  51. #define DMA_FN_OUT  _& o6 M3 n  G. I! f
  52. #endif
    2 X7 ~  N6 C8 _) t; l: v: `1 P
  53. , V7 q3 p& L! o7 T' V. H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . }5 |' M' k* f" x8 }& L4 c% G
  55. #define STATIC_SHIFT                3
    0 u. o6 x' ]4 f! _3 \
  56. #define TCINTEN_SHIFT               205 |6 q! h6 s) |7 X/ u* V% C7 ?; g
  57. #define ITCINTEN_SHIFT              21
    * L1 {8 Y7 n! s1 v; J6 z+ f
  58. #define TCCHEN_SHIFT                22
      s9 W6 E7 Z9 V: ?( r) {# K
  59. #define ITCCHEN_SHIFT               23
    $ m; k/ i" S' U4 o
  60. ' r" E- X# ~5 Z
  61. static volatile int irqraised1 = 0;
    * ~+ j" j1 J2 u4 X) G
  62. static volatile int irqraised2 = 0;6 a/ X% S, H# {8 [7 _* A5 Y
  63. + X7 b  ?5 w8 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Y: P1 ]" \3 N, c& J/ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 `* D% ?: `) K- |3 M4 R6 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / n7 @  K" U% M) T+ h; j
  67.   G* v8 @% p+ Q& o; t
  68. dma_addr_t dmaphyssrc1 = 0;& d: Z  g6 @! o/ r
  69. dma_addr_t dmaphyssrc2 = 0;/ K5 w1 Q9 b" |4 _, s7 }
  70. dma_addr_t dmaphysdest1 = 0;
    ; q& U, }- d; A9 s! s* t0 H
  71. dma_addr_t dmaphysdest2 = 0;
    ; K" G* v+ F% e; D2 _5 q

  72. 7 {! p6 Z& w8 U' I& n- l* T
  73. char *dmabufsrc1 = NULL;
    4 V; }0 Z! K8 H6 n2 M
  74. char *dmabufsrc2 = NULL;
    2 u' ^3 B( b* Z3 z# J: P. ^* c
  75. char *dmabufdest1 = NULL;
    8 C0 m. q' W! [1 G7 R; k2 R+ }; n. [
  76. char *dmabufdest2 = NULL;: g* e2 }+ s# W& w; @3 [

  77. & ^* \. b7 N+ i' o, m# D
  78. static int acnt = 512;, _% v0 Y9 N% G$ O: s- |4 ~- U5 l
  79. static int bcnt = 8;
    - H2 l/ H2 ]1 z: G
  80. static int ccnt = 8;( C. l& Q/ F* j

  81. 2 B: ^3 K+ @5 I' L% ]; W
  82. module_param(acnt, int, S_IRUGO);
    0 m$ J/ f, E7 A9 f$ `  h
  83. module_param(bcnt, int, S_IRUGO);
    ; J' B5 ~% E  Q5 v# n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 t& u( T4 I9 ^0 H5 k7 c
6 Z' ]8 c9 z- e' l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 D& l* U  Q, U- {6 ^0 U$ larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! ~7 L) @7 F& I, W* n0 Y' n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' e, l2 q1 P+ {
) Z' m+ q+ u0 Q+ }! l5 [; R
% }8 C! u' l) ^0 V& Q: Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 13:36 , Processed in 0.040022 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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