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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / F- U1 D* {1 F
  1. [code]EDMA sample test application3 Q0 e2 r9 O  ]2 I1 w1 r& J
  2. /*
    9 m, ?; o" R* K1 {) M# D
  3. * edma_test.c! D4 o) r6 j* e! X
  4. *: ]- K1 i0 i4 A' K2 `! j# O
  5. * brief  EDMA3 Test Application! K. L. F& @( ?4 R* M% S# X# X* A
  6. *! c4 D' N+ `$ _6 y+ E1 ~
  7. *   This file contains EDMA3 Test code.
      P/ @1 V" H  O. z; v
  8. *& F. F4 H$ C( E5 o  G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# }8 `$ h* h, h, `! `" R7 m# L) h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - U. x' K& o3 y* R) I
  11. *         TO CHANGE.( a+ A' m! t1 I5 b* Q
  12. *
    $ F8 ~. a9 \  E) Z% v( V( m" h! W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% p% f3 e0 U& Q* R$ S
  14. *
    ; O" C  J$ e3 U7 e. K
  15. * This program is free software; you can redistribute it and/or
    " E" b8 h3 ^8 L6 Q2 x0 T4 A& b1 g# S5 o
  16. * modify it under the terms of the GNU General Public License as
    8 B- l; d7 K: U1 f, r- U1 _) q2 [* i/ Y
  17. * published by the Free Software Foundation version 2.+ o- G; |; y' U. t# I; [
  18. *& j0 |" R6 i2 M5 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 w% p% U1 n$ g7 E1 E+ ]  @% ~$ H
  20. * kind, whether express or implied; without even the implied warranty
    5 d' K% @* F( ~8 H1 w. Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . [( {5 G' t2 R7 j
  22. * GNU General Public License for more details.) R& N! g" W) J! B3 Z
  23. */
    # q  m8 c$ m0 j7 F

  24. * e8 C4 G( f( E5 k9 X7 d  h
  25. #include <linux/module.h>$ c1 R- h+ j, @% L# Q4 \8 x
  26. #include <linux/init.h>
    4 M5 Z3 u3 \5 y0 Y8 ^$ _& n
  27. #include <linux/errno.h>
    # N% I7 \0 h% a, l( X
  28. #include <linux/types.h>
    / b% d, _3 E$ ^
  29. #include <linux/interrupt.h>
    7 a/ s3 ], \# n* f( ~5 q
  30. #include <asm/io.h>
    7 ]# ~: C3 j1 ^, ]& ~
  31. #include <linux/moduleparam.h>
    & c7 b6 M: ?2 v
  32. #include <linux/sysctl.h>- R% W" |# [8 M3 K, G
  33. #include <linux/mm.h>% L- H- _  M7 D7 G
  34. #include <linux/dma-mapping.h>  B8 z6 M& |3 f
  35. 0 [+ c2 k! w) H. u' z/ o$ z1 K+ H7 j
  36. #include <mach/memory.h>
    - A7 @3 b' k4 P( _5 Z( [
  37. #include <mach/hardware.h>* l* i& T2 _2 z* P- q
  38. #include <mach/irqs.h># S& `- @8 D) n$ g% f
  39. #include <asm/hardware/edma.h>
    " O9 y  k5 [. w; ?- A9 k

  40. & T; R6 Y' A; L- i/ |
  41. #undef EDMA3_DEBUG# h* S! E1 |; y5 G5 [6 j
  42. /*#define EDMA3_DEBUG*/" f4 B# \3 i' W! n
  43. ' o; u. I2 c  H# a5 ]$ M( C1 X
  44. #ifdef EDMA3_DEBUG
    # b* B. d/ {. z4 m- H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- [% L/ \% O8 R/ {, z+ s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 L3 K1 Z4 v4 X7 b& t% S3 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 H3 v- w7 x! s2 g& }
  48. #else
      T7 p9 l' M; _9 S  i' _6 \, r
  49. #define DMA_PRINTK( x... ): O/ e" W( B7 \
  50. #define DMA_FN_IN
    1 B1 J5 |. t& y& V8 T
  51. #define DMA_FN_OUT7 c" e9 F" L0 n/ v; ]# z
  52. #endif7 n  ]1 G6 N- [1 L$ `# ^# t

  53. 2 c! q- `6 D$ M, U1 d! y7 R& y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) Y, S+ n" k1 i
  55. #define STATIC_SHIFT                32 S9 C! s! j5 W6 S
  56. #define TCINTEN_SHIFT               20; ]7 t3 a  t$ D; p5 c$ E
  57. #define ITCINTEN_SHIFT              21, S* T3 T) H: b5 m
  58. #define TCCHEN_SHIFT                22( K( l5 V( S, H2 w! f9 Z( @0 c  j
  59. #define ITCCHEN_SHIFT               23
    , ~7 m3 W6 u/ L% x# B; X
  60. - ?3 l9 O; R" y0 X; L3 g9 l
  61. static volatile int irqraised1 = 0;
    ; Q; ^* V1 t  e. ^
  62. static volatile int irqraised2 = 0;* c5 _$ m$ I# T+ b) t" P1 K

  63. & Z4 R, z- b' c* J2 _2 E5 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % B. A; D( [# f& B1 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 n  u6 Z2 X3 F- `& }4 N4 V0 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . J0 g, O  T( F( z' _, g
  67. : n; D, Q+ o& m. c) K* a
  68. dma_addr_t dmaphyssrc1 = 0;
    . ]) f9 O5 N/ V* y6 L
  69. dma_addr_t dmaphyssrc2 = 0;
    ! E, F/ T1 m: _( h  t+ j
  70. dma_addr_t dmaphysdest1 = 0;
      ?" z3 X3 {8 \  o/ }
  71. dma_addr_t dmaphysdest2 = 0;
    2 W! Y1 s. q6 M/ L4 y9 F

  72. 8 O) C6 i+ y5 G) [& e$ I
  73. char *dmabufsrc1 = NULL;! ?1 m) {8 H, S- u4 v) A
  74. char *dmabufsrc2 = NULL;2 }* \9 d& a7 l) F% I. }, w% x
  75. char *dmabufdest1 = NULL;) p( C/ E8 I, X+ F' X+ x+ H, a
  76. char *dmabufdest2 = NULL;
    ( I- O2 D5 w: S
  77. / L- {2 p4 `  L- z
  78. static int acnt = 512;2 M5 J% H) D) h9 Y% m3 K# O# e% O
  79. static int bcnt = 8;
    6 B1 w; K+ g1 Y( N$ J
  80. static int ccnt = 8;7 Y2 Q) a. J* H
  81. % r: Y4 h( ~$ w9 Q( R
  82. module_param(acnt, int, S_IRUGO);
    . _2 F9 T, {& ?8 Q' \
  83. module_param(bcnt, int, S_IRUGO);6 d( Y! d, ~; l; O9 K* m1 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; }- w: B6 k9 b, k- J
5 I8 e: r* }% P; H% I" s5 Y) R/ }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- `: ^8 {3 H; p5 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ C3 G( }/ o1 `- T, a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. C, q  d$ n5 F$ W, t' b1 Z* }7 w2 h
4 z8 l. @2 {$ k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 19:51 , Processed in 0.042620 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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