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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 r/ K* ^1 s0 ]% H
  1. [code]EDMA sample test application
      \, F/ ^  B% S3 u
  2. /*
    . `& a' ^# g. Q
  3. * edma_test.c
    # N4 d3 Y, ~/ _6 H  ]/ D
  4. *
    0 H* I! _/ R: q
  5. * brief  EDMA3 Test Application
    ) p9 x( T+ t6 p- x+ w
  6. *
    ) u7 ]0 S3 d- T
  7. *   This file contains EDMA3 Test code.
      Y( l5 y" q3 C* {* W# H, [! B* M
  8. */ P+ @' L9 u! N6 h0 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& T* _; Z) @: m* i1 q. G5 @7 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- N' e; K5 ^# G) O7 I+ C
  11. *         TO CHANGE.
    7 P. h$ N  \9 f1 ~
  12. *
    $ M' H. O4 a2 B. {6 L, C/ O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / }) }$ D, R! R* i# h# B
  14. *# o4 v3 U! i2 s7 C& a( P" y
  15. * This program is free software; you can redistribute it and/or
    # j- ]7 o$ w5 u6 E6 O" b# N) L% K
  16. * modify it under the terms of the GNU General Public License as; x" c0 U% |  L2 n3 g
  17. * published by the Free Software Foundation version 2.
    # r& W3 A$ {9 n7 _$ d, w& b
  18. *: i; q: x$ z; {% Y2 Y# \$ W5 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( e3 {- q( f9 L% J2 p9 Z
  20. * kind, whether express or implied; without even the implied warranty
    , c8 j% c+ _, \6 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # S4 G1 `; `- {* e
  22. * GNU General Public License for more details.
    9 y! M+ V5 H8 N
  23. */( d, P) M4 \; @( B" V( U# y5 z
  24. $ u& Z' Q  N) i3 S2 c6 C, @5 M+ R
  25. #include <linux/module.h>; t$ ^/ _  h" U$ Z/ L' f9 a
  26. #include <linux/init.h>
    : p. i, C  ~# J, D& a
  27. #include <linux/errno.h>! u* ?; ^) d2 \" d% n
  28. #include <linux/types.h>, g; |( {0 c9 F1 {  X
  29. #include <linux/interrupt.h>
    : \8 C: W# b4 A* D
  30. #include <asm/io.h>+ w) e8 P7 t& l* g
  31. #include <linux/moduleparam.h>
    / j+ U5 U' \" x' [6 x
  32. #include <linux/sysctl.h>
    2 ^; j. I  i! R6 J& Y$ i
  33. #include <linux/mm.h>
      o+ W. f6 m6 v2 R3 @
  34. #include <linux/dma-mapping.h>
    3 E3 R  f7 U* d0 I' Q

  35. / {/ I. E2 i7 @; S: t1 Q6 X% T2 h
  36. #include <mach/memory.h>* J! {( m- D& n% ~
  37. #include <mach/hardware.h>
    , L( R( i; \+ L. @4 P1 z: X
  38. #include <mach/irqs.h>
    0 ]' Z! C6 q, G" `5 j7 N5 Q3 l
  39. #include <asm/hardware/edma.h>
    6 l) w1 u0 F! K

  40. 7 L5 g8 x- p$ _! H$ ~( i
  41. #undef EDMA3_DEBUG# _4 M0 @2 |" ~& a7 E0 c
  42. /*#define EDMA3_DEBUG*/
    2 b# g  e3 I8 }' f: E, S
  43. 0 I; D# J% i: y
  44. #ifdef EDMA3_DEBUG
    . |8 {6 e+ i) B6 s6 X8 R- g* P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  e: q$ ^, X! n% R9 @  E- k$ Q4 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + D3 f4 |4 f& M1 \8 T$ Y6 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 G9 o6 B& u& X# {" j$ w: z
  48. #else( j% y8 m. Y. i; t! t% h6 K1 U
  49. #define DMA_PRINTK( x... )5 Z8 i8 r2 c0 F. l0 S3 ~
  50. #define DMA_FN_IN
    1 e+ o5 |+ |' m% c
  51. #define DMA_FN_OUT/ ~' d8 e2 P+ @6 G. @
  52. #endif, G" x6 D1 X+ y# C
  53.   x% R7 v" ]+ c& l/ c  K0 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): f# j+ e- h5 l+ {8 N" u* H( n' s) K
  55. #define STATIC_SHIFT                3" c' J( [# `& A( d. J
  56. #define TCINTEN_SHIFT               20
    $ f8 \, R3 Y  B8 Z" Y% t9 ~
  57. #define ITCINTEN_SHIFT              21; u- u) w: p6 `: Y* `6 }  {1 P
  58. #define TCCHEN_SHIFT                22
    - S, _, y# r" T
  59. #define ITCCHEN_SHIFT               23
    & g2 L0 F  \; h7 X' y; d" [
  60. # b: W# A: W( A# _, {
  61. static volatile int irqraised1 = 0;7 `/ [1 c3 F  _8 m4 y8 l
  62. static volatile int irqraised2 = 0;1 j3 o( C( }8 j& a* ^8 _
  63. " W7 {7 i8 d4 t6 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; \, [, m! C! m# h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |: T% l/ N* ]- E4 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " N3 s2 c" k0 y% k

  67. : f2 B6 E9 U  H
  68. dma_addr_t dmaphyssrc1 = 0;
    % c' o6 }9 J& X! @# i
  69. dma_addr_t dmaphyssrc2 = 0;: |0 b! j- Z: Q) E! o  ]% m% c
  70. dma_addr_t dmaphysdest1 = 0;
    5 @; U, p" V) z$ \! i" `0 {
  71. dma_addr_t dmaphysdest2 = 0;
    0 ]. l( T! P6 z& L' I$ j

  72. ! f( ]" l  Q. T
  73. char *dmabufsrc1 = NULL;
    5 s9 K# Y2 M- P* j8 N
  74. char *dmabufsrc2 = NULL;
    % s6 M. S4 A% `" b4 H9 z$ t2 O
  75. char *dmabufdest1 = NULL;
    6 v0 O6 v7 Q  u5 S! q, T; M& f/ B
  76. char *dmabufdest2 = NULL;: C; G! C3 p# B& q3 a

  77. - V7 [5 u  x6 t8 B- p
  78. static int acnt = 512;: V: C! p. q- h+ ~
  79. static int bcnt = 8;
    1 E8 s/ a, _) }( p! V; K9 c. n
  80. static int ccnt = 8;( a- x" z. g1 m$ h2 D9 D: A
  81. ( K; w& f$ m) s1 ~
  82. module_param(acnt, int, S_IRUGO);8 ^, F: Q! D6 a% ^3 m  J# C
  83. module_param(bcnt, int, S_IRUGO);
    ( S) `' ^6 F/ I1 K1 p3 i/ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 w. _5 j& B' L, U# h+ b) h9 |# F: P
9 N" I& W) M% D! o% r2 _$ m" w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! K, k7 ^1 ]3 C3 c( j& r+ C; F( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! D! h4 I' f* B' \5 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) p/ J# {5 x2 g/ l; r+ ?6 C8 a2 x7 w; W: K: B

4 s+ l/ P* d( C6 G3 i5 |" D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 16:53 , Processed in 0.038953 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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