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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & h% A% i3 ^, k0 E- [; l: M; z
  1. [code]EDMA sample test application
    3 f+ s0 Q) \4 e$ h& X
  2. /*
    8 P7 {  C- {2 I9 F5 u: V7 g
  3. * edma_test.c! t9 X9 F  a! s6 P, a  |- C5 o" v5 g
  4. *6 D9 v3 i5 j1 `0 a3 f6 u$ M, O2 X
  5. * brief  EDMA3 Test Application7 u$ _8 I; B: y/ B& ^
  6. ** w1 K; G. w' |* |
  7. *   This file contains EDMA3 Test code.
    * n5 B, |7 K# k$ E9 w6 \3 d9 v- F' D: s
  8. *
    : q) g  N  y' m' M. ~/ M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  z( ]0 [  f7 S0 E, H/ R. n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      {# Q$ u/ z0 X7 |. V) a# M
  11. *         TO CHANGE.
    8 t* F. U0 q% q1 @* Z' L. g
  12. *7 |+ D5 h1 e( W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# n) R. X9 i" i# _2 d
  14. *
    7 m2 L5 h2 r5 O1 c, G3 v8 Q$ r. ]# \
  15. * This program is free software; you can redistribute it and/or6 s# c( o% G: P. y. {4 T6 H
  16. * modify it under the terms of the GNU General Public License as  |/ _$ w$ d( x, C. b
  17. * published by the Free Software Foundation version 2.7 B. e. G4 V; x: g1 h
  18. *: W% e, q4 ~% k* f8 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 j2 ?9 `* u1 l' h6 S* l
  20. * kind, whether express or implied; without even the implied warranty" q2 Z+ n& n# b# g- n0 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 x& }8 n9 P  s5 _' b& w  q
  22. * GNU General Public License for more details.  Z- e3 ]+ ?9 J( N1 D
  23. */
    + t7 u' C# ]  E5 V. W1 L
  24. % n$ Z+ C! N" h8 @( {0 _, w
  25. #include <linux/module.h>
    ( A# d$ f7 g8 I; u0 L1 t7 Z
  26. #include <linux/init.h>
    ( y( H' \8 E5 @6 C2 S) ~& `
  27. #include <linux/errno.h>
    0 S" C9 s7 J- p# B/ P1 ?
  28. #include <linux/types.h>
      A. V5 G' y, J4 C( b: P
  29. #include <linux/interrupt.h>
      R* `( @7 ~; j% E6 J( w
  30. #include <asm/io.h>
    ; V$ M0 B* G0 U7 w
  31. #include <linux/moduleparam.h>: w( K- B) N7 ~+ z! a6 m, }4 M
  32. #include <linux/sysctl.h>
    2 F# Z' ^4 c& E. d/ d
  33. #include <linux/mm.h>' x3 ?/ t# _( ^; r
  34. #include <linux/dma-mapping.h>
    / K, U# e) R8 t+ |
  35. , {, B. `, h. f* z" S" D
  36. #include <mach/memory.h>* G7 s* E3 h, d
  37. #include <mach/hardware.h>5 A) u+ r0 _+ }! a& m+ \
  38. #include <mach/irqs.h>, w* i: ~* s+ v; \6 R
  39. #include <asm/hardware/edma.h>
    ; R8 Z, Z. o# x
  40. 7 q8 m& d( L8 i; }" G2 S7 n' [+ J
  41. #undef EDMA3_DEBUG
    ' b3 w$ W0 {/ g! Y) X5 S3 e0 o# w
  42. /*#define EDMA3_DEBUG*/
    8 X& p' ?. V  X: J) `( ]
  43. $ H1 y+ c5 B6 \  Z6 k
  44. #ifdef EDMA3_DEBUG0 K4 s2 N; x# ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 s5 g$ l$ m; o2 C$ ?# m# k- `, q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ ~! z+ i+ ~6 E/ J, [) Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Y: M& |. K9 ?2 R7 M0 Z3 P
  48. #else
    ; d" P) X0 t) p% R. e* B
  49. #define DMA_PRINTK( x... )
    ) l- L1 o7 T; N  K$ |( B0 Z
  50. #define DMA_FN_IN
    + n) A+ C3 i0 H$ N
  51. #define DMA_FN_OUT& G& G& ^8 A! w  D/ ^+ L" W; O0 b
  52. #endif
    $ Z* P( `1 V8 @: G' \( |
  53. % a! K5 C) `: q3 d: O# x. P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ y% S% {7 K( }6 F+ L1 l
  55. #define STATIC_SHIFT                3# X0 M/ f# @% \8 W
  56. #define TCINTEN_SHIFT               202 P( t8 C  G7 n1 b! P
  57. #define ITCINTEN_SHIFT              21
    ! ^! U. Y4 R5 K" A
  58. #define TCCHEN_SHIFT                22
    & Y1 e$ i! H+ O" D9 X8 Y, C; c
  59. #define ITCCHEN_SHIFT               23
    5 W, F5 I/ y" x+ [& ~5 U
  60. 3 ~' {$ y/ Y& s! E
  61. static volatile int irqraised1 = 0;; j6 V7 b; R8 I
  62. static volatile int irqraised2 = 0;( s5 r: D/ ^) S' h, V* q- \

  63. ' `4 v: e# G  T; ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + O2 k) R1 S& M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 P) X! b: ~! {0 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V2 N( Y) n, P# |- C% e
  67. + ~6 v* C- _2 h( A
  68. dma_addr_t dmaphyssrc1 = 0;
    6 @" o4 l1 h" j: [$ B  b% k7 K& h; B
  69. dma_addr_t dmaphyssrc2 = 0;! R/ n7 Q0 [, \& ~1 r
  70. dma_addr_t dmaphysdest1 = 0;
    : m6 R1 K" W+ y! ?
  71. dma_addr_t dmaphysdest2 = 0;5 D+ x7 z9 n5 g" U0 `( P' y

  72. 0 M% i/ E" j6 o$ U3 I2 u8 e/ G1 i
  73. char *dmabufsrc1 = NULL;
    6 w# F+ {: ^9 V3 a2 |- M- k8 ?
  74. char *dmabufsrc2 = NULL;
    # J1 i5 l0 F5 J7 |  m4 a! g
  75. char *dmabufdest1 = NULL;
    - p9 q8 I9 P9 i
  76. char *dmabufdest2 = NULL;  h& w3 W% D; Q' z$ M$ z; t

  77. 4 s" i% q  B# l+ j# N, g) t3 D
  78. static int acnt = 512;# H1 R5 z1 L0 h0 a; s
  79. static int bcnt = 8;1 U; A! {( e- A, a& F
  80. static int ccnt = 8;
    9 y( I5 I- N( ~

  81. ! `) L( r! a+ p& |, I5 d4 \* [
  82. module_param(acnt, int, S_IRUGO);7 f6 A4 c- Y. G& @) M- w/ @9 O
  83. module_param(bcnt, int, S_IRUGO);# ^7 v# W8 u, O1 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 J$ @" l( u! I4 f! n8 g  @
2 A: `9 U. G# t; j, ?0 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 [7 g( F# I' l" `% d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 P; u2 d9 e- n' ~- K) T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ d' l6 k2 o: s1 H1 v

# C9 n/ ]2 W  Y) G+ J; ?3 y, N2 g6 J8 y& J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 15:02 , Processed in 0.037040 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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