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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F7 d; z" P( d  S% a# q. }
  1. [code]EDMA sample test application4 k* W/ A& @% D+ i1 Q) r
  2. /*8 R% ]" z! ]* L; E/ s' L/ w
  3. * edma_test.c1 c' t5 J! N% R$ @  r. `$ W, y
  4. *
    * a6 \# K1 p. c" ~4 D
  5. * brief  EDMA3 Test Application
    * w$ n5 x- x3 Z# [# `8 V0 |+ x
  6. *
    0 p( G0 g( h% S/ r1 |
  7. *   This file contains EDMA3 Test code.
    7 r9 K0 j) [5 o1 t1 H
  8. *
    8 a  V1 X. E- S4 |, _$ J$ x- v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ]3 U' L6 M; ~8 c( T, M$ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B; X" q+ l7 a' e1 q
  11. *         TO CHANGE.
    ( ^4 r, |" A7 P5 j+ W3 K4 l
  12. *0 G# W) ?6 z* J* M' S& H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: X  \- J8 k5 F6 C! R. }) Y
  14. *
    9 [# n; v4 o. p  z4 S3 e% t( j2 O
  15. * This program is free software; you can redistribute it and/or! I& b, L( p( m2 U4 g3 a
  16. * modify it under the terms of the GNU General Public License as/ j  T1 g3 }2 W' v! \
  17. * published by the Free Software Foundation version 2.. Z( k4 B, ~6 r3 t: N: [
  18. *: w( Z% y% Z+ R+ _. D2 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 g7 w( N7 L/ H2 ]
  20. * kind, whether express or implied; without even the implied warranty
    0 a' R' t8 ]" z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % ], Q  c' w& ?4 B  Y3 n1 y
  22. * GNU General Public License for more details.
    ( S: j$ \5 C% p3 i. U
  23. */
    : ]4 C# e" d' k8 X$ l+ \

  24. 5 Z  n: R1 |$ c! V8 x- {
  25. #include <linux/module.h>
    - _7 ^4 x: {0 A2 G) n. v
  26. #include <linux/init.h>
    , X" I, z+ J& g3 l
  27. #include <linux/errno.h>5 v8 ?7 o; }6 q6 [8 p% b0 W8 T3 {+ U+ f
  28. #include <linux/types.h>- L3 Y: t8 k9 p) C8 Z
  29. #include <linux/interrupt.h>5 U3 M0 P0 }5 O! o$ o
  30. #include <asm/io.h>
    & W7 I- P2 r) x" b% D
  31. #include <linux/moduleparam.h>
    ' k3 B! }  }" s4 [$ z; d
  32. #include <linux/sysctl.h>, {% `6 f2 o% L0 N
  33. #include <linux/mm.h>
    , o% E7 F( v8 k; G( i# `
  34. #include <linux/dma-mapping.h>
    ! J  O4 ]0 v1 S" y

  35. 1 [5 @6 O' ?7 Z# J" _8 Z
  36. #include <mach/memory.h>
    / C# L5 ?8 [5 v' ]0 q
  37. #include <mach/hardware.h>
    2 q& a1 _( a$ s+ S: @  H
  38. #include <mach/irqs.h>; m0 @% h9 d6 f( a3 c9 t, q
  39. #include <asm/hardware/edma.h>
    . s9 i7 r) h/ P( Z

  40. ! j9 |  U; e' D6 O7 I, w
  41. #undef EDMA3_DEBUG6 c6 p. O; f/ V# A
  42. /*#define EDMA3_DEBUG*/' m, I5 ?9 W" W+ D2 e
  43. ' }" m; s; @' u) |$ [9 e5 m# \" \. B
  44. #ifdef EDMA3_DEBUG* l: z/ Y" b' V2 \% d" H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- h4 ?- D6 j* X! j+ m- p8 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a9 x6 A: x6 K8 b8 v1 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 P: A! \, \8 c3 I- H
  48. #else
    ' W5 S# o4 w  H6 ?) f
  49. #define DMA_PRINTK( x... )3 [: s% e& p/ H. V1 M
  50. #define DMA_FN_IN
    8 q; ?9 D% q, \3 h  q% P7 k) v
  51. #define DMA_FN_OUT
    1 J$ Z. y; R  w
  52. #endif  r) v8 U/ f; k1 l' x" }4 Q: q, g' K

  53.   E# c, a, D; x/ [1 _) R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 J3 W8 g9 _4 V" A
  55. #define STATIC_SHIFT                3
    9 ~6 t* K2 s" c5 X  U
  56. #define TCINTEN_SHIFT               20- _7 g6 O# U# H+ P- s) Z* O4 N# a
  57. #define ITCINTEN_SHIFT              21* d4 r* R" O* d+ g5 \1 g
  58. #define TCCHEN_SHIFT                224 A, _5 S# e& q& B  X% k& I. x( Z% ^* u
  59. #define ITCCHEN_SHIFT               23
    $ ?! x6 T- u1 H
  60. 6 W8 v' |7 s2 u+ T
  61. static volatile int irqraised1 = 0;
    3 v$ n2 S8 x' G9 D, ?/ i5 D
  62. static volatile int irqraised2 = 0;5 J% k( u6 K+ A- @
  63. , `" \$ M5 X0 H8 _7 ]2 f# Y2 ~, V; \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~( p  d8 ?. r  \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 p, n0 b6 z( B( J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t. ?# y, y. r+ d
  67. : b& D5 J" J& J6 |
  68. dma_addr_t dmaphyssrc1 = 0;
    ' m& J: b8 P1 B
  69. dma_addr_t dmaphyssrc2 = 0;
    + q0 u& S4 V0 U
  70. dma_addr_t dmaphysdest1 = 0;
    + F$ F, k# v6 @/ M3 X- G
  71. dma_addr_t dmaphysdest2 = 0;
    - a& e; U3 X# t4 W

  72. ' u7 a1 W& A. @. k
  73. char *dmabufsrc1 = NULL;
    1 r' a0 d% s8 `
  74. char *dmabufsrc2 = NULL;4 S  P+ @% T$ W3 V" ?; H* ?
  75. char *dmabufdest1 = NULL;* p7 ?2 j2 |/ K* `) \
  76. char *dmabufdest2 = NULL;
    3 i) k& A4 I  A, o5 b3 v( Q* |

  77. 2 |' T9 `7 L0 `. O0 Y7 o. o. e) s
  78. static int acnt = 512;
    ) w0 \. y; R0 `6 E& U
  79. static int bcnt = 8;
    & ?; c' v* l, H
  80. static int ccnt = 8;
    # P4 S1 J0 e5 d1 c9 K
  81. " x  x& C8 H" T
  82. module_param(acnt, int, S_IRUGO);" o; o( X( \1 O% a; [
  83. module_param(bcnt, int, S_IRUGO);/ h+ Z$ c0 u) ~0 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 z: t0 D  E' r1 b
( Z& C) S2 b7 Z$ Z. u# g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 |- N, u+ C' U1 D% v4 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 R( `; o" r& B( r; c2 P! ~* t$ y& o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! \* I5 f7 p- ~  ~6 S2 i- y
* Y" B/ ^! Y6 ^, i) r

. _& B; O0 y  _" E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 05:04 , Processed in 0.043809 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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