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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! T3 o  D$ O1 Z5 P5 W. [  E
  1. [code]EDMA sample test application1 B5 ~! d+ j; j
  2. /*/ Z7 c9 T1 [$ X, I% X' K
  3. * edma_test.c5 f) S. Q+ L, A$ A" d; q: t  n
  4. *
    6 p7 w8 B1 t2 b' H* z: g3 B3 X* N
  5. * brief  EDMA3 Test Application
    # G7 ~$ f, J! ]9 R
  6. *
    3 e' w  h; W% A) }. T
  7. *   This file contains EDMA3 Test code.
    ; X1 Q: y! Y, i* C: O( C* Z
  8. *
    " ^! A; \" R6 k: e$ u+ `' V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % ]" ~- f; g- P, y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : r8 J( ?6 O& o0 d& G
  11. *         TO CHANGE.
    , c1 d. b2 k; b1 L) l! O
  12. *8 j, I3 Y6 P. C; h4 c( l7 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& Q5 l. a- b0 l- [3 B9 I0 W
  14. *$ g0 ^6 \6 F& H4 ~* |
  15. * This program is free software; you can redistribute it and/or
    ) {6 D; B, E0 Q
  16. * modify it under the terms of the GNU General Public License as7 d; F, i+ H, O* J4 m# Z& t
  17. * published by the Free Software Foundation version 2.
    3 `* h$ L1 ]% C+ J- l$ p) `
  18. *7 B; h2 G: r. c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & k  F& W* F4 a2 C$ f! C* g
  20. * kind, whether express or implied; without even the implied warranty1 C: G/ r) C2 H4 t$ W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " x0 V3 f+ Z+ A: F2 h- ?. D- z  \
  22. * GNU General Public License for more details.
    : y9 ?9 i. c4 ]1 a- |( p
  23. */
    1 z4 e1 C3 ?. q
  24. 5 L- ?* b8 X) m3 I% K' S
  25. #include <linux/module.h>
    1 g3 c1 V: R% L6 i) \
  26. #include <linux/init.h>1 E! g( j6 |, Y" U- ?' `' W
  27. #include <linux/errno.h>: A* w& h$ ?: d8 Q: _1 w
  28. #include <linux/types.h>
    ( f  a! @  X* n) j
  29. #include <linux/interrupt.h>& {9 d  \  u' }/ `. R# u
  30. #include <asm/io.h>+ v' W0 V3 M. K) S5 S
  31. #include <linux/moduleparam.h>/ R+ h" g: S+ J( M
  32. #include <linux/sysctl.h>2 t; H" j4 O+ L# N" I4 c
  33. #include <linux/mm.h>" o' i8 F9 M- w
  34. #include <linux/dma-mapping.h>
    - M5 @& G+ c3 r* l' E9 v2 ^

  35.   M' o- B9 f9 r
  36. #include <mach/memory.h>* v) I' o: b  m- M2 J. C1 u  P
  37. #include <mach/hardware.h>8 J2 k: {+ w' V) b! r7 L
  38. #include <mach/irqs.h>
    ! H! X: ^# p; P5 B
  39. #include <asm/hardware/edma.h>. r2 {: c1 `( T! V  o

  40. / _8 E) {, k$ D  B
  41. #undef EDMA3_DEBUG* N3 ?/ O& ]+ c! q. ^  ~
  42. /*#define EDMA3_DEBUG*/
    8 Q" d$ T1 V& T0 |
  43. 6 u' h" o; |0 e. j5 M' P# W$ E0 d
  44. #ifdef EDMA3_DEBUG
    ! {8 D* G% H! U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 q( A* C+ ?/ e) Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& O5 [  Z& Z8 U- L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 r3 ]; `$ ^5 U6 k
  48. #else9 A/ R; w  \7 w$ v% [1 K3 t: _' j
  49. #define DMA_PRINTK( x... )
    & w3 N/ T7 n6 C
  50. #define DMA_FN_IN4 c: Z& S& }. b+ }- E5 E. _6 ?% x1 G
  51. #define DMA_FN_OUT
    1 X  g; j4 R: I$ g+ \5 ?
  52. #endif; T% i! P) W# j/ b9 U

  53. 9 Y9 W/ s3 v) U4 C3 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 T! J& f) l- F) a
  55. #define STATIC_SHIFT                3
    1 R" _# K# h1 {, t- I% G* k
  56. #define TCINTEN_SHIFT               20  W2 ~, w& W! k% ^8 d8 R5 m
  57. #define ITCINTEN_SHIFT              21
    0 N5 v+ p- t' N0 o5 Q
  58. #define TCCHEN_SHIFT                22( x& C( n. L9 U5 y
  59. #define ITCCHEN_SHIFT               23; {6 y( |" E# O4 ~2 V+ Z

  60. # o+ ^  w. \9 j; p7 ?
  61. static volatile int irqraised1 = 0;
    ' o) c; n5 T, }
  62. static volatile int irqraised2 = 0;
    # k! s% M8 ]& X, G2 C
  63. . F( J2 ^- U5 n4 f- K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' @* t8 s5 B) n- R: F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( i, F$ L, X! H; @5 x( t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " C/ N2 q. u4 M/ w/ P( M! S
  67. / f; H) [4 d' g- j
  68. dma_addr_t dmaphyssrc1 = 0;0 C* @0 R8 b0 _* M0 o) `- O' r
  69. dma_addr_t dmaphyssrc2 = 0;
    ( s& d! M' A# g9 q- q
  70. dma_addr_t dmaphysdest1 = 0;5 L0 l- {& F4 h4 E( y; y/ w4 b7 q
  71. dma_addr_t dmaphysdest2 = 0;0 A# i% h5 o% o# Z9 J

  72. ! b( j& g2 c2 u) d9 ]
  73. char *dmabufsrc1 = NULL;
    - c' G2 u- R8 k: Y. I% Q9 i
  74. char *dmabufsrc2 = NULL;
    * @' \8 K" D' u
  75. char *dmabufdest1 = NULL;5 F; L% c) M: K% v5 L. T
  76. char *dmabufdest2 = NULL;, P0 |$ x: f( |( D

  77. " l2 D3 L; n' x2 c0 [+ B' l
  78. static int acnt = 512;( x5 K! H8 S3 P/ l5 \
  79. static int bcnt = 8;# Y; G, U" |6 F1 E1 Y  ?* @6 K/ y8 ^
  80. static int ccnt = 8;' q; M8 t" x1 |4 B: _
  81. ( h/ d3 A$ n, D# h
  82. module_param(acnt, int, S_IRUGO);
    4 J' {  j' U0 X( f" |  a5 v) Z
  83. module_param(bcnt, int, S_IRUGO);
    ; r5 a" {( b& V3 A+ R% l. U' {) x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 t* c- j$ B5 u. z! W

  K$ K8 o$ E0 b* {, L4 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ U7 t) W% @! G. T2 i- @. Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( d- y3 P! N- u( P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" W' C2 S9 c9 S4 g/ L! A  M# y& e$ G  n# [  p

$ W7 Q  C8 x4 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 14:24 , Processed in 0.038248 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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