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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 B7 x4 b8 M! X% G( [; F7 H3 H6 c! h* d
  1. [code]EDMA sample test application& g& H4 \  b' M, K$ l
  2. /*
    * Y4 s8 @- y8 v. q. y1 j
  3. * edma_test.c
    7 `( I: m: P: P
  4. *
    1 N/ W  X4 [) f- j
  5. * brief  EDMA3 Test Application$ R- S& R' Y* Z5 U
  6. *. }1 H- R* V/ O2 _" H' |. s  s
  7. *   This file contains EDMA3 Test code.+ s+ s8 L7 ~& d# J. R+ z7 ~
  8. *
    - C' X/ O1 ?, ?* s- P: r. z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 p/ U, c! G( }: E7 V! h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 k+ d$ C- b( O- y. l( i- `: L
  11. *         TO CHANGE.
    - ~: @  ?6 m5 R# M/ y& T; N. w7 l
  12. *
    ) J# c4 [2 j! k. q5 h& ?9 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. U9 i/ u. K, o0 i$ M! J4 e
  14. *- M: x7 ]2 ]3 L+ X. Z: H) n
  15. * This program is free software; you can redistribute it and/or9 m$ Y" M& I0 V. i0 |
  16. * modify it under the terms of the GNU General Public License as1 s$ f  z+ T& P7 x; R
  17. * published by the Free Software Foundation version 2.
    % X' F7 e) Q! \. |. ?$ h* {+ t
  18. *
    : n, y8 T" _' H4 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# }: e9 @9 ]! g3 G0 k$ N# N, |
  20. * kind, whether express or implied; without even the implied warranty
    " K; ^( D6 |$ X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" f& ]* ]3 h* U/ I$ B
  22. * GNU General Public License for more details.
    1 r3 y) J! E7 D* \& g
  23. */
    - v, I- a: U; X2 o
  24. 7 _' V7 k+ [8 d. {$ Q# _: ^9 Y
  25. #include <linux/module.h>
    2 c( L! J: y$ A, F, s
  26. #include <linux/init.h>
    ' q' }! D6 n/ B
  27. #include <linux/errno.h>
    9 k2 ~0 K1 r0 y3 N0 D; `
  28. #include <linux/types.h>
    % W9 d: t" P& E
  29. #include <linux/interrupt.h>0 K$ i8 b8 I. O9 q
  30. #include <asm/io.h>
    , b" \/ R- ]9 o
  31. #include <linux/moduleparam.h>
    - D: i2 ]' H$ \# A- c+ a
  32. #include <linux/sysctl.h>
    * a0 W1 c8 C6 t" ~/ k- k
  33. #include <linux/mm.h>
      G6 a3 \8 ?: e% q) [. z
  34. #include <linux/dma-mapping.h>0 {  ?4 c- f3 G! g# p, v; V# O

  35. 4 h: A( w9 h! h# r8 ~
  36. #include <mach/memory.h>8 R+ q5 J5 F; k$ D3 j/ k
  37. #include <mach/hardware.h>& E; G# ]" P- x) G
  38. #include <mach/irqs.h>
    1 |( H# h* U" F% y
  39. #include <asm/hardware/edma.h># Q" i1 A* ]" l% A" {. N
  40. , X8 c: ]* ?: Z8 P
  41. #undef EDMA3_DEBUG
    - a! {; P+ e/ g# b! T
  42. /*#define EDMA3_DEBUG*/
      F, k: ?# _% q) V0 B

  43. 5 m" ~; J2 t. M/ e* C0 A  p8 W2 n+ z
  44. #ifdef EDMA3_DEBUG$ U4 Z( \, C( u3 g" {: ?% K: E7 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% D# L) c& U- d$ l4 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 {% @: E0 T8 \8 T) h9 N) }2 ]' r; d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' I. f5 q3 a; Q# N7 a) b9 s8 `& @
  48. #else
    + p$ L6 \2 y) Q1 E: \
  49. #define DMA_PRINTK( x... )3 ?# |" V8 q6 Q  v5 a4 A2 X! c
  50. #define DMA_FN_IN$ L+ ]; \; u# v" C' |
  51. #define DMA_FN_OUT4 d  J% D/ I# p* l( L$ n" D2 u
  52. #endif
    % g, u% R# T/ t1 n% z+ E

  53. ; J, I1 d$ P* J  @) j- _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 w; Z7 E. `& u
  55. #define STATIC_SHIFT                3
    6 d  M! L% u: p, Z
  56. #define TCINTEN_SHIFT               20
      Z/ t4 O5 U: T
  57. #define ITCINTEN_SHIFT              21
    , d9 z* ~; e8 t& o& R( w
  58. #define TCCHEN_SHIFT                225 c  V! }: t3 `/ x0 u: ^% s
  59. #define ITCCHEN_SHIFT               23
    - J( O7 h+ p0 Z% e0 j7 x& K5 T, F% d9 i4 z
  60. . j' f7 E3 g; N# D1 m+ b
  61. static volatile int irqraised1 = 0;
    ) k" X  P$ d0 P; ?
  62. static volatile int irqraised2 = 0;6 v$ R, K; a% {$ q7 l* B7 w9 B
  63. 7 s) p6 ~+ N- j$ b0 C5 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # P1 S- [. w$ e0 x% P: Z1 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . @0 w% ^/ P+ N. f+ `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 \: m5 ?- j+ l! j/ `* S
  67. ( _, B1 b3 R; J! n/ d; S* Z
  68. dma_addr_t dmaphyssrc1 = 0;$ M1 A* S$ y' s2 |
  69. dma_addr_t dmaphyssrc2 = 0;5 {) e4 f7 D7 T0 E7 k1 g
  70. dma_addr_t dmaphysdest1 = 0;7 F4 W4 N1 S8 O2 j
  71. dma_addr_t dmaphysdest2 = 0;
    9 o4 [. S" O& ^& @" s# ]+ R

  72. ' B" A0 m1 b4 e
  73. char *dmabufsrc1 = NULL;
    0 E& O9 A1 U+ R4 X6 g! V3 g9 Z% ~4 y
  74. char *dmabufsrc2 = NULL;
      Z2 g3 H( R; f$ c( {- B& Z  C6 w
  75. char *dmabufdest1 = NULL;
    3 K/ ^( x2 l# N
  76. char *dmabufdest2 = NULL;; p1 G7 z$ N* d7 k$ e2 b

  77. ! _' z; a3 |' V7 Q
  78. static int acnt = 512;
    & ]$ t( B  x* W
  79. static int bcnt = 8;" P# t: F8 r, f1 \3 i) g
  80. static int ccnt = 8;
    * c4 [( T4 q  C
  81. ; K4 A5 H  H' b; e/ a
  82. module_param(acnt, int, S_IRUGO);
    4 _9 K4 [. @0 M+ _, ]6 c. N
  83. module_param(bcnt, int, S_IRUGO);: N, B5 b; i" Y( ^' P* N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# m9 q) q) i  ]. F" m5 g6 p* N$ q+ N5 S  L8 W- n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; B6 [) W0 k' C& R* _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" W9 ?# m& G( V$ n9 P* {# w% A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' r3 l6 N2 q, L
: A( E5 B1 F* b; t

6 b  l5 V. Q! f  O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-11 11:51 , Processed in 0.040538 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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