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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 K* N' ~( G) y8 c7 O
  1. [code]EDMA sample test application9 `: H, B; i4 M& o
  2. /*9 k7 l. J. x( W
  3. * edma_test.c+ c( d/ |* ~5 l8 l/ y! ~
  4. *
    ( _4 h8 r9 S: \8 {& W8 Q# |5 I" @* K% z
  5. * brief  EDMA3 Test Application
    & A' P6 D" w" w5 H! O7 @
  6. *3 \! b5 ^1 E& }9 t2 ^0 S
  7. *   This file contains EDMA3 Test code.
    / b  h" y7 @! r, O$ q8 q
  8. *) `, X9 }2 T0 t' y* ^5 |* @, n  G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + L. I! ]: B6 ?( U1 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 v/ u! Y9 F& T1 u7 ^: O
  11. *         TO CHANGE.
    , ?; [. n. Y* P. M$ d% I8 A
  12. *+ e- i  H$ ?  @. E' I  G! T; H# K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 ~9 i9 F& }7 _
  14. *
    % }* g. g4 V. l% S$ L
  15. * This program is free software; you can redistribute it and/or$ t& h& I6 b2 Y+ j) }8 T; n. O% A
  16. * modify it under the terms of the GNU General Public License as
    * _& W6 _# Y  `# H. ~  \3 J
  17. * published by the Free Software Foundation version 2.
    % l- ]3 q: g/ f( n, s
  18. *
    ( t; V! K5 a0 v+ |/ f! S  J6 g3 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# y! `6 p# M; k) t
  20. * kind, whether express or implied; without even the implied warranty
    ; G  s7 m3 D+ \4 ^- C) I! W& l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      Y# }' Z) t) S
  22. * GNU General Public License for more details.  O. s9 t! w) S1 e% L3 [$ s
  23. */+ y& D$ S+ t$ D+ D

  24. & r9 @1 ^7 H( u# ^! O# k* _
  25. #include <linux/module.h>
    # d. K0 D* T6 m9 r. f5 }7 u& f8 W
  26. #include <linux/init.h>
    / `4 g) W& |$ O+ X
  27. #include <linux/errno.h>
    # d( A4 ^" P$ [
  28. #include <linux/types.h>
    * P8 j3 Y% J; v% K! C
  29. #include <linux/interrupt.h>' a- i' C  b7 {* i( \
  30. #include <asm/io.h>
    ' ^6 W: H3 U+ ?2 O& M& g7 P
  31. #include <linux/moduleparam.h>
    - j# y$ T/ e0 C, e5 ~/ ?: X5 J  y
  32. #include <linux/sysctl.h>
    , ?6 A7 r5 _0 A0 ]& t- i
  33. #include <linux/mm.h>  o, o& X" k- R8 P& U# I
  34. #include <linux/dma-mapping.h>
    8 R* q' s. o# L, r

  35. 3 ^9 _2 K: |/ F9 D, s
  36. #include <mach/memory.h>
    9 g  C, W9 L6 x! P9 `9 N  N
  37. #include <mach/hardware.h>- @# _8 y! y% f* p
  38. #include <mach/irqs.h>% E1 d- I2 t' G  A8 M) P
  39. #include <asm/hardware/edma.h>
    ) D9 G5 K7 V- F& v# C3 D

  40. 0 D7 z) _- t4 V! F; ~7 V4 N% `/ ]
  41. #undef EDMA3_DEBUG
    * H+ v6 G! M+ S" W7 b6 v
  42. /*#define EDMA3_DEBUG*/
    7 r0 u6 \: ]8 o2 g, @

  43. 0 G9 X, s' f8 _* i* |4 s: K; }
  44. #ifdef EDMA3_DEBUG! X7 F" _9 E' S, W" z  h2 B" J; j" \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ l; W- j0 c5 J2 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) I8 @. s: ?$ Y6 B5 n/ G+ T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 ~/ F- b) g: c$ |$ Z
  48. #else7 H/ E9 S0 e% s( Z
  49. #define DMA_PRINTK( x... )( f' y* [' T3 v; E) _0 ~
  50. #define DMA_FN_IN
    3 V8 g* _  s6 E
  51. #define DMA_FN_OUT
    - Y! ?8 F) K% T) O' ?- C$ Z
  52. #endif
    / ^$ p' S6 e. Q$ b# o; Z- n' C" v
  53. / a6 o! L* E5 E1 y$ Z$ q  l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! L" t! z+ V- e7 }
  55. #define STATIC_SHIFT                3
    3 O% V9 u- M$ S2 A
  56. #define TCINTEN_SHIFT               20$ v* q. s, A% g. x1 o
  57. #define ITCINTEN_SHIFT              21
    5 \; M* {) `) f& _" x$ s
  58. #define TCCHEN_SHIFT                22/ f) u0 i3 M' X+ G' B0 K' c! |8 a
  59. #define ITCCHEN_SHIFT               23  }; U# r# ~" G! P1 r
  60. ; I1 V$ E/ x7 I, L
  61. static volatile int irqraised1 = 0;/ D3 B- g4 d# \, h: e* b* S
  62. static volatile int irqraised2 = 0;# X, ]' W6 J" w5 g  |- e, Q

  63. ) j* b) R$ v$ ~1 X$ E- U( p; x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L. |0 A0 b. Z" @, V" r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H: V- O; N: n1 a7 R0 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 N- |2 z0 U% ~) \+ Z

  67.   l- w- w  r, V0 p+ m
  68. dma_addr_t dmaphyssrc1 = 0;' G7 n% ~, X* W  y% r
  69. dma_addr_t dmaphyssrc2 = 0;
    + H5 S  _0 V+ u
  70. dma_addr_t dmaphysdest1 = 0;4 H3 I1 A! n" H5 |
  71. dma_addr_t dmaphysdest2 = 0;
    " ~( ?3 I9 X" C. J2 \
  72. % r8 ?  ~7 N0 l/ J: `7 B
  73. char *dmabufsrc1 = NULL;% s: ~0 e: d) ~% X% T
  74. char *dmabufsrc2 = NULL;: x" _0 X8 A. K6 W' v9 O5 t; i
  75. char *dmabufdest1 = NULL;
    * g) `" f( n; y& D8 p
  76. char *dmabufdest2 = NULL;
    3 P& K: }* }3 r/ N" O5 P, N' F

  77. 3 L& a- O* H, \7 U  X& L1 S
  78. static int acnt = 512;
    4 G  {9 w: {2 E/ }
  79. static int bcnt = 8;6 q; ]! O# f9 E  L. O
  80. static int ccnt = 8;. Y! a" H! P4 M1 [
  81. . Y/ Y) h5 P' V
  82. module_param(acnt, int, S_IRUGO);
    # J8 \5 t( S2 ~# F  f4 N
  83. module_param(bcnt, int, S_IRUGO);
    ( d5 N9 ~# c8 H  _9 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* D& P, P- R& f% l

6 `  @( {$ |9 S, u# D  z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" {/ w# c5 |7 Z- k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' J) p/ d! l! F( Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' M! Y1 A* s/ }* b5 H% \: w& K2 r3 Z% ?) N3 n( H: g+ g# K
; w+ q6 T6 v9 l- {+ w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 04:04 , Processed in 0.040108 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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