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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : \, i, ?, F$ [. _' V4 C* |1 f2 X
  1. [code]EDMA sample test application  l: p2 D5 Y% S; Q* Y( d( ]
  2. /*
    ; E4 [- J. |0 d! x  I) Z
  3. * edma_test.c
    ) S- [* r% t# Y5 K% {9 W2 I
  4. *1 t3 ]& m7 Q! V* O2 E" d" l# c
  5. * brief  EDMA3 Test Application
    ) C( m* n$ ?7 q# h3 W! [- V
  6. *9 `0 ?) V5 Y( ?# S+ J
  7. *   This file contains EDMA3 Test code.
    ; E& [; Z. B( V
  8. *% K, @2 L. G6 p1 _9 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 L8 S) l# a* k4 s. k6 e! o0 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 m9 R$ J) l5 k
  11. *         TO CHANGE.
    7 t" f' R, A6 y% A  D" o: y
  12. *) }+ J1 z9 U8 G, H( T+ P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 q; k# A) F8 k8 w2 F  Z
  14. *$ y- P: h, `7 M9 [
  15. * This program is free software; you can redistribute it and/or: u0 S! ?7 n/ A1 k0 ~9 _4 q
  16. * modify it under the terms of the GNU General Public License as! Q, c9 a  D( n# O
  17. * published by the Free Software Foundation version 2.
    5 w2 Z3 G8 H* V" Y: @- F" `
  18. *4 ]5 I0 p! o' a" u+ E5 J; h4 p7 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 {$ @  b, M4 T& \" M3 `
  20. * kind, whether express or implied; without even the implied warranty
    # {6 M% \+ f2 F5 V2 U0 b* L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 b7 P. u# w; o$ b( t3 ?% ~# z7 Z
  22. * GNU General Public License for more details.- P1 M4 Z3 C+ q2 |
  23. */8 O8 q8 |( X7 }4 k' M; \
  24. / F/ @1 c6 l: [# T: X  P
  25. #include <linux/module.h>: j7 K4 }  p5 [. _7 m, |
  26. #include <linux/init.h>, |" H3 S/ K1 t2 C1 a2 s4 o
  27. #include <linux/errno.h>: p5 j  m# L  n; v( N! h
  28. #include <linux/types.h>
    ; D; x, I" R. d& {% D
  29. #include <linux/interrupt.h>
    7 m5 K! V8 D# t4 d6 Y
  30. #include <asm/io.h>% K! d8 }9 B" \/ {: r* d: \  v. x. T
  31. #include <linux/moduleparam.h>
    7 ^& v3 W" p  j
  32. #include <linux/sysctl.h>) e$ L5 }* i7 D/ S0 z/ E9 W
  33. #include <linux/mm.h>
    ( e, L" g/ [8 r6 i" s; p
  34. #include <linux/dma-mapping.h>( O' R* x# g1 s5 x) ]3 T# Z
  35. 9 G) `, M" f0 W, H7 v
  36. #include <mach/memory.h>( W: Z( D* R& O/ g
  37. #include <mach/hardware.h>
    , b2 |/ U$ U8 H% N: Z" }
  38. #include <mach/irqs.h>
    % A: y, S4 U) x
  39. #include <asm/hardware/edma.h># r. y5 F# G3 o4 t
  40. 5 g7 l- E5 y+ G/ Y" e
  41. #undef EDMA3_DEBUG
    + ^: e; Z8 k+ D+ C" g! P& N
  42. /*#define EDMA3_DEBUG*/
    2 J7 ~" s! o  c

  43. , e! m2 G* ]- L- e4 _9 O9 i
  44. #ifdef EDMA3_DEBUG) X3 E, l1 n' k: N( H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 M" N) d  H( F, x* e7 {, R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# O8 q) ?& |6 `8 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + y. ~3 a" A+ ]1 j6 h. p/ I6 W
  48. #else0 U8 f1 T* {& _( `, G
  49. #define DMA_PRINTK( x... )
    . R1 A% Y3 l8 c6 Q" C3 U. v& b: H
  50. #define DMA_FN_IN) g( b6 F9 k! W0 a! O7 T  a0 o6 F
  51. #define DMA_FN_OUT
    # w! V4 U* }. @
  52. #endif4 E5 T9 C1 L0 C. o' u" n
  53. + d1 }" J; v$ ]- X' {+ M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # T% {1 o/ |- s  S; M" Q, f
  55. #define STATIC_SHIFT                36 Y2 b1 d- r; ~- W
  56. #define TCINTEN_SHIFT               20
    8 u! D) q! _, v4 z/ y2 {3 J
  57. #define ITCINTEN_SHIFT              21
    $ x. W4 ]! c7 m" m: e
  58. #define TCCHEN_SHIFT                22
    7 ]2 a) \; O1 q& ~8 f$ n; {4 I! t
  59. #define ITCCHEN_SHIFT               23
    # r- F4 y2 L1 G* _5 D: @

  60. ! e% ^% `3 w1 ?" g$ s
  61. static volatile int irqraised1 = 0;+ m& s2 A9 e& B3 b2 v
  62. static volatile int irqraised2 = 0;6 {, P+ L. C+ m# x2 T

  63. . C( T4 Q: W& O% p5 V( X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' a/ c  M4 S0 d* a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + i; X* l. A2 C4 g. v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ o' s! w' p" ?5 _

  67. + O, _( n, E3 p' [
  68. dma_addr_t dmaphyssrc1 = 0;
    ! M9 h: Y# k0 d9 m
  69. dma_addr_t dmaphyssrc2 = 0;7 V1 k! ]% z$ c0 d8 q0 h+ F' Z
  70. dma_addr_t dmaphysdest1 = 0;
    / P$ F$ n1 i, x1 ^# E2 n3 r) p
  71. dma_addr_t dmaphysdest2 = 0;, R; a5 }: S. h/ S" N4 E0 \

  72. . p+ a4 V( R/ r+ {' T% N* ^, o
  73. char *dmabufsrc1 = NULL;
    . x2 Y5 X" N  r, P# K. y. X
  74. char *dmabufsrc2 = NULL;0 _  @0 Z7 O8 T) h5 r0 z7 f
  75. char *dmabufdest1 = NULL;
    / h# i1 h$ |* I2 v2 y; R
  76. char *dmabufdest2 = NULL;" [/ M& y6 L* v% |5 H
  77. : r8 f% s- O  c- `, V$ c3 e
  78. static int acnt = 512;! j3 S2 ^/ c& ^
  79. static int bcnt = 8;
    1 {9 y* p$ m) D. h1 u" e1 {& d
  80. static int ccnt = 8;& i( ?1 b- R3 v7 U
  81. 9 B; [' C1 J9 V  L
  82. module_param(acnt, int, S_IRUGO);# k* `, Q: x# \* T) S" Q' {1 `1 [
  83. module_param(bcnt, int, S_IRUGO);  K- N1 E4 _& J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 t: y2 X  x7 m8 X# M
3 {+ m( u5 p$ O/ R9 v4 m2 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 |' w( f1 I, n0 b* e( _: x  q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# y1 {. Z0 j% y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& m6 x* D9 u' G: ~' R' a9 s
4 \" [7 C% l( a- C( N
5 h1 ?3 @6 A. w1 T7 U+ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 15:02 , Processed in 0.040488 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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