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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 }( R8 X0 @6 c
  1. [code]EDMA sample test application
    1 U' l' T5 Z- f
  2. /*: k% a; [4 i; q9 `  |8 h! f
  3. * edma_test.c
    2 k5 d4 s* g3 u9 P6 j. O2 i& ~
  4. *  h' H( [! U7 j0 h, `- P. j, K
  5. * brief  EDMA3 Test Application# b# R) \) e+ w; d8 H
  6. *% Q1 }* A' `  h7 S$ b/ b) g
  7. *   This file contains EDMA3 Test code.
    , L* v4 z4 C; i0 M& f) Q6 K
  8. *
    4 Z, e0 u+ t! T8 U6 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, p% m4 h: D% i/ ~  x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, [1 Y5 S+ S" p: F
  11. *         TO CHANGE.5 V8 }1 \- }% c- s
  12. *
    $ J  d; M0 @- c/ G9 b  e! h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 l0 a% ~- U/ `: M& p  \
  14. *
    0 \7 W9 M5 o3 Z( ?, B* Z# J9 s
  15. * This program is free software; you can redistribute it and/or$ f. ]: ~. f0 \$ s* L; Z5 g
  16. * modify it under the terms of the GNU General Public License as. C1 H! P" H( f7 d, K, {" ?
  17. * published by the Free Software Foundation version 2.: p( L4 \9 s" }3 n7 g( O. c0 M
  18. *+ t4 r$ q( C0 u' K- X2 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 S9 [$ e3 E) M" Q' Q& s" ~
  20. * kind, whether express or implied; without even the implied warranty9 f6 ]: `* t2 t! f' C' X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " t% W0 _& A* ]9 |7 W1 u7 G: v
  22. * GNU General Public License for more details.
    0 j7 d; X+ f& n  T0 L
  23. */
    4 C1 |; A+ A5 m8 _/ r

  24. 5 V% ]+ X: v  f! P( m# _
  25. #include <linux/module.h>
    8 Z, a$ Q- |* f$ r% G9 F: G* E& x3 u
  26. #include <linux/init.h>' j. p3 O% J: U3 ]  @
  27. #include <linux/errno.h>) s5 r$ |; g; L$ _! S/ ?4 y
  28. #include <linux/types.h>
    # X) ~) w4 x( g* [1 [
  29. #include <linux/interrupt.h>
    / q3 \: H+ h6 x; N
  30. #include <asm/io.h>, D1 J/ ]: e8 e/ ?. P
  31. #include <linux/moduleparam.h>
    9 `/ d5 O# m  U  W& H/ b5 P
  32. #include <linux/sysctl.h>
    % G2 P6 U% Z# F( U! I0 z1 ~5 c
  33. #include <linux/mm.h>; }- s, e  L% v& X0 o, h
  34. #include <linux/dma-mapping.h>
    5 t7 i) R3 q5 ?$ W$ X, g1 w
  35. . {  e$ x- j7 k  y5 m
  36. #include <mach/memory.h>; x- q: l9 B( P, |* G' L
  37. #include <mach/hardware.h>1 D  \: M# j! m) }( I1 e9 W! g
  38. #include <mach/irqs.h>
    : t5 c& V1 Z& y$ t4 m
  39. #include <asm/hardware/edma.h>4 n6 `1 L( j5 T0 d: B* W' A
  40. - {, I$ b1 Z7 O; r
  41. #undef EDMA3_DEBUG" R5 l+ j) c* |7 W4 j& o% @
  42. /*#define EDMA3_DEBUG*/
    . v3 B. R( ~( H8 M
  43. ( L2 u* i8 f% O& _; e
  44. #ifdef EDMA3_DEBUG& S" v9 f$ e, C' P* I8 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 m' d4 m' J; o' i  n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( t" _9 b) e( ^# s3 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) K# f) S1 H# e  g. t
  48. #else
    $ p$ a5 p0 ^) {5 F, k( Q# w# c
  49. #define DMA_PRINTK( x... )- {2 c) L; ]/ Y3 h
  50. #define DMA_FN_IN
    % t# x. O: N1 {  V
  51. #define DMA_FN_OUT
    . `; T9 N9 k8 o+ [! R
  52. #endif
    * q/ h: g9 N- K9 F; w# X; t9 x; R% k
  53. 0 `) C/ n! d9 W1 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ O1 T5 y& X# {- j# ]; K! r
  55. #define STATIC_SHIFT                3
    $ f5 j4 |1 u- K; s# A
  56. #define TCINTEN_SHIFT               20# l7 G! ?" B' f# Q  Q4 r' i; o
  57. #define ITCINTEN_SHIFT              21
    4 K2 P5 e- _( l6 T
  58. #define TCCHEN_SHIFT                22+ J/ L) ], R. j3 m  |/ q, X  H$ g: l
  59. #define ITCCHEN_SHIFT               23
    9 a, n( ]. ], D( U0 Q& W
  60. + y* Z& c5 c) H: t, Y. f# q% f
  61. static volatile int irqraised1 = 0;
    & s8 P& k4 z/ D( L; i
  62. static volatile int irqraised2 = 0;
    * M- M/ w& C6 P6 [
  63. 8 ^, l5 }- A# {1 @3 S0 S. o  W1 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M+ Q  w' q: l$ {( S$ }% J9 z1 ]1 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : K1 a! @# Z" R" S& {3 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 O7 Q$ s& n2 S+ N% b

  67. : \2 O% \- W! l* z% u) e- W
  68. dma_addr_t dmaphyssrc1 = 0;
    1 X. r% p& Q0 X) t0 X" T
  69. dma_addr_t dmaphyssrc2 = 0;
    4 \9 P, H9 O! |) D
  70. dma_addr_t dmaphysdest1 = 0;2 t, ?5 w3 r) D. \5 n+ \4 A, D
  71. dma_addr_t dmaphysdest2 = 0;: x' H& R0 c2 e. \8 `' o
  72.   m# b0 V3 `- |  h* B2 j& Q
  73. char *dmabufsrc1 = NULL;
    $ @% c: `) p8 ], Q: T, d0 {# O
  74. char *dmabufsrc2 = NULL;9 U4 z" d+ D2 O; r: g. @; u
  75. char *dmabufdest1 = NULL;
    " ?  [. J! `4 m: B
  76. char *dmabufdest2 = NULL;
      L0 L& c4 D" q0 ^
  77. % J! H6 x/ \; ?
  78. static int acnt = 512;. z  Q5 D5 B- m2 y$ D" U: X
  79. static int bcnt = 8;
    1 o' q/ V! F+ r% q! \
  80. static int ccnt = 8;2 m, m: N) ~+ p/ P

  81. 2 ]: W6 o) j* B: d( n! r
  82. module_param(acnt, int, S_IRUGO);% u1 t6 P+ E& M$ m7 J; a0 D
  83. module_param(bcnt, int, S_IRUGO);
    2 Y- y& z1 m$ [" s7 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( ~$ a$ c& W: k# _0 a' t
& P% U4 `+ Z3 J& _, }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# B6 a& M6 n& J/ L& j9 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% Q$ Q: A# y- V* J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 n- @. }  y$ C0 o: ^; h$ k

: J+ ?) |# \! [, J. @  _; F; G9 c9 p& \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-7 19:07 , Processed in 0.038637 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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