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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 x: q; ~; q- a! t) U
  1. [code]EDMA sample test application8 S; p3 o4 @$ g
  2. /*1 L! h2 {6 L; Q# i' \1 H: y
  3. * edma_test.c
    , H1 z  H7 c6 F7 |% R5 g1 U7 C
  4. *# P+ q' x9 F& U, R4 U
  5. * brief  EDMA3 Test Application
    ( K6 o5 w+ ]: v5 X9 B
  6. *
    * [* u# w4 T8 t0 W
  7. *   This file contains EDMA3 Test code.) M8 a- C9 k  d  Q9 N
  8. *
    0 a$ L/ {2 K* r6 ?$ y' R9 w* d) F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ `% D2 V) w8 m) |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ x; f$ q& }8 G+ B  J
  11. *         TO CHANGE.* }+ u* q& P- B- \# p" P$ A! \
  12. *
    ' D! f! I5 K5 ^" O& W2 X5 f7 v+ t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % |( j2 }. v) z# I
  14. *
    ( _' ~$ V+ C4 e  `6 `5 b& Z$ z7 \
  15. * This program is free software; you can redistribute it and/or
    & ]* `- E+ M3 U( L( q( G: @- T
  16. * modify it under the terms of the GNU General Public License as
    ' E. Q7 b% O7 C  G" M' p# b8 V
  17. * published by the Free Software Foundation version 2.
    & x( C2 @% [7 \, X  d
  18. *( N% u6 ?0 O* L5 V1 R' i: x9 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ J" r8 g7 o. ?% [+ a
  20. * kind, whether express or implied; without even the implied warranty
    ! y* S& I0 D5 V. w: D+ Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . Q, A5 _8 o& O. u- W. o, @
  22. * GNU General Public License for more details.- h8 f! l: s1 L0 S6 |9 w9 z
  23. */
    8 V, ]# X% j/ r* V3 ]; t2 o& @

  24. - y$ X7 A, W+ x4 b, `
  25. #include <linux/module.h>
    6 |9 X4 D6 B& @% }9 Y: `
  26. #include <linux/init.h>
    6 H: |0 Y& T( l; z& B: L) a6 k2 Y) x
  27. #include <linux/errno.h>
    ; f7 Y/ V, s/ g3 @: U" t9 v+ V
  28. #include <linux/types.h>8 o$ }! Y- Y1 `4 |' z& {
  29. #include <linux/interrupt.h>
    1 l8 j& C8 A: @0 _* H% t) o- r
  30. #include <asm/io.h>
    0 L% J7 d( l! O3 J
  31. #include <linux/moduleparam.h>. r. M( M+ P  a" z% L( V# _
  32. #include <linux/sysctl.h>& d& i( U6 v+ |& S+ v4 N; [
  33. #include <linux/mm.h>1 D5 P# N0 x; u. d2 C9 {( a# {
  34. #include <linux/dma-mapping.h>
    1 ~8 [9 {9 z* T- j5 o
  35. : T* N4 @7 J9 X2 |. Y1 i
  36. #include <mach/memory.h># Z% i* X& _/ [: Q# Z
  37. #include <mach/hardware.h>8 C" m) T. g1 @
  38. #include <mach/irqs.h>
    2 w( \+ G5 r9 x1 Q3 j9 H9 ]+ P
  39. #include <asm/hardware/edma.h>
    - D$ I6 @/ U9 D5 E

  40. 4 f! k6 ?  h: P% y/ F4 S, ~
  41. #undef EDMA3_DEBUG5 @* J& G7 N8 L4 g
  42. /*#define EDMA3_DEBUG*/$ [$ a. \9 G$ v1 j6 l) N) e" j

  43. / t9 P5 g' R; G7 f+ \
  44. #ifdef EDMA3_DEBUG4 }: y8 i6 f. X. M" p) g0 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 s. B9 @: d1 j0 V. R( j4 e* y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), h2 o7 X. c# E3 `" J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( N& \3 x" {/ {. ^: L4 h# x
  48. #else
    $ q+ `3 R* I  J  L9 G# x$ h; L
  49. #define DMA_PRINTK( x... ): Z" I$ V  L4 j8 m: p$ d
  50. #define DMA_FN_IN
    8 e5 X( R+ c, ]) t! Z* l+ Y  H
  51. #define DMA_FN_OUT  ~3 o, k- t  A
  52. #endif4 P) a+ t8 I; h# e$ H) h( t% S( ~4 M
  53. " C! E$ f# F6 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + p7 u4 D' P5 z: o0 G
  55. #define STATIC_SHIFT                3
    ; ?+ z" g( Q4 n, P( U
  56. #define TCINTEN_SHIFT               20; K4 k4 n9 D( j8 Z0 I' j
  57. #define ITCINTEN_SHIFT              21
    " m- C: D* B5 ?8 q+ f0 W6 s
  58. #define TCCHEN_SHIFT                22! G; R" s+ ]+ o
  59. #define ITCCHEN_SHIFT               23+ n  y" J+ y" H& V
  60. 9 A; r# e6 P, s) e# Z
  61. static volatile int irqraised1 = 0;
    7 Q( m, {2 `% G% N
  62. static volatile int irqraised2 = 0;1 t; O7 h) X# A- F

  63. * w$ y) X# M/ N' L2 ^2 C4 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' Q/ S+ ]; A4 A) R/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - [* t- B8 C2 o' `+ D4 [: c  i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . J1 I* ?" K+ ^1 P" L

  67. ; P1 v0 x5 u' Y1 ~+ X- m+ S, m
  68. dma_addr_t dmaphyssrc1 = 0;
    % k  Y+ ~& A. |; |5 K$ \( C
  69. dma_addr_t dmaphyssrc2 = 0;9 e. `. B! u  [0 M' S
  70. dma_addr_t dmaphysdest1 = 0;, ]% ~" L7 W* `
  71. dma_addr_t dmaphysdest2 = 0;, o( E+ }) ?) z; d" o0 v4 `: a( O
  72.   _9 S+ }' L5 l2 A: X
  73. char *dmabufsrc1 = NULL;
    & o1 D% G" c5 h% `/ T. z7 d: a6 C
  74. char *dmabufsrc2 = NULL;
    ( J5 ~: m! {' @3 h/ e, U
  75. char *dmabufdest1 = NULL;- ^8 K- ?$ p" u
  76. char *dmabufdest2 = NULL;# ?4 B2 w5 ~, _  F

  77. $ b  ^5 r, U. G1 |5 u
  78. static int acnt = 512;
    7 g5 u2 I2 C% h4 ], i( W- g, O
  79. static int bcnt = 8;
    7 W& R; z- D- V& Q- y5 d  f4 y9 Z
  80. static int ccnt = 8;
    5 N* r: o$ {3 P. |0 q( C" [

  81. . ^/ ]8 c" T1 s3 [  {
  82. module_param(acnt, int, S_IRUGO);
    ! g+ e" q5 N' u9 c' E0 _
  83. module_param(bcnt, int, S_IRUGO);
    : S2 T. n+ X9 P. E+ i. a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' ]7 p' |' i/ b+ b7 r4 V

7 ]) `- w* f' ^; E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 V5 ~6 u0 j) S! ~- ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! L: a5 |: q( D1 B9 I* `& K& G6 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 B# `- f; t" {! Q1 u

* u1 d6 x; W) x7 e9 ^9 ?" g9 G+ ?8 k' V6 T1 }% L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 06:42 , Processed in 0.044698 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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