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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ ~9 f; I4 o8 q
  1. [code]EDMA sample test application; A; h* d9 J' y5 |6 B
  2. /*. I1 N: `- q$ y& L. e
  3. * edma_test.c
    : c7 K# Q: x  k: |) k& L
  4. *
    ) Q1 @8 {5 M( b) S1 x
  5. * brief  EDMA3 Test Application
      }; g  f- ?! V. c, N4 t- x8 v
  6. *
    - b- l! R8 u2 |# L; M" Z& X
  7. *   This file contains EDMA3 Test code.4 T( g/ N/ [; @( O1 z( w% q  D5 a
  8. *5 F9 _. v4 ?5 d" @+ w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) v$ B+ C( U+ Y% T% S8 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , `, P1 P; N- b
  11. *         TO CHANGE.' I5 W) v- ^3 Q7 j5 \
  12. *
    1 g& V* `: x6 M( h' N, o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 @3 b; e- h- \4 h0 R1 x& e8 W5 J0 B. z
  14. *
    , W5 ^; u  n3 o4 `+ t4 F
  15. * This program is free software; you can redistribute it and/or
    / C* m5 J$ p" Y! J9 \5 M
  16. * modify it under the terms of the GNU General Public License as* a- Q& K- f+ |
  17. * published by the Free Software Foundation version 2.
    % ^  w( S5 E' \) |" n5 E  U1 c
  18. *
    $ J9 n$ q4 A" Z* U; D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , P9 t& |2 {4 ?( s5 M
  20. * kind, whether express or implied; without even the implied warranty; ?5 }' G7 Z! V7 d" K# j2 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: ?2 N7 O# i/ h; Y7 G
  22. * GNU General Public License for more details.# l* O0 m' A: m! P- _" H
  23. */  i' f' v  p3 Z! j

  24. / ?8 C  b  @4 \, [6 s8 Z
  25. #include <linux/module.h>
    1 @( m, J5 o8 ~) u  _' E
  26. #include <linux/init.h>
    , O6 Y, ^; Z% b: o8 x
  27. #include <linux/errno.h>
    ' f  q) v8 C3 Q' t
  28. #include <linux/types.h>
    % y& h! ]$ G1 N. c, z  P
  29. #include <linux/interrupt.h>( |# ~- ?4 G7 S; ?0 a% m5 S
  30. #include <asm/io.h>
    $ S: a+ {/ v, Y$ y7 i- a; l
  31. #include <linux/moduleparam.h>) B+ H( C4 b2 L9 `4 ?0 M( |
  32. #include <linux/sysctl.h>; J% ?3 Z# {. N/ z( Q3 z% N1 c
  33. #include <linux/mm.h>
    & t; n) Z% ~" x
  34. #include <linux/dma-mapping.h>
    2 m3 {9 _% i  U# K5 Y/ w7 B

  35. 2 |& o/ g5 U, ~/ K  s5 Y
  36. #include <mach/memory.h>! B) b4 f1 y) y
  37. #include <mach/hardware.h>
    1 c8 `* \( p. |# \# G
  38. #include <mach/irqs.h>
    ; T0 O- ]: G  a+ Y* W
  39. #include <asm/hardware/edma.h>
    4 B' R: [) m1 d* x: n& O

  40. ' b# r) P" P1 `1 `! o2 ]9 M; i. I
  41. #undef EDMA3_DEBUG
    $ \* x( v: ?) W1 f
  42. /*#define EDMA3_DEBUG*/9 [, c+ {' z* x- B

  43. # e. c, V% W8 ^$ e2 o6 ]+ L
  44. #ifdef EDMA3_DEBUG; _7 K& f7 s, D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; [! @4 H; m1 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); @  C' p2 l2 q6 G2 f) W" \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& N( b- i3 W8 t" w' {
  48. #else
    ' H/ W7 p. e& O+ y  Y+ B" A
  49. #define DMA_PRINTK( x... )
    2 i* W: B9 U  |) m8 F
  50. #define DMA_FN_IN7 r( h: l$ T  b1 _$ ]
  51. #define DMA_FN_OUT! z# M% L8 R' H6 f# L" {
  52. #endif
    * m7 U/ m6 r8 O3 G5 Z9 W# Y& `
  53. 8 z% o$ N: G7 V" D, I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " O" J, o+ O5 K, Y
  55. #define STATIC_SHIFT                3
    ) L$ n  T% G2 W5 l  v7 Y+ C2 p
  56. #define TCINTEN_SHIFT               20
    ; k0 U3 a, y# G9 D. \
  57. #define ITCINTEN_SHIFT              21
    0 f8 H! ^/ {9 v4 |1 X
  58. #define TCCHEN_SHIFT                22, f: ^9 Y% ]# r/ a; u* {- R: t
  59. #define ITCCHEN_SHIFT               23
    & B  M3 Y) B# Z
  60. - [! _5 `4 Q0 b( U
  61. static volatile int irqraised1 = 0;! ^7 C+ \5 v! l% I% _! `( d
  62. static volatile int irqraised2 = 0;- Q) h  K# Y: I* P# s) s
  63. * e4 M( R% B" ]' x9 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S1 W- X1 C% [" q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V7 Q/ f. x2 H6 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C# m+ p- M4 S9 I, b5 [; N

  67. 2 O, n  s+ e9 c8 [- ], z
  68. dma_addr_t dmaphyssrc1 = 0;9 E. V. }* d) a8 ]* \
  69. dma_addr_t dmaphyssrc2 = 0;
    & k2 i+ h' H/ R2 N8 m
  70. dma_addr_t dmaphysdest1 = 0;6 P; G. v6 R9 V+ j2 b0 O) W5 P9 j- \9 V
  71. dma_addr_t dmaphysdest2 = 0;
    , j) x$ t, a1 ~: J4 L6 A9 V' |, N

  72. ( z: D0 j6 C- {" e
  73. char *dmabufsrc1 = NULL;! X* v! \& ?2 k' H3 I
  74. char *dmabufsrc2 = NULL;; G! P9 h9 t: T' [
  75. char *dmabufdest1 = NULL;
      r9 q5 T1 S8 a, e
  76. char *dmabufdest2 = NULL;# w3 D; y/ {( L! Y. X

  77. 4 F" U' g# N! t* v
  78. static int acnt = 512;/ y* e/ G& c( `1 x7 M' X
  79. static int bcnt = 8;
    + q( M* Y% `9 y; E! u2 M
  80. static int ccnt = 8;
    & [- v5 a- c8 ]6 i6 B% c
  81. . P# \1 O& X- d# F
  82. module_param(acnt, int, S_IRUGO);' P! h2 e% V! Q& M  w/ w
  83. module_param(bcnt, int, S_IRUGO);* ]3 C/ Q' m8 Z& m* q2 r' s, F! d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ ?( B' G- @" X+ \2 |" v. q7 _; Z7 q+ l0 z- \) \( b; q% H8 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 J( g% e/ }- }: \5 J# y( Jarm-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 M6 c. z6 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! p* Z$ o/ G, U
0 B8 j9 J( S2 K- \3 Y

( g8 Y: Q* y. l; }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 04:21 , Processed in 0.041546 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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