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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - H' a$ g- u, x) m
  1. [code]EDMA sample test application
    6 n; S& o% y) l  ?
  2. /*
    " S6 m4 [) L* M/ s
  3. * edma_test.c
    & g4 b# @; f/ Z; w6 X
  4. *
    ) {2 B4 G2 i6 q6 _
  5. * brief  EDMA3 Test Application
    9 H/ @% [$ B5 X
  6. *
    ' t! L9 J- A0 s
  7. *   This file contains EDMA3 Test code.
    7 ~4 }! \& a6 v! ^
  8. *: h& {" ^' ~' e' h' T4 p+ `" s" {  w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 Z- F0 |* _+ T* n3 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% J0 l5 |$ Y- C2 W9 k
  11. *         TO CHANGE.
    8 A5 U) z% y, x
  12. *; ~; k+ K& x) M; a; e2 S  u5 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * Z4 l! ?  ?$ q+ R6 |. U
  14. *, V; R+ D" r) ~( S& p
  15. * This program is free software; you can redistribute it and/or9 o5 f. L( x: |& Y+ U3 h+ u
  16. * modify it under the terms of the GNU General Public License as
    " X8 c" u8 f0 O/ Q2 r3 f  h7 I) q
  17. * published by the Free Software Foundation version 2.# k; l& Y% }/ @! c
  18. *0 y1 m" P$ H% a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * _* `1 T2 r3 O5 C, h
  20. * kind, whether express or implied; without even the implied warranty
      F2 B7 F5 w. o0 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ @4 {! b1 v% l% p
  22. * GNU General Public License for more details." |! V$ V$ R5 k" X0 j# K
  23. */( m& U# G! ^1 f* ?2 C* W

  24. + v: Y4 o. d3 v( E# x7 K
  25. #include <linux/module.h>2 H6 s5 p; x5 x6 q
  26. #include <linux/init.h>
    / }+ R1 P  s1 U6 l4 G
  27. #include <linux/errno.h>7 `5 E- i. s7 `
  28. #include <linux/types.h>
    7 M% ]! ~5 B; w" V
  29. #include <linux/interrupt.h>
    / M: E. [( ^, F& ]8 F* C( }! R
  30. #include <asm/io.h>5 p7 p0 h9 m, {" M4 w/ |
  31. #include <linux/moduleparam.h>
    2 a0 n2 C4 O% c
  32. #include <linux/sysctl.h>( n/ m6 k; [2 c$ {4 O4 _( ^; V
  33. #include <linux/mm.h>. N3 m; O& M) F8 T0 |' V
  34. #include <linux/dma-mapping.h>0 h$ U# h3 G+ e+ k

  35. ! @5 f9 x% d; H; D( k4 T' ]0 d& y
  36. #include <mach/memory.h>* X5 I& o; j3 C4 ?
  37. #include <mach/hardware.h>
    : w  U6 w( h6 Z, c' m0 d
  38. #include <mach/irqs.h>" S5 f9 `" _6 j) t; n3 t# @5 X- B
  39. #include <asm/hardware/edma.h>
    , t* X+ h; r9 U5 w9 n! H+ C; z6 `

  40. 6 g/ z) k! e; r
  41. #undef EDMA3_DEBUG
    # y9 Z$ y/ R3 j0 p" {1 W1 C7 @
  42. /*#define EDMA3_DEBUG*/
    8 X: b& B/ n4 H0 Q8 s6 b0 |

  43. / E$ Q; v: H! G, M1 d  l
  44. #ifdef EDMA3_DEBUG/ u1 r. S4 T+ e, S" _9 m9 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 s+ w- }8 a( G* l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * I! r0 _) C! i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ ], [, M- }7 y: U
  48. #else
    , E" {& i# _0 ?3 O( N- ~, M& T; J
  49. #define DMA_PRINTK( x... )
    6 B% Z; b: S" j" U  i( A4 m
  50. #define DMA_FN_IN" k0 {+ e' O  H; r9 @1 T
  51. #define DMA_FN_OUT
    2 `2 T2 k' }7 Y* J
  52. #endif
    6 k4 M& X! m4 F7 d+ K3 N% v
  53. 0 Q- n+ m3 T/ u5 J$ N$ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 y/ x2 j+ V8 C( S( \1 R. l5 @" I
  55. #define STATIC_SHIFT                37 O# f% F$ }  m; ]0 x( g
  56. #define TCINTEN_SHIFT               20
    . m4 p: L) G' w* q4 v. m
  57. #define ITCINTEN_SHIFT              21) Q: X5 L2 I: ~# {8 I+ N
  58. #define TCCHEN_SHIFT                22/ `) K: I8 d/ j. |% G
  59. #define ITCCHEN_SHIFT               23! z7 K6 k- ?8 j& K
  60. * z% P' O7 P( k  @2 t3 k
  61. static volatile int irqraised1 = 0;
    0 P' Z; |& a6 A( e
  62. static volatile int irqraised2 = 0;
    % M" l. \# ]5 P' U
  63. . j) k/ l8 \" i! d( c9 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : J% E' G4 q! }- A8 L; n  s( u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # z$ M, x. i7 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; @7 P4 B* z# j  T8 b7 c% G! @
  67. " A. s4 C, W% i* o
  68. dma_addr_t dmaphyssrc1 = 0;
    : }; Z9 J+ Q; V2 o' Z4 Y* f
  69. dma_addr_t dmaphyssrc2 = 0;
    + l" T: L9 u, V- K! N! j4 _+ [
  70. dma_addr_t dmaphysdest1 = 0;
    1 n8 F0 S7 [; n" `) n% F1 x' `
  71. dma_addr_t dmaphysdest2 = 0;
    # |  d# E4 E! T. ]& Z; W

  72. 8 v& u# }- G0 o# o; Y/ g
  73. char *dmabufsrc1 = NULL;
    6 m' x3 @( k6 n0 Z. y, U$ S& B0 e( K3 T
  74. char *dmabufsrc2 = NULL;* K- T. x# \8 O/ _6 ?, n- U9 p0 v
  75. char *dmabufdest1 = NULL;, i: C  L" a  q* f7 p
  76. char *dmabufdest2 = NULL;3 Q; Z6 D! J- \: T  [

  77. 8 Q/ X8 k9 r2 Q# r* y# q0 X) Y
  78. static int acnt = 512;
    5 {4 S9 m& f- V% P4 t' \" ]$ \3 B9 V; X
  79. static int bcnt = 8;! @7 f" j2 S* l' {6 l& T
  80. static int ccnt = 8;
    , d8 n7 O2 n/ R/ q0 f  a

  81.   x4 n. N+ X' ^- G
  82. module_param(acnt, int, S_IRUGO);3 G, E5 ~, m6 J7 x/ R% P* `
  83. module_param(bcnt, int, S_IRUGO);* ~6 c  x4 L* A3 p! b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- r. I* \( e' C; u. r0 S: W
1 n- ^: K. {" R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 t0 O! c  {5 [5 a7 }! e6 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 E* Z8 n2 V& o3 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* ]) w+ Y0 T0 s6 u9 c& Y2 L" E
! {" Q% l$ J% D$ _4 \7 r! V
" B6 h3 i& c# s, }$ {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 19:02 , Processed in 0.033032 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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