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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ~& k! Y+ Y7 E7 G6 d6 P4 A0 M
  1. [code]EDMA sample test application
    $ X+ U8 T2 n! N: }
  2. /*6 l& f. `' k; R; b
  3. * edma_test.c& z' x8 {) b- X/ x' i3 F
  4. *, @- k6 |2 n& b. C* t
  5. * brief  EDMA3 Test Application
    4 G7 l3 B' g, o$ |! b% i
  6. *2 @( v6 g7 s2 y- S5 b
  7. *   This file contains EDMA3 Test code./ T. a6 G6 Y, X: G) F6 h
  8. *
    $ J) ?2 P; |: h0 o) f4 m. L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . Q( g. x8 S$ \: k  g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ T# r  I- S6 G( O) l3 z7 v
  11. *         TO CHANGE.$ Y1 i* W7 }3 L' J, ~, j( [
  12. *
    3 R' R$ i$ n  S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ N( ^8 f# q& [0 Z; d
  14. *: R" H/ O( i% U- \% U
  15. * This program is free software; you can redistribute it and/or' {2 m7 Y$ U& a+ j, y, s, R$ v. X" v
  16. * modify it under the terms of the GNU General Public License as3 B  R& y& I& n& i& R3 C6 r5 D
  17. * published by the Free Software Foundation version 2.2 P6 ?" {/ m2 I9 t# _6 @
  18. *
    7 V0 {& }% ?4 L- l! }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' F% K. Q8 G+ t# q/ L; X
  20. * kind, whether express or implied; without even the implied warranty8 i" q% P! K+ L$ x. D( s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 O' q5 D" I& [5 c0 ^) q' A
  22. * GNU General Public License for more details.
    ! ~2 G; d( ?% J: v
  23. */
    & {# D4 l& L  K9 T1 T

  24. 8 ]4 s1 s. p, t  d
  25. #include <linux/module.h>
    ! A- [0 k4 y9 n0 k+ p+ Y
  26. #include <linux/init.h>7 ~' N, E1 h$ K) i
  27. #include <linux/errno.h>
    4 C  }3 N1 k$ e' l* @5 l! @& I
  28. #include <linux/types.h>; E7 s% ^% t7 O5 r1 x" E+ d9 ~
  29. #include <linux/interrupt.h>
    ; E8 `2 w" T0 y( o
  30. #include <asm/io.h>/ w0 }3 b8 l+ W- e1 n# A
  31. #include <linux/moduleparam.h>% n+ l. @, d; i( p5 P- Z
  32. #include <linux/sysctl.h>
    ( N1 h1 u5 J/ q. R7 W( f6 w
  33. #include <linux/mm.h>
    5 M; K2 \/ X, h- n
  34. #include <linux/dma-mapping.h>
    $ Z, s- R- T: `+ X6 x

  35. & u9 z+ ?3 r% @! X: [% x3 n% a
  36. #include <mach/memory.h>- {! ^5 {# }+ l; b
  37. #include <mach/hardware.h>
    + M- `( @* u/ k. j; ?# I
  38. #include <mach/irqs.h>. G" N6 E. c9 {% {
  39. #include <asm/hardware/edma.h>* ~$ |3 s, T2 Y6 M5 j; |1 E! G
  40. + P) {  n5 c0 t* E8 q% t
  41. #undef EDMA3_DEBUG- V$ E: n; x5 l0 |/ l
  42. /*#define EDMA3_DEBUG*/
    & z# ~( N* u% Z

  43. 9 R& P- m3 E  a! u+ v
  44. #ifdef EDMA3_DEBUG  F% \; ]0 F* h  p- c& f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 u& I# j; N# Y) C" T% M5 v9 O$ d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . M, h5 C4 m! Q* X+ d5 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  _- Q3 t' }8 n( c( {; t
  48. #else* H; c, s* @' i7 E  }6 x) c
  49. #define DMA_PRINTK( x... )# s8 g8 m& F1 O+ k
  50. #define DMA_FN_IN
    " b2 P; v! n3 a
  51. #define DMA_FN_OUT5 K3 {% `6 G+ f5 M- K: i0 j
  52. #endif( w% o# r; K/ |) O: ~5 x
  53. ' d- x5 V  H  }- i+ L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 [( q2 T+ U! k% T8 H4 G0 A
  55. #define STATIC_SHIFT                3( q8 N2 `7 k) C( U8 e* s
  56. #define TCINTEN_SHIFT               20) B3 o% E$ f7 M  `# {9 P" b
  57. #define ITCINTEN_SHIFT              21
    ( [/ V: y8 P2 i
  58. #define TCCHEN_SHIFT                22
    ( p% A5 T( x' d' l1 C
  59. #define ITCCHEN_SHIFT               238 J/ j* @" h, i  B

  60. ; M4 Q# `) c9 O6 g- i4 G" a; }
  61. static volatile int irqraised1 = 0;
    6 G) b% w: |) _% G" R
  62. static volatile int irqraised2 = 0;+ ~, i  E6 c* z- L  o  Z

  63. , b* h& g* j1 A3 c2 v* ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ]6 J$ e& q& M  R( j9 f- O: X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % `, M; b2 G* l5 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 l5 z) I3 l& n0 l/ k) Q( Q

  67. # e; c8 X' |2 ?# n
  68. dma_addr_t dmaphyssrc1 = 0;
    7 p- J. r/ E( b
  69. dma_addr_t dmaphyssrc2 = 0;. }5 K9 \8 E$ N/ s, L
  70. dma_addr_t dmaphysdest1 = 0;
    + u) K$ h% ]4 O
  71. dma_addr_t dmaphysdest2 = 0;" F, N4 i1 F4 y1 W: H0 s

  72. 5 }6 S8 ]5 `  I8 b, \4 b
  73. char *dmabufsrc1 = NULL;) I2 Z* R, N- v" ^6 B9 x9 I: a6 b0 j" L5 e
  74. char *dmabufsrc2 = NULL;/ I3 ]9 u  T% p5 K
  75. char *dmabufdest1 = NULL;) g* p5 `! s4 R5 W! p- A
  76. char *dmabufdest2 = NULL;
    % [( e0 Z5 d. o# ~$ `1 r
  77. + {3 {( U7 |' |7 x& [8 z
  78. static int acnt = 512;0 P3 E5 w, ~$ y! n" |
  79. static int bcnt = 8;8 ]. q' b0 \; T' m% j( w: s/ s
  80. static int ccnt = 8;
    9 h0 |% R7 q5 V$ o) @: H% Z. o7 j
  81. " q( D1 }! O! ]2 k9 Q& r
  82. module_param(acnt, int, S_IRUGO);" w7 E2 Q/ l  K, ^2 y
  83. module_param(bcnt, int, S_IRUGO);
    & O; j8 L9 E! u- s$ o  V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 i5 g) P3 v$ _9 k2 w, g$ _) B2 `+ m+ D6 \! `! {5 z: E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 @  H7 x. S, E- Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& h5 V7 _% y) A+ \& G6 A2 S$ i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( L* D% ]8 e5 C" V$ p+ M% I5 C
3 ^9 a  R: q- ?' Q! k* ^

2 `  U" @* {; j& C% c0 l* T8 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 16:02 , Processed in 0.048710 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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