OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ X" V# G- o& |  c' u. y
  1. [code]EDMA sample test application
    # a- b) T8 n; g5 ]4 F1 Q7 V
  2. /*
    . ~3 c0 Y& ]. r
  3. * edma_test.c4 h% j) @1 v! C" B. \& Y. Y
  4. *
    5 C' m9 M6 V, i, H
  5. * brief  EDMA3 Test Application
    + [7 T; N/ V% K& v3 O/ c% W& p
  6. *
    ' O5 ^6 z* E& g5 ]1 s. c2 G
  7. *   This file contains EDMA3 Test code., p( P3 {  N3 B# [8 I( w
  8. *0 {4 f; t  b' @5 G8 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " E% ^/ u# B) X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! g1 |" o! C: [' M2 H
  11. *         TO CHANGE.
    + T8 h0 u' I* V
  12. *# g. E0 A# Y. u! a/ O3 H* ?# C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 _5 R+ N7 M8 M0 B/ {, {+ n+ A' |* ^
  14. *8 t. A; |6 ?9 c9 i2 _* k/ B8 o  ]
  15. * This program is free software; you can redistribute it and/or: j- z, [5 `/ X$ \$ g
  16. * modify it under the terms of the GNU General Public License as& Y- R8 Z/ ~: t( a
  17. * published by the Free Software Foundation version 2.1 h! K' ?' J3 Z
  18. *9 ^! x# l0 ]: a! w3 P$ C# G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 I6 @5 q. |, d$ @
  20. * kind, whether express or implied; without even the implied warranty
    - S, B: g4 o/ ^9 w6 t8 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 e( U, K% `9 s; q( s& F
  22. * GNU General Public License for more details.
    % d8 p9 s' l/ ~8 e
  23. */
    4 f; ~, f( Y. t  ]
  24. 1 T0 m$ `- [$ y0 [
  25. #include <linux/module.h>
    9 U4 u$ d1 h3 G- j. a% f
  26. #include <linux/init.h>% B* m" k  X+ M* @+ M3 G
  27. #include <linux/errno.h>% d, M2 V  `' ~3 r2 G
  28. #include <linux/types.h>
    , o; v- o6 G( ?; {, L
  29. #include <linux/interrupt.h>
    - ?1 I8 ?% R$ j3 ?
  30. #include <asm/io.h>) P1 y8 j! n* i# o# z% \- B
  31. #include <linux/moduleparam.h>/ a7 b! n( u+ q* Q
  32. #include <linux/sysctl.h>
      m0 v9 y( _1 O, T
  33. #include <linux/mm.h>+ R+ F1 x: s2 z" n/ H7 ^' g9 B
  34. #include <linux/dma-mapping.h>
    + i: i9 g6 P9 g) y* c# F4 s1 a  u5 M

  35. ' Y- ]# P! l0 a$ ~7 V7 N2 S
  36. #include <mach/memory.h>
    $ b$ g4 Q- e5 P, W7 q# s% c2 g
  37. #include <mach/hardware.h>* W+ d4 j/ b) ~9 a4 ]+ S3 ?
  38. #include <mach/irqs.h>2 j" S. c# ]+ R9 Z0 G3 D/ f1 m+ G# L
  39. #include <asm/hardware/edma.h>. u% C; G5 e  o% j, W; ?

  40. & K! j7 x/ O/ Q5 ~, J
  41. #undef EDMA3_DEBUG
    & m4 I" c7 P4 E% O  c+ ~
  42. /*#define EDMA3_DEBUG*/
    + Z- t+ u. o; q/ Q1 V

  43. # B! t  j/ `2 m5 `! v6 s
  44. #ifdef EDMA3_DEBUG- K8 g( f& b3 d7 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! e2 ?6 e$ d7 i' D  J; g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 D4 R, T) R6 R  a! M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 f% s' b- `8 f5 x2 _+ o8 v6 q
  48. #else
    $ c6 s" h# Q5 H- p8 g. Y( A4 e
  49. #define DMA_PRINTK( x... )- c/ [" E/ h& h$ z1 e9 |( x5 B/ ~
  50. #define DMA_FN_IN% P4 d  u2 q" [4 N5 W! V4 G8 [! n
  51. #define DMA_FN_OUT4 X% K' X# B) a  C# h
  52. #endif( `# P* I" ]+ i" c4 J- C; v* s9 _

  53. 7 M7 Q& g( d+ [0 j, A/ [# I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 ^2 u+ E2 m; T; p! B% z
  55. #define STATIC_SHIFT                3
    7 K# {( W6 @! Z% A" J) \
  56. #define TCINTEN_SHIFT               20# O/ ]$ K  C' z6 o
  57. #define ITCINTEN_SHIFT              21
    + _1 [# H/ ^6 N! {
  58. #define TCCHEN_SHIFT                22
    5 Y" a3 U* [/ B# ]/ k: ?
  59. #define ITCCHEN_SHIFT               23
    ' [% W* M3 h0 P/ U1 u0 Q9 V2 J% m0 x
  60. 9 V6 G- N8 r  l0 o
  61. static volatile int irqraised1 = 0;& U1 q: W  }6 s/ Q/ e; q8 |8 U- j' K
  62. static volatile int irqraised2 = 0;
    6 v7 M. [# A+ `6 ?/ R- Y/ Y* H; R

  63. - L) _' b  w6 Z  g  j0 ]$ Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [8 c  j/ Z, A# {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, P: o, o+ @4 F* J% K! l4 x9 s1 V8 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' y8 C. _; b3 k( O. j
  67. " g' _5 v, W7 z' h+ S( ^% P( ~
  68. dma_addr_t dmaphyssrc1 = 0;: S, `; g  m4 S8 ~+ M  C
  69. dma_addr_t dmaphyssrc2 = 0;/ N$ x& W  i) y& h
  70. dma_addr_t dmaphysdest1 = 0;4 b7 j7 L4 R- l. q$ M! F
  71. dma_addr_t dmaphysdest2 = 0;) _7 H8 W8 Z, S  z: U! s8 r1 M

  72. ( J0 u1 s9 y1 q6 G4 O/ y
  73. char *dmabufsrc1 = NULL;& L6 s. d8 W& b/ P6 ^: M
  74. char *dmabufsrc2 = NULL;
    / _3 ^3 \$ v& j' {  d% k
  75. char *dmabufdest1 = NULL;
    % c9 @7 O. w: i- y1 g9 t& j
  76. char *dmabufdest2 = NULL;
    ! B( g& Y7 E" p
  77. 5 H; B! ~5 D9 s* K
  78. static int acnt = 512;5 g  @6 \1 i% q
  79. static int bcnt = 8;
    % z+ P9 E9 G: u0 e, @& @6 t
  80. static int ccnt = 8;2 b! J7 Z9 u/ N. t

  81. ( p+ O) v$ U  t0 P. s  @" n' }1 I
  82. module_param(acnt, int, S_IRUGO);1 v4 s; L" t% j7 e2 \
  83. module_param(bcnt, int, S_IRUGO);
    " L. D- U; p2 E; q) M, P; `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  Z2 A+ E" ^8 o" ^2 I: M  }
) O* r5 H" `' b5 A! Q; q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ J, J; X6 t0 N" z) f3 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 z( o& N) I  R# J- q; L5 {. m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% G8 m+ G3 C5 s1 v  E3 e# |% C4 i! ^* A, n% a
, h: M6 Q4 M6 U3 Q1 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 10:56 , Processed in 0.037358 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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