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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 L2 e; g% y5 ^+ j
  1. [code]EDMA sample test application1 g; N% N" C! t: \+ `
  2. /*9 R0 y$ [8 w# N+ T; j0 F' F
  3. * edma_test.c
    7 v  v1 ~) a- E6 K( B) H
  4. *7 e- G3 J& L9 j4 b4 [% s& k2 G9 @
  5. * brief  EDMA3 Test Application2 b! K$ P7 N/ [  R- C
  6. */ l* d2 K1 Y! ]6 N
  7. *   This file contains EDMA3 Test code.$ }* l. ~& j+ S9 t/ `$ c
  8. *
    4 ], S' I. X! a% E0 f- a- S5 n0 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 d( W: X/ t: F" m( }! m8 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 d* ~5 ?* J( n# }
  11. *         TO CHANGE.. |4 u- U& o4 Z5 B
  12. *" m9 F) m% P# V  }* w1 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 @4 }: @0 ~' T! M
  14. *
    & g0 C& |4 {3 i2 C
  15. * This program is free software; you can redistribute it and/or; C+ |' p& Y% ^: `# |9 z( Z
  16. * modify it under the terms of the GNU General Public License as6 s* @- w; Q: z2 W" |
  17. * published by the Free Software Foundation version 2.& g- N! d# \9 z, N. l
  18. *! z! Z8 J1 a3 {$ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ X& c) {% [2 B6 J/ y8 {& g8 B* ^
  20. * kind, whether express or implied; without even the implied warranty# [* E- B1 ^6 H9 w6 R# B+ Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 D+ e2 I) N/ X' [+ ]: y2 D
  22. * GNU General Public License for more details.
    - R& ^% n4 g* G/ y1 B! q$ x
  23. */9 T2 P8 P& d: d8 S, x
  24. 8 D8 U6 ?) A$ b- X' C/ z# p: \
  25. #include <linux/module.h>, x7 K6 n# X7 F0 x" D
  26. #include <linux/init.h>
    & M6 y! G$ ]. _% y
  27. #include <linux/errno.h>* o- I' @. Q, E2 h
  28. #include <linux/types.h>
    4 i; ]: [  }9 j. r$ `) g6 c& F
  29. #include <linux/interrupt.h>! O9 S/ R3 N0 |5 @  F1 _  A6 W( d
  30. #include <asm/io.h>
    8 u  l/ M" S, [
  31. #include <linux/moduleparam.h>
    % ^5 W- c5 M  }: g9 C; o, e
  32. #include <linux/sysctl.h>2 Y, m7 u3 W4 V( D
  33. #include <linux/mm.h>
    3 n4 X( a: P3 j: Q1 ]
  34. #include <linux/dma-mapping.h>
    " p2 x1 i; R; E
  35. & g; A- u9 g! q/ t0 t7 }
  36. #include <mach/memory.h>/ j6 D, L$ F/ V" ~$ n
  37. #include <mach/hardware.h>
    8 G( ?/ f9 ^& u- B, [: r0 K
  38. #include <mach/irqs.h>
    ) \* j5 ]+ q8 O3 l
  39. #include <asm/hardware/edma.h>. `" ]: [7 g( p, i; I9 k, K. K

  40. ' T% H( T9 o! ~5 l) q
  41. #undef EDMA3_DEBUG: v9 }8 k4 t2 @5 g' L
  42. /*#define EDMA3_DEBUG*/; q6 e9 o$ M+ r/ x" L8 M

  43. % o3 v+ ]6 {" y2 L% i5 _
  44. #ifdef EDMA3_DEBUG' a+ Z. D, T3 K5 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 G! A. ]& M. i% K, W7 ~4 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " e- G& u5 V' t: k! D0 z  y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 [! b& @! B! c( ~
  48. #else3 t4 ], ?- u7 o; Q6 r! L# |% z
  49. #define DMA_PRINTK( x... )
    + X7 M0 s- z* N% D+ k/ X
  50. #define DMA_FN_IN
    ! {# ?0 s& s% [- a
  51. #define DMA_FN_OUT
    ( C5 W& N8 w( i) k4 y
  52. #endif7 Y2 |/ U$ U+ ^; _
  53. 0 v0 Z7 ?9 E/ ^6 E' t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 A/ A3 [. d, m2 G  X
  55. #define STATIC_SHIFT                35 \# B5 r) V5 @" p
  56. #define TCINTEN_SHIFT               20/ g) t" [* ]1 i- a) [, M% x- [
  57. #define ITCINTEN_SHIFT              21
    9 B, X9 E! i2 L* p
  58. #define TCCHEN_SHIFT                22% l/ W' H5 ]: f
  59. #define ITCCHEN_SHIFT               23
    # }9 O8 D2 u& @1 Z7 H( G
  60. / g; [/ c5 B; G- t) \3 Q0 J
  61. static volatile int irqraised1 = 0;
    & `( S- J: ]" }  I: I
  62. static volatile int irqraised2 = 0;
    & h1 b: }2 n5 L% s+ Q

  63. $ R, `6 \2 L6 d( j, z( ~# Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ G9 {( x0 ]$ q: h( m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) L7 r# G' J" [; T0 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W# G; W4 j, l: s  `

  67. ; [( m& K6 B& R  q; ~
  68. dma_addr_t dmaphyssrc1 = 0;" c! N; l+ d/ n) S) y
  69. dma_addr_t dmaphyssrc2 = 0;
    ( V) u  {7 f: E2 @: q' S
  70. dma_addr_t dmaphysdest1 = 0;: H0 i1 O" |# _# p
  71. dma_addr_t dmaphysdest2 = 0;
    6 X1 i5 ?6 W& `: k& z

  72. % I0 |+ U/ `: w5 F, ~8 g
  73. char *dmabufsrc1 = NULL;$ P; |3 f1 w9 O' S- o
  74. char *dmabufsrc2 = NULL;; b& |) q1 K+ U# j" _  v/ f! k6 [. c
  75. char *dmabufdest1 = NULL;, S3 x& o1 H( S2 T2 s
  76. char *dmabufdest2 = NULL;
    + d2 [' c+ }$ `3 A% |8 w, w/ e, S% N
  77. 2 A5 j8 c+ \: v1 C, A/ {
  78. static int acnt = 512;
    , h0 \1 Z+ A8 b. d9 T0 q
  79. static int bcnt = 8;: ]  M  Y& L& x  e
  80. static int ccnt = 8;7 z4 ?' [# ~6 l: d

  81. 8 \; i7 g2 \0 E4 J* k
  82. module_param(acnt, int, S_IRUGO);
    0 c6 ?7 H) Z% a4 e4 k9 ^: ^0 B
  83. module_param(bcnt, int, S_IRUGO);; J: T: @2 L* c4 ?  R# B# I" P( n1 ?, P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ |0 X5 z8 e. n. ^. L, [  N! o) K2 q1 T# Z) H) D, S/ H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! d! u( a. I* A6 k' S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ a( E. C% d6 j  V5 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ z" K" W; }, l* J. _: f
" ^) K5 [4 T' B4 x5 L: w
+ ]% [: S* b& V$ I3 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 14:40 , Processed in 0.036967 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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