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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! x4 C+ ?; H0 g
  1. [code]EDMA sample test application
    7 @" C$ C" A, O6 `  ]9 d. ^
  2. /*  o5 q- \" A: Q" T8 V9 l4 ~6 X
  3. * edma_test.c6 j2 A. k  }; y) G' B6 \
  4. *5 ~2 b) B2 O4 B3 h
  5. * brief  EDMA3 Test Application5 S# A7 F: K$ A' Q' S/ \
  6. *; [7 V; M6 b8 z0 l8 Y: i: v
  7. *   This file contains EDMA3 Test code.
    5 u. X! J6 A6 J7 L
  8. *  O; F: E5 ?* T# m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ~- Z3 b* y  m: ~. h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! `5 l' n- I$ M$ H7 h; k+ X
  11. *         TO CHANGE.
    4 _  `/ L& C0 m/ ^/ N6 f6 V
  12. *9 c3 u. d" u; X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 e' J  v( H" J, }% {! |
  14. *
    % x1 O6 G0 G8 C
  15. * This program is free software; you can redistribute it and/or1 `1 F2 W. V9 b4 Z
  16. * modify it under the terms of the GNU General Public License as7 E4 @- H) e; I+ N! i, \  q
  17. * published by the Free Software Foundation version 2.% G! H. G. j4 ^7 H4 \3 i7 R
  18. *5 `! z: R" D2 e( z- y% Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: `" |. o" }% {. _& s3 p
  20. * kind, whether express or implied; without even the implied warranty* I; o0 _4 \, W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 z9 e0 i/ f5 i) T+ O# f
  22. * GNU General Public License for more details.
      q' X2 Q0 u) N/ C
  23. */
    5 F; }. }8 H8 E

  24. 3 E; _6 t1 P  a, s- h+ w
  25. #include <linux/module.h>' ?4 Z0 `/ R) N5 ~; u- ^; G
  26. #include <linux/init.h>
    % B# `9 w, a# t! l( U: b4 n4 E4 T6 y0 v
  27. #include <linux/errno.h>
    $ D9 s9 K2 U/ x' D
  28. #include <linux/types.h>8 I- p* e  @; ?! l; M" z- y
  29. #include <linux/interrupt.h>
    # l/ a. A. t  @. ^$ E
  30. #include <asm/io.h>
    $ w  O) V' U7 I9 L2 `2 v& b7 f5 Y" {
  31. #include <linux/moduleparam.h>
    ; P3 O/ m% l9 a) X& h+ v
  32. #include <linux/sysctl.h>- p: V  j7 {' T" @! J
  33. #include <linux/mm.h>
    6 R. [( U# E4 C+ I+ z
  34. #include <linux/dma-mapping.h>
    $ [6 P8 x4 a) A) {& }6 t

  35. 3 u* X5 `" `& H
  36. #include <mach/memory.h>
    1 y  v, A) Z0 }) H. I( O- _/ U! F& L
  37. #include <mach/hardware.h>
    ( q( Q/ ^# I  {4 G' a0 E- b2 s
  38. #include <mach/irqs.h>
    & d6 _+ \- I, _/ J0 Y
  39. #include <asm/hardware/edma.h>
    - l# |: J  g  X. \6 Q. n! D
  40. : t; u0 O( {7 j9 |0 _: S. q4 [
  41. #undef EDMA3_DEBUG
    4 v2 h" u! U, k- r. L. h7 B% S
  42. /*#define EDMA3_DEBUG*/- x: U' F1 ?0 v; I4 @. I

  43. - X$ ~0 H8 G( t) ]
  44. #ifdef EDMA3_DEBUG# K( B& [: P+ F8 V' `1 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& q4 r3 C0 |) k, Q$ n9 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ l' Z3 g/ A; Y' w" L- v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! i* m) N( x& H% k! q
  48. #else
    ( z3 K# U; Y+ }  |$ |, z
  49. #define DMA_PRINTK( x... )/ b5 n: Q& K4 j, z
  50. #define DMA_FN_IN
    : B% R, q. J3 X9 `) S; o. E
  51. #define DMA_FN_OUT, e" X. ~6 q0 ?& ~* w5 A4 w/ G+ {. L
  52. #endif. p; l! S( x( H4 M1 z/ \
  53. ; \  T( e2 E+ e3 y% h! s: a& f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): g& |8 Y! q+ m$ s
  55. #define STATIC_SHIFT                3) A/ i, ?/ _( p# Y
  56. #define TCINTEN_SHIFT               20
    / u. t0 F. ]! s7 s
  57. #define ITCINTEN_SHIFT              21
    : ^: A+ k$ |" o3 {4 e1 D
  58. #define TCCHEN_SHIFT                22/ \$ U% k8 s) O' i- t3 L0 z
  59. #define ITCCHEN_SHIFT               23: K% a& s& e6 \( h; k% |
  60. ( c- A& _  ]" I6 W7 b
  61. static volatile int irqraised1 = 0;
    + i8 V2 N; z$ o8 S; H( [7 E$ y
  62. static volatile int irqraised2 = 0;
    * p+ ^; V4 i6 q/ \2 A5 \2 y* _6 a! X

  63. ( \5 Q" L# e6 N9 h  X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * T2 P9 x$ |6 K! L6 _5 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 d( o3 Q4 q7 k* H6 W( O: M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; _, b2 R/ }4 j9 i% u' `
  67. ! w) |- j+ u5 M" V
  68. dma_addr_t dmaphyssrc1 = 0;+ j* Q1 |3 h: I3 j
  69. dma_addr_t dmaphyssrc2 = 0;5 Y+ c" f3 D* J2 E* \8 _
  70. dma_addr_t dmaphysdest1 = 0;
    ! z& j$ K* O' x0 q
  71. dma_addr_t dmaphysdest2 = 0;( O$ Q- _' T+ w# J! H' b  i
  72. 1 `: B9 a: n2 e% g& m4 m2 f! {
  73. char *dmabufsrc1 = NULL;
    . b! x2 |  O- H8 ~: l/ `
  74. char *dmabufsrc2 = NULL;
    ( o9 T+ P' u# f( [! @7 @
  75. char *dmabufdest1 = NULL;
    , G+ U  _0 Q3 n( M
  76. char *dmabufdest2 = NULL;4 ]9 |# f; G' d: @9 h# Y% O
  77. ) Y+ O% D  K' V: {3 B$ h
  78. static int acnt = 512;
    " x8 b) x0 P( {5 |
  79. static int bcnt = 8;
    " L7 {" S$ p$ [3 ~! U' ^
  80. static int ccnt = 8;
    ( r) ~, p3 @! G, ?( c7 T
  81. 5 k3 t# s. c: N! y0 C2 S
  82. module_param(acnt, int, S_IRUGO);
    $ l' U# B3 ^$ J/ X+ H# K
  83. module_param(bcnt, int, S_IRUGO);. j' J+ n! \) c2 [3 f- |# ]! M5 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" d; m6 [( F- F5 w! X* y* e0 g' k" U9 ~+ D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 U/ N. D. F: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 I7 R1 h1 ^+ _3 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 _8 Y  b+ c: V

: Z" W5 O+ v8 n. \/ O% {5 z  [; X+ i' L9 o# F6 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 14:16 , Processed in 0.039061 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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