OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) K1 e5 F9 T% B* g# w; c
  1. [code]EDMA sample test application" _+ s4 r# ~8 O8 g
  2. /*5 @& \, E2 P) C. `# m
  3. * edma_test.c8 ^6 Y/ Q6 t$ N- S1 ~' R
  4. *$ j1 @1 S* ^- ~9 T! h# R
  5. * brief  EDMA3 Test Application& F0 p2 S" m. J  r
  6. *  ]$ y  j5 b- z) S; D6 `
  7. *   This file contains EDMA3 Test code.2 [8 h6 R8 i: O7 E/ F" M
  8. *
    0 R8 n  w% u: ~5 H+ ^: h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " a7 @8 R5 v0 |8 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & A: v% ^4 X0 h. @! W2 k5 @8 b8 P
  11. *         TO CHANGE.
    . O& W. q% Y+ P! O/ H/ J' `% J# s
  12. *1 q1 }# J! F, s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 w. g) F5 e8 b$ w- u5 e
  14. *+ }# L; i; \; n1 \
  15. * This program is free software; you can redistribute it and/or
    8 ?  u4 j! h9 F" J; o  f5 p+ x* h5 v- O
  16. * modify it under the terms of the GNU General Public License as9 s% P2 b! c8 Q( Q: \, K
  17. * published by the Free Software Foundation version 2.- t& @# j6 a* @  M* ?& p7 b1 \
  18. *
    & B, Y( p6 |3 m% ~1 y+ ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 v* M1 c* g' ?3 t
  20. * kind, whether express or implied; without even the implied warranty
    " [5 B/ @) \0 ^+ ]" Y* X4 Q0 f; Z) n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 \% }* C; f2 [, `# \: W: y) R
  22. * GNU General Public License for more details.4 Y. j- b3 ?$ O; U- w
  23. */
    0 ]( O0 d) i6 V5 f6 [7 G
  24. 3 z! e. _. S7 Y& K% J8 `
  25. #include <linux/module.h>& s1 p+ a/ V2 d0 {9 K' k: g
  26. #include <linux/init.h>6 x+ d: F2 i, Z
  27. #include <linux/errno.h>9 |$ C6 V; f; K5 X" z& Z/ Q) c
  28. #include <linux/types.h>% W- b7 u: n! p' x( p& G% N- v
  29. #include <linux/interrupt.h>
    ) @% B, ^0 @3 B
  30. #include <asm/io.h>& Y+ w/ P3 H. g$ W
  31. #include <linux/moduleparam.h>7 H0 l. U; t: W7 b( c
  32. #include <linux/sysctl.h>
    3 M) p' H  [0 j- h
  33. #include <linux/mm.h>
    - o6 c1 n$ O. W7 G+ p% f
  34. #include <linux/dma-mapping.h># O. `/ W2 r( w
  35. ' W1 D! o% K: M! ?
  36. #include <mach/memory.h>/ v, R, o# ~! `* B
  37. #include <mach/hardware.h>
    0 {) b) F* z: R: Y
  38. #include <mach/irqs.h>( w8 g: }5 z9 i
  39. #include <asm/hardware/edma.h>- @: B3 Y: G3 }# t9 T$ i1 o$ \; s
  40. * l# A  P- M' @2 Q) o: g2 ~8 U
  41. #undef EDMA3_DEBUG+ n2 z; R9 q" ]% N+ P9 E3 X$ b
  42. /*#define EDMA3_DEBUG*/
    - y3 f7 i; H- o" l
  43. 0 U! V* O. N% m
  44. #ifdef EDMA3_DEBUG
    * v* z  \. D6 L& L3 y' O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ g/ P. F, |! s. R* t% u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  ^; |( _- U9 O) z$ K, u8 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 N1 U: `  X9 z! e5 o& j9 v+ D6 k
  48. #else; Z- O# z' \$ \/ b; l) ~* f
  49. #define DMA_PRINTK( x... )
    2 t5 i6 S7 d% k4 p. G
  50. #define DMA_FN_IN
    " N5 N+ }* r4 W9 g( m) y4 ]5 V
  51. #define DMA_FN_OUT; M- q* Y# f. a
  52. #endif
    , N% K+ O7 d7 e" T6 h) z% v) E

  53. 4 N  M0 V& o: I: E# w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 q  u1 t' F2 B# ], M
  55. #define STATIC_SHIFT                3
    " [9 Z# Z- P- p1 f
  56. #define TCINTEN_SHIFT               20# f2 ~9 h- T+ @. m
  57. #define ITCINTEN_SHIFT              21+ O& Y  c0 {$ d
  58. #define TCCHEN_SHIFT                22; J  S! o1 I7 J! e5 P: E
  59. #define ITCCHEN_SHIFT               23: [" l5 @: k$ ]
  60. : @3 }7 s. {* P2 R/ i
  61. static volatile int irqraised1 = 0;' j/ V. _; \8 w; _; a/ I
  62. static volatile int irqraised2 = 0;
    . T; A4 z( y! V5 p
  63. + T: n- `, f0 G! G2 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) e: T; y, V7 p0 W  f# ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M; Z* B0 V& [% E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F2 @9 i+ U1 k# x' o
  67. * c2 n  x- _0 h
  68. dma_addr_t dmaphyssrc1 = 0;
    $ N. N) k1 e1 m0 e/ E
  69. dma_addr_t dmaphyssrc2 = 0;
    5 T( F9 D  ?" Y1 H! r. K
  70. dma_addr_t dmaphysdest1 = 0;
    ( ^4 `6 Q# x" n, c* l
  71. dma_addr_t dmaphysdest2 = 0;
    - O- X6 \& ], ^7 A

  72. $ U( [" H$ ^$ W* j
  73. char *dmabufsrc1 = NULL;3 ~6 B; ^* W) F5 k+ v
  74. char *dmabufsrc2 = NULL;# e5 C6 F/ C* W- j( l- [
  75. char *dmabufdest1 = NULL;
      I1 c9 w( S6 G, J% M
  76. char *dmabufdest2 = NULL;
    % o' A2 }4 Y5 `/ w* t5 g+ N

  77. 7 n6 s3 x4 K5 I9 Z& f
  78. static int acnt = 512;# r  Q( P3 A, e( T) j
  79. static int bcnt = 8;
    - g: X9 ]* c  S6 H2 d
  80. static int ccnt = 8;
    0 |5 F. `- W5 I" r9 t7 a+ q
  81. 5 b6 t/ O5 H$ b5 g+ p: X" Q( j
  82. module_param(acnt, int, S_IRUGO);9 \0 v: H1 ~( F$ F7 I8 _9 A+ S4 {6 l  v
  83. module_param(bcnt, int, S_IRUGO);
    " h2 u& [( }6 F+ h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# P4 }  ?0 S3 E( \7 J3 F
2 [1 _2 p+ |( h0 z1 S# I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. C# e4 n7 H: J+ G7 D0 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  I4 {: E% F+ c3 V# T) C0 W2 I" ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x' z% n0 a( W' Q8 a4 U9 _; E0 o3 s

' X3 R* E/ t. A+ F  a+ V4 h7 \& s6 ?& [' @2 v0 n( b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 12:54 , Processed in 0.037927 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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