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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^; u- a' A6 B  B' l
  1. [code]EDMA sample test application3 @. k3 f9 Y4 B: m* n
  2. /*
      R& i! [, J2 Z' C
  3. * edma_test.c
    1 b$ d. M% J$ |) _
  4. *
    ! ^. D& g, J/ Z7 d
  5. * brief  EDMA3 Test Application
    ' L8 q3 M  y# h+ D) h4 d6 h& U) `
  6. */ U7 r: K! `3 X2 b2 R
  7. *   This file contains EDMA3 Test code., \$ }% j* ]6 A; n  U$ H
  8. *
    ! }0 ?: f/ @0 u* @' D: B0 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& _# _1 ^$ w5 u# ^/ E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . h' S2 O8 L0 Z: V* |
  11. *         TO CHANGE.
    / Q  H) Y% v2 i. l; D
  12. *0 [- z4 H. H1 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' l. S9 v  G8 w* S: e# C% `. {
  14. *3 w$ [5 T" f  V
  15. * This program is free software; you can redistribute it and/or
    ( ^2 F9 m3 l; d) L) ?
  16. * modify it under the terms of the GNU General Public License as9 `' G) Z; h- G) b
  17. * published by the Free Software Foundation version 2.+ T/ r* Q& J6 J$ N4 h
  18. *! t. k* v8 A' m+ I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 }* v) Z& b8 W8 W, z# r
  20. * kind, whether express or implied; without even the implied warranty7 k; @8 u+ V0 m$ p. p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 z: d$ ], n0 A& B  l3 E
  22. * GNU General Public License for more details.
    ; u1 }& N2 F, s8 W
  23. */- ~5 }. _5 C; r

  24. + O# h' J6 L1 d4 B  T
  25. #include <linux/module.h>2 _3 u$ b  H. X- U0 J+ M' |
  26. #include <linux/init.h>+ s& B. j( Q& l1 ^1 r
  27. #include <linux/errno.h>( R6 d* c: {- T! t
  28. #include <linux/types.h>
    ; Z5 p, n/ C/ j
  29. #include <linux/interrupt.h>8 p5 d& I$ |- h" {& l4 b1 {0 S
  30. #include <asm/io.h>
    % c! L+ a6 h( g
  31. #include <linux/moduleparam.h>0 `) |& K% H* s. l
  32. #include <linux/sysctl.h>* @+ M$ v7 Z/ m4 z, ?
  33. #include <linux/mm.h>* j" K* e9 M3 d1 G- n
  34. #include <linux/dma-mapping.h>6 T# d9 s0 V& @3 ?. F3 L; Z
  35. , K" l$ m  y: X
  36. #include <mach/memory.h>7 x0 a$ F+ }6 c6 }9 L' G
  37. #include <mach/hardware.h>2 e+ X4 b7 ^3 n. K6 i4 v
  38. #include <mach/irqs.h>
    + k" Q9 m3 S: V
  39. #include <asm/hardware/edma.h>; f% i+ Y2 G" p+ `3 ~1 @$ }, @4 O  i
  40. , Y4 S3 A9 \1 k3 |. M( W4 R
  41. #undef EDMA3_DEBUG
    - M& w; k3 {2 r( E3 V. [( y
  42. /*#define EDMA3_DEBUG*/# @( I2 C- Y& E8 @
  43. # }$ q& O* R4 P- m- P& D
  44. #ifdef EDMA3_DEBUG
    ' I. a% l. e0 H8 l9 q& }) S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). c) C# _% {4 y3 ]- K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! N3 {* C1 q& B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 z% m+ l$ J! e2 m  J9 e; |. l* k
  48. #else
    . x6 a2 K3 Z% S
  49. #define DMA_PRINTK( x... )
    5 C: a  O# \7 P+ z* ^/ h
  50. #define DMA_FN_IN, m( K. q. r: T5 i: n* O( u: a
  51. #define DMA_FN_OUT
    5 @4 [* }$ Q! c( p* l  @( V7 X
  52. #endif, o" i3 y- e, o0 M- U
  53. 7 }, k/ x3 j& h3 h, Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' ]( N4 i) p: j  [. {- o
  55. #define STATIC_SHIFT                3
    ' Z) l+ e  ^% q5 F
  56. #define TCINTEN_SHIFT               20
    ' H! S9 j# [# i9 o! s; O
  57. #define ITCINTEN_SHIFT              21
    4 w$ q3 p, s, c) y
  58. #define TCCHEN_SHIFT                22# [9 [# H! _* Q4 c2 ^- K" W
  59. #define ITCCHEN_SHIFT               23+ K% `# t' d% e/ }/ N
  60. 4 L) H. @' U7 R* z+ v" m( i) @
  61. static volatile int irqraised1 = 0;3 J/ k4 B8 u2 U% b$ Z* X
  62. static volatile int irqraised2 = 0;3 M& G. m# p7 h3 C! _- y
  63. * S  h9 E5 w; i' D5 g% ~2 X" N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Z4 g0 ~1 ]  L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l9 Y  Y0 Y- `7 U4 f$ w) b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Z- N0 p* Z0 ~8 J4 U! l0 f
  67. $ m' x; X; w" \  V
  68. dma_addr_t dmaphyssrc1 = 0;
    # y# E3 z* H3 B# B2 E+ X' }
  69. dma_addr_t dmaphyssrc2 = 0;( _  M0 ]1 ?) o
  70. dma_addr_t dmaphysdest1 = 0;" ^9 y1 X3 p- Y' U+ l: U
  71. dma_addr_t dmaphysdest2 = 0;7 z8 x4 e- Z- Q; n* K& l2 \( S+ @
  72. / S9 w# }7 b6 j# {
  73. char *dmabufsrc1 = NULL;$ K( b, k! u' B2 d3 x3 E1 O: S
  74. char *dmabufsrc2 = NULL;
    + n$ r. }" M3 S7 m+ T
  75. char *dmabufdest1 = NULL;  y& W+ _, U8 t' z( ~$ M2 [8 u* k
  76. char *dmabufdest2 = NULL;. M# |2 P; ~+ \  D: `

  77. 7 y3 N1 b  Q$ T
  78. static int acnt = 512;4 B$ q7 t' j: o- Q' u6 n0 e
  79. static int bcnt = 8;
    $ o3 J0 f6 ?3 l$ s  b+ X% Q
  80. static int ccnt = 8;
      ?1 W/ w( @/ F  q/ k) C' ?

  81. 5 G1 P1 w/ f1 ]/ @6 q+ ?. e, ?5 \
  82. module_param(acnt, int, S_IRUGO);
    ) U; W* x1 d$ B" `
  83. module_param(bcnt, int, S_IRUGO);
    ) ?* Q  l# h) Q1 A8 R" ~# z9 o- ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 M; i8 |( j" `$ a& g7 N
2 Y+ B( z; ?8 t# y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ Q. G" ^2 G; I3 T* Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ i7 ]8 _0 X3 q# r+ ~3 t: w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O8 Q( w. j' t& X% m
/ b  A6 }1 @& J% L; B- I! o, Y- u
* {- E$ {& T; p2 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-7 03:31 , Processed in 0.041174 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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