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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# `' C/ @. j0 }8 K% e' u
  1. [code]EDMA sample test application- i9 C, ]7 J; W
  2. /*
    + S7 A. B4 l4 n9 c3 s4 Y' B
  3. * edma_test.c
    ! }% k3 u+ S9 \
  4. *# K0 Z4 |- J; q. S/ I
  5. * brief  EDMA3 Test Application- U9 e' f, {8 ?
  6. *
    : H8 c. ]. s% {9 v) x
  7. *   This file contains EDMA3 Test code.' I! ~, ~& b3 ]5 L8 o3 O
  8. *
    ( z4 x* ]2 c0 \/ Q1 E5 Y. w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 P, k4 b. h) t2 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 w7 p& H0 Z0 G! [0 B0 p1 I7 |& v
  11. *         TO CHANGE.
    / c$ f4 J( T! \4 t6 F, M
  12. *
    . ?  s( u& T* x" L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~- P: Y; ~* w, U  v) n7 \8 P
  14. *$ O* R$ q  J5 g: E% t9 ?0 q
  15. * This program is free software; you can redistribute it and/or
    " A- R" d! |3 K9 t# m
  16. * modify it under the terms of the GNU General Public License as
    ! R$ H) @5 R6 b. S1 j
  17. * published by the Free Software Foundation version 2.+ d% V$ S5 t8 d: B- g% L
  18. *
    6 T/ P" A7 b& {! K1 J. b' q" y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 Q8 ?) G$ ^4 Z7 b; {) X4 B
  20. * kind, whether express or implied; without even the implied warranty- k) a3 t; b1 f+ g+ `" l' a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 A, x' [. q: }* k% `
  22. * GNU General Public License for more details.$ ?" ~7 H3 L- P/ |+ O5 N9 r. K
  23. */
    8 }+ L$ u* _& F

  24. / F- U2 h1 a+ e; e* k( K) Y
  25. #include <linux/module.h>
    8 y. I4 {+ ^3 ?9 [
  26. #include <linux/init.h>
    5 |! \4 N* w/ N- v
  27. #include <linux/errno.h>5 g% J+ J8 n* `. e
  28. #include <linux/types.h>
    , }3 L$ y8 t+ r3 L
  29. #include <linux/interrupt.h>2 g9 b' R+ ]6 B' j0 d
  30. #include <asm/io.h>
    4 D6 t1 n" t2 v" @$ y# H" e
  31. #include <linux/moduleparam.h>
    $ z1 \- W+ [/ b% I, B+ M/ z) V& a
  32. #include <linux/sysctl.h>
    . X7 k$ J; [+ M
  33. #include <linux/mm.h>  U/ C; x% t7 \# Y7 v  a# X
  34. #include <linux/dma-mapping.h>8 W. p; e  R" r7 \' L

  35. ; X2 B8 m" i! m' n( u9 e. ^+ b* ]1 r
  36. #include <mach/memory.h>
    9 |) S4 j6 ^8 G
  37. #include <mach/hardware.h># O" W, n3 g" u+ ]+ `
  38. #include <mach/irqs.h>% Y; R3 ^% n/ P% o/ @
  39. #include <asm/hardware/edma.h>6 C0 r/ z5 O2 |+ I2 k  g, I
  40. . T+ |% t% N( d8 I4 K
  41. #undef EDMA3_DEBUG
    ) E! L+ a' ^# X& x
  42. /*#define EDMA3_DEBUG*/
    . q9 k% t+ D( ]- g

  43. : \. V8 x/ h" u8 q/ Y/ m  H3 v
  44. #ifdef EDMA3_DEBUG
    & _' L- p, w+ b" O2 A1 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + a) V/ d/ h; W. Z  i& z$ G( X- ?% b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ A; l5 h8 C4 T" L, S5 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) T- d) r; S2 w+ H! I
  48. #else' p$ g* U7 `3 J, e/ |' t
  49. #define DMA_PRINTK( x... )  @! `' H, a4 w
  50. #define DMA_FN_IN
    $ h" R6 r' S1 d3 F/ }
  51. #define DMA_FN_OUT
    6 o+ @: O, w& i5 Q: F  o
  52. #endif
    9 u  u* n$ h! g8 N" |% N
  53. + t9 N4 |7 Y  m) r  G5 W: P  d0 m1 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 v( y( s% ]4 L0 H+ z
  55. #define STATIC_SHIFT                3
    , {" O! L4 n7 ]3 Y" R5 H- @# t1 t
  56. #define TCINTEN_SHIFT               20
    6 g% S1 l) S, ]' S+ t4 @/ d
  57. #define ITCINTEN_SHIFT              21) u# a# {' X; U0 y8 q- Y
  58. #define TCCHEN_SHIFT                223 Q. o8 N8 }0 X3 s6 `  s
  59. #define ITCCHEN_SHIFT               23
    , _5 R' o# m6 H8 x
  60. 0 s+ A: k& _; O2 |8 q
  61. static volatile int irqraised1 = 0;% h, b$ q6 Z& K9 j
  62. static volatile int irqraised2 = 0;3 i. ]) M- c1 y* I& z
  63. 9 D4 H1 ~, ^( z/ B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) f/ k8 y# Z9 n: V, A8 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 r( O1 ?4 |5 M. V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; L; e  ^! x, E0 h1 G" z4 z

  67. ( l) H( t) f/ R; b) `
  68. dma_addr_t dmaphyssrc1 = 0;
    $ R9 H9 x8 K6 R% w$ Z3 {, E$ K
  69. dma_addr_t dmaphyssrc2 = 0;
    9 K2 h. i# `0 y3 J: A) A
  70. dma_addr_t dmaphysdest1 = 0;4 Q/ \- g: s$ g
  71. dma_addr_t dmaphysdest2 = 0;
    . ^- J/ Z" G; a! ]7 @; C+ j0 \

  72. & K, A1 C- y& w  c* N4 M2 {
  73. char *dmabufsrc1 = NULL;
    ' O4 @: Q' \* j
  74. char *dmabufsrc2 = NULL;# W% y9 B/ b; s6 R/ d" C) O" r
  75. char *dmabufdest1 = NULL;2 m4 O, c# _- t: o6 [
  76. char *dmabufdest2 = NULL;, X3 w' k9 u- g' H* |9 V9 _' Z4 s

  77. ) K0 t) O4 Q- z' ?
  78. static int acnt = 512;1 C, [' D+ T" z3 U. ~+ I
  79. static int bcnt = 8;
    # d0 n( y4 c/ Y3 U0 s  Q3 Y2 v
  80. static int ccnt = 8;
    . p5 R6 ^% W4 ^' y

  81. $ @4 {  Q  }- X# o5 o. O
  82. module_param(acnt, int, S_IRUGO);9 L3 D2 Y: H6 Q7 v+ H
  83. module_param(bcnt, int, S_IRUGO);7 H4 [5 Y2 {. {1 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  M- j: i/ }% ^$ r% B  ?* R7 l8 O, c0 v' k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% c% B- ?  U6 m0 @* E% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, u  N; S& h  S4 o$ E( B$ g( j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 O" A6 |6 t. J4 ~: i% C. M
/ d4 u. y5 d1 \3 [
4 b5 t3 w8 q# z, M& [8 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 03:38 , Processed in 0.054889 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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