OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ \4 o& x" V- \
  1. [code]EDMA sample test application$ d4 h9 j+ @. L3 h) }$ y) t
  2. /*! o, g: U, L% k: C8 \
  3. * edma_test.c
    7 F' B8 l1 n& O. h
  4. *
    ( G/ l3 x+ \" B$ ~, d
  5. * brief  EDMA3 Test Application/ V! F, ?( X  f$ j( k8 r
  6. *
    2 c8 @1 W  b% z2 D
  7. *   This file contains EDMA3 Test code.& H  l: p+ r- T5 e6 m0 B5 ~8 B( z
  8. */ _+ a. ^# ]# c+ l  R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 v/ x- w7 \# Y0 t% R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 k+ m( r0 K$ X. L1 J3 i) X8 X, t* ?
  11. *         TO CHANGE.
    7 O7 b$ ^3 k. l# {
  12. *
    , c" ~  A) M2 D) C( ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : l. N$ Q: X! b: D# J
  14. *
    + r/ L% b/ y- Z8 w, e; D$ C) g: K
  15. * This program is free software; you can redistribute it and/or
    ! |" [1 z) E; Z2 P: r& P: {
  16. * modify it under the terms of the GNU General Public License as
    4 Y  u- U$ X( b8 k
  17. * published by the Free Software Foundation version 2.; L' V# z; r  t7 j: e" A9 L
  18. *
    . `- C+ S* @  V; x/ _  {2 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, e" [% d8 I  X: s/ Y3 d* s) G
  20. * kind, whether express or implied; without even the implied warranty. R) X! @- N0 e4 U: v) X! A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( r0 F* N" F9 x/ D, }" {6 u, K5 C
  22. * GNU General Public License for more details./ X' X8 O1 \6 O, g% [) A  b
  23. */0 U* `) y. F- f- p
  24. . l/ u, U  P' p
  25. #include <linux/module.h>" X* J# u5 l$ u6 \2 G
  26. #include <linux/init.h>
    , Z7 K6 |* h+ |, h/ e
  27. #include <linux/errno.h>
    - o$ e9 u; W# p8 s8 P' K* o) D
  28. #include <linux/types.h>4 c# X- Q* N! x2 \+ P1 c
  29. #include <linux/interrupt.h>
    2 _. Z0 A" ]  i
  30. #include <asm/io.h>& e) {$ \8 [" t& W  @
  31. #include <linux/moduleparam.h>
    9 C: M$ j; y4 ~" A% m$ \( z; d
  32. #include <linux/sysctl.h>! ]# {4 k$ ]* ]; n5 p! t. u
  33. #include <linux/mm.h>
    : Q# P' C/ e7 e! X7 A1 ]: S9 G+ b
  34. #include <linux/dma-mapping.h>
    $ S3 U# L5 i3 v8 c2 ~% H

  35. : C2 e' }: ^, ~# M& v/ Y; n
  36. #include <mach/memory.h>
    $ i2 D' V) k4 `+ E6 _/ O3 {) w, }
  37. #include <mach/hardware.h>
    + G0 d8 ~$ C5 a$ r' {
  38. #include <mach/irqs.h>" F5 M( {, Y* W  t  P
  39. #include <asm/hardware/edma.h>
    ) C, l6 w+ a; h8 l0 B3 a
  40. # ^; P/ u* N+ T" _) O; v
  41. #undef EDMA3_DEBUG# L# }3 k5 S: o- R5 p; d
  42. /*#define EDMA3_DEBUG*/! U+ R7 Z! N3 K  O' I
  43. : j" R8 X) N) f; ^
  44. #ifdef EDMA3_DEBUG; V8 G/ l  S/ b. r* I1 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ t- h" c: j4 T" N# B4 K+ ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ x. f' Q6 s# r3 |( f8 e* O/ {' e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) z; v; [; B/ P5 j( g( X
  48. #else1 ]- B; e  \7 T. N6 d' a
  49. #define DMA_PRINTK( x... )+ ]2 j( w4 I# w# D
  50. #define DMA_FN_IN' l$ }1 R0 ~3 u* m- D% E* {
  51. #define DMA_FN_OUT' K$ g# F( c7 V( I: b- p5 F
  52. #endif
    : @) Q3 ^8 {( m

  53. 7 a/ h4 A8 I- m$ [* B' m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . t! Z' `4 Z$ H6 R7 r' W, I4 O! w8 v
  55. #define STATIC_SHIFT                3+ q" B' w& s7 _& \
  56. #define TCINTEN_SHIFT               202 b- \1 X: r  r0 I" W8 A
  57. #define ITCINTEN_SHIFT              21
    1 T2 G) S5 B. _4 }8 E. X7 r, ^
  58. #define TCCHEN_SHIFT                228 `  v# P! \% F8 m/ a3 x% @  H
  59. #define ITCCHEN_SHIFT               23$ Q, M& @& V8 t* @5 U, a

  60. 0 r9 x' ~- N( D
  61. static volatile int irqraised1 = 0;
    . P  @# j- N2 M/ G+ h& M
  62. static volatile int irqraised2 = 0;- O; R/ {+ k: a
  63. , m) f  }4 R' [3 n& n  t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z/ v( U! _# O% r) \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n7 K4 ]8 p* S) P+ V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, @. E$ }5 O1 V' J- U! B

  67. + ?0 d' g4 y! N  O& D/ {
  68. dma_addr_t dmaphyssrc1 = 0;" M: V0 T8 V3 s" O  G" }0 j
  69. dma_addr_t dmaphyssrc2 = 0;
    ! n9 q3 R/ I8 Y& B! \& K
  70. dma_addr_t dmaphysdest1 = 0;
    6 I+ _$ i; ], l( X
  71. dma_addr_t dmaphysdest2 = 0;. c9 G- x$ X* M4 v

  72. + Z1 l( w* @) E3 b& x4 x% J
  73. char *dmabufsrc1 = NULL;
    # z# ]4 T4 S) W9 |0 C
  74. char *dmabufsrc2 = NULL;. |) b, `* m, K0 [; G1 U
  75. char *dmabufdest1 = NULL;1 @( Z0 l4 y, p/ p9 J
  76. char *dmabufdest2 = NULL;
    ! Z$ Q, \$ o; V  N8 V2 @' M

  77. / J1 h  q" A! }
  78. static int acnt = 512;, }/ p* I3 d% G6 a8 q
  79. static int bcnt = 8;8 V! \+ X2 k0 o3 c! f8 E! L
  80. static int ccnt = 8;( m7 {+ M: Y  ^
  81. 7 r% W$ d6 F! h5 s4 X
  82. module_param(acnt, int, S_IRUGO);
    , `, R$ X# g% ]& q6 k
  83. module_param(bcnt, int, S_IRUGO);
    & a9 B" l9 b; N4 x, G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! U! o6 _8 H# d! x3 @

+ ]; P- Q% Z4 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 \& }. W  z+ n( x+ P7 W7 N
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" v$ x5 a: ]3 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  J( ~: D9 U) R) N4 F% ?
1 _" N  M" C4 x" @3 c7 Y4 Y. ^! A: i8 z0 |! q/ L8 p- X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 21:34 , Processed in 0.038584 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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