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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 v% }( E" L  Y, Q# w. K2 S
  1. [code]EDMA sample test application% w7 w3 a9 ^' K# p, S
  2. /*
    / p6 P+ \5 i$ Y
  3. * edma_test.c
    ' D3 R+ J) u0 u) h
  4. *: W% M( C! [) X" A  t! R
  5. * brief  EDMA3 Test Application$ c7 r5 N$ b+ n9 k( w6 Z
  6. *( l0 X' K, m" x: w+ R0 }/ z
  7. *   This file contains EDMA3 Test code.
    ( g6 R3 i& I7 t( N
  8. *- m% U, }# T3 ~7 t4 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" K" Y; x2 p2 l! e) S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 c+ K1 j7 z9 j# F0 k) l
  11. *         TO CHANGE.7 @2 ?* A( J. N9 }$ k2 D
  12. *
    2 ~* k, z. m$ C/ G1 J! X9 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 W0 d2 u6 r* J$ V* f
  14. *  N% J( ?9 r) q/ v8 L
  15. * This program is free software; you can redistribute it and/or/ f; x5 m" D& W5 f3 n
  16. * modify it under the terms of the GNU General Public License as. o! k( F8 x' Z2 k8 Z
  17. * published by the Free Software Foundation version 2.
    5 d  L2 t' G; `6 X
  18. *. u9 G1 L# j9 A: p$ u5 B+ ]* _9 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , F0 a0 j; j- U
  20. * kind, whether express or implied; without even the implied warranty
    , y$ X$ f6 Y5 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. T7 n: y& m% U/ g6 D
  22. * GNU General Public License for more details.
    & p  \6 W7 c( D6 ]; k
  23. */
    6 H5 Y, W5 n8 h( L/ @! T

  24. ! j5 K5 L6 s. @6 s( V
  25. #include <linux/module.h>
    4 j5 e8 T) J" }8 b8 M# d4 z
  26. #include <linux/init.h>
    + q% X0 B8 a; z( a; M# h
  27. #include <linux/errno.h>$ b, D! a: V5 y- o: o2 Z# _
  28. #include <linux/types.h>
    & H6 T6 y0 `6 a, F; [7 W8 h
  29. #include <linux/interrupt.h>
    : |; L# G0 }' J
  30. #include <asm/io.h>* @4 R3 B# y7 D0 ]4 R1 x+ v
  31. #include <linux/moduleparam.h>
    , r7 t* l/ Q7 p$ q; P9 X7 W
  32. #include <linux/sysctl.h>
    4 j% n- Y( [9 L& y9 C5 q; P
  33. #include <linux/mm.h>
    , ?0 l5 a" i* c3 m1 m6 C* a  L
  34. #include <linux/dma-mapping.h>1 ]' s' G% k7 s: R$ B
  35. ! \; ?: S. d1 Z3 j5 @" D
  36. #include <mach/memory.h>  s8 F* B! o+ H( }% R9 C7 G
  37. #include <mach/hardware.h>
      I; h8 v' k/ z$ _* I/ F- Q4 I" r
  38. #include <mach/irqs.h>
    6 _/ Y8 ?$ J& X
  39. #include <asm/hardware/edma.h># u  q: h/ F0 F2 V; R
  40. ! O+ v3 V* X3 Y+ C* X3 c$ B
  41. #undef EDMA3_DEBUG
    , Z  {; p3 H1 O) l8 u" G
  42. /*#define EDMA3_DEBUG*/" a, L) l: X0 M; b% F( |
  43. & u1 M2 h. W" h
  44. #ifdef EDMA3_DEBUG& E6 x) E8 R5 b" S! h7 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 X, F9 e$ x# P- n4 ~/ |. o0 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) k8 S! n/ S/ r0 |) m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 U( {5 ^, ~; p" I
  48. #else( @. a( x$ D+ ]7 L0 F; f6 y
  49. #define DMA_PRINTK( x... )  m# h. X; {( I; N
  50. #define DMA_FN_IN- [. w/ Y( M. g2 ~5 {1 @5 r1 u
  51. #define DMA_FN_OUT
    # ~- j0 l4 n9 O
  52. #endif' I. ?5 ]& @! M. s  T2 c
  53. & u' R# l# U0 T) t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) M5 s# R9 z  w( q7 q
  55. #define STATIC_SHIFT                33 u6 b6 n) G( [: H5 h
  56. #define TCINTEN_SHIFT               208 o  ^# b; q& q
  57. #define ITCINTEN_SHIFT              21" g4 T) {  k9 {/ K
  58. #define TCCHEN_SHIFT                22
    % D) [2 S3 ~# F' E7 t
  59. #define ITCCHEN_SHIFT               23
    / H5 i/ v, ^$ q  x6 D9 J

  60. ' z+ }3 x7 Y  ~  G- Q
  61. static volatile int irqraised1 = 0;
    % q, K) M. g; Z% X5 @) D; M$ L& M
  62. static volatile int irqraised2 = 0;
    3 d2 Q+ s& ?% s3 c) a+ T

  63. 6 Q& S, U, S+ w3 p4 j8 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b. N% W9 V8 }; X2 A5 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D3 [1 ?# D; c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 c% }; t! h% Y0 g
  67.   {7 f0 G% _/ H
  68. dma_addr_t dmaphyssrc1 = 0;* n/ X: k& i! w+ D! {% L
  69. dma_addr_t dmaphyssrc2 = 0;! L7 G3 a" W7 m* Q2 S$ {' v
  70. dma_addr_t dmaphysdest1 = 0;1 s* Z( F) c$ z- {6 Z% ?% A
  71. dma_addr_t dmaphysdest2 = 0;0 C! t0 P5 z8 B5 M+ _' v7 j. v

  72. 1 S6 S- K" M  I8 O4 F+ h; \
  73. char *dmabufsrc1 = NULL;
    6 m/ C5 ]" o9 }$ ?* j$ A' ?  b
  74. char *dmabufsrc2 = NULL;
    " `5 l. ^6 ]& I7 T# R" c( l
  75. char *dmabufdest1 = NULL;( b7 H" f: `2 y* ~
  76. char *dmabufdest2 = NULL;: q3 b: I7 a$ U5 w' `2 n2 g4 p/ {

  77. 6 f& \$ _! E" k# P
  78. static int acnt = 512;6 F$ M9 ]( M9 P' I9 I
  79. static int bcnt = 8;# B4 p" N: k2 s6 h! K( x
  80. static int ccnt = 8;+ m. @& C0 o! T. b+ z- |6 V/ }
  81. 1 h- p8 l  ]2 ]5 |  O
  82. module_param(acnt, int, S_IRUGO);( M" n% n) S$ X; w# M) n
  83. module_param(bcnt, int, S_IRUGO);
    / b7 o: P9 f* |, x& ]  }$ \: R) M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 Z9 X2 ~4 a! Z- A  d4 W- t/ l% M+ j* B4 X: Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) s0 z6 _4 a% T- {3 C* N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 X' C" `9 F$ h& _0 N  A: b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 g5 F' S/ Q# Q8 G( F
: H5 C4 U) c' G

8 S& X' W5 [  |+ y, S$ ]; X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 10:11 , Processed in 0.039680 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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