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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 L3 G& \4 O+ |# E; Y+ H6 n8 |
  1. [code]EDMA sample test application
    ( F' {. x: ^, t+ R
  2. /*2 _' g' E$ f1 I& _7 _
  3. * edma_test.c
    4 K# C/ M# ]: d
  4. *' c3 H0 e8 M. r( W4 J5 c$ I
  5. * brief  EDMA3 Test Application$ D5 p- G. u" ?2 k9 J  D% T% ^
  6. *% k( M5 E6 @0 V! v: {
  7. *   This file contains EDMA3 Test code.
    ) M# Z! R; O; k! A5 c
  8. *' O( p0 Y" x# _, S( V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 f/ V( p6 c2 w* w' B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 a* v, {2 q$ A7 D9 [! ]: W
  11. *         TO CHANGE.
    $ D' K" X" ?8 I) g+ p' K# @
  12. *
    8 U: k, h, |1 ~( p% s% d5 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( X0 y5 K: o6 I0 G5 P/ ]
  14. *% i; J" k6 v4 L2 c7 p
  15. * This program is free software; you can redistribute it and/or
      @. @7 y/ s( Y6 }5 f* Z
  16. * modify it under the terms of the GNU General Public License as
    3 G& ^9 ^$ k* C$ X5 a
  17. * published by the Free Software Foundation version 2.
    % b4 B( ?9 Y0 @! B7 y
  18. *) o& d1 o2 _- j" @3 m! o5 w6 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- X* i7 G3 q0 r' u
  20. * kind, whether express or implied; without even the implied warranty. e0 q5 e2 W/ o% X( U2 j0 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) d7 C. w: l7 ]
  22. * GNU General Public License for more details.
    " y$ c+ S7 ]' ]4 h9 i
  23. */
    8 s3 I2 z. h1 V' S; S7 J
  24. & z4 j% D+ ?( w. s5 [6 R! _7 |
  25. #include <linux/module.h>
      l3 m4 h9 q8 j5 U
  26. #include <linux/init.h>
    % Z8 V# c0 V0 y
  27. #include <linux/errno.h>4 w5 U( k* \+ t( ^! s, W1 V
  28. #include <linux/types.h>
    2 E+ G1 E& G2 t, p, q* V& K5 n$ i+ V
  29. #include <linux/interrupt.h>
    $ ~5 @; S9 n* r) i3 K
  30. #include <asm/io.h>
    1 f7 C6 T  O& z$ X9 S- E% w
  31. #include <linux/moduleparam.h>" Z: ?: [4 T. @/ O; d
  32. #include <linux/sysctl.h>
    6 A5 `& k7 ?7 s5 i
  33. #include <linux/mm.h>8 X% m1 O" A+ L5 S$ C
  34. #include <linux/dma-mapping.h>
      k# P6 h& U* y( B
  35. + w. D+ U2 e" Q7 q; g( f2 S' J- ^
  36. #include <mach/memory.h>
    & Y2 ?. L4 i6 _$ W8 d
  37. #include <mach/hardware.h>
    " q! _' |' _) _5 P! V) j
  38. #include <mach/irqs.h>
    / K6 U  Z' J6 @. S4 [( t' {9 W/ E8 @
  39. #include <asm/hardware/edma.h>- x. z0 n7 H. m! d

  40. 9 F5 N1 G* k: a+ R! v
  41. #undef EDMA3_DEBUG
      n- b( D1 @9 \9 b% `; ~, p
  42. /*#define EDMA3_DEBUG*/
    + T, U, n5 L) v/ Y) g# C5 n9 q

  43. 2 ~9 q0 T2 K" {. v- L8 Y
  44. #ifdef EDMA3_DEBUG
    ( R) Y; V7 e" Y0 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' D: d4 W/ k5 o( X1 ^" Z! b  d: K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % |/ B6 d) h( U! g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). o( t# z% S6 s" E# K: x
  48. #else' x4 B+ b- X3 T7 e# B* D7 n
  49. #define DMA_PRINTK( x... )- R( J; y9 a$ {8 {4 V' ]
  50. #define DMA_FN_IN( I- \  b) p7 a+ f7 I# U
  51. #define DMA_FN_OUT
    6 U4 C, V8 u2 J0 d8 R' }
  52. #endif4 V; w( c( L% ]/ I2 F: e, c
  53. 0 A# W8 C3 \  K$ ?4 ~. E" U. z3 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' _/ D) _* ]4 N/ K6 i# A6 A7 {
  55. #define STATIC_SHIFT                37 K( K3 E! W: b" c2 A
  56. #define TCINTEN_SHIFT               20' U, F, t7 P' ?. K9 G! k' E* Y
  57. #define ITCINTEN_SHIFT              21
    ( J( K' |& R1 E
  58. #define TCCHEN_SHIFT                22
    ( |3 c9 _& N6 w0 |: D
  59. #define ITCCHEN_SHIFT               23  W% z) f) P8 u$ ~* m0 u2 c: {

  60. 2 t9 I0 m; Q( b% L& G) }. ~
  61. static volatile int irqraised1 = 0;' U) }! C2 B9 v# Z+ r
  62. static volatile int irqraised2 = 0;
    - X, X# U1 b9 k4 I
  63. $ u9 Z2 c  P8 @# L% g7 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 |+ r( G4 b% N- L  K9 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* h; \- o, `  u8 }& }7 g1 Y4 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , y  ?; E9 s5 U+ T+ j

  67. 5 t7 [, w' }# j2 q# v( D
  68. dma_addr_t dmaphyssrc1 = 0;
    . K) `3 \" K$ }, F" [) @
  69. dma_addr_t dmaphyssrc2 = 0;8 ?. N5 \2 u! S& e
  70. dma_addr_t dmaphysdest1 = 0;
    , @6 g) ~( U9 R, C2 P7 [
  71. dma_addr_t dmaphysdest2 = 0;- c& j+ B+ ~5 x5 i

  72. * [, K& F& o& b; t7 p- P; Z3 |
  73. char *dmabufsrc1 = NULL;# R+ [# U! N/ ^) i. m
  74. char *dmabufsrc2 = NULL;2 R1 i" O0 C$ n! m# J
  75. char *dmabufdest1 = NULL;, j$ ^  N6 ~: m1 f6 ^" ?
  76. char *dmabufdest2 = NULL;
    8 D$ u1 N( X" P- i( O

  77. + s# b' n% [, H
  78. static int acnt = 512;& H2 J. K5 D: ?) g
  79. static int bcnt = 8;
    ' `! K& }  Y* W
  80. static int ccnt = 8;
    9 f* y' V6 s0 C  L! }( @( J

  81. 3 C; P# v! D: F
  82. module_param(acnt, int, S_IRUGO);
    0 C: I( U: P& u9 ~$ V' T8 G9 M) o
  83. module_param(bcnt, int, S_IRUGO);' B! M$ M# r5 F$ G. i9 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ p0 @( e! Z" o3 y# v; t' M6 z) a( L
' @! K1 T/ {7 x* B# k2 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, e9 r& R' U6 x/ A& ]( Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- p- j/ \8 Z9 W  E* F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; q$ v3 @5 ^3 |2 N/ l# J3 s2 L$ X
7 v) |# {/ |8 N2 a" N8 d, v/ W/ V5 _2 P8 Q- E. f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-6 13:45 , Processed in 0.047288 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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