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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ^( i( b$ W& q0 }
  1. [code]EDMA sample test application
    , Z7 m* r4 `7 c' I: X% Z
  2. /*7 \+ b+ A$ y" g8 n! S& M
  3. * edma_test.c
    + e. B3 k1 }. C  ?
  4. *
    1 _9 y0 z0 t; }. O" j7 ^
  5. * brief  EDMA3 Test Application# H6 I8 }/ q! L4 W
  6. *
    + k) g" |9 p  U: L/ }% S2 v  c( t' b
  7. *   This file contains EDMA3 Test code.; s- W2 c" x; u# t
  8. *
    & i* G$ o7 I9 u6 H8 y9 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' e" |1 p) D; n% P8 {6 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 c! X. c" l( q( @: Z
  11. *         TO CHANGE.
    7 z3 F  P8 L, h/ i; d
  12. *! o! R6 U: X  U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % c3 @+ T( H2 `$ h# D# r6 w
  14. *$ }0 o9 n7 ?: b# K, I* U( C
  15. * This program is free software; you can redistribute it and/or
    # c6 {6 m& v; @; f
  16. * modify it under the terms of the GNU General Public License as
    7 X8 I" n6 B' i6 F0 O( @
  17. * published by the Free Software Foundation version 2.1 K- g) j4 _  D; Y# p2 Q% s
  18. *
    * B* x+ U$ M4 \- o6 u' s9 T$ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . `  ]& r0 w: S6 u( U* J
  20. * kind, whether express or implied; without even the implied warranty8 P; Y" G4 s: \- a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" a' z. o: o" }% a, o
  22. * GNU General Public License for more details.
    1 S& z" l1 Q3 U
  23. */
    4 q5 @6 R& k0 M3 A  k1 E+ n
  24. - y) ?- c  w. Q" D0 j: V, L! n
  25. #include <linux/module.h>7 ]0 \9 ?; n& _6 |# S
  26. #include <linux/init.h>* E0 r5 R/ B. G5 W
  27. #include <linux/errno.h>
    ' l$ h# A0 x0 ^
  28. #include <linux/types.h>
    7 w: R# c: D& A! R
  29. #include <linux/interrupt.h>( ?% P) c! U" H7 Y( H) ]" k, V. N
  30. #include <asm/io.h>
    ) x$ R* v4 I% c2 F1 t
  31. #include <linux/moduleparam.h>8 c: N; ~2 I3 G2 ?6 Y
  32. #include <linux/sysctl.h>
    4 X) u! ]5 K* E0 N8 Y
  33. #include <linux/mm.h>; {7 r9 U3 v; i, ^* x- V) h
  34. #include <linux/dma-mapping.h>" s/ y- e( `! I: ?. j4 J

  35. ! f. N) |5 C; o: Y$ |/ U1 P( Q
  36. #include <mach/memory.h>. G' }5 `+ I, i
  37. #include <mach/hardware.h>
    3 q3 ~/ N! }1 G7 K& j+ K( o
  38. #include <mach/irqs.h>& S. X; ^$ _* G5 A; j
  39. #include <asm/hardware/edma.h>+ x$ s2 Z$ ]' E
  40. " n" D! y) p. ?% L: H( z
  41. #undef EDMA3_DEBUG
    0 k8 A- L" g' f' T9 J0 [9 g2 I
  42. /*#define EDMA3_DEBUG*/
    / o! E. Q1 F1 J
  43. # U- b8 B% `) t# w
  44. #ifdef EDMA3_DEBUG
      r: R) g4 P& F1 m) O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% k7 r' B# a: G4 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 Y3 L) T# O( f# ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 z8 o! ]5 A( ~$ ]* ^0 q
  48. #else2 Z% M  l4 m  R. `' m: L4 K: {( W
  49. #define DMA_PRINTK( x... )" w. D' n1 c" u  n! H
  50. #define DMA_FN_IN
    & I; a. i; F" t7 K  ~$ a3 N
  51. #define DMA_FN_OUT
    , b, \# N* R4 R1 }
  52. #endif
    7 O/ w, U6 b' V* @; p7 E0 C" W
  53. 7 c! K/ `& d. n# B, V: Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : ]+ F1 O& ?: Y7 O* U
  55. #define STATIC_SHIFT                3
    ) \2 M' C8 ]' {9 A; n0 {; C# W; o4 _
  56. #define TCINTEN_SHIFT               20
    1 t6 U" J0 X1 H
  57. #define ITCINTEN_SHIFT              21
    ! K7 G0 v. }( D7 t3 b( i
  58. #define TCCHEN_SHIFT                223 B# ~2 [- S8 T! ^( n
  59. #define ITCCHEN_SHIFT               23
    1 m; P7 h9 m; U) b! H4 p  m4 f
  60. ) w, Z: `& Q' f, P1 O9 e
  61. static volatile int irqraised1 = 0;
    5 L: {& k6 P; B' U, z* j
  62. static volatile int irqraised2 = 0;
    9 _  _4 q" n* j) l7 F( D2 _

  63. 1 c1 q8 W$ `/ [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      L0 l) a- Z1 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% `1 k0 @" J; l3 D. L0 y7 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t1 p$ Y+ V5 a- J  @& P

  67. ' o, |. g* \, S8 w
  68. dma_addr_t dmaphyssrc1 = 0;; ]0 t. u3 `* ^4 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ) C& l' N5 d! J4 a/ q
  70. dma_addr_t dmaphysdest1 = 0;1 e" o7 G" R/ d6 l8 k8 I) q
  71. dma_addr_t dmaphysdest2 = 0;' U! o$ I8 o9 u. P4 V
  72. # ^% l1 ~0 u  u
  73. char *dmabufsrc1 = NULL;
    ) m' A/ Q8 V0 ^$ C# K
  74. char *dmabufsrc2 = NULL;
    ) y; |2 W0 h* M( t- e3 a" D
  75. char *dmabufdest1 = NULL;* [4 V' I9 E7 v$ K# B$ g
  76. char *dmabufdest2 = NULL;
    ' I  l5 G. y8 g. m: \! H

  77. $ X2 o* s3 \8 a/ x) M
  78. static int acnt = 512;- w, |. `4 `* t% k. [
  79. static int bcnt = 8;
    % ^# R% A2 q0 @! S& n, W0 R
  80. static int ccnt = 8;) C% [3 Z( B7 N; H+ `% X4 f
  81. / X; D" k# S( d: Q4 Y. N' o
  82. module_param(acnt, int, S_IRUGO);
    . p" @3 E- r; x. G7 S2 A. k
  83. module_param(bcnt, int, S_IRUGO);
    8 H2 e" |! S/ t  i. i2 h7 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 O9 D9 u2 x! y6 O( _$ I5 g& M0 b2 D

) X- Y0 ~4 U3 L" O3 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: P; t9 \/ {# p. x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ~' F& U* H5 x) W5 j3 r& @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ [' P$ `2 ]& Q; \7 j

3 y+ J7 X0 L! H( y# t7 @" j0 x( O4 v- e2 M* r: ]7 v% q' ^6 W! ]( m9 B, z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-18 22:48 , Processed in 0.041095 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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