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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  q& a1 p" {% q7 x7 n; j& a+ P
  1. [code]EDMA sample test application
    % {$ E/ H; J8 e9 l/ |
  2. /*
    , Z( L5 t2 O$ w2 @& \
  3. * edma_test.c
      b. N+ Z3 x' x& R1 A
  4. *# n2 ^; @7 _0 R# Y  M
  5. * brief  EDMA3 Test Application
    * l& S( q* y- p  H9 Q' r; i
  6. *8 v9 I6 B9 S4 ^+ p% F
  7. *   This file contains EDMA3 Test code.- k7 n7 q5 u: Q' _
  8. *
    7 `6 v& R' I1 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % {* C- Y, A4 s$ h6 g+ ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) O6 J- z& U* R
  11. *         TO CHANGE.$ q, J8 A$ P& [- W: q" `: M
  12. *
    % X! p7 U( m$ d9 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( Q/ h5 G& a6 m
  14. *7 E" e4 y. @- b4 R* I; i! O1 g
  15. * This program is free software; you can redistribute it and/or) {8 ~3 N/ s+ C
  16. * modify it under the terms of the GNU General Public License as
    : m& Q+ Q2 H; q- {, ]
  17. * published by the Free Software Foundation version 2.
    5 p8 Q7 g: X- z( s7 z6 X
  18. *
    * k0 A; e3 e# G. y# t8 _$ h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , L' Y; }) ^# w0 Y" o
  20. * kind, whether express or implied; without even the implied warranty
    0 i) N9 D2 J8 s6 C: Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 N# W0 n  g# g8 B9 p. o% ]; |
  22. * GNU General Public License for more details.
    0 Z3 s- g2 z' Q; Z2 L
  23. */
    6 U: `( n* ^* ~0 t- X: T* Y% A
  24. ( z6 m6 n# d; J0 I$ v, `: a
  25. #include <linux/module.h>/ R% Y" ~; K7 l0 g
  26. #include <linux/init.h>
    ! A' X, j6 g2 l' s0 L
  27. #include <linux/errno.h>
    ) m$ J! P! a/ c+ [7 ?5 P
  28. #include <linux/types.h>
    8 k, s' O/ ?. a, T- w7 D4 S
  29. #include <linux/interrupt.h>
    7 a6 Z6 C0 p, H9 |8 x) ~9 t0 v$ U
  30. #include <asm/io.h>
    4 P6 U3 x( m# D) Q3 I
  31. #include <linux/moduleparam.h>
    3 x8 f2 f3 h% L- |+ k
  32. #include <linux/sysctl.h>' `3 E2 H4 p- ~: j" ~3 W
  33. #include <linux/mm.h>
    2 e8 z6 I+ N- \% u2 G$ m" j
  34. #include <linux/dma-mapping.h>
    / e7 S/ c& Y- |4 Z2 G2 S9 u9 l

  35. 2 S% p& n$ g0 A
  36. #include <mach/memory.h>
    1 ^' d5 b# v" @/ {
  37. #include <mach/hardware.h>
    ! @: O' }4 h7 [2 E$ Z# R
  38. #include <mach/irqs.h>1 {# V! ]5 g( E7 a1 i/ B! K) G2 H& P/ v. U
  39. #include <asm/hardware/edma.h>: o# ~6 n0 J: Q1 r5 }' x
  40. 9 K$ }% m: G/ R/ b$ ]
  41. #undef EDMA3_DEBUG3 t, |5 v5 f+ B' F, c1 E7 ]
  42. /*#define EDMA3_DEBUG*/
    6 g+ [2 k0 |: \2 `5 G) w+ _

  43. 6 m: }7 A' g$ H' S5 ^, X; _
  44. #ifdef EDMA3_DEBUG: m/ ^( G' J/ j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); P8 w; J7 M5 j* l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , [! w: Q" {; A/ P. ^6 l3 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + [. {/ w+ c. l7 B" x" q
  48. #else
    9 d% M! o! X- J
  49. #define DMA_PRINTK( x... )4 y0 r: E  D& @1 n+ c5 z/ w! c
  50. #define DMA_FN_IN! i; t6 G6 R- R
  51. #define DMA_FN_OUT
    + w# E, ~9 K$ [
  52. #endif- i7 f) f7 t* n" C9 [

  53. 0 W" Y5 J3 S# Y4 p( V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 q4 {: O5 a1 f$ \# N; E! Z
  55. #define STATIC_SHIFT                3
    ( U9 T) ]  `% g/ U) w- ^7 p8 }6 i
  56. #define TCINTEN_SHIFT               20/ B" `! {' J9 r( a
  57. #define ITCINTEN_SHIFT              21
    $ J) R: @5 Y- Z2 c$ D
  58. #define TCCHEN_SHIFT                22
    7 }9 I  `) n; P) L4 H0 n1 P
  59. #define ITCCHEN_SHIFT               23, h, h9 j2 ^- P4 U
  60. 2 t# g* ?: r0 b5 t9 t+ e' d0 C0 W
  61. static volatile int irqraised1 = 0;$ t5 }& p; y+ L% l
  62. static volatile int irqraised2 = 0;0 f/ O$ @8 Z7 d1 b4 r- ?- @
  63.   _6 M, d% e9 d( s" k# W# n/ f& Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 k, C- p( H, N3 L, A5 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! y: h' \" ^5 K% T' T- J. {. g0 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& s9 p/ O" h9 e& h

  67. " a( `  c" Z! Q
  68. dma_addr_t dmaphyssrc1 = 0;
    3 Y( x. v; {4 a# O
  69. dma_addr_t dmaphyssrc2 = 0;$ C: E* E1 O; L" [1 Y2 p
  70. dma_addr_t dmaphysdest1 = 0;8 d, U8 L5 @/ Q$ I- Y: S) ~
  71. dma_addr_t dmaphysdest2 = 0;
    8 m. w0 f. Y! K, Y4 t
  72.   R- @5 `; v, ]3 P! p8 W
  73. char *dmabufsrc1 = NULL;
    ! |9 s& [3 j( z1 v
  74. char *dmabufsrc2 = NULL;
    0 \+ p: S. `  e4 m  h* ^) y  Z4 i
  75. char *dmabufdest1 = NULL;3 K1 l8 f* c6 ~  m9 V
  76. char *dmabufdest2 = NULL;
    5 F9 b* {* c; f9 B3 X7 a" A
  77. ' t3 O; Q+ ], ]& J5 E4 j
  78. static int acnt = 512;% }( q1 Y" S( P2 z) n2 z" j3 r
  79. static int bcnt = 8;
    / R  x% J" b- \
  80. static int ccnt = 8;
    0 X6 D( k& r, w2 s; i' G8 ?; i# f

  81. + D# p7 x: V& d9 z/ r0 s
  82. module_param(acnt, int, S_IRUGO);- |& c% B" Q$ ?% a
  83. module_param(bcnt, int, S_IRUGO);+ p6 Z/ J! t" C9 C+ M- r& A5 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ g6 w- \. b! Q8 d

; B! H8 s% T& d' K, J7 ]" Z" |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 z( T3 r6 A" T# f' v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 o- _& B. I( F. j4 h. {3 K* w  F& j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% Z* f! V* R8 N9 g  z
( y& o) E8 Z& y9 d7 A
  I5 ?& m# g1 a4 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 18:40 , Processed in 0.042363 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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