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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d. ^- g( {( _0 h
  1. [code]EDMA sample test application2 l: e- _7 J# Z8 S6 G4 D+ c# U* e2 b
  2. /*
    . R$ N9 J7 H  Y, w( ^4 d
  3. * edma_test.c
    & m* v5 k3 G, }* {. e4 v' x- y# a$ @
  4. */ y4 P1 i+ A% H
  5. * brief  EDMA3 Test Application
    5 {& I/ ~+ b. {! Q, p9 L2 R
  6. *
    3 ]2 f8 R; c# ]
  7. *   This file contains EDMA3 Test code.. ~6 U7 q" L5 p; ^* s6 E
  8. *1 D4 X/ M# F: S4 [( R) H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 g( L+ N) s4 m5 @9 h% P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 J, L% R5 ]+ Z
  11. *         TO CHANGE.5 O4 F9 p( H" ?* F
  12. *1 z- b5 K3 `1 {( _/ O) b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 j3 Y; x5 R5 t0 x  j2 p
  14. *" H, L/ r* y* |
  15. * This program is free software; you can redistribute it and/or& @$ C, q6 a- z; @# D, z6 r5 a
  16. * modify it under the terms of the GNU General Public License as
    ) g! s$ v2 r1 \5 M4 c+ {
  17. * published by the Free Software Foundation version 2.! {; k9 u# d, G- h9 b$ F
  18. *$ H; j% C8 G+ X5 q" C" t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 l. r, ?( y2 |) H+ o% n) p
  20. * kind, whether express or implied; without even the implied warranty. ~' W: @2 ^7 n2 v7 [) o6 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ~4 x' K/ b* t1 p5 l
  22. * GNU General Public License for more details.
    7 ^  X6 b+ ^1 r2 l# E
  23. */3 ?' j9 m! D3 P
  24. . ~6 l7 U6 H) p7 `& Q# t4 k! }
  25. #include <linux/module.h>
    / V9 \7 M3 c) F4 K! K8 i4 u2 |
  26. #include <linux/init.h>: @; h1 J7 m# U6 F6 G' ~! e5 y
  27. #include <linux/errno.h>
    3 Y' m  Y/ V3 _7 J6 K. v) k3 @
  28. #include <linux/types.h>" B  \& Z; o1 B" L3 ?& Q* m: a
  29. #include <linux/interrupt.h>
    7 |4 V" |- ~, ]- L: b& M: _) T
  30. #include <asm/io.h>1 r# o) Y/ u4 A' ^" N
  31. #include <linux/moduleparam.h>
    : C  x7 C& Y; x" c; P, }) E
  32. #include <linux/sysctl.h>! H8 d- y  }  R& f
  33. #include <linux/mm.h>
    3 X: l2 H# C1 H0 Q
  34. #include <linux/dma-mapping.h>
    ! j0 E* F5 r! R) D3 J) e$ T/ n
  35. ' |# n+ E8 M2 S- P
  36. #include <mach/memory.h>) H; R5 |0 q7 z! j( r
  37. #include <mach/hardware.h>- g* G0 g1 U- y0 B7 I; f: f
  38. #include <mach/irqs.h>
    ! t$ o1 @; n- D) X* z
  39. #include <asm/hardware/edma.h>
    ( ?' F7 f0 _8 B( V9 M2 c0 _

  40. / x( Z- j# c. x) P# U
  41. #undef EDMA3_DEBUG$ |" @5 ^4 ?- h( b  Y8 W$ Y8 ~& x
  42. /*#define EDMA3_DEBUG*/) P5 M4 l* ]6 A: ?+ d! a

  43. 5 g1 y8 }* Q; g) E; P
  44. #ifdef EDMA3_DEBUG
    : f9 S; r% ?* H" K! v! m3 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / e5 i, _) u+ m3 T, ^" g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 D+ ~4 v0 y1 b- t' w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 D" f. n3 R3 O6 p6 k. w; |
  48. #else
    6 \* ?2 q. m; }2 B0 z8 D- p$ d
  49. #define DMA_PRINTK( x... )$ x! f0 Y& D+ F: V+ i7 I' _
  50. #define DMA_FN_IN0 N4 M" ?& ?% f+ r
  51. #define DMA_FN_OUT3 _" E' V2 v2 J) Z
  52. #endif8 u& F3 f& Z; f& Y$ e

  53. % @5 F% _7 d) P1 a/ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* h' ^8 G. A) J4 u/ |
  55. #define STATIC_SHIFT                3# r9 L* h1 O9 H$ J6 C" j
  56. #define TCINTEN_SHIFT               20! ?8 G1 h6 e2 N  C
  57. #define ITCINTEN_SHIFT              215 G! E  y. L, `- Z) Z( J9 u
  58. #define TCCHEN_SHIFT                22
    % r- I8 l9 C! v! V3 t5 t
  59. #define ITCCHEN_SHIFT               23
      ^3 Y8 }& T) k  |0 |# s
  60. 6 m" \) P. s9 i  o( V
  61. static volatile int irqraised1 = 0;
    6 m* k1 @$ `! o. E, s1 Z
  62. static volatile int irqraised2 = 0;( K* ~* H' F1 N7 D" e5 y0 N! V* I  \- w

  63. 6 w8 _+ G% {$ g8 |: x" g; h( \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' _( D& M  I! W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 I  c5 {7 y7 P) X( R2 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / E* Q5 E1 |3 _7 w/ O7 l& O2 R
  67. . y6 L. |' \  {+ b! @" C0 `8 [
  68. dma_addr_t dmaphyssrc1 = 0;1 ~/ y3 i: g( n4 `5 y
  69. dma_addr_t dmaphyssrc2 = 0;. ^4 C; b% v  g; |9 L2 @
  70. dma_addr_t dmaphysdest1 = 0;6 B% z% e& M# J
  71. dma_addr_t dmaphysdest2 = 0;( U1 `9 W3 r, O) R5 e" K1 N

  72. ) A' B9 c$ E/ |$ H1 p' i
  73. char *dmabufsrc1 = NULL;6 [% a- T. F# Q- q& ~  P' n, c
  74. char *dmabufsrc2 = NULL;
    " ], h+ G) H! J. f/ N- ~
  75. char *dmabufdest1 = NULL;. h+ k! u/ y" l
  76. char *dmabufdest2 = NULL;
    1 |* \$ V/ [- L: r
  77. ! x& j+ |9 j: C  v5 A$ ?, ?; o9 L
  78. static int acnt = 512;* V/ k6 n" S+ Q2 ?
  79. static int bcnt = 8;
    : S, M1 X/ }1 ?$ Q# ^0 N
  80. static int ccnt = 8;0 R) S! K& t2 ]0 D

  81. , a% Y; R9 P% e0 ?
  82. module_param(acnt, int, S_IRUGO);
    % G4 J% b8 y4 d  y0 A
  83. module_param(bcnt, int, S_IRUGO);
    $ _6 L" v1 n" @( `6 A7 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- |0 F. m' p4 Z$ y5 A' k
; x9 U9 M; |6 ~. b) Y4 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# D- s# f, ?# `. A" {/ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 L  H9 P! w, k5 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 h% |  e" u, e6 p) w+ o8 i
( H* [" k4 K' \, n/ y# \. ^
% S( ^2 f& {% L+ N4 B+ O" X, r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 21:05 , Processed in 0.055318 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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