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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. v; ?. D+ N5 `  Y
  1. [code]EDMA sample test application, h% s9 U% H9 @5 B! f& C3 I( Z
  2. /*2 x) Z+ W3 k- H( _) V
  3. * edma_test.c. f. _0 X: s! E* b1 }# u
  4. *
    4 _- s. l! h) Q/ e4 I- J, S- I
  5. * brief  EDMA3 Test Application
    4 y5 i  D* x5 }; k- R4 C, g
  6. *
    , u) }2 ?0 U3 V- M( p  S
  7. *   This file contains EDMA3 Test code.
    & c1 H- [9 G9 L1 S/ J
  8. *# t3 g! S8 B& ?3 B. @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- l. J& U) L9 l8 l  U/ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . Q3 m( ?) `  Z2 v4 u/ j9 J8 k
  11. *         TO CHANGE.
    7 T) A' \1 M! `
  12. *5 J' G  a7 N% p+ J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & H1 m+ w/ F+ S7 Y% D
  14. *! j7 G6 R' U) G) _* ]
  15. * This program is free software; you can redistribute it and/or$ v  Z: D7 K1 ~) Q
  16. * modify it under the terms of the GNU General Public License as
    9 Z2 H; |. g( e5 H
  17. * published by the Free Software Foundation version 2.
    6 e) v* C$ U7 l# s% d
  18. *
    4 X9 A6 o7 ^! V- j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 y( [( |1 S, S' d. q1 z; z0 n
  20. * kind, whether express or implied; without even the implied warranty6 E& ]* Y2 ~8 R- k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 s; @# h# x! ~$ }* G
  22. * GNU General Public License for more details.
    6 t+ ]7 J5 k$ _, \
  23. */
    3 K$ |% ^- @6 o7 K
  24. ; }2 ?$ j% i) o0 m1 U* I
  25. #include <linux/module.h>9 E; v9 h  x& n3 V  |" Q' F& o
  26. #include <linux/init.h>
    0 E0 z0 R  P. u( u" d7 Y
  27. #include <linux/errno.h>
    # c  E) T( ]5 l7 @3 E8 s
  28. #include <linux/types.h>
    ) m  m# M2 G1 Z1 n
  29. #include <linux/interrupt.h>7 F: c/ w. E& j2 z
  30. #include <asm/io.h>
    # \/ y$ f8 W0 l0 I, ?0 ?$ Z
  31. #include <linux/moduleparam.h>
    7 t! O1 \# b# L3 X. @
  32. #include <linux/sysctl.h>
    7 t' J2 K  i( B* x7 f
  33. #include <linux/mm.h>
    ( d1 N+ X# Z& E3 u& D. ?. [
  34. #include <linux/dma-mapping.h>- d! g$ J7 w3 F9 t& H6 g0 c  M
  35. ' ]1 Z. w  S$ {2 x
  36. #include <mach/memory.h>+ L7 U. M% F/ b# A, k( }4 q
  37. #include <mach/hardware.h>
    9 _: j1 B3 i7 ?& T9 Z/ U
  38. #include <mach/irqs.h># }6 F5 [- U% i, I! f# F7 \
  39. #include <asm/hardware/edma.h>6 @7 Z2 b2 w/ s2 h2 D$ Q5 q
  40. , d7 U. R: D  C- r# x
  41. #undef EDMA3_DEBUG
    9 K7 B$ K9 O2 B2 `: H
  42. /*#define EDMA3_DEBUG*/9 i+ R3 K8 ^8 u( X9 |; h
  43. 6 m( z; a5 x4 Y$ k
  44. #ifdef EDMA3_DEBUG$ B1 ?/ n  w! T# l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 N; [" j" V7 i0 E0 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) ?. P$ T0 u" |) c& U* [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): l% Q' _0 C8 k/ P$ G0 H
  48. #else
    - e* w' l4 n) M
  49. #define DMA_PRINTK( x... )3 @: k( D" V8 A/ U
  50. #define DMA_FN_IN
    ) w! E( p+ ~% \) Y: l% D: k
  51. #define DMA_FN_OUT3 G1 v+ j' W7 `& ^
  52. #endif
    + ]0 O; ^7 a, _( e9 v: P$ i

  53. + J9 b  @7 s7 R- F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% A2 d8 A' L* J' S6 w# q* x( v# p
  55. #define STATIC_SHIFT                3
    5 U1 w, B5 o5 j
  56. #define TCINTEN_SHIFT               20! E! K, h5 b9 B% z& U
  57. #define ITCINTEN_SHIFT              21
    ) L% w+ H0 Z) m2 e
  58. #define TCCHEN_SHIFT                22" z4 t/ [: m* V  K
  59. #define ITCCHEN_SHIFT               23
    ; m) E5 u( s* h. _- z

  60. ' _; x4 n1 {+ d6 V6 {) Z7 x
  61. static volatile int irqraised1 = 0;5 H1 Z) k  \" m! N
  62. static volatile int irqraised2 = 0;$ e" I9 v/ p/ X6 X- \7 R

  63. / B2 l% @; F: v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 F' a) p; Y' ^! U- S+ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 E5 V3 q/ a5 r5 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 D4 g* `! s3 I; X1 w

  67. 5 p8 C  [$ Z; ]4 V
  68. dma_addr_t dmaphyssrc1 = 0;# `9 g, e& t6 F% g/ P. j8 u
  69. dma_addr_t dmaphyssrc2 = 0;
    7 Z  v) i$ c/ D
  70. dma_addr_t dmaphysdest1 = 0;9 S, f0 o2 M3 ~5 v* b
  71. dma_addr_t dmaphysdest2 = 0;
    $ ~: o: B" b$ N
  72.   d$ f$ N. t, H3 B6 K6 L% _* o9 ^
  73. char *dmabufsrc1 = NULL;
    " |8 G* i& N% ~+ I3 [: j% }
  74. char *dmabufsrc2 = NULL;9 c4 W" ]) j& _2 ]  f; F
  75. char *dmabufdest1 = NULL;& D" _$ z4 R) _" S7 t/ F) H) l
  76. char *dmabufdest2 = NULL;
    7 P- f+ g, `  b) [4 r" P* s
  77. 5 ~: u; x9 p. D$ h# C) I) l" K
  78. static int acnt = 512;
    : Z+ d5 L3 ]0 T* J) p, `: h
  79. static int bcnt = 8;2 g. X9 U; N0 G$ M4 O( Y, W
  80. static int ccnt = 8;
    5 j) T* U" Y7 X
  81. * G5 b3 e3 {: I9 g' z. r* z
  82. module_param(acnt, int, S_IRUGO);" L9 l0 `) [% _2 ^+ u; w
  83. module_param(bcnt, int, S_IRUGO);
    " P# Q: H7 I0 [4 ?9 O! l& U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( J! Z. \/ u* H$ {/ e4 y

/ G$ o; |1 A9 f( @0 g4 r- g$ z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# Q5 X. ~  c( `( m6 s5 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& I5 o: U& w0 `0 A8 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. c& T& m7 i) ^. }
3 E  l9 ~) f9 r9 K6 o- U
) T/ J7 U6 {( x7 _: D$ B) F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 23:40 , Processed in 0.036220 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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