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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 {9 h  g- _7 A" z8 R6 `+ c
  1. [code]EDMA sample test application# ^3 U: C& O- m% F
  2. /*
    0 r* x+ v' J+ @3 D- z
  3. * edma_test.c
    4 r) }4 z  O! a- ]
  4. *9 u* d1 J( n6 T7 C6 v' M. m- N
  5. * brief  EDMA3 Test Application6 U8 d3 h( b' P) x2 x* N  Q& M5 o  W
  6. *0 x& S* F& R# W2 o7 |
  7. *   This file contains EDMA3 Test code.
    " l# I/ O7 T+ l* l# {8 L* M% V* G
  8. *
    ! r* X6 s( y/ v) B7 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ I( x2 A  k- g) L( h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' X- @3 W& F( N& U4 p
  11. *         TO CHANGE.
    4 q/ I4 y! U9 [% a0 f
  12. *
    + K: F  N! ?1 Z; A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 e9 Z: X" P' a! j2 t
  14. *
    + J1 J# q8 T; P
  15. * This program is free software; you can redistribute it and/or
    ! y' `" _9 W3 O+ f" G
  16. * modify it under the terms of the GNU General Public License as& \6 _. x5 F1 N* h3 Z
  17. * published by the Free Software Foundation version 2.
      U5 j7 C# Q" @6 I) e) w& V
  18. *
    - _- L6 |4 }5 I$ q( K/ x* D& x$ I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' Q( @$ v: S6 X2 e9 Z$ s6 G1 d
  20. * kind, whether express or implied; without even the implied warranty
    # Z8 s) }$ F. W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 \( a$ ~7 w3 q8 E. O' T
  22. * GNU General Public License for more details.9 ^, ^# {4 x2 p* q2 p% W
  23. */
    - E& r& @' K! t) A! M# k" i1 t/ l* I

  24. ) q' u+ O: Y3 r/ c7 }# f% b
  25. #include <linux/module.h>, w+ x7 H3 U3 L: c$ }  t& h( f
  26. #include <linux/init.h>
    , D6 D9 v6 b) r- L$ ^
  27. #include <linux/errno.h>
    " O  k8 g% i" Z. x
  28. #include <linux/types.h>  X9 ^+ W  \, g4 A! s
  29. #include <linux/interrupt.h>6 L/ h5 U* o4 b% P7 ~
  30. #include <asm/io.h>
    8 d  k) x0 J" k  T
  31. #include <linux/moduleparam.h>' a) }" P: E  q, Q, _
  32. #include <linux/sysctl.h>
    : X" }& e1 b! Z3 Y8 ?
  33. #include <linux/mm.h>
    2 Z$ y1 |+ H3 y4 v/ j6 w
  34. #include <linux/dma-mapping.h>+ F/ `- S9 x! s2 j' C8 {+ ?
  35. : t# _/ k- G$ S; B8 `" B$ @
  36. #include <mach/memory.h>
    0 x; a2 H( m8 @! _  z& r
  37. #include <mach/hardware.h>
    1 s1 N$ e/ v7 e' _% A
  38. #include <mach/irqs.h>
    3 ]" }$ Q: u. o( \, R1 h
  39. #include <asm/hardware/edma.h>" i3 B, u' _, _) ?
  40.   h5 h+ K  L% {/ Z! I, v
  41. #undef EDMA3_DEBUG
    0 j4 w( I2 @4 o. H& o
  42. /*#define EDMA3_DEBUG*/6 j' I0 ]' J6 n6 u
  43. ( F: M" K6 x# Q) m6 j& B/ h' g
  44. #ifdef EDMA3_DEBUG: v! d% W$ [5 V2 o# z. d3 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# I2 c- ]  p( w8 C7 J* x! {2 i2 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / Z. H% a/ j1 W2 \, Q1 F- c. c0 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 j% ~4 \; L& J0 v. R0 b: P
  48. #else! R- ?! m5 T' J
  49. #define DMA_PRINTK( x... )& S5 V1 z+ T2 w7 [7 A4 Y9 M
  50. #define DMA_FN_IN
    + P% m$ |; M6 \# c* r- {
  51. #define DMA_FN_OUT7 ]0 S6 p# `8 _
  52. #endif$ z' B) K, U. ]$ e

  53. ; T1 Z7 B6 O+ b+ r* c* u! \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 R5 r8 U+ B9 k4 v
  55. #define STATIC_SHIFT                3
    " \. I8 G- r7 l+ X8 N0 r
  56. #define TCINTEN_SHIFT               20# }% m5 M  a" \; P$ H; {0 |
  57. #define ITCINTEN_SHIFT              21
    7 b; Z( j% n, }) O5 O5 z8 W
  58. #define TCCHEN_SHIFT                22
    2 ^7 R2 ]9 I& q1 W5 ~' @
  59. #define ITCCHEN_SHIFT               23$ x" F, S/ \+ }$ A5 u" d. q6 g

  60. $ W/ R+ l' U& h: N+ P) F; `5 ?& q
  61. static volatile int irqraised1 = 0;4 ]6 _( F8 P: D
  62. static volatile int irqraised2 = 0;
    ) L6 Q5 H- L6 _: N2 [: T

  63. & l  s! P: g4 o# V9 A9 K0 b" q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 `5 X; c; R7 G2 {3 j3 S& a8 V. n0 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 G% j. Q! [  M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 G) i1 o$ ?' V

  67. : z& O1 B9 F* x0 V! l
  68. dma_addr_t dmaphyssrc1 = 0;- \# H8 M: {& F: y
  69. dma_addr_t dmaphyssrc2 = 0;
    : n. X8 Q% B  B! k
  70. dma_addr_t dmaphysdest1 = 0;
    5 e2 c6 z( I7 L4 L9 h
  71. dma_addr_t dmaphysdest2 = 0;+ x! M' P- n( k6 K. x1 ], t
  72. ; R- e6 w, ]2 ?- u! L/ A
  73. char *dmabufsrc1 = NULL;
    * y/ }2 @- U* j$ P* l# S9 {
  74. char *dmabufsrc2 = NULL;4 z. S, n9 k% W  v. z  O3 \: A
  75. char *dmabufdest1 = NULL;, O7 @0 }$ S) f" ?, C
  76. char *dmabufdest2 = NULL;. I! x0 H+ g' n1 F9 p

  77. / Q0 s  X' T8 K) b2 L) [5 [) D
  78. static int acnt = 512;
    7 M; _8 Z' d/ |5 g' j/ t. y! H5 e
  79. static int bcnt = 8;
    6 G% |/ s4 o+ e# O" W9 Z0 ?, f
  80. static int ccnt = 8;
    8 V5 c5 v  v) e( {: [# v& }
  81. ! h& Y/ @: g" U; m/ y! o; i4 I( f7 P7 j! ~
  82. module_param(acnt, int, S_IRUGO);
    9 L" x7 t3 A7 _& `
  83. module_param(bcnt, int, S_IRUGO);
    9 D$ p6 Y# m) m( I% `% S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# t' O2 w6 ?" P

1 l+ h  U; Y/ d1 Z5 E4 n" J2 F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( c7 A8 W3 f! K/ p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  V, C  L. ?2 e5 L5 F1 E4 a9 b: l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' O7 y3 W( ~0 A% y. `  h; K

" @0 \5 c2 ~5 F- r4 i6 @2 P" [# t5 E7 s3 \+ b8 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 22:50 , Processed in 0.042439 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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