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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 S6 g* K) A. G( o
  1. [code]EDMA sample test application7 k, l+ ^6 @0 o$ ~# R+ m
  2. /*2 Q. n8 d- P  I4 [" }/ S
  3. * edma_test.c( K3 q7 W/ D2 E# H% [  S6 \1 s/ e% O
  4. *( m, s4 A+ p' c6 w# ^
  5. * brief  EDMA3 Test Application
    9 p/ c9 q; J- @. _& a
  6. *
    ' Z) s, E1 K) J: x# w
  7. *   This file contains EDMA3 Test code.' b$ ^4 \( b  u% f6 k  e
  8. *
    5 g  [' m, k. _$ N8 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) I5 d: x5 l; ?  B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! S; i" e  t' k5 K+ f6 @: v
  11. *         TO CHANGE.
    # S3 W" U7 B( j- c9 `# [
  12. *, ?$ J; l9 C' N) D" D0 k: f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 H& _7 e- I! c  d* X4 P
  14. *( r, k; p$ _, n
  15. * This program is free software; you can redistribute it and/or
    ; K8 m- M3 H% z: a* j' ]
  16. * modify it under the terms of the GNU General Public License as
    0 t; d; _& e' H" K7 A2 c: o. U
  17. * published by the Free Software Foundation version 2.9 O! E0 r. X% p' \8 x9 ^/ R+ }
  18. *
    ; m/ q/ ]* J, \7 }1 K! H; U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 `1 |  R5 e+ q3 o1 W$ T* O3 @
  20. * kind, whether express or implied; without even the implied warranty4 B4 m, u" `2 x% P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 J+ X0 X. R1 E2 n6 U
  22. * GNU General Public License for more details./ U9 u; D# Q1 s/ |
  23. */
    , S4 P5 j( q5 E+ x4 q

  24. 6 {+ q5 L4 y. U) @( s8 W
  25. #include <linux/module.h>+ g$ y$ `$ ^# {4 e3 \1 k. A1 _
  26. #include <linux/init.h>1 n& N5 C7 E, k1 J: S, S
  27. #include <linux/errno.h>
    , A# P( v2 V; d& F, p0 L6 h
  28. #include <linux/types.h>0 A1 L% m, j( ~0 s; i. I- N
  29. #include <linux/interrupt.h>
    ! C, K* m4 c, f8 e. A
  30. #include <asm/io.h>+ \7 K! s& {% j$ \6 U% G+ S" i# B# K
  31. #include <linux/moduleparam.h>! R2 |' ], ^4 ?: }" U- o, g
  32. #include <linux/sysctl.h>
    7 ^8 `& ^* P0 R0 Q) \7 p. y
  33. #include <linux/mm.h>
    ' e, k' {; r3 ]# e, R! g
  34. #include <linux/dma-mapping.h>6 M& v2 u6 d: j' Y  K" G

  35. / H$ W% i/ [, d  n6 E& L
  36. #include <mach/memory.h>+ F- W! C. E6 ?6 s3 I, p) \  Y
  37. #include <mach/hardware.h>/ S# t  V. j" Y  Z- D' o- Q
  38. #include <mach/irqs.h>
    9 ^1 F( e) E( B' {$ T
  39. #include <asm/hardware/edma.h>
    1 y  p- _7 C' e, P) j
  40. 5 o/ E9 O+ A9 p" t1 j
  41. #undef EDMA3_DEBUG
    ' V8 K; R# F$ [! D) P4 Q  q
  42. /*#define EDMA3_DEBUG*/+ J: M' I5 K! G+ c  P$ N% ^' F

  43. / {+ e1 }% e8 D( r
  44. #ifdef EDMA3_DEBUG. B) [9 Y, K9 |! w/ K% J9 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ^" }! c% M" p$ l, Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 o) i  |6 @! j1 ?; Z# }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), |8 y6 y8 h! m+ x9 k7 z& H' J
  48. #else* p' B. J! k" N; i5 {
  49. #define DMA_PRINTK( x... )
    8 c. N# @4 T5 I
  50. #define DMA_FN_IN
    + `9 T* Q$ y9 P
  51. #define DMA_FN_OUT/ X/ |* {3 f" D& s# s+ |- C" i
  52. #endif- w: L( B; w6 k5 Y+ q0 a

  53. + |( [2 G& c. W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): Y8 N7 T. e+ x/ L. S
  55. #define STATIC_SHIFT                3
    + `) K# r' u  E# H% J5 a( F% Q
  56. #define TCINTEN_SHIFT               20" @, s6 j+ @2 S/ X4 C0 q
  57. #define ITCINTEN_SHIFT              21
    / {. ^% A9 ]# I- i
  58. #define TCCHEN_SHIFT                22
    0 l  O8 W+ U- H6 W$ t  a: c- q
  59. #define ITCCHEN_SHIFT               23
    ' ^# _8 |$ i6 j4 `- Q) A9 _

  60. 3 r8 ?  h- P5 J0 M; \2 @) O, D$ q
  61. static volatile int irqraised1 = 0;$ m% _* w7 U  y. Q4 W
  62. static volatile int irqraised2 = 0;* t$ ~& q- p" p4 G$ n$ X7 f

  63. $ d  c1 _/ k7 ~8 w" N. c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q+ A: e, s# O# j3 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R9 s  y7 e. P1 E( C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . `1 S* ]6 |. c8 y3 Q1 W! C/ u
  67. $ G4 u5 a; _+ T
  68. dma_addr_t dmaphyssrc1 = 0;& ~2 }' w+ Y  N6 H  q0 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    5 z- L1 \0 a: G5 N0 M
  70. dma_addr_t dmaphysdest1 = 0;# _7 _( f- J) I, A4 l2 [
  71. dma_addr_t dmaphysdest2 = 0;: ?; d; z7 ?( {7 |9 w6 n. `  A

  72. + |. M0 J" F% p8 Y' L3 J" C# t
  73. char *dmabufsrc1 = NULL;1 \# N  i7 W' l5 T% P
  74. char *dmabufsrc2 = NULL;
    ; e( E* X1 g% [# V3 f
  75. char *dmabufdest1 = NULL;
    - S7 |. Z. L5 [' B6 l7 @/ ^* b- L
  76. char *dmabufdest2 = NULL;
    ' @# _. ]7 r$ w# C0 E# p+ p

  77. 5 a+ s' x5 \" P9 E# S7 q  e
  78. static int acnt = 512;% z0 P$ v  H0 A$ J7 w1 r
  79. static int bcnt = 8;
    ' i5 I! p9 ?& j8 ?
  80. static int ccnt = 8;
    8 h- m1 u) d" c" F7 U3 Z) T3 G7 f- _
  81. ' N+ _4 e4 Z. v1 ]; c& b9 v
  82. module_param(acnt, int, S_IRUGO);& Z" m2 l4 ?6 W; @0 ^( T+ w1 m# u
  83. module_param(bcnt, int, S_IRUGO);& N/ W# K" b4 D; h$ i& r+ O+ ]8 Q% g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; S, a1 K* ~' ~& p+ `1 ]3 E) @4 g9 V1 ^7 B7 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D, \' }7 _" P5 g/ j9 P2 ^; C6 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, N5 w7 y6 O# w% ~5 S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 F. {: N: ^3 y( h# R3 \

8 T1 J. M* s9 h" u9 Q5 A0 k9 T  _1 `+ M8 ^9 |1 D2 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 15:23 , Processed in 0.038486 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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