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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" O# _& d  k& y' i$ u2 J8 n
  1. [code]EDMA sample test application
    1 D6 Q1 N# G0 v8 O
  2. /*1 y! H: c; {. p2 d! u5 j
  3. * edma_test.c; a; W  o7 y) L! M9 X. l
  4. *
    6 W0 D, z  u8 x7 p
  5. * brief  EDMA3 Test Application
    % [" `2 ~; n2 i) T! ?, Y' u+ r
  6. */ R, d& E& g! A
  7. *   This file contains EDMA3 Test code.' U  b* B* l3 e) j8 s7 Y7 g
  8. *# a; z# Z: Z: }$ Q* t" Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % A6 b* j4 [3 Q: w+ t9 N6 `3 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 s. z3 H" h4 `2 X) M: ]
  11. *         TO CHANGE.
    : g( A! a7 q8 B$ o$ }) `
  12. *' [) r8 I4 s- w$ `0 K6 e- T8 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" T0 O" M- h# R; Q# U+ P* l
  14. *
    : a5 V. @! u' }
  15. * This program is free software; you can redistribute it and/or
    0 B- v9 H# E7 h" A! ?8 V& G' D
  16. * modify it under the terms of the GNU General Public License as
    % E* @* D' c9 C. [
  17. * published by the Free Software Foundation version 2.
    + {4 b4 J2 ~2 Q9 X8 Z
  18. *
    + a. A1 y) r' l& k, t# f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # F5 O5 m# q8 i3 S8 E& F6 @
  20. * kind, whether express or implied; without even the implied warranty" a6 h$ a5 C# f4 u0 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 B. c# `& X/ A8 }5 D0 H! i
  22. * GNU General Public License for more details.7 P. @3 u% r/ e$ m  y
  23. */
    6 M! \+ K5 ~, E% {) ?5 t5 N8 Q5 ?

  24. 9 J% p! t( g6 J8 h5 V
  25. #include <linux/module.h># n( k& I( ?/ Y  o
  26. #include <linux/init.h>
    4 [: _! e0 G! B1 U& O; p+ Y
  27. #include <linux/errno.h>
    0 K5 D( n0 a% c3 d3 x/ k
  28. #include <linux/types.h>! `7 v& O1 p* f8 n0 K6 U
  29. #include <linux/interrupt.h>& w+ D9 ~3 g* X) C! f9 Z
  30. #include <asm/io.h>
    / R9 c2 v# L" H2 A
  31. #include <linux/moduleparam.h>
    " Z; d/ s# p) G  ^2 D
  32. #include <linux/sysctl.h>9 q" {, q+ a" z( j2 u+ U& g/ R
  33. #include <linux/mm.h>& ^) q$ M! D! d4 [) ~* s
  34. #include <linux/dma-mapping.h>
    9 H1 u0 c* u4 U& @
  35. ; N. ^6 ^5 n7 t0 I
  36. #include <mach/memory.h>( C; u1 i9 e9 x0 r4 I
  37. #include <mach/hardware.h>3 @8 a$ r6 I2 L* n: c
  38. #include <mach/irqs.h>
    $ n$ A$ o( S  i  H# J" o( i$ }
  39. #include <asm/hardware/edma.h>! y  j; N7 Y6 F
  40. : e% C$ o! K! I) q
  41. #undef EDMA3_DEBUG1 B. u# [# T* i$ _. e- F
  42. /*#define EDMA3_DEBUG*/
    / l4 U* I2 M* [6 V

  43. 6 R! T# U- ?; f+ ~+ D; g
  44. #ifdef EDMA3_DEBUG9 o- Z# O+ \& z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 g% S( n1 {4 m5 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* P- a, i9 Y+ `4 z/ x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ ]5 p) Z- C. K# J3 j
  48. #else7 V, D7 \/ X$ e" O# |* r, ~5 q1 h
  49. #define DMA_PRINTK( x... )+ e+ Q4 F4 O  _; Q2 |9 ]
  50. #define DMA_FN_IN
    6 w; ^3 k' t+ [  {1 L! O& q
  51. #define DMA_FN_OUT; Z0 c6 A- v& x  t  }
  52. #endif' N( o  S: U5 ^8 l# X9 ]! |% g
  53. ( k! F* V1 U5 J$ `4 ~+ g, a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" z6 ~  W' c2 i1 q: Y, Y
  55. #define STATIC_SHIFT                31 y* ~2 E1 x3 W* t
  56. #define TCINTEN_SHIFT               20' x0 [$ G) D/ F% V! j
  57. #define ITCINTEN_SHIFT              21
    # g5 |# X! t% q4 }
  58. #define TCCHEN_SHIFT                220 U5 K  T8 e, |- }2 `9 e9 f/ N9 u
  59. #define ITCCHEN_SHIFT               23" F7 o, l) \0 S" C+ q5 t8 \
  60. 1 Q5 ?! {! a8 [; @1 |( v6 R
  61. static volatile int irqraised1 = 0;
    8 }+ S7 |% F' U, `9 q+ L8 r( t
  62. static volatile int irqraised2 = 0;
    + g" E1 @3 n' A8 C5 K# E  A

  63. 1 M, q: b  i% K, n& i$ V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]% u. U0 _2 T4 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i+ U; o0 E: y2 ]6 f, k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' i$ s( |; Y1 l% {- V) t
  67. 1 C3 g* ~8 |4 B1 W! [8 ]% M
  68. dma_addr_t dmaphyssrc1 = 0;
    5 H+ H5 `4 L  P4 ?' i) S, r
  69. dma_addr_t dmaphyssrc2 = 0;% T7 ~3 b9 t( u6 C6 I0 ~( A
  70. dma_addr_t dmaphysdest1 = 0;
    7 ?, y0 e. p  ]3 m# L
  71. dma_addr_t dmaphysdest2 = 0;/ k- x- ]6 J! e% z9 G5 j

  72. 1 s( ]- w2 |; C) h4 C! k# f
  73. char *dmabufsrc1 = NULL;8 W9 ]; O0 @  k, k0 E! ^
  74. char *dmabufsrc2 = NULL;& y3 n' w5 \+ Z2 o) w, A' u8 f
  75. char *dmabufdest1 = NULL;
    6 y3 w9 M) m4 C5 b2 A
  76. char *dmabufdest2 = NULL;7 y6 L3 y! W9 L0 O5 z$ k4 W+ }

  77. ; F3 \# R/ ^. |& `: m2 M1 p
  78. static int acnt = 512;8 W6 N) g+ q3 Q' d
  79. static int bcnt = 8;
    , \9 x3 K( o9 Y9 e9 a+ y- J
  80. static int ccnt = 8;
    # V6 D) N6 V* `
  81. 7 v7 n# x# y% l+ [! f; T$ y
  82. module_param(acnt, int, S_IRUGO);: p+ P% m* n. I
  83. module_param(bcnt, int, S_IRUGO);3 W9 p% L1 g4 \1 l- p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 z, @# b) K9 E. B+ `* s- V" I- w$ v  H( r/ O& x( d5 j/ g8 Y( d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: V2 w& \& f, ]* R* Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ w; }/ B7 K, h5 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 a/ n1 k# D7 ]' Y7 S
" S/ v# b! r( r6 B9 {; A0 u: T4 H/ _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 03:06 , Processed in 0.046353 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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