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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& a- G5 p2 _( y( E% N/ F
  1. [code]EDMA sample test application' a% j4 W! W/ p: P0 }( D+ `/ K5 V
  2. /*
    0 b, w9 h& r# @* i# j& e
  3. * edma_test.c# Z! Z' W! Y$ d/ A2 ?2 j1 l
  4. *
    " l' b/ ~5 P! m0 L% H
  5. * brief  EDMA3 Test Application
    , Y1 K( ?2 T/ o; C
  6. *$ y" ^: k/ N) I0 @
  7. *   This file contains EDMA3 Test code.! K3 Q, K: M* r, X* a* W/ [) {
  8. *
    * W8 i' Q# @& G5 V/ q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, h# M. u9 p* _( {6 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 a: W2 R- F7 Q/ d6 X3 I
  11. *         TO CHANGE.9 S' k0 {; H' z- {" P3 `0 G
  12. *& G# Y2 x: H/ f# q, O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n4 W4 l: w: [: Q/ k
  14. *
    % [& U; r- ^6 n+ S' x8 J" w3 I1 o( `
  15. * This program is free software; you can redistribute it and/or
    ' ~  }9 m! H* V, m
  16. * modify it under the terms of the GNU General Public License as
    0 V' h, p  u& @3 C7 h
  17. * published by the Free Software Foundation version 2.9 A% p7 Y  X/ J# z) e8 f
  18. *) }% v0 i# U+ h* r( ~; e1 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , `7 F7 Y, ^& F+ n) x) g
  20. * kind, whether express or implied; without even the implied warranty, ~, ^9 M' f' x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ ?5 I" `( X! v+ B- m
  22. * GNU General Public License for more details.
    1 b: Z5 t  C6 Y" q) _, @. A
  23. */( Z& Z: S1 V, i- G

  24. & Z. d7 N4 N* Z8 P: T
  25. #include <linux/module.h>* W  A: u5 `/ w2 T7 Z2 ~
  26. #include <linux/init.h>9 I0 u' c6 r) |; o
  27. #include <linux/errno.h>3 O$ F+ V' L( ^4 _: j
  28. #include <linux/types.h>0 ^" Y3 U6 E6 e* w
  29. #include <linux/interrupt.h>
    ! k" ^8 a3 f* E* L
  30. #include <asm/io.h>
    # K, V  |/ O4 j9 f+ I5 c, p
  31. #include <linux/moduleparam.h>
    : S8 ~9 L1 E8 f
  32. #include <linux/sysctl.h>
    8 j7 M% h: m; Z3 Z' E6 G) _
  33. #include <linux/mm.h>
    3 J( S3 `# x3 }: M
  34. #include <linux/dma-mapping.h>
      B" c' x  K# j. h( j2 C
  35. / y' V% M- _  i9 U, b
  36. #include <mach/memory.h>" j- f7 T0 K# \* j
  37. #include <mach/hardware.h>; O& A! M9 P! |7 v
  38. #include <mach/irqs.h>
    1 u8 e9 t9 y6 V* `2 U8 H: i
  39. #include <asm/hardware/edma.h>* [1 X' d+ c7 ?) s, y

  40. 0 |- e. y+ o0 v2 c# e! v- \* Y3 _
  41. #undef EDMA3_DEBUG6 L* H  i7 f0 V4 n
  42. /*#define EDMA3_DEBUG*/( R  W4 ?9 V7 [0 s/ \7 s& x% a
  43. 6 ]6 `" H( W) L8 e5 A
  44. #ifdef EDMA3_DEBUG; Z6 E5 U, E  c3 x! z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 G* T) |/ C- O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- x/ [" U' J) o1 w+ w0 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 @) U& ?. `7 k) @; U4 s
  48. #else8 x4 S; v9 l! G, [/ K
  49. #define DMA_PRINTK( x... )
      W6 F# L: N' u  P( d
  50. #define DMA_FN_IN3 K* N% K/ n* E4 Z2 m
  51. #define DMA_FN_OUT3 G& `' W9 c/ v9 u: o
  52. #endif8 a. \; ~; q$ u/ `

  53. % e* k: e( Y% n' z4 x4 R8 _  Z; t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ W9 y+ G2 F, K& ?% @/ @
  55. #define STATIC_SHIFT                3
    6 B  d0 s: }) ~! I
  56. #define TCINTEN_SHIFT               20
    7 f4 b  l# v1 e9 P9 [3 v
  57. #define ITCINTEN_SHIFT              21
    4 n  }8 x& a' f# p, x1 ]7 v$ H" p) \
  58. #define TCCHEN_SHIFT                22, e4 [9 _7 c+ G& V6 n6 I2 [
  59. #define ITCCHEN_SHIFT               23
    & ?: f4 |5 s/ v) l
  60. ' ?3 d/ L! y" P! M
  61. static volatile int irqraised1 = 0;# A4 l, r5 \& A5 p
  62. static volatile int irqraised2 = 0;
    . l3 @, Z) t6 Q9 q( S6 c

  63. ' q3 P) G. h# U/ e- H4 a2 z' c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ?" M8 S# a0 p5 s; ~/ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ {3 ]- X8 {; Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 p8 V6 c% F2 @! y( d

  67. ( X6 v0 ~6 j# U9 `8 T) B
  68. dma_addr_t dmaphyssrc1 = 0;  |  _4 j' W# l8 Z% w
  69. dma_addr_t dmaphyssrc2 = 0;0 j: S* W! b$ l: l# h4 U
  70. dma_addr_t dmaphysdest1 = 0;
    2 v3 a# l, R% Y; j. W* v
  71. dma_addr_t dmaphysdest2 = 0;) s- R2 e8 S- s; K; w2 W2 n$ ?
  72. 1 e+ r5 `9 u" c( I
  73. char *dmabufsrc1 = NULL;
    : `# K) z5 L- o+ ~
  74. char *dmabufsrc2 = NULL;
    % u7 w( S6 ?  \+ e
  75. char *dmabufdest1 = NULL;1 Y* Q8 I  @, Y$ }
  76. char *dmabufdest2 = NULL;& l* _" y: _" ^$ k. s" q

  77. " P0 O/ Q- b3 s6 L
  78. static int acnt = 512;
    : [$ ]3 J6 s$ Q4 e+ }0 {. R
  79. static int bcnt = 8;6 s5 h) H8 B' Y( [0 p- k/ D$ R" g
  80. static int ccnt = 8;
    / ]5 l/ F# Y1 F  r  k
  81. ; h+ o. f7 E* D! A9 R7 {0 Q6 D2 Y
  82. module_param(acnt, int, S_IRUGO);" [3 V( T1 i1 K! t
  83. module_param(bcnt, int, S_IRUGO);# @( M" l5 h9 K5 ?: W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& o) a; E4 F: n

1 X  d( Q7 Q- R0 [) v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  q/ K- M+ C' D$ F, i- _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; H) }, v% ~9 X; x5 H  n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% A* `. {4 n- t% v  q( \) c, s  o. F# Z) d# I! ]

; K3 Q+ p) ?2 ~& U1 K+ P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-10 19:42 , Processed in 0.051411 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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