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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 C! _' N* n  p2 m5 U
  1. [code]EDMA sample test application0 U% Q- K; C3 j. d& x, a' M/ c+ e3 v
  2. /*
      j4 O9 H$ _5 {$ v. Y  W, M1 U
  3. * edma_test.c
    6 Y/ w# s* `; y$ z4 I
  4. *
    - Y! }" J' j# M1 `/ G
  5. * brief  EDMA3 Test Application' ?, |7 R& ?. x/ t& y
  6. *
    - _' Z/ J& `8 ^0 E/ R
  7. *   This file contains EDMA3 Test code.
    5 w2 w* G+ v, k' `
  8. *
    ( T' \0 x: ?8 y. T4 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - \( V8 L5 `7 `; L3 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' j& k# |2 t4 o7 `: {. F/ S
  11. *         TO CHANGE.
    2 }  y4 ~! Y; \  S
  12. *- t( Y. x- i; Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) x& C* c$ c" B! m- |, O7 w
  14. *3 X% R( L9 S5 u. c
  15. * This program is free software; you can redistribute it and/or
    3 {! a  h: L6 T$ @4 w1 w7 Q
  16. * modify it under the terms of the GNU General Public License as
    2 g5 S/ d  x4 `5 N( ~- n' P
  17. * published by the Free Software Foundation version 2.
    : s, |" B, f$ a+ ~
  18. *
    ' ^7 p5 p* L5 h0 B% Y3 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + E( W; l* S' M: Y1 K# B* X! @3 ~
  20. * kind, whether express or implied; without even the implied warranty$ i! y* _( j+ _+ I( X0 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 h4 k: b7 S" l/ _  h
  22. * GNU General Public License for more details.
    : ?4 k- W* `6 y9 y* J) T
  23. */
    ) {8 K! \! x: v/ Q3 H2 q2 ~! }8 D
  24.   V; x- a1 P' N  t+ P* L5 \* I& R
  25. #include <linux/module.h>) |1 ~7 K8 q' _/ O# g* D
  26. #include <linux/init.h>+ g* l& a+ s* }: K7 H8 V
  27. #include <linux/errno.h>
    6 E" k6 c! K! T
  28. #include <linux/types.h>
    1 |" x  E! C+ O8 G
  29. #include <linux/interrupt.h>
    % ?* Q6 M( i# @' p/ ?) g" t/ e
  30. #include <asm/io.h>
    9 J& n; }0 I$ H6 R
  31. #include <linux/moduleparam.h>
    ! O2 X+ c, N1 {9 D- O
  32. #include <linux/sysctl.h>* @: f- t: K* _( r
  33. #include <linux/mm.h>
    $ z/ Q7 W4 L" q% Z, g" h* U
  34. #include <linux/dma-mapping.h>
    . y* O2 z, K! i

  35. " i+ `2 }/ A" G; z" `
  36. #include <mach/memory.h>* k! B! Y  B9 t" H- O6 m8 e
  37. #include <mach/hardware.h>
    . ^! q. c: b8 U# E, ~" v3 X! o
  38. #include <mach/irqs.h>/ ?* y2 c% n% J* V2 @
  39. #include <asm/hardware/edma.h>  W7 B- A% D7 W* ]+ L! ^9 H
  40. ; U! a6 y$ ~  `) ^1 {* f
  41. #undef EDMA3_DEBUG! f5 D+ u. @: A
  42. /*#define EDMA3_DEBUG*/. {% `" I# m; d- i  E
  43. , [( N9 ^7 n* u8 s0 V# r$ n- X: D- l
  44. #ifdef EDMA3_DEBUG7 U$ H) r$ k8 l) {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  U, m( Y; G: T9 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% j: c* L$ J: F! ~% L1 ]; U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 {1 P: [$ m2 T4 T; d/ g+ `$ @
  48. #else
    2 G- P( m* |; Y# w+ s1 v5 D
  49. #define DMA_PRINTK( x... )
    2 N- u/ V2 E3 l
  50. #define DMA_FN_IN: j' Z% m5 _0 C* S/ d2 n
  51. #define DMA_FN_OUT
    2 P) f3 Z2 w& Q2 J! z
  52. #endif
    . c- j  R4 Q& v% @' [9 }

  53. . J( r* Z8 r+ [" l* w1 R; j2 N* I! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). f' B5 Y  J) V5 u* f
  55. #define STATIC_SHIFT                3
    , }$ m3 x+ k, F6 z/ p% M& Q- I5 B
  56. #define TCINTEN_SHIFT               20% Q! }  @6 Y7 @+ j) l/ w7 ]
  57. #define ITCINTEN_SHIFT              21
    - G- H, W) z+ W, S, Q0 c
  58. #define TCCHEN_SHIFT                22- C# o  w4 Q+ F. v% u! s) C5 k2 W
  59. #define ITCCHEN_SHIFT               23
    2 Z3 T$ g+ O: e6 M! S/ a
  60. 2 R9 n0 h& K2 ^9 ]
  61. static volatile int irqraised1 = 0;7 [: s( y% C* q1 e+ d3 X
  62. static volatile int irqraised2 = 0;/ G8 Z6 P! W8 C5 p( J3 Q

  63. : f* Y# E$ C" p8 S* @8 \( Z+ u. F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 d) c$ ~8 K% u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ?( m* n' f' |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; C8 t( L/ P3 d+ I- j
  67. * P. W2 g. x* Q
  68. dma_addr_t dmaphyssrc1 = 0;8 f2 J  o7 a* Q  M$ G: G
  69. dma_addr_t dmaphyssrc2 = 0;1 V) |  {# a: t
  70. dma_addr_t dmaphysdest1 = 0;
    $ E8 ~2 J# L* H' V0 R
  71. dma_addr_t dmaphysdest2 = 0;0 ^7 }- i. P  w  M6 ]- ]: a2 X5 k
  72. 6 D$ |) j; I7 u/ S7 U. r
  73. char *dmabufsrc1 = NULL;2 Q, |/ m; T( m* p* @  z
  74. char *dmabufsrc2 = NULL;
    0 Y( l4 X6 f3 x5 k. \8 t& }
  75. char *dmabufdest1 = NULL;6 E$ [$ w* i" k/ @. b3 Y
  76. char *dmabufdest2 = NULL;1 c% }! D0 n4 L7 Z' J9 G* d+ Y) b- P- \
  77. 4 E" |9 n/ B; ^- y9 J3 o
  78. static int acnt = 512;$ m- u" L# k! ?3 j9 X8 L. E
  79. static int bcnt = 8;
    7 Y0 i# j7 `. {# l2 m
  80. static int ccnt = 8;1 B% f) C. @( w! O+ Z

  81. 7 `8 \! S- A- G" U9 r, l  d
  82. module_param(acnt, int, S_IRUGO);
    " |4 _6 [" M6 g
  83. module_param(bcnt, int, S_IRUGO);9 Y2 y8 |/ p2 A0 F' F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 A  K; J7 ]9 e# }. U0 d& x6 d
( t+ [/ `0 e: u, t, k1 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: T/ k3 t% q; V) Q- G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ q* m% y8 G1 J0 f8 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ]( `5 I  f7 R  s& i' f% m- X$ Z4 L. A+ @% R/ g- E

0 ]* _$ B# n* o6 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 07:43 , Processed in 0.036005 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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