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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) t1 {3 g( ~6 N5 O% g, \& R  i6 m, Y
  1. [code]EDMA sample test application6 v8 i  e" q! R$ ?: k7 H6 r4 {
  2. /*, a5 ?. z# k9 G, n; U. k& y/ B# d
  3. * edma_test.c! Q- D# C3 P; m, e' t3 f' K
  4. *
    - f2 ]5 `) C7 ^5 T' g
  5. * brief  EDMA3 Test Application- t. i1 F9 u& P/ Q9 E5 i
  6. *9 R1 h" O! Y9 G6 z
  7. *   This file contains EDMA3 Test code.) j! b' ?. ~4 Z8 l! l
  8. *
    8 _8 t# p' W& o+ x) Y2 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : y2 z$ u4 d" ^& O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# X+ U$ U* @0 ?7 \  u
  11. *         TO CHANGE.
    5 @0 D% c% L7 J5 {4 i
  12. *$ `3 ~0 ?3 A0 U; ]3 S0 x) }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 H/ Y+ x; D$ d( c# M7 d% Y* ~
  14. *& G& u, k4 O! A( F4 X5 V
  15. * This program is free software; you can redistribute it and/or
    % O) Z: e4 @  w( C$ q
  16. * modify it under the terms of the GNU General Public License as2 x- l0 R0 N7 r1 l( Q+ T- j
  17. * published by the Free Software Foundation version 2.  J$ c" o2 r0 V( b5 u# J4 {
  18. *' k6 g7 V7 _8 [1 q+ {6 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 A+ K- U0 B6 W( N; f2 E
  20. * kind, whether express or implied; without even the implied warranty
    : v& @% u0 [+ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( e! {' N# H) p7 q8 f
  22. * GNU General Public License for more details.$ r* p) o! ~. r% @) j
  23. */% _4 |3 k- `3 r

  24. 8 A* Q4 O: W" J' |$ P; c7 ^- m
  25. #include <linux/module.h>; D7 L2 ?8 c5 a5 @7 C
  26. #include <linux/init.h>
    5 @7 j) S% _* H) q' \$ D
  27. #include <linux/errno.h>1 K& ^) ~& P# C
  28. #include <linux/types.h>$ h4 r$ a: C5 P6 K% a: `
  29. #include <linux/interrupt.h>' ?4 i: B1 T; A9 ^
  30. #include <asm/io.h>! H3 v- S/ E# g; F) x" T
  31. #include <linux/moduleparam.h>; m! D, A- t1 l+ N2 j
  32. #include <linux/sysctl.h>
    ( o' s2 a! w& r) F- G
  33. #include <linux/mm.h>
    ; o4 v. r* U8 F
  34. #include <linux/dma-mapping.h>
    0 w# s6 t, J0 G/ s+ {- z4 H' g& [

  35. ! q  |8 b) M  z% o
  36. #include <mach/memory.h>- W& L# R  Q) Z: e. m* {# S
  37. #include <mach/hardware.h>) ]2 N7 f* M1 ?5 k
  38. #include <mach/irqs.h>
    # K. h6 E( Q7 m; G
  39. #include <asm/hardware/edma.h>+ T" N7 V5 T# p
  40. 4 z+ M" @- O5 J
  41. #undef EDMA3_DEBUG
    6 e8 m9 {6 C& T! Y8 l
  42. /*#define EDMA3_DEBUG*/+ b: v5 @3 R  t! ~. b$ Q0 m

  43. - k% S5 ~6 X: U& h0 U
  44. #ifdef EDMA3_DEBUG
    * X, H7 C) B4 R5 J) B, V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): D; |0 Y6 ^, U! |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* `. Q$ `! ^  V& C* f7 k1 K. W' v1 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): c. f2 @/ e4 p
  48. #else
    & B2 @2 n8 m0 s* O7 {
  49. #define DMA_PRINTK( x... )
    7 r- d& S5 [8 Y
  50. #define DMA_FN_IN
      J4 E7 b4 v, I9 ^; L8 ?$ }) r
  51. #define DMA_FN_OUT
    % {8 K( f2 _" c7 n% S, Q5 R
  52. #endif
    0 Y; O/ \$ o' R% ^0 f) Y  K
  53. - _9 m( {& t  W+ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 Z: \' \0 z0 w( L
  55. #define STATIC_SHIFT                3! K! z+ W5 o, \1 R5 g1 ~
  56. #define TCINTEN_SHIFT               20! g: ~) V" U( ~" M5 d: e. P
  57. #define ITCINTEN_SHIFT              21+ N2 C5 V( Y! h
  58. #define TCCHEN_SHIFT                22
    1 Y( A. I6 o6 e% p$ ]
  59. #define ITCCHEN_SHIFT               23# p$ v- t  e% o# I

  60. 9 \+ Y: t$ W; i8 P0 b
  61. static volatile int irqraised1 = 0;
    $ G2 Q( y8 z# N
  62. static volatile int irqraised2 = 0;
    - D* H9 y& ?2 Z

  63. / V- O$ K+ @4 Z0 Y0 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! l2 r. ~" c9 l* S3 V' E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' @" n) O3 u; Y3 l6 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 J0 [- S1 s  Z# o  H
  67. " ]7 ~  D3 e( E$ k& G
  68. dma_addr_t dmaphyssrc1 = 0;$ F) ]; v3 ]( [- p7 H% ]' @
  69. dma_addr_t dmaphyssrc2 = 0;2 @) t6 G, o% H8 f  B% x( B
  70. dma_addr_t dmaphysdest1 = 0;
    - z* {. r# s- c9 K
  71. dma_addr_t dmaphysdest2 = 0;1 [6 w% U$ [- m# \

  72. 1 ~1 {4 b- M+ g9 F
  73. char *dmabufsrc1 = NULL;
    ! a$ ~& P0 ~1 L5 Z
  74. char *dmabufsrc2 = NULL;
    ) l- Q7 h  f. ?5 k
  75. char *dmabufdest1 = NULL;
    / L7 {& V! r$ W& a5 W
  76. char *dmabufdest2 = NULL;8 A# g7 K9 M5 J  n

  77. ) ]" H3 R$ W0 R6 m; d: l
  78. static int acnt = 512;4 P9 i  X6 G! n+ w3 R
  79. static int bcnt = 8;
    + P  L9 Z. A1 N& v: l) N6 h: x* C
  80. static int ccnt = 8;
    - h( }* V+ i% r8 \8 {% B" f

  81. + b6 c  O' J- Q/ E! C
  82. module_param(acnt, int, S_IRUGO);
    6 S$ u# x; ?1 g
  83. module_param(bcnt, int, S_IRUGO);
    $ d9 v; H4 U  Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) K7 H# l8 J3 L- z7 T* i! j5 g3 J: c  w( C, G$ K( [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 A1 x9 T, h) l7 k8 I& J: `1 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* E& G/ T/ j6 l4 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ O& o% S& i# C! X" f1 l* R! [* W& H  U4 ]& Z2 p
4 j- e$ }4 `& G4 m; ^; b7 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 16:41 , Processed in 0.039376 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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