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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 z1 A5 D- d6 g, H
  1. [code]EDMA sample test application
    * }8 P9 y# ~" X, G
  2. /*+ n; m( t5 Q8 X3 V5 _
  3. * edma_test.c
    1 d- L' `! e1 j/ B  M" l4 L/ D7 c, x8 S
  4. *' D, B2 ^7 z! v! P: e8 [1 O0 v8 w
  5. * brief  EDMA3 Test Application
    ( M3 m  ~/ p$ w/ z0 ?3 v6 Q
  6. *
    & _* j- c9 \* C) l$ g" P. f) y
  7. *   This file contains EDMA3 Test code.
      ^  F/ f9 }$ ]3 b; H4 e
  8. *, _" u: o4 d2 o/ f3 |% r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! `0 g3 ?( e- E$ R. u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) M. A! N8 q% S2 j5 x+ z/ z7 V
  11. *         TO CHANGE.& q, V* O: ]5 L3 M* ]
  12. *& O4 J. t4 U/ _4 H( a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) V$ Q! w+ ^# E
  14. *
    9 T- S1 h) k! Q% X  E! @
  15. * This program is free software; you can redistribute it and/or2 ?8 x0 U# V0 d0 g" z# C$ |
  16. * modify it under the terms of the GNU General Public License as
    $ P9 O4 W8 s0 O( m+ I/ P$ U
  17. * published by the Free Software Foundation version 2.: g" X- N+ H% h% ?# Y2 O
  18. */ g+ g: S2 q* i9 k6 q8 L4 x% i& Y# D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 K+ [) S9 c$ k8 w8 A4 S4 X8 X, d
  20. * kind, whether express or implied; without even the implied warranty- _" |0 i+ L+ w( B* f) }5 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' _# A! y- F/ Z8 \
  22. * GNU General Public License for more details.
    . {& ~* \& e& M  ]' ^
  23. */. Q5 F  N7 U! ~5 M
  24. ( P3 k8 H4 K$ _/ Y$ J! j' w
  25. #include <linux/module.h>* E9 o0 p, g) e( Y" z
  26. #include <linux/init.h>
    5 ~! }* X7 r) l  J9 v/ t: @1 z
  27. #include <linux/errno.h>
    % o: {$ d; x, Z. s$ [
  28. #include <linux/types.h>+ U2 N, X$ L3 d
  29. #include <linux/interrupt.h>! n( D% U# }0 H( \) h& V
  30. #include <asm/io.h>1 [- E' S( Z- y( `2 H
  31. #include <linux/moduleparam.h>
    ) v1 X! C0 Y. A+ a: O4 R
  32. #include <linux/sysctl.h>3 N3 m8 o+ T/ ~# D6 B+ W
  33. #include <linux/mm.h>
    " k+ r& `) N1 {/ M
  34. #include <linux/dma-mapping.h>/ B$ q9 f/ m! W7 \0 a3 G/ t- \2 y
  35. 0 _4 i. w9 Z) h" ^8 s) A8 A4 t, F
  36. #include <mach/memory.h>
    " ^. J" m1 B; b! |0 C. S1 T
  37. #include <mach/hardware.h>5 {' [4 S/ L9 z) r! y* e9 p& h
  38. #include <mach/irqs.h>
    " r$ h  |% y' r' m5 e
  39. #include <asm/hardware/edma.h>5 M$ v5 K0 i/ Y
  40. 4 u3 ^+ T; L8 }; S* t/ ]  B" b1 c
  41. #undef EDMA3_DEBUG7 i9 k- _7 \* b+ [6 l3 M9 m
  42. /*#define EDMA3_DEBUG*/
    " f3 g' {3 S3 @7 t) n3 w3 u

  43. 7 B- k: @' ?2 c2 i5 S6 C2 K$ |2 Y& P% k
  44. #ifdef EDMA3_DEBUG# V% W5 ~3 ~: l" C5 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 J, c* [' i' e3 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # d2 b/ z6 Y0 @" J: g. O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% H) ]( U2 v" H0 H4 M( C
  48. #else1 E: G+ I% [$ r/ c
  49. #define DMA_PRINTK( x... )
    1 b8 i8 W6 x: ^7 r- P) ^: {
  50. #define DMA_FN_IN& @% q7 q# T0 q: [6 N0 |
  51. #define DMA_FN_OUT3 Y" c% u/ h( g8 v* [  U8 P4 o9 V
  52. #endif
    0 e0 `& d% X/ J4 r2 z

  53. ( ~" Q2 X' ?0 `' R" T3 `6 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 |; \; ^2 y6 Y
  55. #define STATIC_SHIFT                3
    , _) A& ?2 ]: Q7 b
  56. #define TCINTEN_SHIFT               20- ], z* k. c6 |3 l
  57. #define ITCINTEN_SHIFT              21# D, y& C; X- D) L" h
  58. #define TCCHEN_SHIFT                22
    1 ]" Y  n; E. A$ _$ Z- y# r
  59. #define ITCCHEN_SHIFT               231 C! H4 g" M! v2 X& P
  60.   T: {: G8 H2 _& z  Z: Q) x8 x
  61. static volatile int irqraised1 = 0;. j6 W- T$ x: u) u+ @" [! `3 ^, \
  62. static volatile int irqraised2 = 0;0 h, A  e# r) F4 q, l8 k7 Z

  63. ) k' U  s& b6 [) e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ^* L& `+ k6 e! F3 R! b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " d- ]4 D+ n# l; a# `8 M- ^: Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & D# Q6 R2 s1 o: b8 e! j( A

  67. ( K, {  K  C* N( i
  68. dma_addr_t dmaphyssrc1 = 0;
    4 W- [$ s1 q  K
  69. dma_addr_t dmaphyssrc2 = 0;8 Q4 a  w' j& G5 p+ F! Q$ f
  70. dma_addr_t dmaphysdest1 = 0;& l( \3 k/ w  Q6 K* a0 E- U
  71. dma_addr_t dmaphysdest2 = 0;
    ! x, ]1 ~2 Z6 @5 p' @) Y: `( ~) M
  72. , m7 B" T- B& A+ Z( F- @
  73. char *dmabufsrc1 = NULL;3 u! i0 |* O5 U5 K
  74. char *dmabufsrc2 = NULL;. j; h8 U# z( S) t
  75. char *dmabufdest1 = NULL;) Y9 o4 @1 b" x* p
  76. char *dmabufdest2 = NULL;( x8 ^+ Q) \- r0 q+ E7 F

  77. 7 r/ z' t" p+ O; A2 q' l
  78. static int acnt = 512;5 W7 f; I! y1 l- ^: l- R& D
  79. static int bcnt = 8;( k7 I+ m9 \  [3 j# d6 ]
  80. static int ccnt = 8;$ c& `4 R& O2 _3 Q* V/ f9 R% |
  81. 4 e, i( N0 Q! b* s' [% e
  82. module_param(acnt, int, S_IRUGO);. t8 D$ F1 a" W, i1 o/ v+ I. M# ?& F
  83. module_param(bcnt, int, S_IRUGO);
    1 Y; l9 v+ w& _; t8 X3 K3 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ @) t) e% _9 @2 o9 B! m

+ h6 ]0 l8 J8 R( u+ [+ D. h: G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 x1 x& y; b7 w* H* F) K" ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 X. T% U$ a( M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 Z* y, e; e% T$ ]$ K
* D5 z) [* ~" N7 i5 k( a0 H3 i2 V8 {+ z* m* V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 20:24 , Processed in 0.047457 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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