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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / f( Z+ G. q3 f  A/ z; S8 ~
  1. [code]EDMA sample test application
    . W; T/ h$ V/ Z  Q8 i9 p
  2. /*
    % H; r: E4 u% ?; p
  3. * edma_test.c
    . F, m' V1 |8 F6 h3 w- p; o
  4. *
    ) O* D7 Y: l) _  ?4 w+ A7 y% d6 p
  5. * brief  EDMA3 Test Application$ ~# y6 y4 j" z! h$ Y6 L
  6. *; |( S# E' K2 J) T+ {! ~. q
  7. *   This file contains EDMA3 Test code.7 @" D  m  r8 O$ G
  8. *
    7 k; Q5 e6 T- e$ v4 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - O' b% d- V) ]# j* J: k2 A& t& t6 g7 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' f+ `. j; Z0 k+ E: h8 W
  11. *         TO CHANGE.
    - R$ Q, \, [# i# S- W# C' b
  12. *" `3 k& C4 H7 G4 ^  w- n# U* V  Y0 g) w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( z! E/ f" G3 M) w
  14. *
    ) l% @. Q1 l' D& T
  15. * This program is free software; you can redistribute it and/or
    # L9 M" H# [5 P
  16. * modify it under the terms of the GNU General Public License as
    4 x7 ?$ w& S% U0 V
  17. * published by the Free Software Foundation version 2.
    % H7 @. G5 L" j" T1 m9 o6 C. a
  18. */ G( A" B; Y$ X% {$ I$ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 `/ ?2 L' e# P3 Y1 u: c
  20. * kind, whether express or implied; without even the implied warranty0 B. z" u' E. O1 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * l3 x: @& {0 D  B/ c% S
  22. * GNU General Public License for more details.
    # p5 u9 a( B5 T1 K. H5 R2 {2 K1 X9 D* _
  23. */. I1 W3 V: P! d9 A& U5 x' M8 ], Q9 G, U2 U
  24. ' i! T+ B8 [) A9 M  Y8 l& p0 \
  25. #include <linux/module.h>/ i" A$ F% s. Z9 q8 c5 s( N
  26. #include <linux/init.h>$ I6 _! r- D) Z% \$ ~
  27. #include <linux/errno.h>
    9 F' J/ u! J; m4 d0 ?5 u& J8 L
  28. #include <linux/types.h>/ J2 q! V/ @1 a8 ?6 V
  29. #include <linux/interrupt.h>: n1 L1 L( [/ U% D9 W  \6 m
  30. #include <asm/io.h>8 D4 n6 C1 d$ I  Q) P+ \( a* m
  31. #include <linux/moduleparam.h>
    ; g9 O1 b8 j) q% u% i
  32. #include <linux/sysctl.h>. Z7 H6 [. ?) q5 O  B- q3 ~' i
  33. #include <linux/mm.h>
    " j. ~2 f, `* r' j) Z/ o4 _
  34. #include <linux/dma-mapping.h>+ s6 y0 J- ?  Q. {4 W9 {8 r+ L/ P) k
  35. . b+ u" B. w+ C1 _3 r# a
  36. #include <mach/memory.h>5 \- i/ b  M' {7 }' N2 x
  37. #include <mach/hardware.h>
    3 B: G9 @, y  @7 ]
  38. #include <mach/irqs.h>
    # p, |  P; o2 Y) o8 P
  39. #include <asm/hardware/edma.h>- V3 V; r! z, v2 c; L+ j1 G0 k
  40. ; J! Y0 F$ m( M4 n7 X
  41. #undef EDMA3_DEBUG% H  e( d/ @  a
  42. /*#define EDMA3_DEBUG*/
    8 ~& c7 U  Y; t8 {

  43. ( \  N: ~+ X: W7 P
  44. #ifdef EDMA3_DEBUG! E5 @( w. X6 F, M' j( b( G' |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( c# {' ]! x* Z) K, o! G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % {3 x* Q' Y$ M2 X, V+ e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 A7 f  H* C5 e3 k* R, ]* z
  48. #else
    ! y5 J# B" M! ]* M* C, ?
  49. #define DMA_PRINTK( x... )# m! ?3 y" v! d7 ?, `$ p
  50. #define DMA_FN_IN
    ! z% _5 V# ~9 o; y3 J
  51. #define DMA_FN_OUT6 m  k9 R0 N: \% ]( {
  52. #endif8 p' H( k& o8 s' P9 R
  53.   _/ H5 U" S0 N6 v0 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* ?+ Y. V3 M2 a, O6 E5 x+ x
  55. #define STATIC_SHIFT                3
    0 D  [) e$ F  c: v' K5 @6 b* W
  56. #define TCINTEN_SHIFT               20
    # l9 C1 z( ?+ J0 s
  57. #define ITCINTEN_SHIFT              213 j# T9 h+ @" r; [) V- ~6 b8 X2 H$ Y* u
  58. #define TCCHEN_SHIFT                22* k* R: D0 m1 d1 o) Y8 F* v5 r
  59. #define ITCCHEN_SHIFT               23
    2 ^/ t* [! m: m2 s8 f# z1 T

  60. ! F- [( z0 ^; }3 \! x. q
  61. static volatile int irqraised1 = 0;
    " y- @" n  x# g3 g
  62. static volatile int irqraised2 = 0;/ c- Y# J  t' V4 w4 j
  63. 4 X7 ^7 x4 A) \' J' b* ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& M- X. T+ h5 l+ e; Q; w2 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }# Y, y+ Y! |3 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ]' O* W& D, m8 O

  67. 6 c, J" p' R! Z  O0 Y" x/ c
  68. dma_addr_t dmaphyssrc1 = 0;  |( h" e' u/ R2 Q9 }% ~0 V/ M
  69. dma_addr_t dmaphyssrc2 = 0;/ }8 d' W& t: d( L- e: x* H
  70. dma_addr_t dmaphysdest1 = 0;
    3 G. l5 ]1 U( k0 f
  71. dma_addr_t dmaphysdest2 = 0;- [( i! o" B0 q3 l0 t( a' j
  72. 2 Z/ i; p4 Z, v) p
  73. char *dmabufsrc1 = NULL;
    ) b2 E3 d0 |! \" L  o  s
  74. char *dmabufsrc2 = NULL;
    ( [4 _6 _) E# k" V; v/ ^- `
  75. char *dmabufdest1 = NULL;& m  D  B& }6 \: P
  76. char *dmabufdest2 = NULL;5 ]+ R- ?( M+ P; [8 c( C' W
  77. , Z6 [3 N6 W) N2 i) W! @6 Q$ l
  78. static int acnt = 512;1 p% b. N" Q1 p  _4 I1 V  s
  79. static int bcnt = 8;
    8 [6 ?, q6 W) ^' @. {0 p# c/ P
  80. static int ccnt = 8;
    4 n+ n% Q( h2 |
  81. ) G4 M# X. u! X; o& e
  82. module_param(acnt, int, S_IRUGO);  s' e: ?, [' _  h! [: M
  83. module_param(bcnt, int, S_IRUGO);/ j* g6 e  R# E) c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 B% v$ Y2 C: Y! A4 f2 L3 R2 ]' C! o% K0 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ]$ K* T0 R: U  O+ n+ E9 {! Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 p7 y8 d" d& i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  L( L% U$ s7 T* U

  S- ~! L+ B4 |3 ]. r3 M5 D3 v' O+ t: L, S3 u( l2 M/ w! V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 11:10 , Processed in 0.039286 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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