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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: d+ G$ r6 x$ k. R
  1. [code]EDMA sample test application: K# E# w7 v) a4 `! A1 ^
  2. /*1 j+ r  Q3 ?3 F& y2 c1 `
  3. * edma_test.c
    + `. ^" m7 E3 q+ [# i! Z
  4. *) x! j6 I- M5 H+ H' m- U- Y$ @+ ^
  5. * brief  EDMA3 Test Application' n+ ~. q5 M( y/ [  K0 P
  6. *0 j5 a7 c) p8 b1 c: [
  7. *   This file contains EDMA3 Test code.
    & M4 F1 B! e, D" x2 u, B
  8. *
    + ?& K* N( V4 y0 }( P& P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 R% ~' s+ Y. i* P3 @+ B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 l' Q# U8 D% @5 }( v! Q/ l* c! H
  11. *         TO CHANGE.
    ( {8 q- t0 T+ \# b2 u
  12. *9 `/ }" H( S7 h. N5 [8 h& |' {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Q/ S2 S3 D0 n# x: m) U  [" B
  14. *
    * `& @) h4 l/ p* P' K& {
  15. * This program is free software; you can redistribute it and/or! h6 R; ]/ S$ y& e
  16. * modify it under the terms of the GNU General Public License as
    # k! k* d% \! t: D( f6 e1 K
  17. * published by the Free Software Foundation version 2./ i$ S4 Y& d  |4 ?; q
  18. *5 `. S5 d6 E, y( b3 I& H" t$ {. \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; J& P$ E, g1 N7 Q, k% z! W
  20. * kind, whether express or implied; without even the implied warranty0 W( k( b; [+ ?0 I  S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 I& C$ ^2 y3 L' b
  22. * GNU General Public License for more details.  g9 Z( ^9 O! z
  23. */+ R( y" N' Y8 H

  24.   ^; N8 V: f8 M& |( c
  25. #include <linux/module.h>
    ; @* k9 E6 K% r0 {% i% R" D: @
  26. #include <linux/init.h>" _9 ~7 t) Z; }) f# n0 t
  27. #include <linux/errno.h>
      {) ?1 Y/ h& q7 b3 M3 ~, o
  28. #include <linux/types.h>
    1 J2 s# e+ s0 `! z2 K
  29. #include <linux/interrupt.h>
    ; w- r; F; g: Z0 L5 s
  30. #include <asm/io.h>( X( a4 s8 O( a% ~9 ~6 ]8 f- C/ M
  31. #include <linux/moduleparam.h>3 ?" |& x( `) ^7 X( R0 e3 y% }/ k; b& s" l
  32. #include <linux/sysctl.h>
    9 g! M5 O4 n+ S
  33. #include <linux/mm.h>
    $ O3 }# F: t( Z* J7 _9 y5 w
  34. #include <linux/dma-mapping.h>$ P7 a& ]8 {7 }  e# h# O
  35. ) s% ?+ H4 U4 V: M. M8 S3 F2 G
  36. #include <mach/memory.h>1 w% i7 W- p. V5 x
  37. #include <mach/hardware.h>
    & s: I# e- ~6 f  s% x, K
  38. #include <mach/irqs.h>
    . A$ c$ b( m  o5 {, x
  39. #include <asm/hardware/edma.h>
    ' x) s( S* T+ e+ s: Z/ L
  40. 5 p/ ^% q; A+ ^  p/ T
  41. #undef EDMA3_DEBUG5 g# r0 y: \7 o
  42. /*#define EDMA3_DEBUG*/' `* v. V  N8 k/ |7 A0 B3 Y
  43. ) K% J4 n- e% ^% V2 n
  44. #ifdef EDMA3_DEBUG
    4 Q7 B" }7 K: W0 c1 \/ a+ ?9 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 |0 O4 [7 |. q6 S( |+ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 W% o5 J" j$ J% w6 X  t9 V6 Z$ u3 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / N3 ]6 E* }' n1 H1 K- [) }/ j
  48. #else0 O9 W: J' A$ N  p0 b" T* {# Y
  49. #define DMA_PRINTK( x... )
    2 |9 n- S$ G9 B
  50. #define DMA_FN_IN9 `, l: `* c  e' S( i. H" p
  51. #define DMA_FN_OUT
    ) H7 S6 ~3 h) f0 D( G: l4 Q4 s
  52. #endif9 I3 L' k" c7 N7 f% b2 e2 X

  53. 5 c4 i, a5 c! s9 Z0 ]3 \: O$ C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' T0 d4 d; J2 b$ I' R7 Q# f9 g3 ]
  55. #define STATIC_SHIFT                3
    ; E7 G& Y  p, L  G! B
  56. #define TCINTEN_SHIFT               20
    6 e+ w" y; Y5 b
  57. #define ITCINTEN_SHIFT              21
    - J! f! f- m' K, v
  58. #define TCCHEN_SHIFT                22
    & y' A: A& A! d. p
  59. #define ITCCHEN_SHIFT               23
    - F9 S; l( P# V4 _

  60. 8 t3 l. o# b3 S* F* q# n+ K" H
  61. static volatile int irqraised1 = 0;6 R) F& c; m- ^: ^$ N
  62. static volatile int irqraised2 = 0;
    + V5 I! ~/ G, K( n1 a

  63. 8 S4 G$ O& Y+ M# m" g# O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X0 `/ f) ^# q9 Q" j5 U% |; R( g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 T4 v, c: I" `  o* \8 `! f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 X2 }8 }. @0 g7 F1 Y+ h
  67. 0 E. T- W6 n4 z7 f
  68. dma_addr_t dmaphyssrc1 = 0;
    0 h$ o3 p: V/ x
  69. dma_addr_t dmaphyssrc2 = 0;
    . Q, u2 \, J5 r  f7 i/ `
  70. dma_addr_t dmaphysdest1 = 0;' j; v3 A, [/ L8 |
  71. dma_addr_t dmaphysdest2 = 0;) M2 t* C: h# V, t4 W, z+ R
  72. " |5 d/ Y0 @* O) y1 d
  73. char *dmabufsrc1 = NULL;
    1 m; w( b( Y  [
  74. char *dmabufsrc2 = NULL;
    4 U2 ^2 q7 t  P8 Y9 _
  75. char *dmabufdest1 = NULL;
    * y9 P3 y; W! [$ [
  76. char *dmabufdest2 = NULL;4 m( w  L! E9 {" N
  77. 7 a% \% w1 z" ~# N, ~# x$ X
  78. static int acnt = 512;. N4 M% M; Y/ N
  79. static int bcnt = 8;
    0 n& l9 @' R2 z! c# {0 \; v( s& P
  80. static int ccnt = 8;& T0 C) Y, V+ `5 z3 d
  81. ! d2 I/ G" l8 h- a$ I" T! d: w
  82. module_param(acnt, int, S_IRUGO);( h" U! e& ^; A9 d' r/ E
  83. module_param(bcnt, int, S_IRUGO);
    : c, g: a. O! D0 u4 z9 n& c* t  ?+ f) b; H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ X  E1 @9 T3 I* M( Q2 w

1 H& E) o8 c) ^# w% r0 ~( \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* S/ S! G: \0 S- Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) a6 a( V1 A$ i: j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, d* |9 ^  ~3 q1 }+ D9 @8 @

3 D: }& o8 E* f8 x
% m& ~$ b4 j+ x3 Y2 M& {4 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 05:09 , Processed in 0.055693 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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