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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % o/ l2 W8 C) [4 K/ V
  1. [code]EDMA sample test application
    / v9 f& N- L! H; x" H/ r! b; O
  2. /*# Q0 q% o9 Q0 f& [9 _
  3. * edma_test.c% S1 n0 Q, `$ L: c8 v" }/ C
  4. *9 Z, c- }/ l, h$ h% K8 d4 O
  5. * brief  EDMA3 Test Application
    8 ?9 [/ q! k) c- D( L( M
  6. *% O- j  M  C+ B& e0 z5 M+ C
  7. *   This file contains EDMA3 Test code.
    & P  Y* M% R1 X5 q* k' H
  8. *
    ) D+ d+ ~" }0 R' O4 @. k9 e' D8 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( q0 C' S1 }( O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + U: C# j2 S/ E( [0 i
  11. *         TO CHANGE./ g1 u/ o: W1 q. B2 g
  12. *
    2 ]0 P, u- K2 Y  d( o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 N% X! [4 E; k  }& ?
  14. *" q  Q- \6 T4 m" B4 G4 G
  15. * This program is free software; you can redistribute it and/or9 V% W- i, }0 T: ^
  16. * modify it under the terms of the GNU General Public License as
    + j8 G" e7 I7 z# K
  17. * published by the Free Software Foundation version 2.
    0 k9 s6 v" t7 L/ f8 ]& a! @
  18. *
    0 Y0 u7 k1 x$ z7 M" ^9 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 `( V( \& B4 U, s7 U. ~5 L
  20. * kind, whether express or implied; without even the implied warranty
    " s. E7 R7 U0 h7 u" s! d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# J, z) L- y' s
  22. * GNU General Public License for more details.
    . R; `5 D; `" I5 U2 s7 [+ @: A& W+ D
  23. */' w. t* U/ X5 D* n4 H( |. u
  24. ; T" O( L  n8 P% ?+ S* g
  25. #include <linux/module.h>) a- t  @" e2 U% Y& y) T% P
  26. #include <linux/init.h>. z8 t- n% j! f4 r0 O/ D) H9 e* B
  27. #include <linux/errno.h>) A' @. {0 ?+ M
  28. #include <linux/types.h>
    ; l! K& l7 u/ z3 w
  29. #include <linux/interrupt.h>
      y$ [) L6 b  t  F/ f! X# {
  30. #include <asm/io.h>$ r6 V5 r( k1 W' T
  31. #include <linux/moduleparam.h>) B* n$ i5 @( ~% v% v) ~$ j
  32. #include <linux/sysctl.h>
    " L0 P  d# I4 d3 o+ U3 o  ^
  33. #include <linux/mm.h>/ k! n5 F3 ^7 c6 E. F
  34. #include <linux/dma-mapping.h>  f& g+ E1 y4 R0 C

  35. , v2 c" b/ A# n6 O5 n' S
  36. #include <mach/memory.h>! L4 s& m) f7 g" _2 f! O" p) Q9 _% B
  37. #include <mach/hardware.h>
    ! q8 B2 }* m9 |0 b* W) r5 J5 R
  38. #include <mach/irqs.h># O$ B  O% U5 l$ g- U; G
  39. #include <asm/hardware/edma.h>( E- R  F; c$ q

  40.   c1 }2 A; @! G6 b3 f0 ^  [
  41. #undef EDMA3_DEBUG2 b- ?9 i' h  H6 u, q6 L
  42. /*#define EDMA3_DEBUG*/" x  X  S% d( Z; o" Q
  43. & o3 Z' F! r7 J2 h5 {9 D* H
  44. #ifdef EDMA3_DEBUG" t% x' {; y9 u! T/ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , a" g0 X1 A) {/ ]9 a8 }+ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( Z5 H$ A4 J$ I9 h' m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g( j# X( ]6 d; q; H9 o
  48. #else
    1 y2 W: x0 S& g: f8 Y9 X
  49. #define DMA_PRINTK( x... )) y- p, _+ I' q+ }
  50. #define DMA_FN_IN+ z* H0 _$ I" n1 ]6 t+ L
  51. #define DMA_FN_OUT
    ! r/ B) R) c# L
  52. #endif2 E& r1 g; ~# m2 W' V; g' }" S
  53. 4 w+ g, s2 G) \" w$ X2 R3 A, @$ b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). c6 K5 e( R  W
  55. #define STATIC_SHIFT                33 R& B3 b5 w* Y- l- x  y0 N$ s# h
  56. #define TCINTEN_SHIFT               20
    6 T8 r: N3 P! r  a; L0 o" R
  57. #define ITCINTEN_SHIFT              21
    ; q; K7 J" I4 C: Y3 ^
  58. #define TCCHEN_SHIFT                22
    # P# L! q9 V" H) O
  59. #define ITCCHEN_SHIFT               23
    : o, x7 M3 P: b1 I( w

  60. $ I/ u; c$ ]8 c
  61. static volatile int irqraised1 = 0;$ n. q; A2 L/ Y6 l4 ~" i, l4 y
  62. static volatile int irqraised2 = 0;1 \. M3 j2 C9 e5 p0 i9 V

  63. ) ^' ^+ k+ z% l: f/ k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) D# y5 _0 w, |2 `4 T4 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # q9 y7 d+ d3 l: k) C+ c" \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! c8 O3 r# x) s) c. A8 g
  67. 0 ~; N3 q8 R0 X4 B/ N/ ^
  68. dma_addr_t dmaphyssrc1 = 0;
    " a' Z7 g" d3 `/ V' d. b
  69. dma_addr_t dmaphyssrc2 = 0;# a. T: C9 V- k1 _8 S0 R
  70. dma_addr_t dmaphysdest1 = 0;3 H! W. m/ z; F5 ]3 l
  71. dma_addr_t dmaphysdest2 = 0;
    ' @4 y/ C1 J# Z( y

  72. 5 _, Q' }; l# C3 Y& x
  73. char *dmabufsrc1 = NULL;
    : a( C4 c& j8 a! E2 z- t
  74. char *dmabufsrc2 = NULL;9 B/ y/ u: ^% @8 M# h' b1 L
  75. char *dmabufdest1 = NULL;
    + ]# l9 g7 J, R+ T
  76. char *dmabufdest2 = NULL;
    - Z, |' l( T- B' H% F8 e
  77. . H2 ]6 [: V& Y. J" o1 T3 N
  78. static int acnt = 512;
    ) ^' f! n2 [- f$ u& g
  79. static int bcnt = 8;
    . N0 I6 N4 ~( x$ S- r$ [
  80. static int ccnt = 8;
    * T* |" h" P  a# }; m$ ^

  81. ! y( u$ {+ e* y  V1 _/ a( o
  82. module_param(acnt, int, S_IRUGO);
    , B' u6 W/ Q' j7 m7 `# H
  83. module_param(bcnt, int, S_IRUGO);
    4 ~7 ]5 b4 Y1 \  `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 W  s( }# T  z# V3 P) U- Q" o" t. D; z- ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Q1 U2 a8 z( u( L  {% Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) i! y% v9 Z0 r. ]% r0 E6 F" A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 v- l: c8 G3 f. H2 |) f( W9 ~; @. |- W, N, o5 `) a

2 {$ ?% I7 y& f. C. k4 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 01:55 , Processed in 0.037015 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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