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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   x* E, ]4 v# M1 i3 X7 J
  1. [code]EDMA sample test application
    " w7 C1 H  w' }1 T- a( I
  2. /*( D* O! {& j& i, k$ n$ E3 N
  3. * edma_test.c
      E7 U8 J# G/ i
  4. *. j2 [6 v8 F- o" K; }8 S
  5. * brief  EDMA3 Test Application$ W5 m' `% D1 k! ]1 l5 U/ L+ T9 T
  6. *
    $ I" ~2 y; h" m5 e, @+ w+ d
  7. *   This file contains EDMA3 Test code.
    6 y$ s: G. }3 B$ t# p
  8. *7 R/ F8 Y; g( U7 ^/ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " s! X1 E! {& C9 f# J6 x2 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) {! w2 `$ {2 M( ?
  11. *         TO CHANGE.9 f' {4 I$ V- w3 P6 F
  12. *
    6 x2 X0 J/ C* r1 A4 p3 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" x9 W2 R5 K0 s$ O+ b
  14. *
    6 }2 T5 I' `) Z* w0 s" C3 ^
  15. * This program is free software; you can redistribute it and/or
    3 z. w  ]/ X: g. k0 y( W
  16. * modify it under the terms of the GNU General Public License as
    ( H" U' k0 K9 Y) q
  17. * published by the Free Software Foundation version 2.- j6 K" h/ X  t4 D
  18. *
    ' v+ j% B0 r. E. i; h& o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 s7 i/ K! m! A1 }: T
  20. * kind, whether express or implied; without even the implied warranty' d( c3 S; S% P/ `/ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 |" ?! k' o  q" w6 x
  22. * GNU General Public License for more details.( X3 n) e, _7 e1 C! a: b0 D/ E$ O, [
  23. */
    - ?8 q% [; m( l" v% b  _& l

  24. ) j- Y. d" a( F  {/ y3 r- D
  25. #include <linux/module.h>& T9 `+ g3 J  y" i4 U" D
  26. #include <linux/init.h>1 h5 T! E: w8 y
  27. #include <linux/errno.h>
    2 ^$ U: h3 G. d# W2 V6 v- p: H1 f( g
  28. #include <linux/types.h>
      `  h; X- B& p+ [6 w
  29. #include <linux/interrupt.h>* ^  N# r+ p* l' |) S9 j; x
  30. #include <asm/io.h>
    3 `" B/ ^5 Y0 H
  31. #include <linux/moduleparam.h>( Q* j5 {# X( `; y/ j& Z. z
  32. #include <linux/sysctl.h>* d' P. M9 K$ t: i0 _* k
  33. #include <linux/mm.h>" y4 q( r8 m. g
  34. #include <linux/dma-mapping.h>0 c  P9 L/ ?3 Y8 k  H0 I

  35. ; c" `9 f5 m2 t+ K- d, ?
  36. #include <mach/memory.h>( W" d: u3 q! I
  37. #include <mach/hardware.h>
    7 y. T4 i* C3 _. I. x. p1 m# L7 K
  38. #include <mach/irqs.h>
    / _# s& Z9 q+ i2 P1 U. t9 C6 N
  39. #include <asm/hardware/edma.h>) C* F3 c1 N6 {$ q7 G
  40. , f# U6 D1 y& t1 w3 i$ {. Q
  41. #undef EDMA3_DEBUG
    $ M( T5 X# p/ C, L/ Y( o% S
  42. /*#define EDMA3_DEBUG*/7 o. X$ }" i. e( L1 h$ ~" B, L- S% d9 g
  43. & y# y" E+ b+ p/ _6 T5 D7 L$ h" Q
  44. #ifdef EDMA3_DEBUG
    : u5 X5 b$ T3 i, s, ]% d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) r  G! S+ y. `# @# r( z* ]( c; o& M. g7 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 B! R5 k. k7 @5 u9 S/ A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 t! F  I( C8 P7 I: {" s
  48. #else
    ) E. i/ W5 b& ^* W# J
  49. #define DMA_PRINTK( x... )" F- F2 x, }% U0 Q9 d% Q+ v
  50. #define DMA_FN_IN7 y7 E% m8 k' W. P/ J/ k
  51. #define DMA_FN_OUT
    5 v; ^1 v7 q2 t/ l6 M6 Y
  52. #endif+ j3 y1 l7 w+ E( u1 I& M

  53. ' U& `' m" l; ~3 k3 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 x3 |# o( f) G
  55. #define STATIC_SHIFT                3
    * t) V4 @; m0 B- I' V! K
  56. #define TCINTEN_SHIFT               20
    3 l$ l* p, }) l
  57. #define ITCINTEN_SHIFT              214 Y( W, ?( p4 }" P& q
  58. #define TCCHEN_SHIFT                22
    $ X3 \0 k8 S" v$ t" ]) w
  59. #define ITCCHEN_SHIFT               23
    2 R1 _* F! K. a3 Y

  60. 5 C2 A% E4 u$ i; ]2 E: O
  61. static volatile int irqraised1 = 0;, H1 r& z) B& |( R3 @: g6 b. P+ d7 B
  62. static volatile int irqraised2 = 0;; r) ?+ ?7 c/ N4 `: }9 ]( \! C

  63. # A& D0 \! F5 c4 z4 M4 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 c, w( I; Q2 B2 b+ [- ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 r6 T, k' Y! W' n2 W9 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; E- F2 u% y8 p$ E: |

  67. + _- H% Q+ F9 |# G+ h% H
  68. dma_addr_t dmaphyssrc1 = 0;
    3 o' @( Q2 Y( `' k5 q  H
  69. dma_addr_t dmaphyssrc2 = 0;
    $ I9 i4 n( q& D4 [% {
  70. dma_addr_t dmaphysdest1 = 0;( U: x' ?/ b! b- W2 [$ s. i
  71. dma_addr_t dmaphysdest2 = 0;, S6 o# o6 M4 q3 `

  72. $ U5 M- p  ~9 c' a2 {5 |# L
  73. char *dmabufsrc1 = NULL;
    4 Z6 Y5 q) a& ^
  74. char *dmabufsrc2 = NULL;
    ! @+ {$ g; D$ C3 \- K1 }1 r
  75. char *dmabufdest1 = NULL;
    ( s% p  J' |, G" v$ n: z, I3 [- ?
  76. char *dmabufdest2 = NULL;
    ! o! }  O4 [& R3 J  f% ]9 D# `

  77. " K- w; B+ Y. w) C* C1 n+ `6 @, h
  78. static int acnt = 512;
    ) }  u* c8 }( q3 C+ m: X
  79. static int bcnt = 8;
    ! w% t/ H7 Z* ?) U, k
  80. static int ccnt = 8;* @4 f, l# n' X( _$ q" v8 l
  81. . }6 w6 l5 o: p2 x9 U
  82. module_param(acnt, int, S_IRUGO);8 L7 F/ ^% t5 _8 B/ z
  83. module_param(bcnt, int, S_IRUGO);0 o. u( z" Q: h& _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& U+ ]  `- |3 Z2 \+ g9 z7 [8 O5 C2 J" R9 w' B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 s' T! B" g9 S, M" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( b6 K; S! ~; d0 ?' T5 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, _/ \) V7 E* ?$ ], u9 ^
8 ~4 N! B5 f  _* F  M
( P% ]$ R" b) C2 W6 I- J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 11:14 , Processed in 0.043355 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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