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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 R6 \. |4 {1 u4 Z. K8 {
  1. [code]EDMA sample test application4 N- {$ F/ T0 m4 v" J/ X
  2. /*
    8 U( o0 L2 k/ x1 k; `9 Y
  3. * edma_test.c
    , k0 |8 p3 v- [1 ?2 v; e
  4. *" ?) }" Z; Z7 U+ s
  5. * brief  EDMA3 Test Application1 ~* b! s$ G; p1 ^( e" r; T
  6. *+ c8 D2 [+ G. E# g5 [+ o% [
  7. *   This file contains EDMA3 Test code.
    ' `5 K/ _& L- X$ d) ?6 v
  8. *
    8 Q5 V: y4 Y3 s4 V, |3 ~) W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, @8 K& {3 A9 G* h3 g  w% Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! v. I) d, j3 i/ Z2 u$ ~
  11. *         TO CHANGE.
    0 h, b  X/ i4 w
  12. *
    ' Y0 d5 x6 ~$ W' ]! h0 C+ l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" k) G* F$ E+ l
  14. *
    # m8 w# a. w/ h+ ]! P
  15. * This program is free software; you can redistribute it and/or8 M4 z+ J+ n" i, H, l
  16. * modify it under the terms of the GNU General Public License as
    : q/ ~4 Q) w+ q. P) G  e
  17. * published by the Free Software Foundation version 2.
    ( f* L% K: J5 Q! n" Z
  18. *
    . c3 N/ y2 b, U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) V! h+ Y  P6 X! y" M& X$ Z
  20. * kind, whether express or implied; without even the implied warranty
    - w& j# a8 l/ D+ V3 }) H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) w0 s- J$ y! |' x$ n
  22. * GNU General Public License for more details.
    $ M/ j1 n$ K  w' |7 R8 T, _8 H: f
  23. */* u4 g( U, j8 R( u6 I

  24. ; p) f, ]& |: w- M! D: M
  25. #include <linux/module.h>
    # }4 d% z) o5 m
  26. #include <linux/init.h>/ E2 c8 e) E' [! C  H: u" c+ [0 W
  27. #include <linux/errno.h>
    $ j7 C" E- O; }, ~
  28. #include <linux/types.h>
    / X/ k! D) l; a& X8 T
  29. #include <linux/interrupt.h>7 N8 L3 O% |) S0 t( {0 b# X8 _
  30. #include <asm/io.h>" E' J" [8 w0 [3 U. n. W2 H! `
  31. #include <linux/moduleparam.h>
    ) B+ a' g. A1 z' z" @' U
  32. #include <linux/sysctl.h>4 l/ I$ ]! x7 @* J8 I- m
  33. #include <linux/mm.h>
    0 [8 V5 H. D* B, k" O
  34. #include <linux/dma-mapping.h>3 w3 S- ^/ l9 o4 g4 f

  35. 5 T  p2 F& Z8 T: |
  36. #include <mach/memory.h>
    % y7 e, C- X& w, u) J1 m4 E
  37. #include <mach/hardware.h>
    ) F% Z- t# \+ q6 o5 F
  38. #include <mach/irqs.h>
    . l6 t1 ~; \0 s; \( `1 f
  39. #include <asm/hardware/edma.h>
    , e5 E$ ]! ?% G! G

  40. $ K4 i8 I; \! p2 \9 Y
  41. #undef EDMA3_DEBUG( a4 A" K2 W! x- }& m6 V
  42. /*#define EDMA3_DEBUG*/% z; c  B7 m4 D, i

  43. 3 ]+ k  b/ t. t
  44. #ifdef EDMA3_DEBUG
    ! ]' a6 w1 y' q+ x# J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). d, l9 ?  I9 y) S. B1 O* e: l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' m+ U8 |% v+ s8 N. H$ O* _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! O& W9 T  T- Y% n1 L+ Y* g4 `" W
  48. #else
    . `" Z9 b$ u& G" j! J# g
  49. #define DMA_PRINTK( x... )$ W, x! [8 o$ H# g' t
  50. #define DMA_FN_IN
    ; Z% K: O8 m* L) ^, B& \* A
  51. #define DMA_FN_OUT
    % R- h$ f. |. \6 M' W# E
  52. #endif
    ! X: u# i5 R5 F2 X, ~& ~
  53. 4 a( d) }) J$ v: X. Y' O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); J4 K( J3 U; e( Q: l! C
  55. #define STATIC_SHIFT                3, c0 @' \. H) n
  56. #define TCINTEN_SHIFT               20: [: Y3 _$ i2 F; y# O5 f# J; g3 F
  57. #define ITCINTEN_SHIFT              217 D* o9 l4 n3 I8 {2 G1 c) T( X
  58. #define TCCHEN_SHIFT                22# A2 d  ^. D$ n0 n  j# m  |
  59. #define ITCCHEN_SHIFT               23! M  ?  y& q0 |) n( X5 N" Q* Y- l

  60. 5 w0 x  N% L* X, T' K4 a
  61. static volatile int irqraised1 = 0;2 J" x) z( x: O% @9 O2 t% R; G
  62. static volatile int irqraised2 = 0;
    , P! t) m$ L; t* V) B

  63. 0 S1 g9 R, |+ f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - D, e. ~$ u0 I0 N+ S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ B- o6 B3 g9 @7 c+ i+ W8 Y* s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ W. n" M& |. b: @

  67. & }$ ?. _6 ~0 G7 D: V
  68. dma_addr_t dmaphyssrc1 = 0;
    : Q! W7 Y7 Y( }+ z" a6 g
  69. dma_addr_t dmaphyssrc2 = 0;5 T+ Q5 X3 j# K9 I6 f
  70. dma_addr_t dmaphysdest1 = 0;
    9 _1 R' l3 m' Z/ N/ k
  71. dma_addr_t dmaphysdest2 = 0;) k# G& V: v, f% f& ?1 m' i
  72. 3 }  x0 Z8 F* j2 o3 g
  73. char *dmabufsrc1 = NULL;
    : q2 B- q0 u" f
  74. char *dmabufsrc2 = NULL;1 f% y* U9 i# {7 W# R2 C- T4 T; }
  75. char *dmabufdest1 = NULL;# a0 F1 H  w' |5 @
  76. char *dmabufdest2 = NULL;
    0 s9 t0 P6 C. Q2 G* U1 o% T

  77. % a# ^& b8 K  E' y& e# K/ q
  78. static int acnt = 512;& K. y6 H- z! g; L. Z4 F" C
  79. static int bcnt = 8;- Z5 [+ u; L/ C+ a6 }2 [
  80. static int ccnt = 8;4 S3 X' u3 U2 }% @# k
  81. : [. Q" u" h$ h9 d4 G2 G* c% e
  82. module_param(acnt, int, S_IRUGO);
    $ z& O, `! M0 B9 X3 }+ J& H
  83. module_param(bcnt, int, S_IRUGO);8 d& d3 W/ l' [( X) i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' z& S* R" @  S6 X. O( b7 |# }3 P+ x* k0 @. W/ q0 _# `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- X; k' r- r4 i; g0 X, G. P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ _$ M. j  M5 L. r2 j7 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. Y  U3 U# I, ~+ [
; e$ n7 b$ v8 `- B* g
) H9 D. U% k1 Q7 l' e" @, T/ X; L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 19:25 , Processed in 0.039649 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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