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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 E7 _4 S# D$ i  t& U7 Z# Y7 @! S) V
  1. [code]EDMA sample test application3 b" N) J* V' ~( u0 Q4 F
  2. /*+ H6 ^7 k) S% `' J: H+ j/ h
  3. * edma_test.c
    3 p. h3 I' N, [8 E: I2 Y
  4. *+ `$ H0 K7 n2 \4 s" p& k1 j# Y' Z& T
  5. * brief  EDMA3 Test Application. J( B, V2 y4 j; }0 I# T! e
  6. *
    ; z+ y: G6 Y, H$ d
  7. *   This file contains EDMA3 Test code.
    " U2 D9 ]0 J$ a# }5 h
  8. *' J5 e+ T2 f2 e- E4 u* b" C, l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & w7 K% ~" ~& t: O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 C6 b2 X" F: E
  11. *         TO CHANGE.
    . V- Y9 [' O/ i5 N- I6 M7 i
  12. *! w' @- e* H/ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 y6 v) ~& i; L/ [
  14. *
    , M/ g0 y' e. j5 i. W- F( K9 U
  15. * This program is free software; you can redistribute it and/or
    1 U8 k+ K2 s6 }. a* \. }8 h
  16. * modify it under the terms of the GNU General Public License as
    " E- l) g- U# D' |
  17. * published by the Free Software Foundation version 2.
    . A9 g# Q2 O' k6 [& f
  18. *$ w% o. S* h5 t2 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; f/ L* j6 W6 A
  20. * kind, whether express or implied; without even the implied warranty) k% a/ p( F% R/ b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! A& N  @" e- c
  22. * GNU General Public License for more details.% j8 b, x7 G% B
  23. */0 L+ C5 e# I, N% J
  24. - A3 q" |# B; o$ l& Q3 N/ R
  25. #include <linux/module.h>4 Z" a0 |$ R6 r) r
  26. #include <linux/init.h>) x8 w" A9 d" x* G; j! {. ]# D4 q
  27. #include <linux/errno.h>5 I9 W* V2 F$ k
  28. #include <linux/types.h>
    " P9 M4 }9 a9 t3 y' Q
  29. #include <linux/interrupt.h>! z5 v6 z1 L) E* w" U
  30. #include <asm/io.h>
    ) Q0 Z$ C; W5 w1 @* y6 \% ]
  31. #include <linux/moduleparam.h>8 D/ }. K; @% Z7 v3 d
  32. #include <linux/sysctl.h>
    # a4 p. N, K4 a% A. s
  33. #include <linux/mm.h>
    ( K2 E3 }2 ?( b: G9 v
  34. #include <linux/dma-mapping.h>6 O$ {$ ?4 z# O- e* J4 R4 Z+ X# {
  35. , e( _- ]+ R5 s! K! m
  36. #include <mach/memory.h>
    2 y; m- v, z( ?8 X2 Y
  37. #include <mach/hardware.h>
    / I% C& X" W& f+ I  q1 ]3 [6 z
  38. #include <mach/irqs.h>
    7 s# P. N8 Z( }, w  h; [
  39. #include <asm/hardware/edma.h>  p& u! R( L: g9 o7 g
  40. 4 ~0 c* }/ M8 k+ y6 z7 l
  41. #undef EDMA3_DEBUG+ [2 ^( r" \" h0 e$ S
  42. /*#define EDMA3_DEBUG*/1 K: u6 V5 i/ I+ r( z( A

  43. 7 r' x3 h+ R, S
  44. #ifdef EDMA3_DEBUG
      B( J3 P4 K4 E8 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# [- i- G) b. I4 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : ^0 ?2 H3 \- y( h6 J- ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ k. _) B) T! v: C/ u& \; F3 k
  48. #else
    ( {: Y$ B; _  r
  49. #define DMA_PRINTK( x... )# l: {" c" e2 h3 g
  50. #define DMA_FN_IN
    % Q+ }' L* U) P3 A9 _: v; T
  51. #define DMA_FN_OUT' K$ P) p5 I% b3 t! @$ [
  52. #endif! l4 w: V5 n% B4 [
  53. - B( M6 [, `' e' d5 v* ?+ B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- u; A6 d3 |3 c# [$ P! H
  55. #define STATIC_SHIFT                3
    4 t: ]6 O5 L5 `9 H
  56. #define TCINTEN_SHIFT               20) U( j- i( I$ F, ~- C0 N
  57. #define ITCINTEN_SHIFT              21
    5 e( S  [3 Y' T' C
  58. #define TCCHEN_SHIFT                22
    " C, s! b; p5 _3 _' o7 T& D6 x6 Y
  59. #define ITCCHEN_SHIFT               23
    ) j0 s) O- c+ t, B( b1 N8 S

  60. 0 [- a/ k( \9 F3 Y6 j
  61. static volatile int irqraised1 = 0;: g$ I" {) }9 r) `6 Q/ y
  62. static volatile int irqraised2 = 0;
    6 N# o7 k' E- K% E, ^

  63. # W+ i& u4 W5 R, V* S6 C& y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : c" E% P5 q( S7 ^+ [# R: f+ V2 Z. ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 T* a# l6 Y, ~3 ~+ [3 O- o' `$ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 i3 w$ ~% G3 S6 M% e/ x5 B2 b
  67. 4 R) q" P9 J/ d& _& M0 t
  68. dma_addr_t dmaphyssrc1 = 0;
    / [0 L6 o( j9 B) V/ y3 }1 N
  69. dma_addr_t dmaphyssrc2 = 0;8 G  |& k7 ], r1 Y7 ]
  70. dma_addr_t dmaphysdest1 = 0;
    5 R$ K# d6 {7 x: R; v& y+ X
  71. dma_addr_t dmaphysdest2 = 0;
    + e, @; ^  K/ |7 g/ T: H; Z& o
  72. ) A$ D, S( c' p
  73. char *dmabufsrc1 = NULL;
    , n$ z7 Z/ v" P5 S  E3 p
  74. char *dmabufsrc2 = NULL;
    : A4 W' B/ y: W- ~
  75. char *dmabufdest1 = NULL;
    4 `# y! @, ~/ J, Q+ o
  76. char *dmabufdest2 = NULL;) F' S+ m1 I+ I- V% i
  77. 1 w) C0 [% N+ `, k
  78. static int acnt = 512;7 ]( t% W/ f3 l: J
  79. static int bcnt = 8;% m. c, m- @. @' M* E* A3 T
  80. static int ccnt = 8;: z& D9 d1 S9 d7 U

  81. 3 @) V; k; y7 V/ ^' V9 }
  82. module_param(acnt, int, S_IRUGO);
      L, {5 w6 |1 V- F, s5 g
  83. module_param(bcnt, int, S_IRUGO);
    * ^4 c( b! q! M+ [  t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; P- @8 S' Z. a+ }: s% v3 _6 K
3 |  f* I+ d. ?/ ~0 B3 d1 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; I5 l+ K! k' Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 `  c- E9 K7 g1 q  i5 a# F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. r2 K3 v# M! F5 \1 S0 V1 j: t
2 `8 B* f/ I5 Y% V; q3 x3 k" T7 F( r3 O

4 i$ k$ D4 X* J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-16 00:04 , Processed in 0.037125 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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