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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & x; N3 \  s2 ?- d; \) u. y( W) Z
  1. [code]EDMA sample test application* I+ u1 x4 i7 ^$ H3 P3 X! n
  2. /*
    * w* ^8 w& ~* d0 P/ G, d7 z
  3. * edma_test.c
    ) [: Q% m" V7 n$ E# P
  4. */ G; X, |5 K# a- H# ?
  5. * brief  EDMA3 Test Application
    * G  w3 f8 E; v3 g1 l7 M
  6. *& t& z: \1 S* h# _1 \3 W$ l; {
  7. *   This file contains EDMA3 Test code.
    ( \) Q* k6 Q1 X! k' c
  8. *1 U5 A2 A6 k, b+ `+ r$ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 R: M1 @1 Z* c/ |" k. O& E5 Z6 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # M$ P' y2 Y; \. e  {4 C( N! b
  11. *         TO CHANGE.
    ) n$ Y2 W' c! Z* g; c- i) J
  12. *
    ( _3 D7 u, ]  }! u0 h8 D+ ^" }' I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , X! u' ^( m( e4 _
  14. *
    " C6 ^! n# L- \' s0 G+ M
  15. * This program is free software; you can redistribute it and/or
    8 h5 }  L5 I# |# Z& F$ Y) {/ S7 Q
  16. * modify it under the terms of the GNU General Public License as
    ! Z+ f; d: H3 d! M1 d/ q
  17. * published by the Free Software Foundation version 2.
    $ ?& k( G& x7 A( Y7 M
  18. *# q' t7 V  r4 X' ?9 W5 t3 u" M$ ~% d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! X, y" @- `+ b" s, D" T
  20. * kind, whether express or implied; without even the implied warranty
      P8 w7 C/ f; m$ Z# _8 p& a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & T) @$ N. ^* ]. p9 K+ }
  22. * GNU General Public License for more details.1 W2 C0 V! \9 S/ }3 `( v: X& \% c/ l6 M  m
  23. */
    4 R- f7 H- E1 H# B- ]4 J) C  n3 W4 _7 L
  24. - a1 J- s4 C0 A8 g2 T5 H
  25. #include <linux/module.h>
    * ]4 `( H! i% c: \
  26. #include <linux/init.h>0 ?7 V9 }9 V# E4 p# a
  27. #include <linux/errno.h># |% F/ p0 e2 X: F" p
  28. #include <linux/types.h>
      @1 w9 T+ |" S0 p% _% Q
  29. #include <linux/interrupt.h>9 N2 v4 w7 D# E8 _: v7 Z; Q. R8 h
  30. #include <asm/io.h>
    / c5 ~3 j& c" [+ H  }6 O. f; M
  31. #include <linux/moduleparam.h>8 n& {0 @# s$ x  H! P; X2 ~  p
  32. #include <linux/sysctl.h>2 O& R/ l+ f# K! G, M
  33. #include <linux/mm.h>
    7 ^7 d. e) a- Q1 o
  34. #include <linux/dma-mapping.h>
    1 l- h9 Z- j- \0 v/ r) a

  35. 3 R, M- e! b$ S: t2 A( p9 d
  36. #include <mach/memory.h>
    9 c  B5 c7 ?: d1 T6 O; ?' S- p
  37. #include <mach/hardware.h>* Z1 C/ v2 ^' K8 |
  38. #include <mach/irqs.h>
    . q3 u+ U7 {$ [$ j: I6 {& l/ I6 g, G
  39. #include <asm/hardware/edma.h>! @& C  d$ x) [6 c9 ~

  40. . m( T/ A" n* Z) @) n& ~
  41. #undef EDMA3_DEBUG7 y- `6 k; |" D+ _5 J& S
  42. /*#define EDMA3_DEBUG*/
    : W5 n# u8 g! D3 g

  43. # _2 Q, ?  {  r3 D* ?- S8 _
  44. #ifdef EDMA3_DEBUG
    " ^2 N7 Z5 i$ y9 Z0 E) r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 u& t, \! Z" B1 p" t; q4 m5 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ c) h$ s- ?+ C' q! P% X" J9 Y4 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 f( C3 s( ]: V  p; [
  48. #else* W- Y( s6 M; D3 `
  49. #define DMA_PRINTK( x... )& s4 [' e- j4 y( W6 w
  50. #define DMA_FN_IN
    ( w6 c" h5 M5 Q2 z( g
  51. #define DMA_FN_OUT
    & Y6 a7 N6 ], z2 f7 Z
  52. #endif
    * }% L# D: f) p5 k* N/ t! b+ Z
  53. & h; q, P3 X8 b$ K- K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 p" e5 c4 p- `
  55. #define STATIC_SHIFT                3( L  G  `. z% K$ J- A+ I' ~
  56. #define TCINTEN_SHIFT               20
    / u# k0 J6 p& O/ H" f
  57. #define ITCINTEN_SHIFT              21
    ; S0 |# q& h; o% C1 z. ^
  58. #define TCCHEN_SHIFT                22* V" F5 w0 c0 P" G
  59. #define ITCCHEN_SHIFT               23
    9 Q4 @- ]4 l5 g: C( @

  60. - k, g% F1 i3 B; b1 r$ m4 _
  61. static volatile int irqraised1 = 0;
    & f0 j6 o/ h" h: G4 B: H+ ~+ Y9 C
  62. static volatile int irqraised2 = 0;
    & c2 J1 ^' {. b  Q
  63. , e" @9 j5 r: g  c. z; Z: K+ {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 S2 w, O8 f2 r% `  i6 t; h; Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) i7 b/ g1 s( y0 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- P9 b) |  V: b1 b1 y4 J

  67. $ p( C) q: H- B+ X% ?9 P
  68. dma_addr_t dmaphyssrc1 = 0;0 {* t6 n/ n- z7 q! b3 T8 y5 Y* q& m1 k/ M
  69. dma_addr_t dmaphyssrc2 = 0;  T( K+ R& k: g" o9 V: Q4 V
  70. dma_addr_t dmaphysdest1 = 0;. E. i4 Z! r7 x, S+ z3 S8 I" {
  71. dma_addr_t dmaphysdest2 = 0;
    * N- L' C. ~2 [& P& y. r3 n- Z4 O

  72. 1 D! d6 _7 F' \$ G  }
  73. char *dmabufsrc1 = NULL;
    , S8 ]- r& w) J. h  k! m
  74. char *dmabufsrc2 = NULL;/ _  ]; y8 K8 O7 M
  75. char *dmabufdest1 = NULL;* n9 d# }( u9 ?6 P
  76. char *dmabufdest2 = NULL;
    # o/ M7 X; ?* C. P% y! T0 s

  77. ' a  Y  y" f7 |$ E
  78. static int acnt = 512;
    # B( C4 Y! y, M1 h' @
  79. static int bcnt = 8;- y$ u1 u  T( ?) F
  80. static int ccnt = 8;) N/ S; o( N5 \  ?
  81. . k1 ]2 L) L6 d: m; U! W* a
  82. module_param(acnt, int, S_IRUGO);
    . k" c9 q+ ]7 Q: Y8 i8 ?5 Z6 c# l
  83. module_param(bcnt, int, S_IRUGO);, E  I/ e2 K" g# i7 a+ W, K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ b8 P) W4 b% B2 g9 ~" O

# [) }: x) V5 _  \- M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! y7 I0 W7 q0 M$ p( d$ }& l# ?! J+ g. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, H4 X7 Y- [7 s# R4 `8 i2 A2 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; h) o: i( H; \" B2 i7 p8 z  S0 }0 X6 E4 U* @. Q9 e2 ?# X* Q
, \( I2 @" x. y7 v5 r7 Z" s/ F2 o2 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 10:54 , Processed in 0.038758 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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