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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' E& @- `  B) B7 J; y! ]
  1. [code]EDMA sample test application7 O7 f- K* ?8 Y) s3 p7 @
  2. /*
    8 k: o( o/ f* A- }6 m% [9 u' ?% |4 Z
  3. * edma_test.c
    ! K$ G( _6 M, e% q
  4. *
    ! t) |+ u. G' E' I
  5. * brief  EDMA3 Test Application8 n$ q2 u  T. q
  6. *$ R* M) a* t3 i1 O" s; @
  7. *   This file contains EDMA3 Test code.4 S8 Y0 h8 p9 h
  8. *
      T9 o* _# h9 S) ~5 O" q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ I; E5 F0 l- [0 G  F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& f6 T! C+ j! G5 P' u1 Y- A
  11. *         TO CHANGE.: u' E$ m) I) q5 L. k  t
  12. *: I7 G8 |' \- y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! b0 _) B: I# ^2 l% t4 F9 h0 r
  14. *- ^. p+ ~' A/ C! M& h  b
  15. * This program is free software; you can redistribute it and/or% `2 V5 |3 n! B8 R
  16. * modify it under the terms of the GNU General Public License as/ S- \" d8 V9 ]& n
  17. * published by the Free Software Foundation version 2.3 s! [3 g. X" A, n' l) E7 ?: q
  18. *3 |/ f- J6 Q  ^8 B+ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " @( \2 Y  |# D  u/ l$ k) y
  20. * kind, whether express or implied; without even the implied warranty
    + X( V9 a5 _1 k0 Z6 \# z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 |3 V' l* p' q" d+ R8 E
  22. * GNU General Public License for more details.2 j9 h" s6 M; D& b1 H  O# c
  23. */0 q: C% [$ x) x! B

  24. # ^' H; d0 k& W9 Z5 M- r
  25. #include <linux/module.h>; R( i4 W+ _3 O" }1 M# z/ v
  26. #include <linux/init.h>; q  X) `0 @1 u' ~
  27. #include <linux/errno.h>
    $ L  d( W% O; e8 o% ]9 n0 v+ L5 D( z
  28. #include <linux/types.h>4 \; R5 w$ q- M2 A9 H
  29. #include <linux/interrupt.h>2 ~" l4 u" L) V7 s1 g
  30. #include <asm/io.h>* P9 W  l/ t! }+ j! U& q2 v
  31. #include <linux/moduleparam.h>7 B1 C6 A7 Y- d+ _/ x
  32. #include <linux/sysctl.h>2 \; {1 u6 @7 l7 u
  33. #include <linux/mm.h>
    % \% T* w5 u5 L9 E4 I+ D/ S6 x
  34. #include <linux/dma-mapping.h>$ h: ?" I, B* `! d. i  D

  35. 3 Y& ]0 v; P1 Z( D! f) Q
  36. #include <mach/memory.h>/ ?3 w( e# q. `5 C0 m$ C2 s! {  K
  37. #include <mach/hardware.h>; X4 p: T% {* H3 `$ c" c
  38. #include <mach/irqs.h>8 r) m( W9 V$ e! `  p3 r
  39. #include <asm/hardware/edma.h>) u1 x" C4 E! N$ n/ c
  40. * m( I" P! T# ]* u4 U
  41. #undef EDMA3_DEBUG
    ) {, c  C6 Z0 X& \' i
  42. /*#define EDMA3_DEBUG*/' i2 u1 ?* b: \3 U
  43. 1 b& n( h' ?. G% X# c3 J8 |; e
  44. #ifdef EDMA3_DEBUG
    , e6 e( J' m6 I- n: L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 a8 A  w9 M6 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & _5 i( Y3 h+ r6 e' `% g' m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # b6 u3 J) G! a/ \0 c8 d* W
  48. #else" S( f0 c% I( e9 C
  49. #define DMA_PRINTK( x... )
    % q4 W) w. p3 J% b8 F+ w4 L8 B
  50. #define DMA_FN_IN. f$ k4 K: N' |0 X
  51. #define DMA_FN_OUT, `2 h6 F0 [/ {
  52. #endif& x* Y, }: |& j0 F) x' z* F
  53. 0 a! b( U9 B0 f1 E8 a& J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % t; A9 D4 o; G; b$ y& F
  55. #define STATIC_SHIFT                3
    ! b3 K, C# A0 `* D/ o7 B
  56. #define TCINTEN_SHIFT               20
    : F( F# W4 u6 e( k! n0 N" P
  57. #define ITCINTEN_SHIFT              21% u+ ~# a' H: q/ D# ]7 g+ H+ [! T4 F% v/ |
  58. #define TCCHEN_SHIFT                22
    : |( H! k% g1 G& [8 p% ?; Z
  59. #define ITCCHEN_SHIFT               23( f! j) ?# p' F3 X9 e

  60. % x- z; h/ f( i# M. i
  61. static volatile int irqraised1 = 0;! S( ]( }# v2 S3 Y$ C
  62. static volatile int irqraised2 = 0;, P" `3 Y' M+ p/ y
  63. / X" X5 s8 H/ A! Z; I! ~# G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / J$ o: Q$ w0 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w2 r+ \! r& @! o( g5 _, J4 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N1 x  `" x3 {0 A
  67. ) J3 U. r  r& V. \$ F
  68. dma_addr_t dmaphyssrc1 = 0;1 L, Z6 V, Q/ w+ W& g9 S, `
  69. dma_addr_t dmaphyssrc2 = 0;
    1 g( A8 G4 K) \1 s" g* S
  70. dma_addr_t dmaphysdest1 = 0;
    ' U# C" v7 }: A! c* X
  71. dma_addr_t dmaphysdest2 = 0;( L) A( p- B9 J: q
  72. ' k. E4 r  z. [
  73. char *dmabufsrc1 = NULL;. m" H8 r: a" c- v( Q5 @
  74. char *dmabufsrc2 = NULL;
    * H' h0 ]+ N$ r" N" ?3 s+ i
  75. char *dmabufdest1 = NULL;: q  e1 Z; a- a4 h; G9 P2 b
  76. char *dmabufdest2 = NULL;9 z! M, f/ |8 x) y8 l9 _' Z0 a

  77. & q( G$ o8 V4 f* |
  78. static int acnt = 512;
    : J, |0 u. }# i: _% b: d6 p; r
  79. static int bcnt = 8;
    0 D* A9 P7 M! Y: i8 T' {& U
  80. static int ccnt = 8;
    0 M, }5 A7 L2 Z

  81. % X8 x5 H+ D0 q4 y+ Q# H' M  V
  82. module_param(acnt, int, S_IRUGO);' b6 s8 G; ^9 N8 l. e
  83. module_param(bcnt, int, S_IRUGO);( {6 S  b0 E+ N, Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, V- ]' O" a& Z: k0 Q* v! Q7 T

# u6 ]0 J* e3 }4 b; H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# R% _0 s' B5 t; Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! l6 ]1 f, S" e% O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! m- S! A, c/ A3 l1 ^8 }  J4 G
, H! W7 z( T3 ?# t: H/ I! k0 M& ^
& n6 P  }. D7 F4 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 14:56 , Processed in 0.046198 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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