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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 A8 |: \& O. [* |$ ]3 ?4 j0 h( z
  1. [code]EDMA sample test application* S0 `% l$ s4 z. M0 N
  2. /** x3 B2 [5 Z2 q7 T8 k) x0 L9 ?! _
  3. * edma_test.c; ~: y2 I$ T0 N9 b
  4. *
    - E% K: u3 p' q  C9 j7 |' }
  5. * brief  EDMA3 Test Application
    0 ?0 p' z; _& A+ Z
  6. ** y$ X" U& d- h$ e. J* S6 ]
  7. *   This file contains EDMA3 Test code.- g1 K3 Q" e& L
  8. *4 z3 J5 ^# m* v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 Z# i6 e3 W% g' R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% O1 ?: B- G& C: ~
  11. *         TO CHANGE.0 k5 _* F- W/ |* U2 X
  12. *
      [: H1 d; ^$ |% L" r) i* w% _  y- N) ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " `5 q0 r5 L6 n: W0 {) g
  14. *' |2 S" ~! n( V% P2 y0 J- \
  15. * This program is free software; you can redistribute it and/or2 e2 g: `' A0 x6 g0 |# i! i" N& g
  16. * modify it under the terms of the GNU General Public License as1 k, F8 L+ }2 u1 S" [
  17. * published by the Free Software Foundation version 2.! t; r+ u# ?% ]6 D
  18. *6 c& b, Y7 U3 G* E: J0 j/ E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ Z& S0 k+ t" k$ e2 d& v+ ?
  20. * kind, whether express or implied; without even the implied warranty. E; y' p& B& @5 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 X. s& v+ {3 Z
  22. * GNU General Public License for more details.% z# V4 v6 r0 ^. c
  23. */- h+ y: ^0 C+ i6 t( d8 C
  24. " F+ A4 P4 O& I* R8 \2 _! i
  25. #include <linux/module.h>; _' K9 i0 {' o, d2 U# O
  26. #include <linux/init.h>, L) C0 D  U6 R) b( I
  27. #include <linux/errno.h>
    ; \6 Y4 B7 U# _9 l7 h
  28. #include <linux/types.h>
    6 b4 q8 ^1 ~* M( j4 o  \8 E
  29. #include <linux/interrupt.h>: p& n; B# o: h2 H! q
  30. #include <asm/io.h>+ s# k2 s8 F0 Z& c# k8 C
  31. #include <linux/moduleparam.h>2 @; |5 [8 @" U. w" `) c9 \- c
  32. #include <linux/sysctl.h>3 M7 q' I, P4 d6 X: `
  33. #include <linux/mm.h>+ X, D0 k: l& m( p9 _% `
  34. #include <linux/dma-mapping.h>
    % R7 u5 C5 C) f0 g8 P* M! ?% R

  35. 7 b1 ~# {! e) F6 {1 @
  36. #include <mach/memory.h>
    $ h  K! {& g2 r/ i% N$ A  O
  37. #include <mach/hardware.h>
    8 Y% I1 W8 L$ a; m& Z
  38. #include <mach/irqs.h>
    ( ], P1 b; @& r, z: N  u
  39. #include <asm/hardware/edma.h>8 f; N9 x7 G/ \( m& A, }# N

  40. + O2 x: {; q  j
  41. #undef EDMA3_DEBUG6 t: E& p, A/ u! E
  42. /*#define EDMA3_DEBUG*/$ h' W- |: }- s

  43. 8 o" A6 C" j! }  G  j$ ?) m
  44. #ifdef EDMA3_DEBUG- p6 Q% p& u" n- Y7 m. i+ o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " I: z/ D( F. E" T; G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 Z/ K: B& j# t* s( f: R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . S2 R4 i0 V( c/ |8 j; F; e
  48. #else/ S2 ^$ i! m- O" W
  49. #define DMA_PRINTK( x... )
    - a. ~$ w' C# p+ b$ V, V& t
  50. #define DMA_FN_IN
    ( M/ g4 J8 k5 m+ S- E
  51. #define DMA_FN_OUT
    3 G0 r" f% e' T0 m* u
  52. #endif
    ' e5 `; K+ m8 Q; t! M1 F, z; @9 y

  53. - Y& W; b9 y* u3 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( \9 G+ w- V) Z
  55. #define STATIC_SHIFT                3
    9 M: G6 w, v1 H) D+ i" ^0 o
  56. #define TCINTEN_SHIFT               20
    - S) P7 K- `* ]* X3 X
  57. #define ITCINTEN_SHIFT              21' |  B, s) R3 P; D: z! i1 v2 q& k
  58. #define TCCHEN_SHIFT                22
    " S. `( ~; ]/ W) x  k- e
  59. #define ITCCHEN_SHIFT               23# n! u6 h5 d, C& o
  60. , @+ j1 Y- j' m3 J+ D4 e# I
  61. static volatile int irqraised1 = 0;% [* I3 t! ~& V7 v
  62. static volatile int irqraised2 = 0;3 Z; ?8 ]; J2 A* O. V3 F' B" T$ |6 q
  63. 7 B4 V) J/ \# Z" }9 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H& x' x/ O' [" ?6 G  f& ^, E/ H, j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " A5 h# m) x( ]' H$ P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ J" C- h& V# m

  67.   R3 v6 |5 A: }# |! P
  68. dma_addr_t dmaphyssrc1 = 0;8 ]2 s3 V6 E$ }
  69. dma_addr_t dmaphyssrc2 = 0;0 V% r4 o& O) M) y2 l
  70. dma_addr_t dmaphysdest1 = 0;& O( `7 O7 }3 Q8 s
  71. dma_addr_t dmaphysdest2 = 0;& Z+ i" A/ r4 _
  72. * d& T+ E9 c$ y7 I  g, O
  73. char *dmabufsrc1 = NULL;
    3 I8 \$ r5 w' E9 ~
  74. char *dmabufsrc2 = NULL;$ T6 ~# z/ Q4 x9 }( S9 `' [
  75. char *dmabufdest1 = NULL;
    - x2 E$ P* A( b" S
  76. char *dmabufdest2 = NULL;
    & N% \) ?6 m5 f  k# }4 ^3 S+ L: V

  77. % ?/ |- \4 o" _0 k7 P" @0 A1 {
  78. static int acnt = 512;
    4 n, A. c( T) z8 F/ r4 P
  79. static int bcnt = 8;
    / c. Y' z9 Z; t. H# z8 Y
  80. static int ccnt = 8;
    & v5 L! {# g* U" i, U  `7 W- _7 F1 r
  81. ' }& T/ z. P$ Z$ ?
  82. module_param(acnt, int, S_IRUGO);
    ) P4 j3 ~8 `9 V, D/ H7 z9 s
  83. module_param(bcnt, int, S_IRUGO);5 @+ \$ B7 |( B, `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& d3 p" }( k% _8 \' m( _

( D$ I: C7 p3 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Z5 A, W% d+ ~/ F, W) P& M; X" Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* g* G4 Y& l* L4 C' c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) m, O# [; }% R5 i
  h6 M5 O$ q8 O' q3 j1 |! x- P! ?

, w/ s  M3 ]7 \1 @6 H9 ^" r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 20:00 , Processed in 0.039385 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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