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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( g6 ]' Q. k( E0 c5 V. M( w
  1. [code]EDMA sample test application' h+ V/ E5 p  h+ ?! z- C
  2. /** f! F; Y2 t. ], t2 `" @, V
  3. * edma_test.c* R. l% Q% N8 c7 x2 |1 {9 e$ o
  4. *
    - U& I7 |. G4 `& s7 F1 h
  5. * brief  EDMA3 Test Application
    ; i# W: W& n. ~7 j% v. x6 O8 F: f
  6. *. c) x+ i! ^1 Z$ n
  7. *   This file contains EDMA3 Test code., ~9 I) M9 J- i
  8. *, ~1 L+ j: h: e' e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Y. G: k. a2 U& k5 @, [2 P( R- E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 A6 _. [- S' u8 {5 E
  11. *         TO CHANGE.: A/ {4 y. ]' L1 U& E
  12. *1 _- l, X# F' ~# L8 m% b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 q* l6 |, _* ^' Y0 M
  14. *8 B/ L1 J+ e% P2 m4 @
  15. * This program is free software; you can redistribute it and/or" j9 K) L5 O% q6 R/ X$ D
  16. * modify it under the terms of the GNU General Public License as
    4 P3 B& D9 [0 r9 A% ?
  17. * published by the Free Software Foundation version 2.
    / ~3 V- [. Q6 D2 j3 P7 p
  18. *5 Y: ^: x0 z! P6 }' V0 C& ]6 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  v, Y! d9 F6 x( Q* R9 m0 {
  20. * kind, whether express or implied; without even the implied warranty
    / t* s7 s( f0 Q" X* }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 N4 m! c" I7 V( D: z0 ?
  22. * GNU General Public License for more details.0 T' e. F- |3 t6 {2 m0 z* _
  23. */
    " ^$ k0 y! m" B& N$ M+ k* \
  24. % o0 \5 g: R/ t% e  k5 N1 l' f/ Y
  25. #include <linux/module.h>/ t( j( o- o+ _- z" \( ]: o! E
  26. #include <linux/init.h>
    ! x4 F# d3 K  u
  27. #include <linux/errno.h>* Z7 y: K: B( u# X
  28. #include <linux/types.h>- F: X5 l( n1 ?8 ?" f) L$ Q
  29. #include <linux/interrupt.h>/ O$ L6 U% [/ Z
  30. #include <asm/io.h>2 n  ~6 b4 V# b" L9 p
  31. #include <linux/moduleparam.h>
    % V5 l5 Q4 F9 y" K4 F+ m
  32. #include <linux/sysctl.h>2 v5 I0 @+ ~% h" h- F5 Q
  33. #include <linux/mm.h>6 D$ I( O/ y! i# p! f# o  K/ ]* b# ^. ~
  34. #include <linux/dma-mapping.h>) k: n, K7 ], k% E* x" j
  35. , ~7 i, Y4 M: r1 l! x
  36. #include <mach/memory.h>6 x9 v  O1 O$ Q5 H, \# ~
  37. #include <mach/hardware.h>1 P0 `# `, T! s4 c+ u" Z. L0 r8 l$ N
  38. #include <mach/irqs.h>
    5 g0 \  m: \6 o( T+ Y
  39. #include <asm/hardware/edma.h>4 W6 r3 T' @* b( S9 Z/ L
  40. / c3 X6 Z3 P7 C' N
  41. #undef EDMA3_DEBUG, C* {( Z$ i" [. O, U
  42. /*#define EDMA3_DEBUG*/
    8 a# ^1 |) F0 E7 C* ^' f

  43. ; D( b( H9 j/ V1 I& d* e- m% \
  44. #ifdef EDMA3_DEBUG
    6 n6 W( b5 S' W- G. q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - z& K. @7 Y- z( E% H# F; x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* O8 \$ H& C( f+ i4 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), u" L) g; v  ?1 D+ o& E
  48. #else
    ' }! Q0 A& e# j
  49. #define DMA_PRINTK( x... )
    5 G. g. g9 F$ R/ o0 F# n; }
  50. #define DMA_FN_IN  }6 a* H6 O9 ^3 j* E$ C
  51. #define DMA_FN_OUT
    8 y$ q+ q' f& B/ d: r. J
  52. #endif
    * z2 R% [/ r( d; ^; B5 J& \; @

  53. 1 u; P* |1 z5 f) K4 I+ i% u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  v% t% T! W  o/ t# ~% P) y; y
  55. #define STATIC_SHIFT                3" h  W/ v- a  E
  56. #define TCINTEN_SHIFT               20; q+ G9 W& K6 k: E! z' C
  57. #define ITCINTEN_SHIFT              21; r/ G$ ]/ h1 ]( u; J8 L$ ]
  58. #define TCCHEN_SHIFT                223 D- O! g' ^3 F. ?" }+ o
  59. #define ITCCHEN_SHIFT               23  x  c! @* q/ s" N. T) Y$ s
  60. + L3 s, j! q8 |9 b+ P) b( F
  61. static volatile int irqraised1 = 0;
    , ?9 J: R3 O! Y& I# w. q
  62. static volatile int irqraised2 = 0;
    , ?0 Y( u' y* v( X) ]" }0 I
  63. " ?! X! v' V- G1 E: ~0 \: m5 J: O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ `2 y2 b# z3 a6 q6 v$ H! f- i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }4 N& W* t, W2 w( N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : k! Y7 B9 d/ Q! s$ F- r0 r
  67. # X8 b& a) o, i
  68. dma_addr_t dmaphyssrc1 = 0;
    0 [& Y! I" K" ?1 j* H5 I4 @
  69. dma_addr_t dmaphyssrc2 = 0;2 J/ r$ ^* U8 P. D" a
  70. dma_addr_t dmaphysdest1 = 0;
    ! e% r3 K- p4 j) B+ P0 r
  71. dma_addr_t dmaphysdest2 = 0;6 T) x- Z0 N: {6 c4 R4 d4 G* z

  72. / a) k3 C# w/ {% F/ i
  73. char *dmabufsrc1 = NULL;
    & M# P# X7 S' C+ i* r
  74. char *dmabufsrc2 = NULL;
    * B8 l. b7 A) M/ y( l0 T+ \- j
  75. char *dmabufdest1 = NULL;
    0 @$ R& S$ f3 h
  76. char *dmabufdest2 = NULL;
    1 @  M/ l- c6 i) v/ r5 P

  77. ! p2 t1 b; k; L/ p+ L# M' u
  78. static int acnt = 512;
    ( X! j6 |5 D/ ~+ m, j
  79. static int bcnt = 8;* a& r9 F6 R+ p1 o1 x
  80. static int ccnt = 8;6 x* c$ D8 x+ Y* ~* E9 e8 k+ w

  81. ; |: l( w# ]' v1 L2 _5 N0 G4 h
  82. module_param(acnt, int, S_IRUGO);- u( g1 ?' c. O
  83. module_param(bcnt, int, S_IRUGO);
    " H- D: ~- S1 |/ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 Y. m5 D" x" U/ b; ^1 w' j8 Y. V8 _& ~8 v: g" d7 `; S# K+ m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( r& U! f9 H; s7 x4 s3 R! ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 p5 q. u$ V8 y* z" d1 X7 I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 e6 I  E- |- n( V6 M! p6 m( O
; ~3 a! x) r1 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-25 03:20 , Processed in 0.042305 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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