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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 J4 Y! @- g5 Q2 W
  1. [code]EDMA sample test application
    : W9 J" b# K( t5 I0 G4 E" n
  2. /*
    9 i# |2 u( Y# ], q: B
  3. * edma_test.c, d# ^) w$ Y' {  A# m* Z
  4. *
    ; @$ U$ O% d$ J9 e# V" F# I
  5. * brief  EDMA3 Test Application
    $ R3 r, }9 F6 @4 t
  6. *
      e, [/ V0 W, v% _& B( \; b2 x
  7. *   This file contains EDMA3 Test code.$ S! m) p$ i, n$ L
  8. *; p" M( {5 g9 _  j4 g) q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. F/ o9 {+ z- Q6 k" s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : k& h( }+ r) R" X' G6 m! u
  11. *         TO CHANGE.
    ) h( b: t2 L5 c! i, f. o0 F* k
  12. *
    , ^& U0 n" e- {/ U  i5 G6 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. k, T& w9 x& u5 i, ]( m$ s
  14. *
    ( R" b1 ?0 |  D$ |
  15. * This program is free software; you can redistribute it and/or9 A9 K. b7 ~6 T# j
  16. * modify it under the terms of the GNU General Public License as
    7 G% A% ^# e2 s! p7 X
  17. * published by the Free Software Foundation version 2.
    4 ^2 T# P1 W! s2 |: M: k; w& i
  18. */ ~' ^5 u: }( {% }" i& L$ t$ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( {' u; f2 {& E5 l; ~& |
  20. * kind, whether express or implied; without even the implied warranty# r0 X) U; V, Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ j2 W- m2 A0 F0 ^; t5 y
  22. * GNU General Public License for more details.
    * T9 o3 n8 Z; V$ r; k  e! w
  23. */4 y) t" e" P0 B
  24.   O4 b) a6 m6 \  R  B
  25. #include <linux/module.h>
    ) x4 o1 j" V9 K/ t+ Q6 P* s# V
  26. #include <linux/init.h>4 X1 _6 ~. Q9 h
  27. #include <linux/errno.h>
    - e5 J8 C3 z$ B" O& b) U
  28. #include <linux/types.h>
    0 I5 Z, \8 Y2 ?- o7 n2 d
  29. #include <linux/interrupt.h>6 l: H5 F& g& y& r
  30. #include <asm/io.h>
    + l- A- G! L0 l* a- q; G
  31. #include <linux/moduleparam.h>! P2 u5 ?. O8 C6 \' q4 v$ x
  32. #include <linux/sysctl.h>( T1 I- k* w# n4 p$ e6 O
  33. #include <linux/mm.h>
    . d0 e" m" c7 U9 h& y! c2 C
  34. #include <linux/dma-mapping.h>
    / I6 B8 O# u* h5 B9 W6 B

  35. ! K& P, M0 f1 e9 K! V, p
  36. #include <mach/memory.h>
    ! K% k5 J7 ~* u# C7 k
  37. #include <mach/hardware.h>6 _7 h( L) n, Z" _2 ~) N  ]
  38. #include <mach/irqs.h>
    ! A+ M7 U8 ]$ a# B
  39. #include <asm/hardware/edma.h>
    * @1 X( X& u  e- v% f3 z* I
  40. # V5 M5 t4 j" _, Z, u  r
  41. #undef EDMA3_DEBUG
    + b" B# T+ n+ L& F2 R* w
  42. /*#define EDMA3_DEBUG*/( Y, P8 s% W) @4 ~7 N
  43. % h0 @5 `& _( L( c, ~
  44. #ifdef EDMA3_DEBUG
    " Y9 {* u2 X5 K  z7 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 t- r) R1 x4 j' H0 U* s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 o9 T% [- n4 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' P& |. Y  K0 o2 |- ]
  48. #else6 ]- P! Y. x$ U
  49. #define DMA_PRINTK( x... ); A, i3 o. w3 e5 d8 U& Y, l6 ]* r
  50. #define DMA_FN_IN
    ) R  D& v3 ]5 U7 M# \
  51. #define DMA_FN_OUT
    / H( a, M+ a( U; H' u: V9 q7 V- _
  52. #endif2 ~( u: b! W/ t

  53. 8 M  H8 u) D1 _! t0 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 F; z3 L' P$ f9 ]( }: i% [
  55. #define STATIC_SHIFT                3
    ; V. \! Z8 U4 D+ j' e
  56. #define TCINTEN_SHIFT               20) r; j' a$ f) i9 u( y' S* W5 o
  57. #define ITCINTEN_SHIFT              21. V1 I3 }/ l# A' t, p7 H
  58. #define TCCHEN_SHIFT                22; `- f. J" Q; z# v' p. R, l( D7 U3 k
  59. #define ITCCHEN_SHIFT               235 M* m0 Q  r! y$ Y. E3 K
  60. $ D  ^( K: o. \3 k
  61. static volatile int irqraised1 = 0;
    - U  D, E0 L9 t# v+ b0 f$ e- o* N8 X
  62. static volatile int irqraised2 = 0;
    2 ~. H& P5 R3 g$ u+ x
  63. , d( e3 |, @' ]+ V- s! O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & S5 `: O) u6 r3 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E1 z2 U* O3 |7 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 b2 M1 T9 P' s, [- Y
  67. , u2 @# ~7 W% O8 S4 o
  68. dma_addr_t dmaphyssrc1 = 0;6 O, }# S: k! X/ B- g7 }/ |
  69. dma_addr_t dmaphyssrc2 = 0;  t4 s3 X- W6 U2 @1 _9 ]" C
  70. dma_addr_t dmaphysdest1 = 0;
    $ h1 C- E$ y# N7 g& ^
  71. dma_addr_t dmaphysdest2 = 0;% @$ z& u0 |0 ?  E/ f7 ^
  72. - l! J! |3 i0 _
  73. char *dmabufsrc1 = NULL;
    ( E7 p* N0 m8 [/ q
  74. char *dmabufsrc2 = NULL;
    2 h  M% b6 Q% @5 p6 M- u/ H
  75. char *dmabufdest1 = NULL;
    3 D1 ?3 c! m4 }# |
  76. char *dmabufdest2 = NULL;
    ' C( |& o1 K3 |8 T  Z' x! J

  77. " K% F- h2 Q: I! R  j. _6 v6 ?6 Y
  78. static int acnt = 512;
    ; b% m1 G' v' p6 o' M. O  ]% H
  79. static int bcnt = 8;: `6 c# H5 V$ G- |9 c
  80. static int ccnt = 8;
    7 u- G0 l/ R/ Z4 W7 a: k( f

  81. + ]0 G  ^: N( H- ?* @" W
  82. module_param(acnt, int, S_IRUGO);. o# w& O# ]/ |' f# |! W) N
  83. module_param(bcnt, int, S_IRUGO);
    8 |5 Y3 s& B! u( @0 w9 B5 P& p( \! A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; T. m, C" N2 v9 O! h

" p% a) p; Y. i/ B3 H, J# f% e  S4 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 D. k2 z& S2 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% k! ~+ l! |6 u' o- r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ E: q  o/ ^5 f' G! x1 l
7 J: Y/ h# x# N. M2 N$ G% B/ e# H: C9 H: t7 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 19:54 , Processed in 0.054697 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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