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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 v! T7 d8 x3 k  I! @) @
  1. [code]EDMA sample test application# D: _/ X8 h! P2 ]- T
  2. /*, q. v  k$ o* ?- Q3 t
  3. * edma_test.c" ^; B3 ]" d6 ]2 f
  4. *1 A+ J8 B: s* w) e) z( F4 J6 d3 r
  5. * brief  EDMA3 Test Application0 l) L( G4 f" F% {4 w3 n* ^! F
  6. *5 ~+ D0 b0 h- D1 t
  7. *   This file contains EDMA3 Test code.
    4 X4 H  B* e1 B
  8. *
    + Y" I# l& T3 |  ?) Q" k  s+ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" w: x9 E4 F* y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 o( x3 _& t; {% t3 ^" T
  11. *         TO CHANGE.
    3 U( o  K+ ?! [* m3 `( \7 v
  12. *
    2 s' i6 r; p$ o) O8 t( U- s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 d& H- p" ^& {& L
  14. *5 c/ o* I7 h1 e  B- d
  15. * This program is free software; you can redistribute it and/or( a( U) Q% W% S
  16. * modify it under the terms of the GNU General Public License as
    - z% s& G: i0 F% N% s# Z
  17. * published by the Free Software Foundation version 2.1 N' `, e! G/ k* L& t& \8 N
  18. *  f7 Q$ U0 s) d( c: Y# l8 Q* W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 u6 M& M6 r5 h
  20. * kind, whether express or implied; without even the implied warranty1 O0 i8 y1 Z" c5 l) n: D7 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 @3 c% Z' E# \4 O
  22. * GNU General Public License for more details.
    8 v: L4 ]0 V; F4 _
  23. */8 C. a" F1 Q3 e; E) u

  24. ( A1 |8 e! I- ]& ~$ d
  25. #include <linux/module.h>* D3 k. C: i0 O. f3 Q
  26. #include <linux/init.h>* s# X# E: {9 q# i( Z$ r+ q
  27. #include <linux/errno.h>3 D# {- j8 A+ \7 ?; h; r
  28. #include <linux/types.h>
    & s8 q& |7 }% A
  29. #include <linux/interrupt.h>
    0 O; Q) t+ L8 D% c9 i
  30. #include <asm/io.h>
    ) U: ~% z5 _6 t3 H; D) x
  31. #include <linux/moduleparam.h>
    9 S1 Q; F( D- v$ Y
  32. #include <linux/sysctl.h>: Z3 ]+ U& R$ P
  33. #include <linux/mm.h>% K+ F* r# z0 E6 D, r
  34. #include <linux/dma-mapping.h>5 u" I4 E# N5 ?. f+ z* [0 Z

  35. 2 u7 N- ]! g, }7 C! S" U
  36. #include <mach/memory.h>
    " `) @% t$ T0 O. I5 Y, ^7 w7 B
  37. #include <mach/hardware.h>
    5 h( y6 v" t+ B+ O+ Y# I+ k
  38. #include <mach/irqs.h>/ s% S% S6 h9 O+ Z! S
  39. #include <asm/hardware/edma.h>
    5 j! v, N* o+ E- r
  40. " l  R+ A' G% r7 J7 d" ^
  41. #undef EDMA3_DEBUG
    % b6 I* p9 _+ t$ U9 H/ C
  42. /*#define EDMA3_DEBUG*/
    # W: Y( M" m7 t: T: w

  43. $ r+ [5 N% l( S  d
  44. #ifdef EDMA3_DEBUG
    2 j# G9 y8 A& ]) S5 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ d3 l2 Y4 K1 y1 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 \1 `; q5 N0 k6 L4 x9 E. T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 r8 Y2 R) D1 m4 p7 l
  48. #else
    3 [0 c5 C6 t7 ^
  49. #define DMA_PRINTK( x... )) k4 i3 i$ [8 h" k  I& \; ?
  50. #define DMA_FN_IN
    , ^1 x8 V) X7 v' I$ W
  51. #define DMA_FN_OUT, F% |3 [2 F: K- F, d& U
  52. #endif; n% m6 k3 _2 f# N7 }
  53. * t! j6 n9 M) h: c* h) @; ~6 Q! M- I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- z5 c3 N  I4 W* E4 _* w- H
  55. #define STATIC_SHIFT                3% d( a3 f3 ~1 s: o& M
  56. #define TCINTEN_SHIFT               204 o$ A" P4 K! W0 |
  57. #define ITCINTEN_SHIFT              21
    $ {3 t# Q+ G4 ~7 ], V
  58. #define TCCHEN_SHIFT                22/ x; P6 j% v# H4 h# t9 L
  59. #define ITCCHEN_SHIFT               230 l% ~- x7 s1 x; y! q

  60.   Z+ Y! U; T2 g! d
  61. static volatile int irqraised1 = 0;& Z- L- p5 x0 n- n; V* T3 ?
  62. static volatile int irqraised2 = 0;
    5 r" |  Z9 y& @  W9 _
  63. ' O8 U9 |' T6 c2 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J& @1 u0 }# S; `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      [0 n8 L( @6 l; ^) `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & h* ^8 x9 b$ |# e; U5 N

  67. 1 R: R- t: \3 I/ `' K
  68. dma_addr_t dmaphyssrc1 = 0;
    : N' ]4 G+ Y9 o9 A9 \) L
  69. dma_addr_t dmaphyssrc2 = 0;
    ' r9 D6 z5 @! p$ b6 C5 c
  70. dma_addr_t dmaphysdest1 = 0;' G2 `$ \6 N1 b: n1 w1 B4 G) U  F8 e
  71. dma_addr_t dmaphysdest2 = 0;
    : x2 S/ [6 m, w

  72. ) v4 g- D) o# o$ ^0 Q+ u, q1 M
  73. char *dmabufsrc1 = NULL;! R0 L9 h; z& I3 U' B
  74. char *dmabufsrc2 = NULL;+ ^" x- k' C0 C# C: W5 e  f( e% V
  75. char *dmabufdest1 = NULL;
    ' {% L+ O1 p0 x3 B6 F
  76. char *dmabufdest2 = NULL;
    . o, A  X1 {+ n' O+ D) B

  77. 9 c. {& b/ @0 D& R
  78. static int acnt = 512;8 b; \5 v' H/ l
  79. static int bcnt = 8;
    * j. ?7 P# s- d7 J/ G2 l
  80. static int ccnt = 8;; M) u/ n" Y7 e. p$ }

  81. 3 c) O( U! \5 n/ W
  82. module_param(acnt, int, S_IRUGO);
    - r, ^+ j$ A  B# L  ]
  83. module_param(bcnt, int, S_IRUGO);
    ! E  w2 Q; I2 ]' Q4 _1 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 n, P# @) Z5 \) W2 u" Y; g$ Q

. g3 U; G) G/ v" o5 T) p: P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 c0 E! Z6 r, L; o4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 q- f! j+ @  |& l$ v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: i0 H7 I/ t3 E; l4 l' _6 i/ f7 a* L! }

' \( C2 p) i- C2 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 02:54 , Processed in 0.040263 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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