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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  e) u! u7 }- U5 g
  1. [code]EDMA sample test application
    + l& V, u  I  X! u: R" x$ E$ ?
  2. /*
    . i$ _9 e! K3 M) R& k
  3. * edma_test.c" q7 b8 ~) F0 Y) G9 H3 g( t7 r& ?: M8 X
  4. *
    . h) p) C9 U. N4 W, k# v$ }
  5. * brief  EDMA3 Test Application
    * y, `" n0 X9 t( E
  6. *7 G+ ?" u7 y* d% H# L, b4 s  y
  7. *   This file contains EDMA3 Test code.! g2 t8 M/ X: V* W0 O; d" W: I
  8. *9 q, t9 \- A/ I! Z7 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " {9 O2 A& Y8 u0 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( w! H4 \$ u5 |& a0 w: {4 i
  11. *         TO CHANGE.* Y" i  P# ]0 V/ o7 d
  12. *' D5 ?8 [/ z# T, }3 y2 R; `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% [. M$ y1 T8 D9 Y5 U4 H
  14. *) }/ W- b& f- k# H* M: m1 ~
  15. * This program is free software; you can redistribute it and/or
    " Z  {: z9 d8 {- `
  16. * modify it under the terms of the GNU General Public License as
    8 |! D# K+ K: D
  17. * published by the Free Software Foundation version 2.5 O; `0 m6 ?  l, C: G7 Y& e
  18. *
    8 l( X9 f( W6 P0 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& j2 e: V; N3 _, a0 ^$ Y! d3 d1 ^
  20. * kind, whether express or implied; without even the implied warranty
    7 f9 F" o+ U% T* }& w7 k, H7 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ r) }- Q9 _6 _; F
  22. * GNU General Public License for more details.
    % b( }/ E( c: _8 E' j7 g
  23. */1 Y  x9 B; Z+ M3 G
  24. ; L. h2 J/ G# q4 U- Z
  25. #include <linux/module.h>
    $ f4 G. U+ f6 ~9 n3 ~
  26. #include <linux/init.h>
    4 h' r4 D+ s, d" w/ E* r2 W
  27. #include <linux/errno.h>
    6 n# `& m/ N6 P# H
  28. #include <linux/types.h>4 l. g4 c5 W) ^! P7 B$ @
  29. #include <linux/interrupt.h>
    8 q* Z  b+ A9 Q( @0 @
  30. #include <asm/io.h>
    1 _0 [  k# i) k/ [% n
  31. #include <linux/moduleparam.h>, m1 ^8 m& P- L) Q1 G
  32. #include <linux/sysctl.h>$ e! a2 P6 J+ D: z7 \
  33. #include <linux/mm.h>
    % X* m8 m8 o% s8 y% N8 u
  34. #include <linux/dma-mapping.h>9 w3 X, H7 E7 c+ J$ M- ?6 o
  35. 8 e2 ^* l8 @  b2 ^% q+ t; O8 u; G4 [
  36. #include <mach/memory.h>0 I5 M6 K& f: p, o5 Q- @# j
  37. #include <mach/hardware.h>
    ) l) i% f- U$ s
  38. #include <mach/irqs.h>( B, _  D* g& \" E0 L/ I1 s
  39. #include <asm/hardware/edma.h>
    2 T4 Y0 v$ Q' N2 r0 _7 Y# e: g4 S! O

  40. 2 ]' f# t- A9 H
  41. #undef EDMA3_DEBUG, r3 s$ }. K- c6 R8 g
  42. /*#define EDMA3_DEBUG*/
    $ P7 _, {$ q" h8 N) C% H! a# X! }' M

  43. 6 h  z  w) w, Z/ |
  44. #ifdef EDMA3_DEBUG5 q/ a! ]5 P0 T0 g! B" e$ _8 N- O8 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , n: k0 `$ k2 \7 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 U1 M1 a1 q7 r) t9 S9 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 I, t+ P$ ?; t/ W5 z3 B- o& F
  48. #else  Q4 h  ]: z! `1 }. S
  49. #define DMA_PRINTK( x... )8 |* o7 _2 `- r' G4 u7 ~
  50. #define DMA_FN_IN. h5 U4 j  B; ]3 L
  51. #define DMA_FN_OUT
    . R0 R& \3 R6 ^0 i
  52. #endif5 p7 B  A% {8 ^4 c% C& d9 c
  53. 3 H& t% D0 r$ A" A! h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . M% W8 i/ ^% B
  55. #define STATIC_SHIFT                3
    & k/ T- M4 E! ^! G+ i6 A. G! ^
  56. #define TCINTEN_SHIFT               20: C4 U/ s3 \' i4 J9 [
  57. #define ITCINTEN_SHIFT              211 t9 r% d/ A+ l+ j- w* I, u& w
  58. #define TCCHEN_SHIFT                22
    : q8 U# [; j  l* I8 s2 j; l
  59. #define ITCCHEN_SHIFT               230 f5 G  N/ `: z* z
  60. ( [: Y6 w0 f( I" r" g, O$ Y
  61. static volatile int irqraised1 = 0;) T1 y* \7 s- N; h! F
  62. static volatile int irqraised2 = 0;
    $ S5 k- D% T" {5 y) g( i% j
  63. " E* w3 T; ]) S& l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 v$ @# }6 O$ {  q( z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 _0 e3 s% v6 B/ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ]5 g/ j( o( F- C

  67. 8 G) A7 S! R) p- G# j+ Q
  68. dma_addr_t dmaphyssrc1 = 0;
    : Z/ Y: e7 ?- Y6 f4 x) R9 \
  69. dma_addr_t dmaphyssrc2 = 0;
    1 A$ M0 p& h  G, R  X( _
  70. dma_addr_t dmaphysdest1 = 0;
    4 w) Q4 |# F) y4 R  Y. z+ S& E# S
  71. dma_addr_t dmaphysdest2 = 0;
    : {7 I4 ?8 M1 x0 i1 K6 c
  72. 9 ?! U" y% x/ R  \0 H8 T' R, b
  73. char *dmabufsrc1 = NULL;/ V3 E4 z  [9 c
  74. char *dmabufsrc2 = NULL;
    ( n# U" y5 W: Y* ~
  75. char *dmabufdest1 = NULL;
    . ~% N; T4 [# Z) ?  z" j
  76. char *dmabufdest2 = NULL;5 p/ D0 Q, W1 l. R1 J/ o
  77. : J& P! x7 N. A+ V( m5 o5 Z
  78. static int acnt = 512;- n! e: L' b- \2 @" E
  79. static int bcnt = 8;
    4 p. ?4 l( Y7 {# F0 U# i9 {  k
  80. static int ccnt = 8;% a% A% K$ z, p. k# Q7 s
  81. $ l2 `6 a$ n4 h6 x' K6 N
  82. module_param(acnt, int, S_IRUGO);
      L/ `2 _- H, `% s- G& M( H
  83. module_param(bcnt, int, S_IRUGO);
    7 F! P9 I3 N2 @5 Z8 j8 U) l& l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 w% e& N6 K0 {, d

8 Y1 ^7 q7 ?' W7 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 O$ {/ O0 D5 v% S" ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ^% c. o( p9 L- |) c% Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ u& L1 F- w0 M7 c9 m3 i5 `6 M% X
: G+ w5 |% @6 {& c' {! t2 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 02:09 , Processed in 0.055496 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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