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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) u- \6 Q6 q7 Z/ [. |7 S
  1. [code]EDMA sample test application7 J( k9 O8 Y8 {
  2. /*3 L* Y, ~5 a6 F1 Q- ^/ p
  3. * edma_test.c- W3 W% Q- }4 D  i. [
  4. *  d3 Q6 j$ X7 [$ n8 g8 o! \, C" r
  5. * brief  EDMA3 Test Application. I/ @; O( M2 S" z8 k- Y: k
  6. *9 \& o8 @/ D/ j3 K1 N1 }
  7. *   This file contains EDMA3 Test code.
    & k' A+ P2 @; I/ \! T
  8. *
    % E9 u& l! ~- _+ v" w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . G( i' F; |+ M3 F+ \  z; G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 v" @) G1 |5 k7 r  S' D. \: f
  11. *         TO CHANGE.- q. r7 r6 E7 H
  12. */ ~& H& O2 s) R( w. g! V5 B. \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: U  L3 N7 e6 R0 h' t' m
  14. *
    ) H' w3 O$ z  ^9 {
  15. * This program is free software; you can redistribute it and/or
    ) J  s" C: s3 ]+ _1 T" X8 Z
  16. * modify it under the terms of the GNU General Public License as
    6 ~) _6 h( Z8 b# x1 Y
  17. * published by the Free Software Foundation version 2.
    8 d- _" ?- C/ w8 X7 g
  18. *2 d1 S! D) e* s$ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 l  h; H* a) M8 v/ I
  20. * kind, whether express or implied; without even the implied warranty
    / Q! x/ B+ V* i$ Z. ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ Q! X  }% Z/ W4 r4 b: n$ `
  22. * GNU General Public License for more details.4 P- Q8 a( c# B' s. a
  23. */8 l& O$ ]4 u6 H4 Q
  24. ( Z# L  h. h; T) X% k
  25. #include <linux/module.h>
    0 U* M8 }! ]$ p* U, k: h8 u, C
  26. #include <linux/init.h>
    1 F* _% B8 I$ z) k
  27. #include <linux/errno.h>$ D5 [5 R3 r" o
  28. #include <linux/types.h>4 d, v: M6 \# q" W7 p$ z, D' k4 F3 w
  29. #include <linux/interrupt.h>' H3 w! I6 j) N* F- ^
  30. #include <asm/io.h>2 l( s% C; _& o; [5 Z# E
  31. #include <linux/moduleparam.h>3 j  W" ]' _, C4 Z: o& A
  32. #include <linux/sysctl.h>! a/ s; ]/ s- k
  33. #include <linux/mm.h>% `8 J0 K# \0 @! i1 a
  34. #include <linux/dma-mapping.h># T' s, x, d6 L$ U0 R7 v
  35. , I/ V3 `9 J* P
  36. #include <mach/memory.h>& k  Y; C4 E5 w
  37. #include <mach/hardware.h>; u4 g5 |* }% y
  38. #include <mach/irqs.h>
    / q/ i/ Q; v% F: Q) p
  39. #include <asm/hardware/edma.h>
    ( N- I; t! M* @1 x0 _3 U0 i" O8 ~

  40. ; v& s0 d+ ^/ D' `% O4 m
  41. #undef EDMA3_DEBUG' f/ B8 U5 R. C1 f( ]& v6 O
  42. /*#define EDMA3_DEBUG*// y: f% u5 m0 V; g5 M0 M
  43. ; B# e9 M2 y  F' T( P0 p; ]4 w- {
  44. #ifdef EDMA3_DEBUG
    6 C- P/ ]0 _  K3 w1 Q  k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + ~9 I) _9 ]+ C/ M, ?, M( _) \8 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ]6 V6 C" E2 N/ Y/ b( S/ u% z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- M( H- l5 ^8 R3 S  t1 U% P$ [; V
  48. #else1 S4 h9 D+ A) ~
  49. #define DMA_PRINTK( x... )& X* V1 s2 t( F3 u% K2 D; O* L
  50. #define DMA_FN_IN
    : [( Z! ~# C5 x+ \& ^
  51. #define DMA_FN_OUT
    ( A1 |3 B/ J+ C6 H! e. I% n$ L
  52. #endif+ J9 `9 e) P3 M6 @/ o

  53. 8 q" Z4 a& l8 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). H2 K; t5 h; b( }! ~0 X7 Z( o
  55. #define STATIC_SHIFT                3$ _4 x9 X, C% t, T( o
  56. #define TCINTEN_SHIFT               205 w7 @( y4 E! `$ m( m" w
  57. #define ITCINTEN_SHIFT              21
    " k6 C5 v  v! b; m6 G) |/ X2 Q
  58. #define TCCHEN_SHIFT                22
    & x' I, u% Y) r3 s0 a: z
  59. #define ITCCHEN_SHIFT               23
    # @' I6 ]9 E( t4 v5 B
  60. 5 N. Q+ b! E; e& D, e2 K
  61. static volatile int irqraised1 = 0;
    & C0 \0 [  W8 o& K6 O* E& \' w" |
  62. static volatile int irqraised2 = 0;" }2 I, q1 S+ g5 U6 G7 D- Q
  63. ( Q9 o9 |2 s5 ]/ p( _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) y8 ?- N6 D0 x4 E' v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + q( t+ S: o3 R* J* C: p9 Q6 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 C$ Z0 I& r/ _: o5 a1 z
  67. 3 b4 ^4 M- y1 F, a; o1 e; n
  68. dma_addr_t dmaphyssrc1 = 0;
    9 a, ]0 C* g  S# ^4 U* p) c
  69. dma_addr_t dmaphyssrc2 = 0;
    & {0 I* E- [* w$ i3 [
  70. dma_addr_t dmaphysdest1 = 0;
    ( |8 V" T8 T  @3 U2 O9 D2 a9 f2 U: b& Y
  71. dma_addr_t dmaphysdest2 = 0;
    " c8 J' @! E$ M/ Q- i- j/ \$ q

  72. 4 g# b# ]' @+ K+ I; x$ d
  73. char *dmabufsrc1 = NULL;
    ; r) n' X% {% P2 X6 C) G8 S+ C
  74. char *dmabufsrc2 = NULL;
    ; z. C, c( E' s4 T! }$ N0 o- u
  75. char *dmabufdest1 = NULL;
    ) I% `5 j5 U# @0 U2 }# @
  76. char *dmabufdest2 = NULL;
    + |4 Q& ]& R9 E5 D
  77. 4 n% }  p4 s( e. b
  78. static int acnt = 512;2 T7 l9 l# K0 v! n
  79. static int bcnt = 8;
    1 U0 T' v" Q1 P& t1 X
  80. static int ccnt = 8;7 c; ~" G! W3 u/ E: W  o3 L0 {* x7 C
  81. : G9 }) ^# K7 o8 v- R6 o
  82. module_param(acnt, int, S_IRUGO);
    8 @# ~! x6 W) q
  83. module_param(bcnt, int, S_IRUGO);* l' H9 t0 G2 T$ _; P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 E$ h. {0 e$ [% T( L. J: Z7 K& d- |
" N" d/ o0 r$ w# f4 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ~# g1 V' Q) I3 N6 y; V; g! K& K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 A# q: U; X4 I) _" }, s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ u; X) r$ l) p: l6 `
% ~( r# X0 ?' k& G4 h: O

- B  S# a) h# Z  c# k6 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 18:38 , Processed in 0.040000 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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