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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 H, U* G2 Q+ l3 S$ E$ Q% v
  1. [code]EDMA sample test application
    1 f3 k0 z4 |5 \5 o" Z* [8 |1 p
  2. /*
    4 e7 t% F: O6 E- W$ I  a  X: l0 ^
  3. * edma_test.c) _2 B4 Y- T- P3 u* Q! X
  4. *' K' Z5 L' Q3 b  M
  5. * brief  EDMA3 Test Application
    " n& G; j: Z; _( ]
  6. *( ?6 C/ C" d6 d2 k* P% U
  7. *   This file contains EDMA3 Test code.
    % |7 g# `; e  _8 |9 k
  8. *
    # n7 Y) H$ Q# u- @0 I3 C" a$ ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 g4 l7 x( L% X. r! G, V) l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 D# m4 O% Q5 ]  V2 O) Q5 Q2 D$ t
  11. *         TO CHANGE.$ b* |1 M+ T5 s/ h+ t
  12. *1 H% x0 b) s9 q  O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; }, S, {2 M6 U% k6 u* U
  14. */ v( ?# v7 q: u( p* o
  15. * This program is free software; you can redistribute it and/or
    ; ^" o- A8 L" y+ u5 G
  16. * modify it under the terms of the GNU General Public License as
    # m) B3 Z; h) V2 s$ s8 X3 y
  17. * published by the Free Software Foundation version 2.' R$ M& Q  ^, |. i8 l
  18. *
    & B$ S: a' d: n5 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ q% R" C3 b9 c! Q" f& i
  20. * kind, whether express or implied; without even the implied warranty
    + @6 h, ^3 V3 ]) S% B9 A* ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" z- F3 x8 I% j. ~* D
  22. * GNU General Public License for more details.6 S( G' y! D" ~3 @5 Q
  23. */
    : Y8 o) b1 N! n/ c- G) K
  24. 7 j7 ?. }3 {8 W* [2 u- z1 \
  25. #include <linux/module.h>6 s# y' Y; R$ R$ P5 Z
  26. #include <linux/init.h>, P& p- Z' D' [  a5 u( Q" S3 u
  27. #include <linux/errno.h>
    & A8 R4 _4 {2 g7 p$ J! Y( v7 j* j- _
  28. #include <linux/types.h>( m- a% [2 G) @
  29. #include <linux/interrupt.h>  V8 j8 }3 M3 @  g+ V$ B/ m+ T8 U
  30. #include <asm/io.h>* S, ]* }1 W& {' H
  31. #include <linux/moduleparam.h>
    8 R, B* H3 t5 E  F6 l8 E, u2 [
  32. #include <linux/sysctl.h>
    & y/ @' @. u# n6 Q+ F/ y$ e5 w1 J
  33. #include <linux/mm.h>( E; i8 U3 I& W4 E& G% _0 k
  34. #include <linux/dma-mapping.h>! b  T6 n# s" S# F
  35. 5 Q& V! |+ J2 z6 l! I) X
  36. #include <mach/memory.h>
    2 }- U4 z5 X+ F2 d* n; \
  37. #include <mach/hardware.h>
    8 `' [3 R+ u$ e( F$ w% m
  38. #include <mach/irqs.h>
    " Y* V/ Q  J- ~' q8 z! d
  39. #include <asm/hardware/edma.h>; Z# h  O7 q# k/ Q: g+ q

  40.   G. b- r2 m' W6 V6 ^. ~' R6 G
  41. #undef EDMA3_DEBUG; e3 X8 P# E. G
  42. /*#define EDMA3_DEBUG*/% ]' V. h" _  D; Z) J( z0 o7 l
  43. 7 f0 P  U% U5 m- A- a, S8 C* `' e8 }
  44. #ifdef EDMA3_DEBUG
    , t  w2 {7 O* H) @  U( }3 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ?+ G: X! |, V" ]; k( l1 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + p: P! U; p! X" L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 s( u: d: f' ?/ m0 u" W
  48. #else
    ' J! ]3 F( j: H
  49. #define DMA_PRINTK( x... )6 ^2 w3 g* v. N: p
  50. #define DMA_FN_IN4 W- u1 W- R* ]! g0 r
  51. #define DMA_FN_OUT9 u, T0 D$ y, ?. y, r, `8 X# Y0 C
  52. #endif
    # Q: n9 q/ x( L) Q. @3 B6 H

  53. ! o9 U* P- \0 U$ b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 {% M6 t5 r7 l3 g" K* L0 Z
  55. #define STATIC_SHIFT                3
    4 {( D( d8 K- A& B; n# Q
  56. #define TCINTEN_SHIFT               20
    ! J8 t; V6 l2 Y
  57. #define ITCINTEN_SHIFT              21
    ) T% _  _: T7 a4 v$ @5 G4 ?/ x0 X
  58. #define TCCHEN_SHIFT                223 M4 e2 z: U: ]8 N
  59. #define ITCCHEN_SHIFT               23
    9 K; @2 h3 e  }  s1 f+ b, U
  60. 5 F# J, |/ M+ n* \- g
  61. static volatile int irqraised1 = 0;( G1 @4 a+ ^  R$ R$ t
  62. static volatile int irqraised2 = 0;
    1 B7 a- j6 @6 ?5 O: C/ m1 m3 X
  63. 9 i3 ]% m+ \1 |. C* v2 _% b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : X' r* ]7 I/ Z, f. [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      H5 }5 `$ E2 X8 Z  x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. i: W1 w2 [9 z# Y6 e4 D

  67. : i6 ~  B7 @, a# e3 H
  68. dma_addr_t dmaphyssrc1 = 0;
    " z6 o1 w0 F/ Z+ t  f; W; j% N) C8 \
  69. dma_addr_t dmaphyssrc2 = 0;# M4 [7 r* m7 `# w1 S, n
  70. dma_addr_t dmaphysdest1 = 0;
    * R/ j% t' Z; b# }! `. U
  71. dma_addr_t dmaphysdest2 = 0;
    6 d5 y8 f5 S# T3 f

  72. ; u* a, ?' q/ s8 |2 ~( P2 n
  73. char *dmabufsrc1 = NULL;
    ( ?/ }- y" b; B# T. n+ Y/ E/ z8 }4 K4 c
  74. char *dmabufsrc2 = NULL;
    9 e* n- H2 W, R: O, h+ j) i
  75. char *dmabufdest1 = NULL;# q- F8 z# f4 ]# d
  76. char *dmabufdest2 = NULL;
    7 _5 ]$ v6 N& @9 `4 a6 ?3 t" R& Z! V

  77. " {( p  m/ i1 J8 ^% ?  A
  78. static int acnt = 512;
    " D& y( l3 x# n, C* Z2 V8 E
  79. static int bcnt = 8;/ N: I' T% j+ ~, x$ m( u5 }
  80. static int ccnt = 8;7 {% ~  S/ L' v, e+ y; V* C
  81. : i; E) U! V% p
  82. module_param(acnt, int, S_IRUGO);
    1 P+ a& g3 v& ?$ {
  83. module_param(bcnt, int, S_IRUGO);
    " P0 w3 W; e5 c9 e5 q% l( v3 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ U% `. @6 |% Y' e  ]. E, `2 z" E0 @) @# k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& m! N5 s4 J+ o& {" D9 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* @4 M( t" `2 I; w0 P  d- O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 S& d- U. C7 N
+ e; \: T7 T7 _  n: t
9 r& c! H6 B! L  u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 11:45 , Processed in 0.038023 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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