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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 q/ o5 o6 n* X/ z' w9 F
  1. [code]EDMA sample test application
    2 |% b" h0 G$ T, T. J' J/ L7 ]; z
  2. /*
    . m  [* W' d- u( `2 ?0 z
  3. * edma_test.c
    + H5 ~/ K! P; B# `
  4. *
    ) v7 Z: l4 e0 F4 F
  5. * brief  EDMA3 Test Application0 ~) ], l& {0 E( k
  6. *, I" z7 x% R( l7 _" G
  7. *   This file contains EDMA3 Test code.
    / P% ~9 ~' _0 v& s: M
  8. *. G( p1 N4 U" V$ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 T1 ?- ?# Z" W, W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; r' o( s( J6 B& i
  11. *         TO CHANGE.
    6 f1 x0 Z: Z" ^/ Y; `) p
  12. *; U( J" ^. x; _5 z* p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 n+ b' O5 _- P( Z# P6 g
  14. *' @. V" Y8 U, }3 S- @6 Q
  15. * This program is free software; you can redistribute it and/or* U% o. d6 C1 A/ D
  16. * modify it under the terms of the GNU General Public License as
    : o$ s* B- `& p9 q' g" o8 Y& F6 U
  17. * published by the Free Software Foundation version 2.
    % \: l" N; }$ u% i' y: J6 h
  18. *
    6 [. x3 t* z4 m) `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% g# b, c4 M& z( y
  20. * kind, whether express or implied; without even the implied warranty
    - [9 D+ i; n: _/ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & f( o  l. h- i% u) ?/ I
  22. * GNU General Public License for more details.0 i& B0 Y! J: u7 s
  23. */* E2 ]5 N, V) F8 l9 [4 {

  24. 0 t+ s  D1 w: `: L2 m, V
  25. #include <linux/module.h>
    ! R% v, p! ?" i/ P6 F, }
  26. #include <linux/init.h>
    + `7 k* f9 l7 ~
  27. #include <linux/errno.h>4 f2 v1 f4 n* x* w1 |# \
  28. #include <linux/types.h>0 j+ v* D$ J: B/ y
  29. #include <linux/interrupt.h># ?) H6 {3 L2 J: Y8 C' n: z  v
  30. #include <asm/io.h>
    % S4 y8 \+ V/ x2 q& F# q
  31. #include <linux/moduleparam.h>
    $ Q& N( e+ S8 T- C+ ]5 l# o9 g
  32. #include <linux/sysctl.h>
    $ N& t& w- Z9 A( j2 L1 g
  33. #include <linux/mm.h>
    . j( G7 e/ p4 H. A# M
  34. #include <linux/dma-mapping.h>9 J5 S  R; q5 Y" @$ {
  35. 0 A9 k( F8 W5 f4 w' w; S
  36. #include <mach/memory.h>+ T$ y& o2 K; I! K5 D$ q0 X
  37. #include <mach/hardware.h>
    + f  l* S6 F7 K/ `+ Y- \
  38. #include <mach/irqs.h>
    " F; S8 l  F% L: Q0 s/ Y# ^
  39. #include <asm/hardware/edma.h>
      i; i" P2 f& F/ d

  40. & Z9 b- G8 L* w' o0 F$ V
  41. #undef EDMA3_DEBUG- o7 M5 x2 t) V
  42. /*#define EDMA3_DEBUG*/
    ) E* ~& m2 S2 g+ `+ w; I
  43. + _0 u7 d: c, U5 {9 x% f
  44. #ifdef EDMA3_DEBUG
    & U' @5 f8 h- p0 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ a+ `( i% o" _+ g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 m# ], y" U. V4 |% M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + w+ z& O$ \3 y3 ]
  48. #else
    ' g/ ?$ U: F( G
  49. #define DMA_PRINTK( x... )
    0 {5 ]- C2 e4 ?% u& ^* i; ~( l0 i
  50. #define DMA_FN_IN
    & n' f7 `2 |5 B
  51. #define DMA_FN_OUT
    # E& Y! y; N$ R8 ?0 {
  52. #endif2 K7 ?1 r& ]+ V7 h

  53. 1 J+ v' a8 J4 y* z0 _2 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " \( G6 w" c1 `9 _  F9 w
  55. #define STATIC_SHIFT                3
    - b7 o! t1 X! B, g
  56. #define TCINTEN_SHIFT               20
      h, C" _$ r8 N! X
  57. #define ITCINTEN_SHIFT              21) Y3 h. T' q4 P2 s: S6 b: J3 n4 g
  58. #define TCCHEN_SHIFT                22
    " }: r7 D3 q9 R; E- Z
  59. #define ITCCHEN_SHIFT               23
    3 a8 h5 o% x% t1 b% A& Y

  60. , W* r0 x3 f/ Z$ e5 _
  61. static volatile int irqraised1 = 0;$ y; Z1 _# Q" K/ S4 n" ~7 y8 ~) U
  62. static volatile int irqraised2 = 0;
    : Z6 r3 Z) s7 j2 [5 A6 K: [

  63. % c, R( b% q6 h( t; |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % I' K. v' X2 p/ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' K/ `1 ?7 R& M* j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ L! }9 z% v" L
  67.   s) u  B- Z) Y& A6 n% _' l) w* ^
  68. dma_addr_t dmaphyssrc1 = 0;
    . p' K$ X$ i1 D% X. o
  69. dma_addr_t dmaphyssrc2 = 0;
      d% M9 ?) V, a2 W- y0 x: w
  70. dma_addr_t dmaphysdest1 = 0;
    . }2 P# G2 a" ?$ Y! V/ p, h
  71. dma_addr_t dmaphysdest2 = 0;
    ( O6 z3 W% a) N" E3 F
  72. 8 T. V0 x% W0 U1 o$ w$ }0 ]/ m3 [
  73. char *dmabufsrc1 = NULL;# w1 G: l. v5 G# W
  74. char *dmabufsrc2 = NULL;2 Z8 t% V1 c$ A
  75. char *dmabufdest1 = NULL;
    3 v" T% ]6 r+ I8 J# I
  76. char *dmabufdest2 = NULL;
    - l3 L7 Z4 C7 m# \) N! v, \( L8 F

  77. ' c4 c2 h# W$ h
  78. static int acnt = 512;2 N7 l! f$ }) E. W4 g
  79. static int bcnt = 8;
    8 G# @7 I% V2 {' g
  80. static int ccnt = 8;
    $ `& T5 b$ q3 ^# ~

  81. * G  S9 m! V' m0 E* l9 v4 t
  82. module_param(acnt, int, S_IRUGO);
    - q. u* @0 H1 e: T1 g7 h
  83. module_param(bcnt, int, S_IRUGO);
    ; H1 G0 h+ R$ M) p8 Z5 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: [" ?8 T, {3 ~2 w) q7 _- z/ P- |7 {6 ^* d# l) n! P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 m1 R9 E. |1 Q2 ]( Z3 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: [+ }3 {6 P, i' `0 O3 _; J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ a  A: U: H1 z# m$ w
8 v+ T& [$ h' T; V/ Z! w$ |' L  G9 s% B& d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 05:42 , Processed in 0.039319 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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