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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ]$ m7 {3 v# @7 i" z
  1. [code]EDMA sample test application
    ) |3 t! h+ E! l5 m
  2. /*8 Q4 }8 ]5 [1 I8 p; Z8 V
  3. * edma_test.c
    ! t8 ^) F. E5 L4 X8 ^: l+ Y* R, f
  4. ** \4 p/ C+ T6 c, D% {8 o, A
  5. * brief  EDMA3 Test Application
    ( X0 o6 z' U! D9 `; c
  6. *! B/ i/ A: g& C5 V4 r
  7. *   This file contains EDMA3 Test code.
    & p+ t% a$ J& U/ i" w" D
  8. *
    ; U/ q7 l8 ?, U5 y& ^( _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % B1 }/ R/ X$ L9 Z0 @. s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' `& L% y' j% Y1 d9 {
  11. *         TO CHANGE., u9 N- ?5 M0 O5 b! H
  12. *3 i% o9 f& l% c% S9 Y3 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( b$ t" P7 H( B# l- ?/ W
  14. *
    ! m5 Q+ b$ g- z. `' s- a
  15. * This program is free software; you can redistribute it and/or
    $ I1 w9 M9 D) z9 H# _. C4 Z6 W
  16. * modify it under the terms of the GNU General Public License as! m6 S1 M9 z6 f
  17. * published by the Free Software Foundation version 2.+ a. U  e" k: p8 n; Q8 u7 U
  18. *
    9 i4 `  O3 M* M- X, G8 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % f( Q2 \8 A- J  V5 \
  20. * kind, whether express or implied; without even the implied warranty
    3 W& J+ c# {& p) \0 h( p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & ~) W: b! G2 R0 s
  22. * GNU General Public License for more details.7 ^- p# w3 j; p( ^3 x
  23. */
    # ^; X  o; t# C8 W1 g2 c; Y6 Z

  24. 6 l' x  p% P7 I
  25. #include <linux/module.h>
    9 y+ P" Y* |. Z3 p  j; f* N( \
  26. #include <linux/init.h>
    5 c4 \& e4 `( e6 p' w9 {/ g
  27. #include <linux/errno.h>1 J3 F# C( V5 g- M4 N0 S5 g
  28. #include <linux/types.h>
    8 k4 m- x" n5 g4 @: B4 y, D
  29. #include <linux/interrupt.h>
    * k5 \3 q; D1 c9 f" k* _  U
  30. #include <asm/io.h>
    0 n7 P) \* p/ Q1 g/ T& f
  31. #include <linux/moduleparam.h>  H* H1 m7 h" N
  32. #include <linux/sysctl.h>
    ( e, g' G% V9 [: S. M. V* I
  33. #include <linux/mm.h>
    & ]( P4 D7 L' E0 p, C9 l' x/ O/ y$ U
  34. #include <linux/dma-mapping.h>- S* i: h5 F- a$ h- Y) |! W  L" L

  35. - k) ^5 N- O; I! I# s3 C" `
  36. #include <mach/memory.h>
      O" G# q2 D, g8 K8 C* ?9 t- j
  37. #include <mach/hardware.h>2 N5 ?+ ~  r, b
  38. #include <mach/irqs.h>
    0 a' U# \4 ]# a( ?$ Y
  39. #include <asm/hardware/edma.h>- o" p' d9 ]- k9 H

  40. ' [: L" m# d. Y; N8 z4 C7 f
  41. #undef EDMA3_DEBUG
    & b1 Z; w  }, F* V
  42. /*#define EDMA3_DEBUG*/
    9 b1 ^5 G$ u  ~

  43. 6 f! W5 b; J: L5 \/ T9 r
  44. #ifdef EDMA3_DEBUG
    " P" }3 D8 ?) m' ]+ O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* g6 H! F, P' H: E5 Y6 l7 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 y* `. v3 i5 _  f( ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 C# j/ z" l) l
  48. #else) z: G" B3 r9 `+ @0 X
  49. #define DMA_PRINTK( x... )
    " q/ Y) ~* C: r7 K/ J( e' c
  50. #define DMA_FN_IN5 {; a$ N: n9 d. ]
  51. #define DMA_FN_OUT5 W7 u3 i+ e2 S, i9 y, Q* }
  52. #endif5 ^1 h' U% |* E
  53. ; u/ A8 X* \9 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) ], m. [* l  O
  55. #define STATIC_SHIFT                3
    ( _1 r3 [1 {" m7 o' J5 W6 h# A" V% c
  56. #define TCINTEN_SHIFT               205 s$ B. W; W4 k
  57. #define ITCINTEN_SHIFT              21" G$ U) l2 U" F5 s
  58. #define TCCHEN_SHIFT                22+ T: u# g: p6 x3 |9 v! b5 C
  59. #define ITCCHEN_SHIFT               23
    ' E* m5 \/ m# R

  60. : X6 x! D2 j2 K% A* z: w6 ^# y( E
  61. static volatile int irqraised1 = 0;
    ! ^1 W( W* t) m6 S$ z: M9 C9 w
  62. static volatile int irqraised2 = 0;+ ^$ i  p0 k6 W* }) S* C( \% L

  63. 5 l5 k2 u* _3 v; F) t( j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! k3 o: O+ @0 I. D: ~" @: L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 V" H" K! d3 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 i# c2 |2 A2 `; H& M7 ]
  67. $ y$ y4 A2 `2 X# c. r
  68. dma_addr_t dmaphyssrc1 = 0;. J+ O; |/ _1 i: E1 ]8 G3 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    - m' r# S4 L) D( Q. j
  70. dma_addr_t dmaphysdest1 = 0;
    # R' i6 S( h5 l1 K. q( e8 H! f/ r
  71. dma_addr_t dmaphysdest2 = 0;
    7 J6 {2 O( f) g" e/ X" Y. N

  72. . v% x% y# f4 K$ H# x
  73. char *dmabufsrc1 = NULL;; x" x# T) b, E
  74. char *dmabufsrc2 = NULL;( e  b6 T# e9 l' r
  75. char *dmabufdest1 = NULL;
    0 U. ~. r1 O$ s) n- l3 [
  76. char *dmabufdest2 = NULL;& ]5 P$ R9 ]9 l' N( V
  77. 5 ?5 }8 Q# y' }1 Y9 z; }- F. D/ \
  78. static int acnt = 512;
    9 r  D2 s0 `  j# O2 s  u
  79. static int bcnt = 8;
    1 Y2 }% c* O' b
  80. static int ccnt = 8;
    2 j8 S$ C2 ?- {, t' c% {

  81. . f; E1 Y4 t. m7 h' P' O5 j$ @" C
  82. module_param(acnt, int, S_IRUGO);
    % g% H% M$ l) i1 b7 ?
  83. module_param(bcnt, int, S_IRUGO);
    2 J: ~9 E+ E7 A! v6 u9 H  b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 a  i4 E) U- Y' @: i, i5 O+ H+ {
$ ~0 z0 Y1 ~( s: p5 \2 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: @  K6 A  c' [+ ^+ Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 c5 U6 l* G4 p" {; `& R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. h  D. t  G5 Z
0 ]2 W, r7 X+ j# E, l& n, M0 o' @7 ^' _% ~( j( Y! W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 07:20 , Processed in 0.036474 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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