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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 K4 t; Z$ v6 n8 G* y3 W5 d
  1. [code]EDMA sample test application
    . l, _% a3 F0 v8 m' b7 g6 b
  2. /*# T9 a4 f" `7 [8 J+ p3 c
  3. * edma_test.c. g4 E% W0 j8 O
  4. *2 D7 Q( R6 D- N  w# q
  5. * brief  EDMA3 Test Application" T( Y, F; V- U4 u
  6. ** c3 g, H5 O- |% E5 [
  7. *   This file contains EDMA3 Test code.
    / c' s# M7 B. ~4 Z8 W0 N
  8. *8 L9 j% E% ?$ m( X, ?% ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * Z% A* @8 g4 u# [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" P9 L1 s, [: a$ G7 T& @% L
  11. *         TO CHANGE.
    ; x* f- D1 h, E5 q- B, \  d9 o
  12. *
    9 H; ?6 X1 U/ d2 F& O8 i  ~" X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, ^$ _* e; t; @2 P0 J" q/ m; b  `
  14. ** a. }0 Z7 H# ]
  15. * This program is free software; you can redistribute it and/or
    . o' P, H5 J% z" V
  16. * modify it under the terms of the GNU General Public License as
    - {+ c# W3 i, Q" t1 \
  17. * published by the Free Software Foundation version 2.
    ! M5 t6 t: @$ L% G- F
  18. *
    % a2 T1 C/ l! `* ]0 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # q9 L+ Z. F9 G
  20. * kind, whether express or implied; without even the implied warranty3 @9 x9 f; \+ O: R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ W/ K. @% K4 |  z  i! @1 N
  22. * GNU General Public License for more details.
    % d3 A: r, L/ y6 i7 \; r
  23. */7 K" u& _' r, p) c

  24. # E2 e& J# _; w+ ]6 D) Q
  25. #include <linux/module.h>
    5 k4 v' ]' i% ^; u" k, s* W
  26. #include <linux/init.h>
    $ n$ i1 E0 K& f9 V. A% i0 R
  27. #include <linux/errno.h>- V4 \: z( z" [4 N# L
  28. #include <linux/types.h>
    7 x2 k5 N/ _1 P7 n& N7 p
  29. #include <linux/interrupt.h>
    7 b8 ]$ O+ I. A# R9 a* N
  30. #include <asm/io.h>* t0 {* p9 y3 t# @# g' S8 L+ Z
  31. #include <linux/moduleparam.h># x0 l' z3 W' ]/ `- [* k! n9 C
  32. #include <linux/sysctl.h># ]/ v$ J# K3 w' M; C# r& B
  33. #include <linux/mm.h>
    # i) I$ w# i, ^: G
  34. #include <linux/dma-mapping.h>
    9 C- S1 L& e! q( a9 {" A

  35. * Y+ J* I0 O4 M! m" ?4 R
  36. #include <mach/memory.h>
    9 }5 @! c# N8 [, f
  37. #include <mach/hardware.h>
    & `( `, x$ n; {0 K; ^6 p
  38. #include <mach/irqs.h>: I9 ?6 g0 v4 q6 i- V3 f
  39. #include <asm/hardware/edma.h>
    . |# p$ K; ~/ d* M7 j: V9 Z

  40. ; z6 V: R0 ?. G) ~6 q
  41. #undef EDMA3_DEBUG
    4 s! m0 v7 \& O# h
  42. /*#define EDMA3_DEBUG*/" x/ M: d7 I' ]+ u

  43. $ o- ^7 t: F9 @1 m& P
  44. #ifdef EDMA3_DEBUG
    ; v7 f; D* {9 F; g* R- b5 R5 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % B3 k8 E% z! Y# u' V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), e# Q& x0 k: T$ H2 {: \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 _5 R/ z: _& [  z
  48. #else* u# K! l+ d  U6 l8 a
  49. #define DMA_PRINTK( x... )
    8 _; F' E% Q( j2 R
  50. #define DMA_FN_IN
    * u+ W* F9 _% X' E5 J
  51. #define DMA_FN_OUT
    + f+ F( d1 c5 G) _" [1 m
  52. #endif2 m' Z; O) F; |% }9 x# Z
  53. 3 k. T2 e8 j6 e; R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' ]8 Q  H2 K$ @  w
  55. #define STATIC_SHIFT                3
    1 p$ \7 r: l6 {0 z3 e
  56. #define TCINTEN_SHIFT               20
    - g8 \: G9 g5 i# ?. b
  57. #define ITCINTEN_SHIFT              21; u2 O. F2 n" o" e$ v) e0 x
  58. #define TCCHEN_SHIFT                22
    1 m1 z1 Z1 j) o
  59. #define ITCCHEN_SHIFT               235 `# v7 n) G$ O4 v( r
  60. , R* J! r3 A9 P5 O2 |/ a/ J
  61. static volatile int irqraised1 = 0;1 p2 N4 J  T* k, D( q1 G
  62. static volatile int irqraised2 = 0;
    * S8 x  G: P  ?

  63. ; v5 M8 J, Y* b- q1 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      C& T; Q1 }- f. e% r3 h# E7 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~( X8 e. t# Y" c1 T- y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O. ]) y( i. k* u: t% U8 l6 A

  67. 4 ^0 U' }5 d$ o) H5 a' |* k' J$ q
  68. dma_addr_t dmaphyssrc1 = 0;" A% b* c6 F, {7 [- i: M% R
  69. dma_addr_t dmaphyssrc2 = 0;* }  ?% K: h' t7 C- n9 y( \. @
  70. dma_addr_t dmaphysdest1 = 0;
    5 p" t" q" e2 k$ S: @* ^
  71. dma_addr_t dmaphysdest2 = 0;
    ) b1 @, n! C7 a0 e. E# v0 ^4 C7 H& ~
  72. - Q+ B. o$ `9 I6 d  a9 D# {: s
  73. char *dmabufsrc1 = NULL;0 T0 q9 r8 L  n8 [' u2 Y
  74. char *dmabufsrc2 = NULL;0 }- @% O4 u4 s6 g
  75. char *dmabufdest1 = NULL;
    ( y1 C9 N; [8 T% f' _, _2 o3 Y8 C) ~
  76. char *dmabufdest2 = NULL;) h. x1 @8 [1 f9 W9 C7 y
  77. - G' S( t+ u; z
  78. static int acnt = 512;8 D* \% t1 q: V& L: q/ i. ^/ Z
  79. static int bcnt = 8;4 H; i. K. ?& G6 H: D9 X
  80. static int ccnt = 8;- e( ?" N5 Q7 J% Z/ C* W
  81. # u& [  w; L$ W
  82. module_param(acnt, int, S_IRUGO);8 F, |8 G) ~6 J3 X/ X
  83. module_param(bcnt, int, S_IRUGO);  _8 S$ E! t; Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 @' [/ R! }/ k" G, Q) Z
, f0 O3 ~6 J2 o  \& z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% n" h  a% n7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' l$ f$ |: e* R- \8 Z- x( p! F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! B- ~, @. x+ }1 D! f6 G- `1 K
- l( Y* J! \! l( Z- F2 C
, w' X" p7 k; j- }, W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 12:21 , Processed in 0.040204 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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