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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 J9 S6 A- b0 W1 N! Y% h! N
  1. [code]EDMA sample test application# a* Y+ \+ k' v! |
  2. /*
    " |9 K; R1 v1 Q' \
  3. * edma_test.c: B/ |% J2 I* N9 M6 D, R' G
  4. *; |' ^1 H  H+ o  ^6 {/ p. C/ p
  5. * brief  EDMA3 Test Application
    " y* H1 S6 p3 v$ ^
  6. *
    - M( {8 E3 |: P
  7. *   This file contains EDMA3 Test code.* o8 d, I+ \8 y
  8. *
    1 K; F/ ~$ e" ]  c' v9 i7 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ S! x3 M9 Y. s# e9 M! j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ Y1 @  \" g* U6 h; F. P. R
  11. *         TO CHANGE.
    ! r$ X; v0 \: x% r, d4 D) v+ \
  12. *3 `1 s# {! |0 t* I' `4 o* Z' v8 q( s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! W% E& T: q; ^9 O
  14. *& f2 f, ~; q7 {* I' N
  15. * This program is free software; you can redistribute it and/or- W) `0 X4 e) |7 o# F8 f% F
  16. * modify it under the terms of the GNU General Public License as9 j5 d, z6 w3 i6 F0 a
  17. * published by the Free Software Foundation version 2.* R; o6 p, _( Q1 A; J) x
  18. *- ~' P7 P/ Z% N9 U# W: a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & ?. R- h* v; L- G' `7 r8 `
  20. * kind, whether express or implied; without even the implied warranty; G8 p1 O- o+ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - L( \" U  ?6 H0 {+ a
  22. * GNU General Public License for more details.
    , H5 {" {. ~& x' M, x
  23. */* G" K* }/ K# L5 p# `( {1 r
  24. 9 [' u3 M4 p; P# Z
  25. #include <linux/module.h>
    * v; m6 ]* K; d2 W
  26. #include <linux/init.h>" I; e# A: {7 |) y# Y, z
  27. #include <linux/errno.h>
    + `- w7 \4 s9 M8 J# J5 e; M
  28. #include <linux/types.h>
    # D" ]' _6 ~; A+ W1 R" N0 E; N
  29. #include <linux/interrupt.h>
    : D: Z* n- D( `; {& U
  30. #include <asm/io.h>
    ' E) n+ O3 ]( @- @! B# {- _
  31. #include <linux/moduleparam.h>
    , _, @% J* [, l' r* {
  32. #include <linux/sysctl.h>5 r( Z5 C  T' m* l
  33. #include <linux/mm.h>' V  ?) M8 d: `6 E6 k3 {* T2 y
  34. #include <linux/dma-mapping.h>
    6 k' S( q) [' V

  35. 9 d1 C$ l3 z6 d) c% E& \' K
  36. #include <mach/memory.h>* R  f0 i+ d( w: ^- _, J/ N+ Q% Y
  37. #include <mach/hardware.h>9 ~) o" [7 T5 z: i5 r4 X
  38. #include <mach/irqs.h>* q# @) w( Y' e
  39. #include <asm/hardware/edma.h>
    6 z1 X; t& u; a: j5 z

  40. $ U3 E8 U4 i1 f
  41. #undef EDMA3_DEBUG& G4 H) \: m8 W( {. ^. Z
  42. /*#define EDMA3_DEBUG*/) ~' v4 f; U# e- d+ \0 Z- T: U; x% o
  43. 2 L3 y9 Q; m. Q' c2 o
  44. #ifdef EDMA3_DEBUG
    # k; w" ]# q6 c. B$ I( w1 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - }5 d3 n- N& l7 X; S  g: p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , z: E2 I# ^) C' O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 m0 r& E$ e* N# ]& K' x
  48. #else
    ! U* [& l  Z2 M( S6 s+ j, M
  49. #define DMA_PRINTK( x... )7 v6 K8 C- M+ W+ Y& I3 p
  50. #define DMA_FN_IN
    + l+ v( V# Y' a/ `( C  I8 i8 e
  51. #define DMA_FN_OUT
    3 x* @& H6 [/ \0 Y
  52. #endif. L* c) M0 N" s

  53. $ A3 R  s4 w  a* s  B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& B: @4 l8 I# U( s8 c8 M% B7 B
  55. #define STATIC_SHIFT                37 X6 r" E' u7 l, F
  56. #define TCINTEN_SHIFT               20% L: x, O+ L5 G0 X
  57. #define ITCINTEN_SHIFT              21
    & s% ?; W7 H) q/ L. k6 o6 ?$ s
  58. #define TCCHEN_SHIFT                22
    8 y5 ~! B3 c5 G6 N" [
  59. #define ITCCHEN_SHIFT               23* z$ U8 l5 n# G+ Z  c
  60. # \& f9 v; C" V5 D' A' V3 ~
  61. static volatile int irqraised1 = 0;
    % _/ E' u6 ^$ v  O7 v: C1 `- i$ r
  62. static volatile int irqraised2 = 0;
    9 \! U+ c) `/ u

  63. . d* i1 K  }& J" v9 |7 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; a5 W& N; J8 J" X$ T5 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 k, c; U7 m" L; V  J8 |/ _4 p5 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 [# b3 a& D/ s$ k9 b% H
  67. # b* \" l/ F6 _- t/ n% N
  68. dma_addr_t dmaphyssrc1 = 0;) F$ Z" D1 b0 f$ ]  g
  69. dma_addr_t dmaphyssrc2 = 0;
    . t+ m4 V% x# {0 }+ J/ X
  70. dma_addr_t dmaphysdest1 = 0;- [1 R# ?0 Y: A  J
  71. dma_addr_t dmaphysdest2 = 0;
    ! \- o6 j7 ]7 w, K0 V
  72. 2 W+ w; v# G' ^( F
  73. char *dmabufsrc1 = NULL;
    5 w8 G- a9 t# |2 ^& t' V9 b
  74. char *dmabufsrc2 = NULL;3 ]" |* ^) A! Z, N0 }6 M  P
  75. char *dmabufdest1 = NULL;
    2 H9 h( M/ Q& d- D- e8 l
  76. char *dmabufdest2 = NULL;) V* c  T" I+ [. o( B! ]3 }

  77. ' [3 d7 J; p% c* \) V. ~* `
  78. static int acnt = 512;
    # r1 q8 k( l- \8 P9 ~' R
  79. static int bcnt = 8;$ o% C. P1 k' _# e& x; g
  80. static int ccnt = 8;
    # F9 G& B9 I5 w" ^& p9 s; U

  81. + c) ]4 }6 j3 S4 [" `* F. f* w
  82. module_param(acnt, int, S_IRUGO);
    1 k  \9 f( K- r8 K
  83. module_param(bcnt, int, S_IRUGO);
    + A8 C  ~# c0 D" W& M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ ]+ p* d: g) {0 _# |7 c! t' ?* |4 T6 E5 w" F2 B9 G& r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" p! k. t+ E' p, W# s5 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 u* H& l! X& r5 l; P7 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 m! G8 g: x2 m* y* x! z6 {3 x4 E
# a% l/ s. @2 r# M: v8 K- j! {( v
  i, T' a" h) Y/ N0 T$ z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 10:34 , Processed in 0.038636 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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