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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . e/ b( [6 J  u8 c: @4 F
  1. [code]EDMA sample test application
    3 J/ f( `3 c+ K9 g2 k/ e+ M
  2. /** _- K6 }2 A5 [
  3. * edma_test.c; d" n1 T: C, w( b$ I# J
  4. *
    5 h) K9 T5 @% {: f, L# q1 f
  5. * brief  EDMA3 Test Application
    6 {2 D5 u/ U, ^6 C! H7 C
  6. *
    . g# N" F( t: O; K& T
  7. *   This file contains EDMA3 Test code.
    * P1 a. A3 q/ e6 I! e' {3 J
  8. *+ L* ]$ W  d& Z3 G% H+ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : K) K5 B. U/ v3 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      b! A9 U  F: Z! k# q
  11. *         TO CHANGE.
    : V" P- M5 J. Z" f  |( s
  12. *9 A6 o7 A. @+ ]2 b- Q# c. `' f5 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 u7 n4 v; P# V  t& j
  14. *
      H2 Y) Q. v$ N( R5 P8 O. o8 P3 }
  15. * This program is free software; you can redistribute it and/or9 p* m) \0 R: R6 f& H
  16. * modify it under the terms of the GNU General Public License as8 S8 g8 G% m1 p' b$ u6 Z6 _* t/ i
  17. * published by the Free Software Foundation version 2.
    6 E  T  |; v' s2 o8 r9 r: B7 b$ x* j
  18. *
      H5 [% c) X; r0 `+ }2 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 H. P- r8 E' S( J& B" ?4 l
  20. * kind, whether express or implied; without even the implied warranty
    " O; @& q, ]5 r/ {) m7 a6 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, s0 j7 _" x6 H' H/ k, P3 |  `
  22. * GNU General Public License for more details.9 r+ B$ D0 k. |5 T3 u$ M5 r6 v
  23. */
    6 E# g: z) {  o0 s

  24. 7 z/ `6 W2 `, n8 N& g4 ?3 |7 b
  25. #include <linux/module.h>2 _2 t' w! [. L  Q1 A  U$ p; [
  26. #include <linux/init.h>$ H  c4 a0 v5 O* ~! A$ K- B+ O
  27. #include <linux/errno.h>, c0 \* n) o/ e) ?( I% l) A" q* A
  28. #include <linux/types.h>
    / B2 z5 \+ p# K9 V7 T
  29. #include <linux/interrupt.h>
    7 \# N  d5 H% v0 Y
  30. #include <asm/io.h>+ |' H# K. {' O
  31. #include <linux/moduleparam.h>
    4 H# I; l8 U! Z; @9 {0 L8 B; R6 p) F5 l
  32. #include <linux/sysctl.h>
    / Y' |. S9 h6 P8 [3 S0 x9 U* _
  33. #include <linux/mm.h>- `0 p, N1 _/ q2 j
  34. #include <linux/dma-mapping.h>' ?$ p8 x. t4 L6 Z

  35. * Q, N) T' e- [, _3 b
  36. #include <mach/memory.h>6 I3 D/ Q7 ]" @! _
  37. #include <mach/hardware.h>2 H/ R" b3 ~: n" J" w% j5 m% _
  38. #include <mach/irqs.h>) \% X6 f( L; t# _) D% J0 M$ E
  39. #include <asm/hardware/edma.h>- j+ G" s& X4 f2 Q
  40. ; e" ~* z* W, T- I# D  ?' o8 h
  41. #undef EDMA3_DEBUG( D4 G  W" {7 C7 s6 W
  42. /*#define EDMA3_DEBUG*/* `* Z. X2 w& g* s' \9 i! F6 C
  43. 6 d7 X( w2 e8 u+ {2 Q3 O
  44. #ifdef EDMA3_DEBUG
    * y- F' E& ?2 Y. ?( M( w( y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) w" \" `! L) b  ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h6 Y4 n6 }/ j9 j5 Y+ A- Y8 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ C2 B3 n! y) ?) x5 H& N1 l+ J
  48. #else+ w; a5 {/ u& ]: V" P4 d6 `& G: Q( p
  49. #define DMA_PRINTK( x... )
    : {0 P( V* {5 l; w
  50. #define DMA_FN_IN
    & f  k  y& K) Z# m& f' S  u
  51. #define DMA_FN_OUT. z& ^0 T! o" R  U1 X! u! w6 L
  52. #endif
    0 N& U8 u  s( W1 F) Z/ [

  53. + r9 z3 Y. X0 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ X2 p' ~* h: n# p) w
  55. #define STATIC_SHIFT                3
    5 ]  h2 ^7 ]8 d2 Q% x( P$ y) G
  56. #define TCINTEN_SHIFT               20
    , S8 v1 N$ v0 {3 g0 R
  57. #define ITCINTEN_SHIFT              21+ ^! l  t& a% J
  58. #define TCCHEN_SHIFT                22
    , j' c. S/ V+ K# ^
  59. #define ITCCHEN_SHIFT               23/ ]9 F" ?) F2 y$ r; S1 h- l+ y- c( P2 N
  60. / Y6 N7 L; I/ o1 {6 J% J) g
  61. static volatile int irqraised1 = 0;
    ) e2 w) E7 k% q( Z) P" i* h
  62. static volatile int irqraised2 = 0;+ K# t% P6 p" C# E4 T
  63. ; T7 d2 a  H% ^# r! X# b8 V3 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s4 D' U& r3 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 y, `9 J  r, V5 _  R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& @0 g: s# J. g* T

  67. 0 D# A  G# H' p3 f! B& R5 b% G
  68. dma_addr_t dmaphyssrc1 = 0;
    . O6 x7 U- r6 M; a3 _& V
  69. dma_addr_t dmaphyssrc2 = 0;
    & |- H) m2 H. L) u: U+ T( u  L, ]
  70. dma_addr_t dmaphysdest1 = 0;7 v0 m& |# T1 l
  71. dma_addr_t dmaphysdest2 = 0;9 j' k2 E( W: F4 {+ ?6 \
  72. % \" E# y' s" S# _
  73. char *dmabufsrc1 = NULL;" e7 ^0 }/ X8 K- Q! ]. |% {! @: i" L. b
  74. char *dmabufsrc2 = NULL;2 G/ p; i6 I/ ], f" E3 `# J5 J  V9 g
  75. char *dmabufdest1 = NULL;
      ^- d1 [. c1 y$ @; A% a0 a
  76. char *dmabufdest2 = NULL;  ?3 y( F6 ^+ t) Y8 E( d
  77. # @& y) h/ v! z# h4 w9 W5 F
  78. static int acnt = 512;% m" l  Q* s" p
  79. static int bcnt = 8;- U" M5 d( ~( |5 ~' i8 Q6 y6 B4 L
  80. static int ccnt = 8;! ^- M! x/ f- ?& P( d) W# `. e

  81. % J, [0 ?1 I- K+ U+ w
  82. module_param(acnt, int, S_IRUGO);8 j8 y; E% ~! S7 d! f
  83. module_param(bcnt, int, S_IRUGO);+ f9 n2 l. _1 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% ?; k2 s3 H, N+ [  _3 l7 f1 E/ l' B5 w" }- r7 ]/ r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ N. w" @  e2 Z2 |3 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s/ K3 o8 L+ O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 M7 W, f/ I% ~( a# @; O
  _3 s$ X  z" K5 C8 c

1 `/ M/ v6 A8 q  }) V$ a( |3 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 20:54 , Processed in 0.041062 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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