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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% r6 V+ K) k! v
  1. [code]EDMA sample test application
    & B" r! O$ g, c( ]3 S
  2. /*
    9 n- E, |/ i( F- P9 C6 r
  3. * edma_test.c
    4 ~  ~: r" O  R8 m( |; d5 o
  4. *
    - r2 w7 g3 k" F# F# ~
  5. * brief  EDMA3 Test Application
    9 Q0 d. `! u# E; r
  6. *
    4 b+ D2 x( l8 ?' a
  7. *   This file contains EDMA3 Test code.2 s' o# n" O- S' \5 M
  8. *
    - ?. L5 u- t# b8 C# C' i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- `6 o2 C+ H6 P0 @/ t4 @' L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : w( e7 x' I+ W
  11. *         TO CHANGE.
      l0 |: O7 A. }- O* {0 H6 y
  12. *
    - ]& E4 m$ b/ Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' |  W0 E8 \9 B! [
  14. *
    " g; O4 \  J6 p9 y/ h- c' ^+ z4 p
  15. * This program is free software; you can redistribute it and/or
    , T: Z4 @8 o& p7 ?& h# c7 n
  16. * modify it under the terms of the GNU General Public License as/ ?  H& i" J  s
  17. * published by the Free Software Foundation version 2." |& X* {# c7 u4 }' \
  18. *
    " ~5 y; V1 V3 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 G7 p5 o* a( f* B( b. F4 h9 Q8 P
  20. * kind, whether express or implied; without even the implied warranty
    4 \3 K( d7 a! A! ?: k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & F2 s# o$ |; ?& P8 j( @
  22. * GNU General Public License for more details.
    0 J6 ^0 Y; z" a$ u$ x$ G5 a
  23. */3 v4 o0 i( M9 M3 O- n6 `$ E

  24. 3 n# Q/ T4 o, M
  25. #include <linux/module.h>
    ' c! b+ h( ?6 f/ a% R
  26. #include <linux/init.h>
    ( h' x" C5 v- R/ P1 Q
  27. #include <linux/errno.h>- J) k: w6 ]% v* v% T, u9 u
  28. #include <linux/types.h>
    7 F5 ?* S, G# K# h
  29. #include <linux/interrupt.h>
    $ q* t/ b* |. F( x7 C: w6 c
  30. #include <asm/io.h>
    . L  t8 O! X- A
  31. #include <linux/moduleparam.h>% m1 {, H: g( `& |4 Z& q
  32. #include <linux/sysctl.h>
    , i3 [+ K+ W! o; D1 B
  33. #include <linux/mm.h>
    % u1 T; S$ C& q6 C
  34. #include <linux/dma-mapping.h>8 J0 ?, \- k0 s7 W; f

  35. 4 F2 J( Q8 I6 Y5 d0 [0 q
  36. #include <mach/memory.h>
      u* Z2 N, B/ `  \$ P* C- h% D
  37. #include <mach/hardware.h>9 ^* y5 V1 ~/ h) O0 [
  38. #include <mach/irqs.h>* V1 l0 R+ [; s* B' s$ o. r& j
  39. #include <asm/hardware/edma.h>
    ( g2 C8 h( x- Z7 B  }/ R

  40.   K4 [4 l" e2 X3 s: r9 u( w' J
  41. #undef EDMA3_DEBUG
    & @& S2 x' E2 C+ Y5 t
  42. /*#define EDMA3_DEBUG*/- p: k2 f- K1 r

  43. + W- p$ o; w0 @3 `, r4 \
  44. #ifdef EDMA3_DEBUG3 P. @& {5 P3 D$ c4 B& J1 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). }2 i+ {& K" y6 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 o: y. a* M$ k3 [+ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' M( l3 _5 b, \# L  l! H
  48. #else
    ) [2 b9 \5 a3 w
  49. #define DMA_PRINTK( x... )1 D8 F% F% O1 K, D" P! L. b0 `
  50. #define DMA_FN_IN
    ! z, {* p  J( a! m
  51. #define DMA_FN_OUT' U% I: Y# ]( G
  52. #endif& |; {/ N3 @. \- g3 w
  53. ' }; Y5 W$ D1 G8 O+ ^$ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" v4 h0 |; }- f  g$ {- S, o
  55. #define STATIC_SHIFT                3
    ' T" u* Y0 a/ J# c( H& }
  56. #define TCINTEN_SHIFT               20
    6 _6 n4 B" H2 a5 _: v6 \
  57. #define ITCINTEN_SHIFT              21& b3 ]9 ?4 j5 B2 B
  58. #define TCCHEN_SHIFT                22
    * @3 {4 e# ^$ H! b: A3 n% H  P
  59. #define ITCCHEN_SHIFT               23
    ' ]1 `" R1 n+ O5 v# @/ O8 U

  60. ' D! e1 C8 z8 \! k+ R
  61. static volatile int irqraised1 = 0;! X! R& q' k1 ]8 u% h+ H7 [
  62. static volatile int irqraised2 = 0;
    * X2 I9 p( e5 M" d. R! y- g
  63. 4 |- ]5 Q/ K( m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 G& K! p4 J4 [! q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % H* L+ w  F. q7 A7 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p" Z" ~0 E* C4 m. C
  67. & R9 B/ ?, @+ I' y6 I9 r. |) y4 M: E
  68. dma_addr_t dmaphyssrc1 = 0;
    2 Y4 o# s* d  T( p+ ~7 l& S' L
  69. dma_addr_t dmaphyssrc2 = 0;
    # c$ a# k/ H- ], ^5 H3 s
  70. dma_addr_t dmaphysdest1 = 0;
    ) W* N# V, p, f
  71. dma_addr_t dmaphysdest2 = 0;/ h5 {# [8 W& a% s: c
  72. 6 K2 `5 @) J4 g5 d# z* \" _
  73. char *dmabufsrc1 = NULL;
    ! g9 ~, n& K' a9 v/ o1 n; `2 H
  74. char *dmabufsrc2 = NULL;* P% _. C# M: `1 X
  75. char *dmabufdest1 = NULL;* T7 G2 b7 P% j' V' g5 c9 l
  76. char *dmabufdest2 = NULL;& k" d7 q# g) G: _
  77. / `( C) |% H1 E! Q6 `" [
  78. static int acnt = 512;. _& F6 w* _8 i: N5 O* T) E: C+ v
  79. static int bcnt = 8;
    " U9 b7 S& F1 m" T
  80. static int ccnt = 8;
    ; {4 }8 x; c8 _- G+ K" X

  81. ! i5 c0 [2 V9 G. X1 D9 m/ b
  82. module_param(acnt, int, S_IRUGO);8 ?7 Z; |5 N" C9 I- k' L
  83. module_param(bcnt, int, S_IRUGO);2 h9 g. O3 c$ \: f  H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ q; x" D" }* i( i, t. D: Z% \  b6 X% r) a" Q2 a/ z+ a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Q9 r# e: h" [6 i. l: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- s3 W+ N. Y7 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N# L4 t' p% s- E) H

. j4 A* F; A  |9 J2 U0 x$ E. ~4 ~% u! f5 r9 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 12:29 , Processed in 0.037111 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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