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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # j5 q( j/ i' w! @: O+ k! c, m
  1. [code]EDMA sample test application
    . J; z. L7 w# O- a0 N" Q! Z  }7 W
  2. /*
    $ l; P1 o5 `' N5 M. \* f$ l7 c& H3 {
  3. * edma_test.c
      ^, F3 K- {, A2 u3 o6 d9 h, a$ n
  4. *
    ; O. B1 L: P; b1 O7 u. t
  5. * brief  EDMA3 Test Application
    + P$ C9 ]: M; y( \3 H1 W. W
  6. *
    ! L: n* M9 ]% n8 D* h+ k+ B2 R3 H/ O  I
  7. *   This file contains EDMA3 Test code.' k2 z1 h7 Y2 m
  8. *) j: e2 B# L4 q7 B, s: ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 H! |5 T3 I! I! }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- T7 Y# f; u  e
  11. *         TO CHANGE.  j/ N- }1 u+ ~) r
  12. *) X( D' S) E0 r$ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' E& ~+ N8 \/ r0 e) e# U; a( P
  14. *5 y7 a  W+ N! e: R3 q+ c
  15. * This program is free software; you can redistribute it and/or9 C3 c! y1 L5 e( l7 U  E
  16. * modify it under the terms of the GNU General Public License as9 B" R; {3 [9 W3 D1 k% N
  17. * published by the Free Software Foundation version 2.4 W; q$ A  n  s) \% U' k/ ]8 ]
  18. *' _/ S  d! I( y' M2 ~0 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 R) F) M2 u1 p- U
  20. * kind, whether express or implied; without even the implied warranty6 C: W$ M. D" Y* I7 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; ^7 F! @+ v+ z8 Y; \  a
  22. * GNU General Public License for more details.
    0 W: s! M/ d( K( l' q6 D5 t* g0 t
  23. */4 }# Z; u) p5 ~# m, H

  24. $ w2 T+ D& j" b& h5 h
  25. #include <linux/module.h>
    , u: g( W- x5 l" k$ h3 M1 H7 }
  26. #include <linux/init.h>& o$ T2 b7 S5 }. H
  27. #include <linux/errno.h>
    ! I2 @& ]; H' O# X) N6 Y
  28. #include <linux/types.h>8 Y6 S4 _7 _* q, Y/ H, N5 h/ c/ Y
  29. #include <linux/interrupt.h>
    5 U+ h9 i8 _' W$ K& B" H& n
  30. #include <asm/io.h>
    $ A- M5 Z$ G1 z4 r
  31. #include <linux/moduleparam.h>
    . k  ]' B9 U  X" N! G. E
  32. #include <linux/sysctl.h>
    " R8 v" W- J9 i8 u/ T, R
  33. #include <linux/mm.h>& s3 L4 ^% q2 L3 ^8 D4 p% _; _& J
  34. #include <linux/dma-mapping.h>2 ?, M$ i- D! ~7 J# {
  35. , g4 P# A. S2 Z& t+ g5 N
  36. #include <mach/memory.h>) h% g' v# R9 F9 T+ @+ Y' d- q
  37. #include <mach/hardware.h>
    2 {2 g) }. ^$ t' d$ m
  38. #include <mach/irqs.h>: {- U1 s) A  k
  39. #include <asm/hardware/edma.h>9 {, l% b% T: Z* j1 k

  40. ) E2 {! i2 c! u* B, h( ^
  41. #undef EDMA3_DEBUG9 o  S0 C1 j% v9 F+ V2 C" B, ]
  42. /*#define EDMA3_DEBUG*/$ t6 q! F  r% _) Y0 t
  43. " |% J" }: S6 K$ v/ q5 c
  44. #ifdef EDMA3_DEBUG
    ) C- z, s/ ?2 s% }* y* e7 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 j+ i) h6 S. v& b0 s, d/ I, J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 B: i5 t+ y9 r1 Q  Q  O' p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); a% W  }, W/ d
  48. #else
    6 u. @" u9 D$ q% a9 q+ s
  49. #define DMA_PRINTK( x... ). H" U- `% \, n: C5 n& G
  50. #define DMA_FN_IN. D: J- Q5 o4 R& f* W+ ^1 U
  51. #define DMA_FN_OUT
    ! T6 ]2 ^8 h0 I, r$ M, F. J* p
  52. #endif
    ! D) b& e( u: t& v2 t$ q# p
  53. - g4 ]: A% {( r! g" m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 r: I' \* [. x/ \; o& ?/ v
  55. #define STATIC_SHIFT                3
    ; [0 Z8 x1 g0 B" J+ J
  56. #define TCINTEN_SHIFT               20& u4 x" {# K; x  {6 K& y, I
  57. #define ITCINTEN_SHIFT              217 R6 h$ m# t  t. I/ y: K
  58. #define TCCHEN_SHIFT                22
    9 o# H' u/ }) `8 h6 @) B" t+ @
  59. #define ITCCHEN_SHIFT               23
    : n+ a9 j6 o* G
  60. 0 c; S, E* B' {% U
  61. static volatile int irqraised1 = 0;3 j. C# y5 X0 u
  62. static volatile int irqraised2 = 0;
    1 T4 H1 Y0 Z6 {' x% I7 T( c
  63. 7 P: a, ~. ^$ ?! N' y/ v2 [" ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * r/ o/ ]  R/ ?% O3 N- `. q+ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 v/ x% W: D2 t8 J. w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 @+ [4 A* }* e* p, C# C
  67. 4 C! g1 ]  o. b5 P7 c" J3 g
  68. dma_addr_t dmaphyssrc1 = 0;
    ' X2 C- ~* n& c( D; K) M
  69. dma_addr_t dmaphyssrc2 = 0;
    & r% e8 \7 K2 A# b9 @& M
  70. dma_addr_t dmaphysdest1 = 0;
    % g; D. Y1 \6 c
  71. dma_addr_t dmaphysdest2 = 0;5 O: h: g# K  d5 \% c

  72. 2 V- o) N: E0 ^6 f9 t9 c$ ~" @/ q( l/ X
  73. char *dmabufsrc1 = NULL;# v/ X4 Y- ~, T3 b, l$ v
  74. char *dmabufsrc2 = NULL;) @& P% l2 G0 @- F
  75. char *dmabufdest1 = NULL;
    : Z! }! I' O4 ~9 [$ l
  76. char *dmabufdest2 = NULL;  i8 e6 U4 g& M; n
  77. 8 A  v# u4 C" H! _
  78. static int acnt = 512;
    " @; G7 c+ {; x7 x
  79. static int bcnt = 8;" V# A% D* h5 ^4 ?' O
  80. static int ccnt = 8;
    ) }3 v1 X3 I0 d- _

  81. 3 e( ~8 f0 l7 f. q: _
  82. module_param(acnt, int, S_IRUGO);$ x) n2 |( C( o, C& f0 Z% r' h8 D( _" E
  83. module_param(bcnt, int, S_IRUGO);7 p7 E+ l1 f# X$ ?9 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ g0 G$ T0 l6 @% G; `7 ~" g1 x# k. ~/ }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: e( _$ V2 F1 A- d" marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ?: C( x9 _3 @- s3 \" @) h$ U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. N/ L1 t) {5 ]9 b% c0 f0 W: _) n  T2 T) u. c: ?' D) ^
+ ~2 p/ I1 [& f0 v* i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 23:21 , Processed in 0.041559 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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