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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 i6 f# S# K5 q6 S
  1. [code]EDMA sample test application( J! C' K1 Y' L0 I, Y
  2. /*
    * J' ~4 o" S  x* J' s
  3. * edma_test.c
    3 Z4 U1 W" G# `& v6 v% I) z# X
  4. *$ K( s1 b, O! e# d
  5. * brief  EDMA3 Test Application  h& E0 Z+ c( f2 `
  6. *  Q7 U, P9 z/ W& D8 I% {+ V; P2 L
  7. *   This file contains EDMA3 Test code.2 I' Q+ E8 x/ H2 [7 c1 ?: x
  8. *7 p4 _6 ^! W2 m) Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % Q! F: \$ m: \) }! e# V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , E$ |, v2 o5 f" h' c, q
  11. *         TO CHANGE.5 u( C, N; T9 Z$ z( U8 q4 g/ c' ]
  12. *
    & ]% {. U. I; g4 t! _! d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 }3 {" H4 g- [2 p+ S0 {
  14. *
    - K, ^; w5 t' Z. H2 x
  15. * This program is free software; you can redistribute it and/or
    + ^  r# u5 w: o
  16. * modify it under the terms of the GNU General Public License as$ N6 x( @- Y; m6 {& B; }" H. P
  17. * published by the Free Software Foundation version 2./ L0 c- I) c" `" j0 X4 ^0 b
  18. *: v  A# D5 i" R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! k5 h2 I# ?& S% H5 _2 N; A/ p
  20. * kind, whether express or implied; without even the implied warranty+ H1 @( D" t; H4 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% f% O, `$ s- t1 ~7 Z3 F
  22. * GNU General Public License for more details.. K9 C- B2 J% v
  23. */+ g! U3 M  k7 T7 a

  24. 6 l9 }+ S' {  j- A  z+ z9 P) ]* d; g
  25. #include <linux/module.h>
    ' A; I+ k) y3 L) x2 _9 a
  26. #include <linux/init.h>
    . n" l1 O) m! E! P0 _2 f- N7 E; r
  27. #include <linux/errno.h>. m' x, S  e1 O$ `  `% h6 f, L
  28. #include <linux/types.h>2 k5 c; s0 H' a0 l* j( f: }0 x+ S
  29. #include <linux/interrupt.h>
    / {( \  q. t1 e5 i. g6 j
  30. #include <asm/io.h>
    / X& V. j' E8 W( B' |& K$ ]
  31. #include <linux/moduleparam.h>
    4 T3 G. I8 u3 d1 o
  32. #include <linux/sysctl.h>
    3 o- N$ I' t# k# d  x9 [8 S3 k* K
  33. #include <linux/mm.h>' O! x( O9 p/ k5 W7 G; c
  34. #include <linux/dma-mapping.h>$ t$ M+ D7 a- {* ?* q# X2 Z
  35. 6 I. ^, ^( ]! I7 Z
  36. #include <mach/memory.h>
    1 t8 X$ U0 v$ P: m, k; \% C/ r
  37. #include <mach/hardware.h>
    * D, B  D' ~6 k; o4 D; c
  38. #include <mach/irqs.h>, Y$ f4 s% ^+ w- m; `7 m: u9 d) p
  39. #include <asm/hardware/edma.h>
    / k4 }' A2 r' Q; p% B6 g/ y
  40. 7 u9 |/ r0 ]$ `
  41. #undef EDMA3_DEBUG
    + V0 `2 M! p: ~; E- V/ H
  42. /*#define EDMA3_DEBUG*/
    " a% `1 ~4 E" V, s. o& M& L

  43. ' @* N  f/ k' [/ i
  44. #ifdef EDMA3_DEBUG
    5 d  u$ J1 r2 B8 m8 u# b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ v4 ^" O* w. C+ k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 s8 o! \) O% \% @" h, ?2 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 z) }0 {" g: \9 H3 D! S$ a- }
  48. #else
    % Q  g. d5 [+ S- [( x6 d7 _
  49. #define DMA_PRINTK( x... )
    & t- n3 J- W2 W4 K; r
  50. #define DMA_FN_IN; @6 A4 u$ H1 b2 {: `, G9 N- h
  51. #define DMA_FN_OUT$ ~9 q# `% c: ?8 h7 [7 b0 C
  52. #endif
    9 [! t8 z# V6 R- K

  53.   ^" d, o4 d7 r1 l7 t' `4 M, u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 K% a  Q' m6 Y8 P" b2 R
  55. #define STATIC_SHIFT                3
    # n9 `$ m/ v5 Y) t9 x! ~, E( j
  56. #define TCINTEN_SHIFT               205 y, n- |+ s  D( S4 E. l5 O
  57. #define ITCINTEN_SHIFT              21
    , ^6 v3 `. R% O1 [& {
  58. #define TCCHEN_SHIFT                22
    0 [; `3 K3 U; G' b
  59. #define ITCCHEN_SHIFT               235 l* J) S1 O  O! {' u+ d
  60. % _7 C% f( {. s7 X( G/ v  M
  61. static volatile int irqraised1 = 0;$ _2 {- v! `0 s8 Z
  62. static volatile int irqraised2 = 0;
    ; T% g3 N$ Q- Q+ ~

  63. 6 Z$ W/ D1 Y" O$ i& L% x/ }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 @# L7 B9 P8 \1 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L5 _+ \7 Y9 ~; m; ~/ Z: I/ \+ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. w! ]3 u2 M$ h4 |7 Z! `

  67. 0 `0 T1 m' t* O  {6 P# F. x6 g
  68. dma_addr_t dmaphyssrc1 = 0;
    & R$ s5 A; V8 Q8 {$ h; c% ^4 W
  69. dma_addr_t dmaphyssrc2 = 0;4 f, ~: _  V3 Q* A' h2 j0 b
  70. dma_addr_t dmaphysdest1 = 0;
    $ o" t! ~5 h1 f- y
  71. dma_addr_t dmaphysdest2 = 0;
    " P2 u$ E& ?, S% M5 t
  72. * G5 \* L7 Z0 x: ]6 D5 r( D4 i
  73. char *dmabufsrc1 = NULL;
    * |, b9 C- a) M( d1 a, X
  74. char *dmabufsrc2 = NULL;
    9 m/ G+ h0 r( N! \
  75. char *dmabufdest1 = NULL;
    4 Z$ U0 s$ ?* H
  76. char *dmabufdest2 = NULL;* N/ N; z' J' l5 J
  77. , T6 i; P7 u7 n( i
  78. static int acnt = 512;
    8 P' i" t5 ?- g
  79. static int bcnt = 8;; r. m( b! A# a* y$ x' m" I
  80. static int ccnt = 8;
    7 P3 q: c* C; K7 S3 j

  81. - K) @6 j! t* v( j
  82. module_param(acnt, int, S_IRUGO);/ d! c! g7 z1 L6 m
  83. module_param(bcnt, int, S_IRUGO);
    ' V5 y* |" A$ @! M. h  q0 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. Z, d. Q. \6 [" ^1 Z
- C  M% b/ J, _$ K0 t3 f6 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ^! D, r5 u6 o! g7 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' m0 m8 @8 L% q' @: j* [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 @7 y" X# h! w; V3 ^- [2 R! m) g

( z% ?0 X! Q) e9 W4 w- j; x: w
: s& J/ T5 h" {3 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 20:49 , Processed in 0.035436 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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