OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 G+ w2 s2 J, ~/ Q) i
  1. [code]EDMA sample test application7 j" Z- Y7 I* w/ t" }3 Y1 L
  2. /*+ u! q  G. Z7 n0 {8 w
  3. * edma_test.c/ m1 s. ?, o& R" \3 C
  4. *
    : }7 `3 C3 x) u0 \
  5. * brief  EDMA3 Test Application3 s5 h5 ^+ Y6 O( Z
  6. *
    7 e& n* C5 D% f4 I* Q
  7. *   This file contains EDMA3 Test code.
    : \9 I8 I& |: h, w
  8. *+ E5 v  ?+ v0 s2 v4 g; n1 O5 W1 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: o+ w7 d% I1 k* [% M1 ^, f- p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 o0 l4 O$ W% g/ b# D4 R% P! O
  11. *         TO CHANGE.
    ) X5 G+ R( g" C. N$ e0 f# v, s
  12. *% }6 `, ^$ e  ~9 O* _9 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 q: z; K' y8 e& a
  14. *
    1 U* @+ K, G  y( m/ k) }& @
  15. * This program is free software; you can redistribute it and/or+ d" c" |2 m+ f7 r4 \/ g0 e8 ?% s
  16. * modify it under the terms of the GNU General Public License as' n9 {! z$ ^; w5 p4 s
  17. * published by the Free Software Foundation version 2.2 A: _4 o8 l" @! g0 p5 K9 q- i
  18. *
    . a) _* C( b* }2 q! m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * w% \* L" `% A9 m+ }8 w
  20. * kind, whether express or implied; without even the implied warranty+ v7 T8 _& C3 [" @. R  k1 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% ^7 Q- H; I. G7 E
  22. * GNU General Public License for more details.- @/ Y: u% u* j7 U4 k! ~4 C
  23. */
    . v: x& Z& W$ W5 l
  24. / R( ~4 ^& W; Q9 Y
  25. #include <linux/module.h>$ R7 B8 L( K- J0 M
  26. #include <linux/init.h>' a6 i. u; H* g; \
  27. #include <linux/errno.h>
    8 @7 w* l% G# Z$ E- y7 c6 [
  28. #include <linux/types.h>
    8 c# [3 Z5 [) |$ O1 w$ O- C) e  J
  29. #include <linux/interrupt.h>% T4 p8 [  r+ g6 I
  30. #include <asm/io.h>
    ( {8 `5 q% e7 B/ _) P$ k: W/ \
  31. #include <linux/moduleparam.h>0 `- z0 C( t' u  S3 o6 ]/ j
  32. #include <linux/sysctl.h>$ K, t' v* c) p( k/ n! J
  33. #include <linux/mm.h>
    1 I+ \3 R9 ~4 o8 Y& ~$ `& O9 W- M
  34. #include <linux/dma-mapping.h>
    * Y1 X5 e: W% w( D8 J' S7 m3 n8 Q
  35. 6 X1 Z9 r% u0 d& I0 ^
  36. #include <mach/memory.h>+ ?1 H, d% V8 L) \- M
  37. #include <mach/hardware.h>
    ' l$ `* z5 t6 m. k& H8 w+ }
  38. #include <mach/irqs.h>
    . T" x9 |, ~& O2 x* `/ A
  39. #include <asm/hardware/edma.h>
    ; P9 Z. F! \; @9 C/ t- k3 W

  40. , q' l1 L  F' c" f9 _. j
  41. #undef EDMA3_DEBUG1 c1 r6 x. s) b( {, l
  42. /*#define EDMA3_DEBUG*/7 T7 w) u4 k4 F

  43. 3 D: e( t$ B+ ?0 |7 K
  44. #ifdef EDMA3_DEBUG
    , v! X- p7 Y( L$ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + q# ~+ F0 s  t/ a) W" f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 z8 c6 P, K1 J/ k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 l$ x2 D( j3 x! U1 X5 n
  48. #else+ A" L# t$ @: H* Q! \
  49. #define DMA_PRINTK( x... )
    8 C$ B: D2 n" Z' @) B. R; U$ G. q
  50. #define DMA_FN_IN4 B$ N" B# H/ q
  51. #define DMA_FN_OUT
    7 k9 V: P* [* x; {: F
  52. #endif4 g7 Q6 G# U! ^  r" w0 F1 @
  53. - r4 O1 p+ {0 y& \# i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); G, N% @; r2 h! x
  55. #define STATIC_SHIFT                33 l* Z6 J( B* Y, B
  56. #define TCINTEN_SHIFT               20. g7 ^7 e8 g* g* h( _$ X8 ~1 u. Q
  57. #define ITCINTEN_SHIFT              21
    ' M; i3 y; E0 O$ N4 P4 z
  58. #define TCCHEN_SHIFT                22, S/ a. ?# |0 ~9 Q5 A2 Y
  59. #define ITCCHEN_SHIFT               23
    2 ^! X5 G) Q, V* z' t
  60. ) h6 b/ I3 h9 y% z6 J' j
  61. static volatile int irqraised1 = 0;7 h7 W/ m; L1 F7 n9 R* _* ^+ A
  62. static volatile int irqraised2 = 0;
    , }. S+ q) K* i
  63.   }9 [' f6 a. j2 l4 v' s+ A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  w4 x$ i& S: z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I! }: i1 i4 d0 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k0 i1 h1 t: Z2 P; |% O# h

  67. . z* p. T' K3 J
  68. dma_addr_t dmaphyssrc1 = 0;5 M$ c& l9 j( Z
  69. dma_addr_t dmaphyssrc2 = 0;+ S! S8 L6 M' j
  70. dma_addr_t dmaphysdest1 = 0;$ g& q$ ?1 s2 n/ ]5 x& L) ]
  71. dma_addr_t dmaphysdest2 = 0;6 `3 z3 j. o& d
  72.   K% o. O$ T# J$ f; f1 L: h
  73. char *dmabufsrc1 = NULL;9 B9 `& e% q- P
  74. char *dmabufsrc2 = NULL;1 N( a; Y- P7 i1 ]" I1 c
  75. char *dmabufdest1 = NULL;
    ( I8 I& R* U" ], |% p) `3 `3 P" ~1 U
  76. char *dmabufdest2 = NULL;) i4 l0 u' h  [$ x# P' M5 e

  77. ! X% X2 `: L+ p
  78. static int acnt = 512;( _* ]1 \  F4 E3 U! J* ~# |* u
  79. static int bcnt = 8;/ C" \: L& x2 ^$ }
  80. static int ccnt = 8;3 V4 L; o# R# f8 m6 w* @
  81. 3 C; m0 A( |  ]5 Y
  82. module_param(acnt, int, S_IRUGO);
    9 o$ H$ v6 N% b% G1 A
  83. module_param(bcnt, int, S_IRUGO);
    . C  U9 y( _7 e" g$ f6 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 k. j- e* y* h' b- e: q

; m! c! ?" N5 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, m& b. _, S# V' Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' X' Y- a7 Z; B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ?" Q. {" z9 v5 \: V
2 f+ I" o0 \) ?" n' Z, T+ S+ L
/ W* Q) x. J2 t9 v* Z7 ]2 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 03:27 , Processed in 0.036831 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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