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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 W% `' i% Y5 ^1 j* p
  1. [code]EDMA sample test application
    6 q2 D5 m6 E# ^2 D  `5 M7 y
  2. /*
    / [* R' v7 r# Z2 A4 j
  3. * edma_test.c
    # O9 E5 s! J1 y
  4. *
      p/ K+ G' P' @: T+ L
  5. * brief  EDMA3 Test Application
    % O' F* v8 w+ Y0 Q6 ]
  6. *4 Q: P" S3 T6 E7 q4 v8 {5 c' ]
  7. *   This file contains EDMA3 Test code.
    8 _  R; n% f' M& \7 Q+ R* U  N$ w
  8. *
    & H5 v. V3 N2 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 t" L5 `2 x& T2 Z) N1 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o: q0 B: B6 y: ~% p$ ?: Z) p
  11. *         TO CHANGE.! P0 s7 J5 K7 q. E8 C. \" i# _& m) L% M
  12. *
    ; Y1 [" S. G$ z# @/ `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% q6 R" T1 t4 m; I0 R+ l5 Y. P: H! I
  14. *
    ) B/ g: _+ v" ]' V4 b- B
  15. * This program is free software; you can redistribute it and/or" h' C$ F# s  S/ k* e$ ]+ A6 I& Q
  16. * modify it under the terms of the GNU General Public License as
    7 l; K6 c3 Z9 v0 Q: `  k6 w: Q
  17. * published by the Free Software Foundation version 2.
    1 b# I# i( i5 [% y' e' g! D& y
  18. *
    . ^+ ~/ z+ M6 k" e  _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 |, X6 F) K2 c) O3 c  ^2 X
  20. * kind, whether express or implied; without even the implied warranty
    6 t0 G3 D9 N% H. I) q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 c, ~. f- J2 _. N
  22. * GNU General Public License for more details.% n& X: v# I6 @3 l0 W) {$ o
  23. */
    : \, X: h* X0 u$ s$ W2 n: }

  24. - T( l4 X3 V4 s% n% V
  25. #include <linux/module.h>( l& u7 D5 F7 m- A  ~  \/ @  ^7 v
  26. #include <linux/init.h>
    ) l) T) B" X# S. |$ q8 X, V
  27. #include <linux/errno.h># {4 U$ L1 p# h  P  Z: q# q
  28. #include <linux/types.h>
    ) g. f" k$ t* A
  29. #include <linux/interrupt.h>% S+ J- w: {2 g( H
  30. #include <asm/io.h>
    7 [4 \9 t2 g6 R4 A4 u
  31. #include <linux/moduleparam.h>
    5 K. J7 A  x" ]
  32. #include <linux/sysctl.h>
    6 S. s. H% i! [4 {3 Y: Z! W
  33. #include <linux/mm.h>( f  ?' Y. W2 s" H) ?# l1 h
  34. #include <linux/dma-mapping.h>
    ( d- A1 R9 c) X- g! k
  35. : L" v# C* z1 X5 X* m2 F
  36. #include <mach/memory.h>& A2 c& {1 Y* B' g/ Y3 N. X2 M
  37. #include <mach/hardware.h>- q1 [' W! s+ d# T/ v, h
  38. #include <mach/irqs.h>/ s0 z, P+ f4 t: q& H8 H  s5 \1 O! D
  39. #include <asm/hardware/edma.h>
    0 T& _6 W9 A( B/ j

  40. 1 `3 E8 X! h! m4 Z, t$ t1 e
  41. #undef EDMA3_DEBUG8 J  a: G) R  G: @/ z) e8 K
  42. /*#define EDMA3_DEBUG*/" R8 m, p0 t8 V- D0 g6 J5 Y9 V) o
  43.   u2 j- w( M. _2 O' \
  44. #ifdef EDMA3_DEBUG
    0 Y1 x9 ?, N! O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : J+ A1 m/ t; l& K- M' _! o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : q. V" F, U  a3 }6 n& f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 R% x% \; g& H2 ~2 C
  48. #else# r4 W: ~. f' B" w, C
  49. #define DMA_PRINTK( x... )
    4 s! H" D  {5 F+ d
  50. #define DMA_FN_IN
    , Z5 k9 j3 \6 w9 b
  51. #define DMA_FN_OUT1 z9 s9 }/ A9 f0 [, j; ~
  52. #endif
    ) \6 i; d: F7 f+ k2 J( D8 F7 b
  53. . h% K+ {! _# L/ C2 _- ^# S4 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , C7 m/ N% S1 o2 n! h1 J
  55. #define STATIC_SHIFT                35 `% ]$ T; h( G$ J* Z% P& ^% f
  56. #define TCINTEN_SHIFT               20
      E0 {6 L5 P, R  ]7 W+ d
  57. #define ITCINTEN_SHIFT              21
    ( p7 j  x3 m/ B" N2 T5 d& X
  58. #define TCCHEN_SHIFT                22
    2 Z  ?* R! D5 p  s3 D# L! f% s/ @
  59. #define ITCCHEN_SHIFT               234 U0 }5 n# l1 I

  60. * z5 p- {. i- G/ g& S
  61. static volatile int irqraised1 = 0;+ z( \1 E& E& k" P# r, S
  62. static volatile int irqraised2 = 0;
    # U' W7 i- [; j9 n$ O" Q- [$ P4 ?0 }
  63. 2 u! u( p- ^6 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" T0 I* {8 {* c3 m# l$ B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 N: h7 B+ U3 F0 o; f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d  B2 A# l, o) D) k

  67. 8 ~" z- W! `1 K
  68. dma_addr_t dmaphyssrc1 = 0;' g" `" g. ?2 o4 y. y9 c, z$ E6 S
  69. dma_addr_t dmaphyssrc2 = 0;/ L! k; b6 R" C% l# r# t
  70. dma_addr_t dmaphysdest1 = 0;
    4 @. p: B5 v6 z
  71. dma_addr_t dmaphysdest2 = 0;
    $ t: i0 M/ H8 l& T3 W

  72. - A( i% N% S- o" P0 e
  73. char *dmabufsrc1 = NULL;
    ( D3 g$ A- V2 C! M( f6 _3 k
  74. char *dmabufsrc2 = NULL;5 h6 \6 ]6 I$ a8 {+ o! k5 i
  75. char *dmabufdest1 = NULL;$ ?1 @" u& [% N5 d4 e% D- j/ w7 H$ w
  76. char *dmabufdest2 = NULL;
    ' P; d: u* b3 ]5 [7 u
  77. # y" ~2 i3 `/ ], F
  78. static int acnt = 512;
    ; E2 Y, V5 n7 E$ \) S
  79. static int bcnt = 8;
    : V' M; ~# k6 q- V) j
  80. static int ccnt = 8;) t0 A) B; U& ~  s

  81. , W4 G6 t) ?! j/ I8 S$ F1 \% G
  82. module_param(acnt, int, S_IRUGO);# N4 H5 A! t- A& S' `( w# [
  83. module_param(bcnt, int, S_IRUGO);2 P" f2 Q6 J$ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( Y& l6 Z; ?- L% H2 s
$ H3 s: Y0 W8 N, ^( R" c2 ]/ `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 g" Q# m+ S: i1 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! p* a& i" _( ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: n- G/ d9 c- x) e" b% B+ s  v
. ^' Y0 D( f* b* Y
3 _; a" ]; S& P' A# Y! K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 10:16 , Processed in 0.040126 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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