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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( [$ \2 s% Q7 J' y
  1. [code]EDMA sample test application
    6 N; N+ X0 q7 e& `
  2. /*
    - q0 ^, a4 f( x4 ~. z6 j& p: U
  3. * edma_test.c
    9 @% \$ I! @5 e/ h6 c( U# \! L
  4. *; u8 h# }6 [* e8 C2 G& ^& o
  5. * brief  EDMA3 Test Application
    * h  V1 z, g( g1 [+ ]) m" V/ r
  6. *
    : q; `5 N! L( R/ W( r+ s+ x- F
  7. *   This file contains EDMA3 Test code.( J: A& a3 w# X) s
  8. *
    " A$ ?% E0 m& h' @. |; ~: Y" k" D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; E5 R& F2 S5 R1 D$ ?5 F/ t9 D$ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" S+ @( h" R8 y0 S6 [
  11. *         TO CHANGE.
    : v" z5 k9 s3 {
  12. *
    % }6 o: h: K# g" i; p8 l9 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ^; A1 `  [& C( s" t
  14. *. l% a$ [! T- V
  15. * This program is free software; you can redistribute it and/or
    % \6 A. N- ]) @. V
  16. * modify it under the terms of the GNU General Public License as9 ]7 x  R4 F. a/ l8 O9 o- k# p  `5 p% Q
  17. * published by the Free Software Foundation version 2.
    - t; P# |4 x+ \& j" T
  18. *5 l7 K$ u' p  X' x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : v# y# m: O# r
  20. * kind, whether express or implied; without even the implied warranty
    & {  Z3 d- }& Q4 y; _+ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 q6 T; \4 M, [, a" @7 y
  22. * GNU General Public License for more details.
    7 V# ?% e/ |" v- p
  23. */  P* U" m+ ]) K, S- z' f
  24. - m- b/ G) p5 n: F; |
  25. #include <linux/module.h>
    % T' y/ }( E1 C0 i& E2 s6 s& d$ S. @
  26. #include <linux/init.h>/ z. q2 P3 U1 h: y. z
  27. #include <linux/errno.h>/ |/ e6 B9 P+ X1 n1 z
  28. #include <linux/types.h>& {$ X2 d; C  v/ ]
  29. #include <linux/interrupt.h>5 X) l6 K( `0 M- V/ S0 Q, L
  30. #include <asm/io.h>/ p) ^% D) R( Q; y4 F; L5 h0 z
  31. #include <linux/moduleparam.h>5 G' x+ C8 s! l8 N
  32. #include <linux/sysctl.h>
    / w8 ^! T, ]+ r4 o
  33. #include <linux/mm.h>: d, z$ W7 R: S8 ^
  34. #include <linux/dma-mapping.h>9 }/ H$ ?7 ]5 S  L
  35. 2 S6 I* L& ~/ h! t1 n9 o4 p8 a
  36. #include <mach/memory.h>
    ' F% z1 N8 u7 F- D/ @% N2 p# ~
  37. #include <mach/hardware.h>; k5 Z* L. r  D) B; N9 t1 I& f
  38. #include <mach/irqs.h>
    / ^! M; g( @" C- R5 w# {6 r; W
  39. #include <asm/hardware/edma.h>
    % I# W! E1 O+ l$ g
  40. 0 u9 u& [7 K: r
  41. #undef EDMA3_DEBUG
    - E8 ], F2 K% L9 {
  42. /*#define EDMA3_DEBUG*/
    " F$ O1 o6 ^% n, m4 g7 F& \9 z
  43. ! J" V6 i' X% D" Q  _
  44. #ifdef EDMA3_DEBUG5 S# m& G6 e" D  o& A" u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); M+ J: \2 U% p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 j7 T& F: u- [4 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 f7 \7 K. k4 z; S' Y
  48. #else% e& l/ V# [" T4 p/ ]& }: ~( C
  49. #define DMA_PRINTK( x... )
    . ^1 P2 A# A) @2 w& K3 p5 I( O6 M
  50. #define DMA_FN_IN
    ' I$ X0 D' E$ p8 C  @$ j7 y
  51. #define DMA_FN_OUT
    3 L' ~1 D- s  y, t* ]
  52. #endif
    ! H7 n) ^0 e/ {+ D
  53. 1 G: C3 ]8 _2 E. W2 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 X0 J7 o$ F* g% \. R
  55. #define STATIC_SHIFT                3% o6 V0 O# Q: H) h. I8 y$ ]
  56. #define TCINTEN_SHIFT               20
    + M# z: f- |. g; E3 G, A& `
  57. #define ITCINTEN_SHIFT              216 u! E/ W; `5 g4 w6 A
  58. #define TCCHEN_SHIFT                22
    3 z4 I% j! t3 I- Y
  59. #define ITCCHEN_SHIFT               23
    6 w# v9 I( ?; j# {
  60. ; I. _/ Z3 P( p! Z+ ~$ Z
  61. static volatile int irqraised1 = 0;" \5 Z+ h% G5 C% j1 N
  62. static volatile int irqraised2 = 0;0 A( c% k. f- g% F" H) r$ ~

  63. 7 k& Z; d1 Y1 o: n8 r5 P: W( U4 h: [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; H% F( f. P% J& U/ H0 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - {, G5 |. \& c* a+ j! o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ?0 o4 v  n) n0 |0 j- A1 X

  67. . r: b; @$ ?; G7 w% m! a/ k6 M9 S
  68. dma_addr_t dmaphyssrc1 = 0;
    ' L" F3 r, M5 b
  69. dma_addr_t dmaphyssrc2 = 0;
    4 U, w! F/ U, o6 o: S: ?
  70. dma_addr_t dmaphysdest1 = 0;, m4 x) G/ W' Q8 [) z' ?
  71. dma_addr_t dmaphysdest2 = 0;  f2 v" A/ R" R( x

  72. 1 O. v% I( A8 J  f6 h
  73. char *dmabufsrc1 = NULL;
    , p7 }5 u4 C8 Y
  74. char *dmabufsrc2 = NULL;
    8 f1 p& p% l" j+ h% E$ g5 r
  75. char *dmabufdest1 = NULL;
    & h# S: h) M/ E
  76. char *dmabufdest2 = NULL;- M; R: c5 g, e

  77. ) I2 ]* D7 G3 Z. K7 e! M
  78. static int acnt = 512;! }: Z( R# N' E/ R) d) F8 I! t
  79. static int bcnt = 8;7 ?$ P  {  p" H: C- q- Z
  80. static int ccnt = 8;' _* S  M! m# b5 t

  81. / t# W! X7 E* O1 F0 x& k  X# Z$ {+ ^
  82. module_param(acnt, int, S_IRUGO);5 K6 T3 ^5 Z8 c: n
  83. module_param(bcnt, int, S_IRUGO);- |! G' r0 E! F+ s: f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: z9 v3 {& Z) V  u
* J3 _7 G; i( V) z# {' Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 b) O' o% D& D  B0 H/ Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* Z+ N4 q: l' E- _/ r2 }& O; T& ?" s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 [5 e$ n( a- Y7 x/ b
' V9 V8 t7 k. w; g+ A  r- a) l9 J; [
2 O2 c% E" G+ n! X: u" G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 18:43 , Processed in 0.041004 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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