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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ^  `) s& I2 B; ?9 d
  1. [code]EDMA sample test application
    3 k1 o- j& ~( v. h
  2. /*
    - L1 A. \* p  L$ l! O2 ^
  3. * edma_test.c9 [1 a* N9 M* ^3 N' z+ P
  4. *
    3 Y/ a5 W% V0 ?9 m8 |  W
  5. * brief  EDMA3 Test Application
    - k; z1 F% ~: _+ r& P: x5 P7 t1 c
  6. *+ q9 \+ H1 l  l" ^. y3 `
  7. *   This file contains EDMA3 Test code.
    3 ?4 I9 e# {  z3 l$ @) r; ~7 z. A" u
  8. *
    8 \6 [3 i# ^- r' ~" x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 I/ ^2 F/ G6 g7 ^* P. F  f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& c. l9 P3 x! q- ]2 e& W) X
  11. *         TO CHANGE.' X. G% [: J9 h! s
  12. *% g0 Y& F1 G: D5 h5 t. H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* _! H! |) b7 W# i; \5 Y$ A# w, i7 ^
  14. ** F/ r. T# X, N0 [: M
  15. * This program is free software; you can redistribute it and/or. |! p4 c7 ~. ^4 f- ~* n9 U% k
  16. * modify it under the terms of the GNU General Public License as3 @+ b0 o. U, G- C& q
  17. * published by the Free Software Foundation version 2.0 p) e& V/ Z% ]
  18. *- B8 C  s9 A% X9 D; J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 o' U0 w$ @# E! h  h2 U  a
  20. * kind, whether express or implied; without even the implied warranty
    % r& f! y# K+ q/ {; Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' o0 W, F3 J# {' V
  22. * GNU General Public License for more details.5 |" L3 ?& a3 ?4 c. S8 V
  23. */3 f  m( L# ]1 R& @- x
  24. + T- R4 {% L; n2 }5 n$ N
  25. #include <linux/module.h>
    . F* w* l: s5 ~6 c3 C
  26. #include <linux/init.h>
    - H  X% i+ N. c. j* m
  27. #include <linux/errno.h>
    " V3 Z4 @" P+ l/ v, o& u- K( @, g. P+ f
  28. #include <linux/types.h>  ~8 X- B& F( T
  29. #include <linux/interrupt.h>
    # _0 E- A& q. g, i6 h& b  O# X
  30. #include <asm/io.h>
    . y/ b; G: m  Z! ~
  31. #include <linux/moduleparam.h>
    - J! n7 O1 N0 H" @
  32. #include <linux/sysctl.h>( s/ H/ D; d( S: S# w3 f# r" S
  33. #include <linux/mm.h>
    9 z& w  v& g0 K6 g; \( a4 u  M
  34. #include <linux/dma-mapping.h>
    / Z  z8 f' A1 M6 o

  35. ' C) r5 ?- C8 v! ~8 H
  36. #include <mach/memory.h>
    8 z+ \4 R" k# e5 z
  37. #include <mach/hardware.h>" N& ~) P4 j5 C8 @+ {
  38. #include <mach/irqs.h>0 c  H6 B- }& C0 U5 \9 {
  39. #include <asm/hardware/edma.h>
    ' ]3 }2 i: H3 Y! d

  40. . I: u$ e3 ^; o, x$ u3 R
  41. #undef EDMA3_DEBUG
    : z& K) W" Z, H- T% g  S7 V; U2 B
  42. /*#define EDMA3_DEBUG*/
      E1 D! \0 \) D4 @" M( H

  43. 6 e  R  q8 ~7 f- e( B
  44. #ifdef EDMA3_DEBUG
    / X' i( \) U1 d: m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # z- F* C3 q( }- n6 ^# }. N2 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ v  x3 D& K1 ^% E2 p/ O- B/ f2 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 c8 b- t# d# P6 Q/ m5 I$ V+ Z
  48. #else; m  t& K. u  H* n' P' Y
  49. #define DMA_PRINTK( x... )* M4 B9 F; ^0 `7 S" ]2 d
  50. #define DMA_FN_IN; }5 w/ {9 |' i7 Q+ ]- W; Z
  51. #define DMA_FN_OUT
    ) \# h. ]" E5 `; z! o# K: ?
  52. #endif
    , }7 q! K9 i% b  x; I1 H' \  B" B

  53. 0 h% v! e" N+ e+ l  U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 y& J5 B0 A' D* ]. j
  55. #define STATIC_SHIFT                3
    + a! f6 ~. u/ n. y9 {/ G" ]
  56. #define TCINTEN_SHIFT               20- p- H; Y. ~7 W/ P! ^
  57. #define ITCINTEN_SHIFT              21
    % e3 A  p9 n3 W1 X' G6 D
  58. #define TCCHEN_SHIFT                22
    % ?: j3 S$ c; t, L) y
  59. #define ITCCHEN_SHIFT               23- A: o" `: ]% F0 L6 j4 B
  60. : ~" H# ^' I. w# B4 T' G; e
  61. static volatile int irqraised1 = 0;
    . L/ g5 v9 O8 v8 J
  62. static volatile int irqraised2 = 0;
    9 L6 m  Z' h- t3 q7 x& J+ z% x2 _9 B2 M

  63. & o+ l2 V5 P, Q8 ^( A2 l" b! M, t! q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \2 \/ {# b) [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! q7 [2 y8 ]% I8 K' x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + t8 E2 A; s1 l$ ^- h
  67. * Q/ i, g# `6 p$ d4 T8 S
  68. dma_addr_t dmaphyssrc1 = 0;
    & q" m. s( z# H) g$ r
  69. dma_addr_t dmaphyssrc2 = 0;4 l. k5 ]: _. M  h% z2 {
  70. dma_addr_t dmaphysdest1 = 0;2 @& e% Z1 i0 i4 G) b8 _
  71. dma_addr_t dmaphysdest2 = 0;  N) q7 M/ m9 S+ J- s

  72. ! l* m, j% F0 h1 m
  73. char *dmabufsrc1 = NULL;/ N% h- w. m1 ]0 L/ f
  74. char *dmabufsrc2 = NULL;5 b3 m# N! I1 L4 X/ _" c
  75. char *dmabufdest1 = NULL;- t3 h3 h8 x: Y4 Y) _4 i
  76. char *dmabufdest2 = NULL;/ }* ?! w2 l6 {! i( l7 Q
  77. 6 u1 n/ }2 t. K
  78. static int acnt = 512;
    1 U" Y  `. f- x+ l8 n+ _
  79. static int bcnt = 8;
    " ^% d3 _8 F9 f, H9 J: N# h; l
  80. static int ccnt = 8;0 T) X9 N( z: j3 m0 ^

  81. 5 g$ B. b3 B3 s
  82. module_param(acnt, int, S_IRUGO);
    # f  O" x  k, V( u
  83. module_param(bcnt, int, S_IRUGO);
    ( D  G/ m3 I; m  E: H; \" y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ B; r0 M1 u0 j- a
. C1 ?4 ^. V. {! f5 G9 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) V; Q! ?7 V4 _$ Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 l( {% p+ _( w$ t- ^9 g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 v( u) q9 b: A
* D: m; {# r3 r$ H
+ p2 |+ T0 V2 e! V/ E* e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 06:35 , Processed in 0.040887 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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