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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 e' L/ }4 m# v. m6 [+ k: ]. G
  1. [code]EDMA sample test application" f( J4 z; }$ t
  2. /*
    ) G/ F2 P! ~4 Q: H
  3. * edma_test.c9 Z8 y8 F6 _1 i; `: C
  4. *
    ! s! e3 e7 B: E+ S+ K6 i
  5. * brief  EDMA3 Test Application
    / Y' K( d# I' q
  6. *
    ) k3 S# D( ~( R1 U; J
  7. *   This file contains EDMA3 Test code.* ?$ s* e! G$ V
  8. *
    ) ]! i, R  N; B4 N7 X% B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ {$ ]8 s# `! g: q; I9 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' M/ J3 q: N& B# N3 Q
  11. *         TO CHANGE.
    " w* }% V( O3 T- |% r7 h
  12. *; l/ f3 s. d0 N9 K' D( X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 |- Y/ ?4 S: ^: K2 Q. n$ F  x0 k
  14. *7 x; v% u6 n( O6 R* y
  15. * This program is free software; you can redistribute it and/or5 [0 Y! u* ]: R& c, t
  16. * modify it under the terms of the GNU General Public License as" G9 [% o1 o( ]! q- i7 ~# j+ g
  17. * published by the Free Software Foundation version 2.; ]' R  _2 @% i, c1 Z7 _
  18. *
    - D" T% q' F3 {7 v6 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ?9 N) M* s) ^
  20. * kind, whether express or implied; without even the implied warranty
    $ u. M  y# i/ G( ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  C( \5 ]/ G; [4 x& n9 a
  22. * GNU General Public License for more details.5 D& V: s$ L% c# b; g& S0 e
  23. */$ \9 t/ n, e4 x/ I
  24. : s9 @/ G( w9 V) D5 c" A. Y- B
  25. #include <linux/module.h>7 P6 t7 G' s; O
  26. #include <linux/init.h>$ p) X+ B. V$ W+ E
  27. #include <linux/errno.h>1 d: J. X8 j4 {
  28. #include <linux/types.h>
    ! ^2 ]# b; `, R& \
  29. #include <linux/interrupt.h>) y( z; O- O  c$ }, I
  30. #include <asm/io.h>
    + X+ p: S/ {5 Z- ?3 Q
  31. #include <linux/moduleparam.h>
      o# A0 o3 T# U' R; U; h. y0 R- s& ]
  32. #include <linux/sysctl.h>
    $ R; b; e" |) y  h
  33. #include <linux/mm.h>1 z2 v# m9 @1 ~5 @' v7 {
  34. #include <linux/dma-mapping.h>% `8 O* C( P9 M5 ~5 D+ ~

  35. 2 ?  v5 {* R+ E0 o* T$ l1 e! V; m5 l
  36. #include <mach/memory.h>2 c. v( x2 j1 r# n
  37. #include <mach/hardware.h>
    $ n4 P$ g. m0 N9 J4 |
  38. #include <mach/irqs.h>
    7 e6 z' t% X3 _; u3 }* \  s" \0 P, J
  39. #include <asm/hardware/edma.h>! o, p2 T* f& ?0 [, q
  40. 3 Z7 `' n/ Q! G) q$ A  J
  41. #undef EDMA3_DEBUG
    ! c/ L( S+ e; I* P
  42. /*#define EDMA3_DEBUG*/. `, \' g9 }4 B9 Z
  43. ' U, V5 U( \9 _4 L" A
  44. #ifdef EDMA3_DEBUG5 C( S0 n: R) h4 T% Q. U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / x2 k& y8 W+ y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 E. s/ X" o: g8 H, Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - l4 |+ d+ |8 U$ @
  48. #else
    5 |  S$ H2 A" M1 M: J# U8 {, l
  49. #define DMA_PRINTK( x... ), o* D. s6 m# O
  50. #define DMA_FN_IN
    7 e! u- k1 ]/ j, F2 l- K
  51. #define DMA_FN_OUT4 }& W# e+ J5 E. |" F8 h+ D/ G! t1 n
  52. #endif
    3 ^4 J/ j, g/ n5 j  v- x: A
  53. 1 I3 n8 a; t2 _8 S# }/ H+ g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ H) f4 t' h. u8 e* c4 o
  55. #define STATIC_SHIFT                3
    ) v* v3 M+ U) ]# q, N
  56. #define TCINTEN_SHIFT               20. k0 w' k7 |6 u! \" T$ k! M; ~
  57. #define ITCINTEN_SHIFT              21* A' p. T: q' {4 p; Q7 u2 V" y
  58. #define TCCHEN_SHIFT                22' e# c$ m2 N- t. |
  59. #define ITCCHEN_SHIFT               23
      d2 S: P" K( n8 z0 S

  60. - d7 g9 \1 Z+ I
  61. static volatile int irqraised1 = 0;
    4 s. M& L" r% v% t+ m- h0 X, z, Q5 x
  62. static volatile int irqraised2 = 0;
    # E6 q$ q; U7 t3 L2 }

  63. * v. i6 k- ?* v! h: F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" _8 z9 Q3 ~0 k) N( ~& S/ H, a/ X" u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      j  `- B+ _" ^3 \# W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: s5 V% `2 R! k

  67. 9 W. d: B: x7 c4 b4 o% q
  68. dma_addr_t dmaphyssrc1 = 0;$ w! g: I) Y3 S! Q; I. L) Q& y
  69. dma_addr_t dmaphyssrc2 = 0;
    + }6 u: P5 q4 w3 p' _" F
  70. dma_addr_t dmaphysdest1 = 0;
    ) {: l$ n# e; ?
  71. dma_addr_t dmaphysdest2 = 0;
    5 \5 C& g0 V/ ^3 z: O$ A0 O' ?+ H

  72.   j. a# j. _: ^4 y. `
  73. char *dmabufsrc1 = NULL;. ]5 |& N% F0 _
  74. char *dmabufsrc2 = NULL;
    0 o; W- E5 N* I0 ^0 b
  75. char *dmabufdest1 = NULL;/ A* h: a- }1 N2 b/ ~; D0 \0 n
  76. char *dmabufdest2 = NULL;! H- }. E% c8 R" U! f

  77.   A0 a' V* ?: d% t& b1 |8 |4 E
  78. static int acnt = 512;) C& e4 y2 h7 |4 L: X8 H  K9 j
  79. static int bcnt = 8;
    7 ]$ c' p0 B- ^/ U7 M% i
  80. static int ccnt = 8;
    6 G% S+ ~' X0 U6 _$ M/ ~% Y) a
  81. 9 t4 v8 H8 U" {# w' g
  82. module_param(acnt, int, S_IRUGO);
    ) i: F0 C+ o7 T4 s! q% B! o. ?
  83. module_param(bcnt, int, S_IRUGO);
    % s/ t" H. H# |+ O4 @, `3 X0 N5 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 U& v# E5 P+ C* f

4 o5 q6 M" b1 l4 e6 Q. M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 b" y2 l; c2 \0 H9 u3 A) f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 g3 v: h* @8 p$ c( T" \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 E' n1 q$ P- M( {. p4 D! q" u( O
$ q# C! R* [) S9 F
: ?* V. C, q& ]- }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 17:54 , Processed in 0.039801 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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