OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 @5 S  b" R2 H2 S
  1. [code]EDMA sample test application0 I0 f$ s2 }, p' G7 A3 @
  2. /*
    8 c/ r- c& r8 }' P4 D
  3. * edma_test.c5 U' o- C* y2 U
  4. *
    * @% M6 m4 e. c0 x
  5. * brief  EDMA3 Test Application
    & l9 X6 U  }5 `; x- i
  6. *. ?% Y  D. w6 x3 i4 t$ M( l
  7. *   This file contains EDMA3 Test code.
    ' u& p& b# x; _1 I7 _9 n
  8. *" B" L  k4 x3 N3 G/ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; p+ j# c" @; p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - Y# I) y0 B; [
  11. *         TO CHANGE.
    8 t* Y$ K# K1 n3 J6 j. x) L
  12. *
    0 Q. ?) E  b. R* D4 J8 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# h& z0 [. l& W  a8 T6 m
  14. *
    : w) e$ ~2 V: f9 C
  15. * This program is free software; you can redistribute it and/or
    3 n- ]6 p. c4 z4 L1 G8 I
  16. * modify it under the terms of the GNU General Public License as+ n6 e. I' `  Q+ A, s2 m& V
  17. * published by the Free Software Foundation version 2.  h* W  H) U/ U% E& L# k
  18. *5 N6 i& I- ?# @# I6 Q! v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % z2 t& d' G& i1 O- a
  20. * kind, whether express or implied; without even the implied warranty+ f+ `1 e- _: c' E: R! W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 g; P5 ~2 [. |# b: F
  22. * GNU General Public License for more details./ w) t0 P% ]9 }; U0 J& r3 V
  23. */9 m, D; J9 w2 o4 D0 S
  24. * M( D3 F' a3 ?  e5 {. d$ W! d
  25. #include <linux/module.h>6 n* Q1 _& y& Q2 g9 X7 T% v. y
  26. #include <linux/init.h>5 h" A  h; Y+ v$ D
  27. #include <linux/errno.h>1 |# {5 h; @, S% v) }$ p9 o0 B- p( K1 @
  28. #include <linux/types.h>
    / F% C! i5 R5 i: ?/ Z% H# U0 r9 U# @
  29. #include <linux/interrupt.h>
    " j/ k+ ~1 ^, E: D/ p& Q+ X
  30. #include <asm/io.h>: a, O  G' p, [
  31. #include <linux/moduleparam.h>* @$ s9 }' N- n% O. n, {+ p
  32. #include <linux/sysctl.h>
    6 X2 K$ B; y2 t! C
  33. #include <linux/mm.h>
    1 |& x6 t" p; K
  34. #include <linux/dma-mapping.h>" _; F& [% Z, W9 x
  35. * X) U! Y1 a5 A9 p( l& ?+ V
  36. #include <mach/memory.h>- D5 S$ Y: Z3 f; N" W, K9 u$ t
  37. #include <mach/hardware.h>! b8 @/ H( y( ^3 Y' k, O
  38. #include <mach/irqs.h>4 P' B" ^0 \: j4 P1 d" b/ s
  39. #include <asm/hardware/edma.h>
    0 A* u( X# c' X- S' ]3 b& O$ {

  40. 6 r/ [4 X$ }/ J- u  L9 j1 r
  41. #undef EDMA3_DEBUG+ E" C3 H. P1 x
  42. /*#define EDMA3_DEBUG*/
    % q' F6 u8 G* S+ j
  43. 3 r- Y/ U  U& o2 b* ^
  44. #ifdef EDMA3_DEBUG
    2 I' _# U' Q* e5 M( [) x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + e/ z% a& y  S) K" U  l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 P# T* o$ ?* e0 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& @! H# t: w7 S. l
  48. #else
    . c. ]5 n' D7 _1 S) j5 E
  49. #define DMA_PRINTK( x... )5 N; l: s3 [, m) V
  50. #define DMA_FN_IN
    % ^( ?& ^1 ~2 b/ v
  51. #define DMA_FN_OUT$ M: z& ?& [% `+ M% @
  52. #endif4 h  h2 B( D" s" J7 t2 ]
  53. $ f2 n2 z/ G% F, _! y; K7 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 p+ w& w" c- l& U) k8 n5 [. G
  55. #define STATIC_SHIFT                37 C+ S* v$ e' k% G2 i/ p0 {6 R
  56. #define TCINTEN_SHIFT               20# W% R/ b" i0 i" [- c
  57. #define ITCINTEN_SHIFT              21
    3 g; Y* T0 C; o5 r# ]
  58. #define TCCHEN_SHIFT                22
    / }' i  W$ U% k" S' \
  59. #define ITCCHEN_SHIFT               23
    , n: V$ x  w' j. H3 p* N7 Y

  60. , w8 X/ F$ U- U8 v7 ?3 N- ]
  61. static volatile int irqraised1 = 0;
    3 m" \# Y5 Y7 p  b) G8 |" o
  62. static volatile int irqraised2 = 0;
    : j) L, g5 Q$ d3 W4 Z3 c& x
  63. " R7 L( G: Y) J" O0 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % d7 l: }9 m, i  s3 N) e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 |. @/ i9 L! \7 {2 ^# }4 B7 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C5 T* V; z: B

  67. # t+ c  Q8 }  P, j
  68. dma_addr_t dmaphyssrc1 = 0;
    ) u. m. \/ a8 |1 V
  69. dma_addr_t dmaphyssrc2 = 0;2 \! \, b. x8 V) E6 G# e* b* y
  70. dma_addr_t dmaphysdest1 = 0;
    7 h! r5 [. j' u! N6 |" o& H6 ~% B
  71. dma_addr_t dmaphysdest2 = 0;
    $ N" c  S1 `) P) F
  72. ( S5 Z1 }( n" I2 s6 W
  73. char *dmabufsrc1 = NULL;
    ! ^7 n0 j) |+ i8 A7 |8 ?
  74. char *dmabufsrc2 = NULL;
    * f# W2 q& C" ]4 w  J
  75. char *dmabufdest1 = NULL;
    / R, R% I6 W' M9 K8 `; t2 S4 O8 ^5 k
  76. char *dmabufdest2 = NULL;
    , N. d  m" W  ~. t
  77. 6 r: d  b# c0 T% ^- m+ S2 _$ u; }
  78. static int acnt = 512;
      N6 w, }& n: F& ?8 q- C; Y2 J% j
  79. static int bcnt = 8;1 u( }% Q5 a$ y# l  ?" Y5 Z! X
  80. static int ccnt = 8;
    2 M# w, o, i; E, x6 u# R3 C5 a

  81. - a, u7 q) d) L$ j$ S. G
  82. module_param(acnt, int, S_IRUGO);; ]) v" C4 [3 j/ o1 _
  83. module_param(bcnt, int, S_IRUGO);
    . t$ M: b6 \, @3 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* O- ^$ Z: ^. h# H% F; Q* R( E. a7 V( f# q" Z- j! ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ W5 Z" m# ?4 I+ Y# w9 r# [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 I8 |3 }) V' N: v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ?) `8 E+ ]; y5 j9 D! j, X
! P# ~* ?" r4 n5 K! p

* f' W! H3 z4 ]/ B. [, j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-17 05:08 , Processed in 0.044386 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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