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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 I  f; @1 ~4 D, J) u
  1. [code]EDMA sample test application
    " w6 A' D) U9 S0 V) K! M( N4 h
  2. /*
    : M% I4 \4 N& g+ b+ O$ d
  3. * edma_test.c9 i( Y1 c: u0 @+ y7 K5 ]' g
  4. *
    2 M' M  p* M& F9 o6 Q, m
  5. * brief  EDMA3 Test Application* T+ J$ g9 B6 w6 d% d: R
  6. *
    5 j" v! u+ [- t
  7. *   This file contains EDMA3 Test code.
    9 ^# ?2 \7 D* a- X: ~
  8. *. Y) X0 v- U" W9 F  w" Q8 _# W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Y, ?; O+ ~1 w$ G# [! w3 Q- Z* O0 L$ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 h$ e- y# G2 }* c$ b
  11. *         TO CHANGE.! K5 n2 m8 @9 e6 o6 _9 Q7 t5 F5 h
  12. *
    ; i$ F/ B% ^( G( D. g7 U$ M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # M2 H/ n5 q8 @! |+ U
  14. *6 V& Q& K" g3 Z9 y1 \6 R
  15. * This program is free software; you can redistribute it and/or6 e: y9 J$ A" z& N' p6 A. ]
  16. * modify it under the terms of the GNU General Public License as- t; ~6 B6 T3 [- T7 B
  17. * published by the Free Software Foundation version 2.
    - c. d, ^5 F. s5 `
  18. *
    1 o" y+ k2 W6 o$ A  v* N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# }0 S# U% r8 ^) }" t+ B; G# _
  20. * kind, whether express or implied; without even the implied warranty
    # ]2 k7 `5 v$ ?' I: \- B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " I& h  P, u' j1 A# I" E1 R$ Y
  22. * GNU General Public License for more details.
    6 s/ N- e  f) H/ {" q
  23. */+ z- ^& P) i! {! J3 s
  24. * u2 Y! B+ ?7 p" N
  25. #include <linux/module.h>* x& C* H8 I& J" A6 l
  26. #include <linux/init.h>
    * |1 p! z- l) {" U# k
  27. #include <linux/errno.h>
    . M- j( p2 ~6 ?/ Y* G
  28. #include <linux/types.h>
    9 E* F! K" l9 a
  29. #include <linux/interrupt.h>
    . G; g1 e+ s- F6 l- H
  30. #include <asm/io.h>
    % p# \: t/ a: x: }& O, Q. W7 k
  31. #include <linux/moduleparam.h>
    , V( `, {9 p' a: d5 C7 F3 ~
  32. #include <linux/sysctl.h>- {$ T( p4 n1 ?5 r
  33. #include <linux/mm.h>& z+ {% D% K, I! K! _3 Q! J4 L
  34. #include <linux/dma-mapping.h>
    , D+ L+ X1 w4 V4 K* n- d! h

  35. 8 O: t- b" a5 |. Y/ e2 ]$ k) ~5 p! `. k
  36. #include <mach/memory.h>' Z/ }. i: }6 R6 P% l) D. y- u
  37. #include <mach/hardware.h>
    1 w: _& G; ?# ?+ s9 |6 ^: V
  38. #include <mach/irqs.h>
    * u5 C$ ]* U3 g0 Z
  39. #include <asm/hardware/edma.h>( X+ ~' @  a" U% c" p, _
  40. 4 z, C1 Z8 V" M1 T8 S5 D
  41. #undef EDMA3_DEBUG5 s7 ~2 R$ e; i/ Y) t  G
  42. /*#define EDMA3_DEBUG*/
    - n3 G  o3 @( `$ G/ Q

  43. " @/ d5 D  K( Y4 p  |
  44. #ifdef EDMA3_DEBUG
    * b9 {; q7 ]) n8 a5 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 l. m5 n; v, z% s& U  m" M" {6 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      v& f! a0 t% m# A. p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Y) e! v% k- n0 m9 k
  48. #else; I- p% Y+ ]5 P5 K/ \' t5 B' j
  49. #define DMA_PRINTK( x... )
    # i/ `9 @3 t- b: ^& v* P
  50. #define DMA_FN_IN
    8 c) O3 D0 S4 U6 c6 `: K
  51. #define DMA_FN_OUT
    : _& n1 d% u; ]/ `6 ]4 j) e  b
  52. #endif1 t: R  ]# `0 }* h6 J3 E! D! e+ y: ~

  53. 4 u& _, r1 K% p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 O) E' P4 m% ^
  55. #define STATIC_SHIFT                3" V* O8 P  |) a* D6 Q
  56. #define TCINTEN_SHIFT               20
    0 i7 I$ I) `' ]2 g# {2 ~
  57. #define ITCINTEN_SHIFT              21
    ) g/ B( c/ G, D9 A' M( k
  58. #define TCCHEN_SHIFT                22% [" d. L, D! Z  I0 W" Y
  59. #define ITCCHEN_SHIFT               23  a8 H7 K+ [; D- c' M
  60. / `5 g, q/ x$ t9 s/ A) A4 q' q/ k5 z
  61. static volatile int irqraised1 = 0;
    , X2 n* \+ o6 ~3 h9 N# C% M/ i
  62. static volatile int irqraised2 = 0;, l1 E; E, Q1 h. d3 w: T( ]

  63. & z  S. m* l, Q( m  w9 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - T: v# I7 F! w1 T8 m  |6 @* \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 [% J! B% _4 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 |: U" [* p8 [

  67. % k8 v) k0 |/ }
  68. dma_addr_t dmaphyssrc1 = 0;
    . `6 x" A3 X  u
  69. dma_addr_t dmaphyssrc2 = 0;! e2 i0 H* c, a, M3 a
  70. dma_addr_t dmaphysdest1 = 0;
    % v' v4 o+ H7 ?
  71. dma_addr_t dmaphysdest2 = 0;* Z4 q5 e7 \$ Q1 O9 \
  72. % F4 a6 k/ N2 [# S+ x" T
  73. char *dmabufsrc1 = NULL;! e4 d6 N! {. A& w; n
  74. char *dmabufsrc2 = NULL;
    6 g5 Q0 Y; s0 N" P  e
  75. char *dmabufdest1 = NULL;! h, w# Z& \' g/ g. w7 N
  76. char *dmabufdest2 = NULL;
    0 T1 W% S$ E# J, q- r7 y3 o0 t
  77. - F4 V; b! ?% {  A( ^+ t
  78. static int acnt = 512;
    , U5 `/ [  c1 U" m8 N/ c
  79. static int bcnt = 8;& I' K" {& l" x
  80. static int ccnt = 8;2 X6 z  y% Y. K# |

  81. - I+ b* i+ R! x+ z& j  e5 J% ]
  82. module_param(acnt, int, S_IRUGO);
    ( V. m: @; r: H$ m+ X4 h
  83. module_param(bcnt, int, S_IRUGO);) C8 j" ?8 r) p, m7 _+ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ L3 o5 {; k" a  B8 o
& q5 ~- E& U5 m+ J$ V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 N" n, @( @+ L1 r
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 D. |% F' u! |( k$ q- d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; O& B, d$ ?5 `3 a" z

. O3 b( G* D& ]1 b$ B7 u! [' }0 |- ]. }" h6 m/ s) D2 [2 d. Q/ Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 00:06 , Processed in 0.048864 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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