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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' z7 u" T! U7 q$ C; ^
  1. [code]EDMA sample test application
    6 t" L( X. Z1 _. L, d
  2. /*
    ! k: K/ v% V! |( s, ]
  3. * edma_test.c" L8 F- T; @% L: {
  4. *$ @2 }9 S$ e; ^5 I' L5 ]+ r
  5. * brief  EDMA3 Test Application; C" _6 G; L5 c
  6. *  |" @! q. i1 D8 e- V2 m, E
  7. *   This file contains EDMA3 Test code.* L8 a6 r1 v. q. c3 G3 [9 l
  8. *# Y0 z) l, M# C8 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % j/ v6 v9 B( x# i5 O9 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f8 S! M6 E. ^% |, e
  11. *         TO CHANGE.- S7 D, D7 A) t
  12. *
    , s9 R4 T0 w# d' X- A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) U1 f( q& G" `1 |% U( F: f* G9 {
  14. *8 M8 d* A" H0 g1 f7 k2 c
  15. * This program is free software; you can redistribute it and/or
    8 C" o1 m8 W- E  n6 Q4 ~
  16. * modify it under the terms of the GNU General Public License as
    ) @! e) R2 A% b
  17. * published by the Free Software Foundation version 2.. k9 P1 |, t4 l" P& V' J
  18. *; o+ w% c; k* |( _- u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 T( X% E3 x2 d
  20. * kind, whether express or implied; without even the implied warranty
    ( F; w% `3 u2 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 s5 h! c6 A$ K6 u
  22. * GNU General Public License for more details.
    " {: }, p* e3 B% g+ [
  23. */
    / O( y7 B8 B; e" F" E
  24. : a3 V$ K9 }( \* P0 C# m/ ]
  25. #include <linux/module.h>
    " M9 ]' ?. B) j1 I; r
  26. #include <linux/init.h>
    ! L* S2 X4 u- s. @4 S* E8 f
  27. #include <linux/errno.h>" F& M: F$ r  h* ~# i# }, Q/ Z
  28. #include <linux/types.h>
    % T' m+ p0 U- _1 n4 s0 q
  29. #include <linux/interrupt.h>9 i2 j1 M7 z5 T6 Z3 r! h
  30. #include <asm/io.h>: c3 {  X! [0 q9 J+ `9 J$ X+ R) w
  31. #include <linux/moduleparam.h># R/ H+ _; f! Y6 c8 B; ?1 D
  32. #include <linux/sysctl.h>3 s7 J6 G6 V$ N- z) U" z) J* u
  33. #include <linux/mm.h>% r& S6 T( T7 X5 B5 r$ B
  34. #include <linux/dma-mapping.h>
    $ C7 f' L$ p0 C3 U+ h+ D

  35. - b6 F2 M# ^4 @% n
  36. #include <mach/memory.h>
    , t1 p9 m# l  |5 ]) ^- e* k0 Q/ B
  37. #include <mach/hardware.h>
    7 H7 ?, S3 D* X3 O
  38. #include <mach/irqs.h>
    2 O$ Z1 [2 p5 L% e, F2 {+ R
  39. #include <asm/hardware/edma.h>
    $ f0 {$ t8 ^% p* c1 Z& h

  40. 6 J2 ?" B' F& I4 B
  41. #undef EDMA3_DEBUG
    6 f+ w: ~+ t2 h& q; G0 F9 a1 c3 T
  42. /*#define EDMA3_DEBUG*/( D/ S4 Z  C' E) n
  43. 2 @/ F( D5 o- P
  44. #ifdef EDMA3_DEBUG3 i4 ^. [/ d' X( R9 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- u& H  n2 Z0 `/ t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 f9 A7 V" ?$ }' G& ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). O! L& T1 e2 h% j- u& r. _, R
  48. #else
    # p4 T& E; b& ?" f  \
  49. #define DMA_PRINTK( x... ): A* M% w+ s& C, x
  50. #define DMA_FN_IN" z& k$ l+ N! Z( C
  51. #define DMA_FN_OUT2 a3 ^. Y0 W6 @9 Q( P' [# b
  52. #endif
    4 d- m' R# }5 s; c) k

  53. # H- c  Z# H' t. D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + H7 x. _# b9 e6 M* F" |. e
  55. #define STATIC_SHIFT                3; {  M- Z/ [  W+ N; \
  56. #define TCINTEN_SHIFT               20
    , q# j; C3 K9 {+ a
  57. #define ITCINTEN_SHIFT              21
    5 t; k# Q" o( Q- J# `6 ?
  58. #define TCCHEN_SHIFT                221 G, C6 D( j* [
  59. #define ITCCHEN_SHIFT               23
    & V( g; h( \  T+ K7 h
  60. ) Q- ^/ e6 w* c
  61. static volatile int irqraised1 = 0;) l! W+ z. _) E  W. \; t2 J4 G! F4 F
  62. static volatile int irqraised2 = 0;% z( [7 ~/ u9 b( M% O; ?) I3 \

  63. 1 B( W5 ~9 e& h0 I7 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E+ e/ F. h3 W# G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" i8 @7 X6 D  n7 G& J. W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * t, s- q# V8 z* h

  67. 3 g* D# D, E0 u% H
  68. dma_addr_t dmaphyssrc1 = 0;
    # @, |' y1 t, _; ^$ _$ I
  69. dma_addr_t dmaphyssrc2 = 0;/ u1 R& g  ?1 H2 p6 N% j* t
  70. dma_addr_t dmaphysdest1 = 0;
    % i# T" k$ K. {& l
  71. dma_addr_t dmaphysdest2 = 0;& B8 `+ J/ P3 p7 A# f
  72. ' z6 P+ U; y1 Q3 Q0 ]5 V! V3 E
  73. char *dmabufsrc1 = NULL;& N: R2 L% L; ^; I
  74. char *dmabufsrc2 = NULL;5 f/ y7 `4 L% C+ P6 y
  75. char *dmabufdest1 = NULL;
    3 w: W' A% S# |+ Y8 ]
  76. char *dmabufdest2 = NULL;
    4 \% ~% O+ S+ k3 u
  77. 6 \$ N# m! l1 O6 s
  78. static int acnt = 512;  I% t" A1 N) i$ x$ M5 ]( z
  79. static int bcnt = 8;
    # v" f0 Z- ]) N. c5 J4 A+ J& g
  80. static int ccnt = 8;
    ; \9 L0 [2 w( u. _. m" {

  81. ) @' x1 d5 N& c' A
  82. module_param(acnt, int, S_IRUGO);
    ' Z% \1 O! P8 S
  83. module_param(bcnt, int, S_IRUGO);+ R8 B' D, j; Q$ Q# J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 R" v/ {' D, I
) D4 \8 i7 b) {9 v0 o; z( v) G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ~2 V: Z9 I' M7 f: W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 `. C% Z8 {" p. F! @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 H% g, b+ e. u# C
7 S9 x3 C4 |9 G/ i# {% I6 T
4 B& }( w- r; F- X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 11:33 , Processed in 0.045071 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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