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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ W! b: C% b! {% m- W1 z
  1. [code]EDMA sample test application! ~; J- b/ N1 D8 E: N! e# B7 e& z
  2. /*' Z  ?! G4 `% R! A0 ~1 Q7 C  p
  3. * edma_test.c8 ?" f' ~( f3 g5 g0 A
  4. *
    & k0 i  l5 w8 _
  5. * brief  EDMA3 Test Application4 q5 @( x/ O1 @! w: X
  6. *
    % U( B" S7 q9 ], I$ p
  7. *   This file contains EDMA3 Test code.3 }6 _2 u$ f$ D( Q
  8. *
    / @  o1 j- E7 F* l8 \% W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( q% n; z8 L0 ~7 l/ b7 F; b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' p/ b% a4 ]# x) @
  11. *         TO CHANGE.
    & N3 p8 ?0 U8 O: I
  12. *' ]; L$ ?+ f% J5 Q# `, ]( J9 S9 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " l5 X0 _% M" y7 i! ?
  14. *9 w* z, U# ^- p6 h
  15. * This program is free software; you can redistribute it and/or
    * w' D* J5 v/ G( q$ g
  16. * modify it under the terms of the GNU General Public License as
    - M1 M$ P6 H6 P7 b
  17. * published by the Free Software Foundation version 2.
    ! ]) E6 T( h! ~* X( `5 r$ W
  18. *
    # M  @" l3 P7 ~* D8 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( C. w" h$ R" X" m' i$ |5 z
  20. * kind, whether express or implied; without even the implied warranty2 r$ T& D+ C; T1 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 k1 G- h" N5 J8 n, `6 G# G
  22. * GNU General Public License for more details.
    : e; Q7 `7 V, H" N7 l/ `  l4 n0 ]
  23. */
    2 I" H% d& W& X; q) {3 F: t& M1 [$ r

  24. / ], r% _/ K9 T# M( o9 F' _4 H
  25. #include <linux/module.h>; w' ?+ f) g6 V; A- h0 `0 t5 M
  26. #include <linux/init.h>
    6 J% ?  I3 `( v6 \+ ]3 o* ?
  27. #include <linux/errno.h>; L3 b# }! H1 p6 l' ?
  28. #include <linux/types.h>
    ' s) x2 b& _- v9 f/ F
  29. #include <linux/interrupt.h>
    * K: H6 o& x0 h3 _. Q/ x
  30. #include <asm/io.h>
    ( o7 w* A8 R/ S) h
  31. #include <linux/moduleparam.h>
    ! C2 F* l( C; W" B6 f  Y  f
  32. #include <linux/sysctl.h>
    ; W! ^+ @1 ~( Z% ]! q$ \
  33. #include <linux/mm.h>* @" \1 ?0 C- ?4 Z
  34. #include <linux/dma-mapping.h>
    : |0 w0 M+ ~( E0 s

  35. 3 ~  r+ Z( ~% i, l/ t1 ^7 e
  36. #include <mach/memory.h>% A$ i# P' u; C
  37. #include <mach/hardware.h>
    . ^# |) _8 J7 D
  38. #include <mach/irqs.h>
    ) ~- d! p% L7 r
  39. #include <asm/hardware/edma.h>9 ?( s6 n9 r9 K
  40. / ~4 `7 m- f2 w" t
  41. #undef EDMA3_DEBUG
    1 c) N+ f; _8 O: a3 C# `2 T
  42. /*#define EDMA3_DEBUG*/) J5 `# e7 M1 @/ J9 r; c$ A' K" ?( A
  43. 7 a$ A( Y! s# r  j& ^
  44. #ifdef EDMA3_DEBUG9 ?# k* e* a/ ~# Y& a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). q/ N9 N3 Q, X4 P4 P. F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / D  m5 o7 U+ ?& c2 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% q, G) r$ _+ Q' G
  48. #else
    8 l2 r" O' e" m. c/ C0 d) Y
  49. #define DMA_PRINTK( x... )' H( y9 Z) ]2 [& e
  50. #define DMA_FN_IN
    6 {% |5 I* R4 J) F
  51. #define DMA_FN_OUT
    8 G# B+ @8 q4 Z
  52. #endif
    * n7 k* S7 c: ?" O3 y

  53. # u. ]  l; l$ T% a. Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . X% c% Z, z8 s5 [7 J" p9 ~
  55. #define STATIC_SHIFT                3  P& R  b; X9 |* c9 Z
  56. #define TCINTEN_SHIFT               20
    - l1 l$ S% B" w) N9 m- x/ W/ U1 A) S
  57. #define ITCINTEN_SHIFT              21
    2 L1 y" Y3 C% i3 v
  58. #define TCCHEN_SHIFT                22' i3 E6 P, X, {! W& c+ Z% j
  59. #define ITCCHEN_SHIFT               233 N! F9 s2 r6 K& C5 n4 ~
  60. 0 t& D# N: C* K* H, t
  61. static volatile int irqraised1 = 0;
    $ k) l4 v+ ^& z) L
  62. static volatile int irqraised2 = 0;5 T+ O1 \+ V" H5 c- x7 p: Y' h
  63. ) ]8 f, a' m9 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 X* D- \- P, i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # q" N! I/ w( o2 N. {" q7 R, w, W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' d6 @& m! t; o% y" N  g1 O- E6 g
  67. $ p7 a3 U" g* f; g$ g2 q
  68. dma_addr_t dmaphyssrc1 = 0;
    * n' A, C6 v! Y, o4 P+ G
  69. dma_addr_t dmaphyssrc2 = 0;
    2 X: x+ o+ C0 L* F1 \6 G* A
  70. dma_addr_t dmaphysdest1 = 0;* d4 g* B: `5 W. t5 u( \
  71. dma_addr_t dmaphysdest2 = 0;
    ; n( Q* ]$ g0 ?0 x( m" r9 k% v$ R
  72. 2 Q; c' J) _1 m, o
  73. char *dmabufsrc1 = NULL;
    5 B: J9 X/ g7 B' r6 S0 k, y
  74. char *dmabufsrc2 = NULL;; l' b: }% ?. ^9 f# b
  75. char *dmabufdest1 = NULL;
    * ]) w6 X3 a/ O. y
  76. char *dmabufdest2 = NULL;# X( z/ f5 C4 P( y- ]6 k  W4 U
  77. . \" k. R9 T1 b* x6 n+ U
  78. static int acnt = 512;8 v( p# r; c. x. U2 N9 [% V9 E7 f
  79. static int bcnt = 8;
    3 f; `/ V- `/ C
  80. static int ccnt = 8;
    " \* b2 L) \6 i  Z" t
  81. + d5 f' ~/ w8 a" `0 A$ d
  82. module_param(acnt, int, S_IRUGO);" k! \1 {/ [! j$ G; c+ y
  83. module_param(bcnt, int, S_IRUGO);/ e/ K7 Q/ p1 ?6 T( F& _( b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 b8 d2 U/ h0 n
6 ]3 U& |' }9 B2 z* h! q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 {5 e# {+ P' H8 H4 W% Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ?" z8 L0 ^( s/ n4 }( X! X) k" A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& F3 a6 W- Z! e' a( ~" i
6 V+ x% V) T- F8 ^& h
  Y1 l& k+ `# u- P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 05:47 , Processed in 0.042007 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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