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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . a2 I  j& Z" u
  1. [code]EDMA sample test application8 _) n  d% x6 k7 W
  2. /*) r; C, H. c, n( d9 A- `
  3. * edma_test.c
    ' V1 D2 Z% ~7 x5 h
  4. *  S3 U& g: ~# z
  5. * brief  EDMA3 Test Application2 z9 R" f1 F9 P1 U& U9 ~
  6. *
    ! T8 v4 P$ \  k4 t
  7. *   This file contains EDMA3 Test code.
    6 Z2 H2 T7 P+ r3 X" p
  8. *, K$ [! W) L+ r: ^" _8 z8 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # T' G- d- Z" a- x( o7 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! _/ ^7 X& z3 G" g. I" z  b
  11. *         TO CHANGE.
    3 J) T. B8 d/ }) y; z: C7 ~( A0 u
  12. *) d6 j& `  e$ |! u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " L- X- p6 \% [
  14. *' E, p6 {$ |! d
  15. * This program is free software; you can redistribute it and/or2 Y: N8 y( Z* q/ O$ }  ?
  16. * modify it under the terms of the GNU General Public License as7 {$ J$ i; q' }" Q' u) O2 `
  17. * published by the Free Software Foundation version 2.
    # n0 r* n, x9 c& L: f& T/ `
  18. *5 |/ j+ Y1 Q: Q3 `4 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 }  j* N& e  o0 H+ U% {: U( x
  20. * kind, whether express or implied; without even the implied warranty2 ~$ l; O  R. t' [8 D$ J, z" A; y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 t% a# T; f- G; t  z, ~: u4 H1 |3 }
  22. * GNU General Public License for more details.% b" ~  X% A" u3 U1 a4 e
  23. */- U$ ]: e2 c6 i) \8 o, a* k) [

  24. # x' h+ S3 D, d( X5 E: p: X
  25. #include <linux/module.h>
    % G- m, ]  t' l
  26. #include <linux/init.h>
    # G6 [  Z7 [" G/ W3 |  D
  27. #include <linux/errno.h>* A! q; G7 w( `# z
  28. #include <linux/types.h>
    + G2 N0 d+ Y3 Q4 Y6 H, _0 M" ^
  29. #include <linux/interrupt.h>
    7 x2 N# a  a) a
  30. #include <asm/io.h>: L# s# Y3 C6 D+ }: ], {# N. J  X
  31. #include <linux/moduleparam.h>
    3 m3 c* I" S3 c
  32. #include <linux/sysctl.h>
    0 E' E" @% \9 S
  33. #include <linux/mm.h>& J: y4 _' Y4 Q) X" s
  34. #include <linux/dma-mapping.h>
    # m; }4 I1 h9 z2 M* [- {
  35. * U0 d  h1 e( @3 n+ u6 I. X: |
  36. #include <mach/memory.h>
    & S# J- o! I" S* p: s; _
  37. #include <mach/hardware.h>
    $ f0 T8 ]& L+ W
  38. #include <mach/irqs.h>
    ; }! R; N! M7 ~# {. a! p/ k& ]' r4 s
  39. #include <asm/hardware/edma.h>0 K( ?4 @8 Y7 ?# h, n0 Y

  40. 5 o3 G; k: j2 @0 R$ z, q0 e* L
  41. #undef EDMA3_DEBUG' c1 i6 y1 x# H
  42. /*#define EDMA3_DEBUG*/
    : o' A9 G. c( O9 e; M  F0 K
  43. 3 o* S; v0 p3 f& w% J5 }0 C9 ]6 @7 }8 d
  44. #ifdef EDMA3_DEBUG1 ]' A2 B0 N( _: _* G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 R! U  D5 m9 o) x' ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 |! L: n2 i3 g# e* e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , n+ j1 }& W' z
  48. #else0 b7 C/ |  \$ _; C, R9 k
  49. #define DMA_PRINTK( x... )
    * ~8 R" [6 ]/ Y: \
  50. #define DMA_FN_IN# H! [7 u" z# Z+ n4 A4 C  P7 P( Z
  51. #define DMA_FN_OUT
    ) e  p8 [$ ?' X
  52. #endif7 E1 }0 V$ e/ k; {7 q
  53. ( s7 Q* V- r+ ~' m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) d1 ]) s4 B, E1 m0 E' q  A2 u2 h, j
  55. #define STATIC_SHIFT                3+ l! m0 i; N/ p* L% ]
  56. #define TCINTEN_SHIFT               208 R) f6 H0 |5 y+ r# w. a. a1 {
  57. #define ITCINTEN_SHIFT              21- V( U2 P' s  M- q0 \4 R
  58. #define TCCHEN_SHIFT                22; `% K- R6 l+ V# J% m% ^0 J. P
  59. #define ITCCHEN_SHIFT               23, Q  Q% L5 z: S$ h

  60. , F3 Q) G$ D0 I
  61. static volatile int irqraised1 = 0;8 r: N% _9 T& Q
  62. static volatile int irqraised2 = 0;( B4 g- y7 ?8 b) w0 y
  63. / @8 O0 Y7 O, D. D6 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' t# P. J, k0 B( j+ m% M6 D! {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Q' S' n, ^" w0 ]. G, X8 z/ k* N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 N1 S8 \& P- I9 p- v

  67. 8 c  c: B, Q0 c9 q5 o
  68. dma_addr_t dmaphyssrc1 = 0;
    . B  R- ~+ N& g2 S
  69. dma_addr_t dmaphyssrc2 = 0;8 I4 {( V$ U* `7 p
  70. dma_addr_t dmaphysdest1 = 0;
    $ Z/ k. y# D9 m$ R; U
  71. dma_addr_t dmaphysdest2 = 0;( L- C. N$ N' ?; U& a9 I% _/ Y  w

  72. 8 ~$ t) J  A! O. `, @  K  _
  73. char *dmabufsrc1 = NULL;
    6 l# b. G( X$ Q1 k! d
  74. char *dmabufsrc2 = NULL;
    5 I7 F; j8 ]; g
  75. char *dmabufdest1 = NULL;' ]5 E0 o& q8 A8 Q% K' e$ k
  76. char *dmabufdest2 = NULL;
    & r1 L5 Y1 ]  Y; g' m$ l$ T. P

  77. ( c" h3 L; t4 E8 s  H0 h
  78. static int acnt = 512;
    , @  l2 n0 B5 i
  79. static int bcnt = 8;
    7 j- J+ M& J8 h0 R. l9 V
  80. static int ccnt = 8;
    0 B5 |( D0 X; n  q
  81. : Y* l, Y+ L9 P& T4 z5 A
  82. module_param(acnt, int, S_IRUGO);
    0 E6 E: @" {8 J, P8 S% t
  83. module_param(bcnt, int, S_IRUGO);
    ; b+ ~* P# D$ G, T6 }5 _6 ]$ c6 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# K/ W* C& W! e( H" ?- U8 I  k1 b( b# K" P8 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 I# t7 A/ B4 w5 |5 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* t$ E; ?; O! N/ B7 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ s! U* w$ `, C. z6 n
& A' V& i0 a: o# r! q7 r( E, J8 w
6 ]: W2 s& {3 ?/ w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-18 16:28 , Processed in 0.040596 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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