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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * U) h( W' s3 D- A
  1. [code]EDMA sample test application& V9 }3 w% K- L& D$ [
  2. /*3 H& k+ g+ s8 e8 U) v6 f" m
  3. * edma_test.c# z3 B. K* d' r2 y+ }1 j8 D
  4. *" A! e" p; P, c1 }
  5. * brief  EDMA3 Test Application6 c& D4 N2 }* B! _2 t
  6. *( K9 h7 ~& P2 c7 c4 {6 K
  7. *   This file contains EDMA3 Test code.# u- k% }3 v  `5 j! |: W
  8. *
    . C" n( F2 q. P. d0 z* P; O4 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 }. |9 x) _7 h5 p1 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . H4 H* V% ^% F3 q# C- M
  11. *         TO CHANGE.
    1 m% X9 l) ]2 N, N+ ?1 W
  12. *
    7 r! S- G- ?( K/ F  m+ R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 C; K4 m9 P8 A0 ^( W$ {
  14. *( I& I& R+ [1 U0 p: `
  15. * This program is free software; you can redistribute it and/or
      e# s# }0 C3 y
  16. * modify it under the terms of the GNU General Public License as. j! m4 i7 S/ b% L# p% X. b
  17. * published by the Free Software Foundation version 2.
    ; y% E$ N  o5 E- b! o# L+ k+ Z
  18. *' l9 R3 w" d: ]- s& p8 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 m0 C4 R4 _6 Y* \: N
  20. * kind, whether express or implied; without even the implied warranty
    , r/ x  u# M9 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 T& P" w% w% S
  22. * GNU General Public License for more details.4 o7 o0 k# L% r* c7 @
  23. */
    & R# e# [" ?+ H

  24. " A$ v& h/ Z. q4 c
  25. #include <linux/module.h>1 u: t2 w1 G" X! u
  26. #include <linux/init.h>$ G( R$ x! S/ R3 M1 x& n% `7 f
  27. #include <linux/errno.h>
    5 w2 F6 F  S9 P$ L3 f
  28. #include <linux/types.h>2 M( d+ L# Y2 a1 `
  29. #include <linux/interrupt.h>
    ) ~" r8 ~! Q* w1 O& e! |
  30. #include <asm/io.h>
    ' ]2 s$ P3 }2 n6 j- r5 R/ N
  31. #include <linux/moduleparam.h>9 @% f( @  T4 x) J, k
  32. #include <linux/sysctl.h>
    # h9 w/ m4 S5 w# {- E& A) k# V1 {
  33. #include <linux/mm.h>
    % h( P: f. W7 a
  34. #include <linux/dma-mapping.h>
    2 c& e6 f$ j) u/ G
  35. , o% h8 X1 a3 a/ L
  36. #include <mach/memory.h>
    , R9 D. a; ]: B0 Z& d& p" T5 U
  37. #include <mach/hardware.h>
    8 [5 ^/ @7 G& F2 `, k8 W
  38. #include <mach/irqs.h>. l$ R5 C# J9 C2 g, `; k1 B, c
  39. #include <asm/hardware/edma.h>% ?0 U2 v( m8 n
  40. 5 D) Y% F9 \* b5 k9 T
  41. #undef EDMA3_DEBUG* y' s  G7 h+ t, \7 b0 N  w
  42. /*#define EDMA3_DEBUG*/& w! G0 m- Z5 d) L# t
  43.   c5 R% v8 @1 V! T
  44. #ifdef EDMA3_DEBUG
    , g+ x. Y; j6 ]. u$ O3 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" M9 `- j8 }+ Z+ O: d# e! h! i: c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . X1 ?* R9 Y0 j$ H* F+ x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); o, i7 R% N" {- [; Y
  48. #else6 Q! }5 n! v. k5 e
  49. #define DMA_PRINTK( x... )
    + }- [  c& c% @4 W  o
  50. #define DMA_FN_IN
    5 }  U8 D& |, ^
  51. #define DMA_FN_OUT
    3 K3 Z0 M2 S$ u$ S3 K" O/ h+ i" h& z  Z
  52. #endif
    1 ]+ o6 n5 c1 G
  53. 3 w. p; ?' O; b% V; r9 T5 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      _# H2 H" i) S2 _4 I& Q
  55. #define STATIC_SHIFT                36 s5 k: P# j/ `' E+ K+ v
  56. #define TCINTEN_SHIFT               20
    * K0 I0 X1 l) ~; y4 o/ Z
  57. #define ITCINTEN_SHIFT              21
    8 ~% t4 i! _% A& X  L+ E/ q
  58. #define TCCHEN_SHIFT                22
    ( |# ^! V+ l2 t5 ?  V  R/ @
  59. #define ITCCHEN_SHIFT               23
    1 i4 J& L+ b  [* R
  60. # G$ q+ C% L& W( {, Y+ Q
  61. static volatile int irqraised1 = 0;
    + H+ i) c7 {- x+ @+ w
  62. static volatile int irqraised2 = 0;
    0 a$ F0 n9 y/ A) j: Z0 g& T
  63. , T, J# O  j0 X) |' b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - _' `: i; k: G& y: A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& V. f$ a, v3 q! S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {0 X  r4 H; Z# m7 C
  67. ( F( l5 ~/ R: y4 X1 m' ^1 R
  68. dma_addr_t dmaphyssrc1 = 0;9 M- }3 w+ j/ Q5 @4 M
  69. dma_addr_t dmaphyssrc2 = 0;& l) u' \# ?% t) P8 H$ E
  70. dma_addr_t dmaphysdest1 = 0;4 V) d7 `# N; {( L
  71. dma_addr_t dmaphysdest2 = 0;
    0 p, a. \2 \3 a  q4 @3 Z! n8 b! B

  72. # Y+ @' u. B  i
  73. char *dmabufsrc1 = NULL;0 @& V3 V- h3 ]
  74. char *dmabufsrc2 = NULL;" x! `* F4 r" u$ c5 I7 Y  K& q
  75. char *dmabufdest1 = NULL;
    # v1 U( s6 a; Q% i7 c, I2 }0 i. @# s
  76. char *dmabufdest2 = NULL;6 }% ]2 h  _9 E. i' _- f" n2 p
  77. / I. `! I# E& g0 U8 G0 {* \7 |
  78. static int acnt = 512;# a3 ~6 {0 x8 J. s
  79. static int bcnt = 8;
    $ m/ t& W$ {  o; M3 y
  80. static int ccnt = 8;
    7 B( A' T3 M6 Y& F
  81.   h% X  ]" H0 {3 L; M1 o& w
  82. module_param(acnt, int, S_IRUGO);
    ; {. G4 A3 Y. V3 L
  83. module_param(bcnt, int, S_IRUGO);% h- O  y  N0 K  g7 T" V% t4 a- s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ^) v; ]8 y" m; X$ I$ p
# G; D3 M0 {5 I" P" @; Y: R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; x' Q+ j# W( harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# V+ {/ @2 A4 t- x% \( X* F. l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 |7 d3 O  D! t- D# w  I& [5 R

) }8 U" I5 u: y. n! F5 V: C7 S( ?& \  R# X1 [; N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 23:20 , Processed in 0.040435 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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