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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 G4 }3 U1 R6 K" \% b
  1. [code]EDMA sample test application
    ) g) Q3 _% j+ ^( L% {/ R& l# F
  2. /*
    8 M: T5 L7 ]: G  ?3 i# f3 W
  3. * edma_test.c
    ) {; [6 [- k. x" C" N! L; W
  4. *
    7 R; x+ e$ _8 e2 N- }8 x  G) x
  5. * brief  EDMA3 Test Application/ i5 C* W. n( Q6 k
  6. *
    : s: j- _: e- P) f( ~, a
  7. *   This file contains EDMA3 Test code.
    6 N3 ]4 r3 u3 u. ~; e
  8. *& C* |! C, V" C7 N6 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( R' @, _9 N4 g2 y- o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Q3 M4 O8 k8 x2 d# t! c
  11. *         TO CHANGE.
    $ _2 @. l7 h) t4 }) S
  12. *
    $ g5 Y, i2 q& D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( S% D/ V" C' l  T6 T0 c9 b( N
  14. *1 g! s2 }# p; c& N6 I! E$ a
  15. * This program is free software; you can redistribute it and/or
    ; l. `  W/ I$ t; I% m8 z
  16. * modify it under the terms of the GNU General Public License as- `8 ?+ h7 j8 S: p6 ?6 x) n
  17. * published by the Free Software Foundation version 2.
    ( {& C7 s% x; @& G: I4 g
  18. *! M) Q5 p4 h& g8 `( N( g  y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, o6 k" J2 G2 N# J$ X/ U! u9 L
  20. * kind, whether express or implied; without even the implied warranty
    ' y/ Z' @" V# e, B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 _* {% T0 ?3 \* ~
  22. * GNU General Public License for more details.9 p" |: L$ @4 @4 V2 d+ t
  23. */
    & ~  q8 b: m- k$ a2 U4 ~- [) }

  24. " E  m# {; q1 f: b6 o' n
  25. #include <linux/module.h>+ ?- r) T0 X2 ~$ M$ u: N0 p
  26. #include <linux/init.h>) ]. W% G0 {$ i$ v
  27. #include <linux/errno.h>
    & s. l7 Q" F4 V3 r* ~& c3 r: x; R
  28. #include <linux/types.h>. ?! P* P7 Y/ H, i) \% O
  29. #include <linux/interrupt.h>& s7 r/ ~+ r2 v
  30. #include <asm/io.h>0 \. Z" Q' {2 o
  31. #include <linux/moduleparam.h>
    * `- D4 c( x, |# v5 v, f0 C
  32. #include <linux/sysctl.h>
    + h" _1 C- x9 D( E. a3 i* f
  33. #include <linux/mm.h>6 `; e4 C) W9 o9 f
  34. #include <linux/dma-mapping.h>
    5 m8 S6 Z/ i, W7 Q& A) e  c* Q

  35. 4 R  `/ ]6 w' h+ T
  36. #include <mach/memory.h>
    + C" I+ ^: b2 H: G2 n
  37. #include <mach/hardware.h>  R3 \' b& O% a2 i5 |
  38. #include <mach/irqs.h>8 D7 @5 _: {( i4 Y/ ^  q9 H( r. F5 {
  39. #include <asm/hardware/edma.h># W. ~. h6 U2 m% g' \  E

  40. & G6 X( g' q& K9 L) ]  C
  41. #undef EDMA3_DEBUG1 G1 u! C* A( G! Q5 `  ~$ ~
  42. /*#define EDMA3_DEBUG*/
    5 `; l; M. D9 ~& w6 |* U, M
  43. : R9 d! ]: S1 Y. g) {
  44. #ifdef EDMA3_DEBUG1 D7 n- A7 w$ T5 {  P, v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( m4 _5 F5 Q4 j1 m( z* ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" J  G- _, A/ V4 v; x7 v. i# N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 a5 H; l4 O7 _5 Q  |
  48. #else5 l  W5 q6 p/ t
  49. #define DMA_PRINTK( x... )" H" n3 @; _6 a6 e
  50. #define DMA_FN_IN% o# ]' O8 V9 @( I  J/ s
  51. #define DMA_FN_OUT
    * m! q) k: @# Y8 l; v
  52. #endif
    ; j& [5 [" L( H* i1 y

  53. 0 r! \% \5 }9 N* f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : r( E* c" d& i3 W
  55. #define STATIC_SHIFT                3
    1 {' W/ `  L, Q$ X0 b
  56. #define TCINTEN_SHIFT               20' s( G& M4 N/ z7 w" J1 ?( Y
  57. #define ITCINTEN_SHIFT              21$ l  R! w" G' K- k8 v# ~( ]2 Z5 Z
  58. #define TCCHEN_SHIFT                22) K6 S5 j) K4 L9 `  J
  59. #define ITCCHEN_SHIFT               23
    & Y$ S- f# k# ^+ Z* J" m
  60. ! N9 u# T; Q3 w' ~8 H4 Q
  61. static volatile int irqraised1 = 0;
    ! F* m5 \( o! D& D" Z% v4 k
  62. static volatile int irqraised2 = 0;1 k! t( N8 q/ p8 Q0 |2 q

  63. 6 T" {3 k* B% `' |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 |* U& ?, U* z6 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* M0 k( Y+ J% g- b: |% v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : `( w3 ?5 Y$ K, ]5 I- H- M

  67. 2 n6 a( I  L8 R8 v8 `
  68. dma_addr_t dmaphyssrc1 = 0;
    2 d/ K7 W3 f# W' a  j
  69. dma_addr_t dmaphyssrc2 = 0;
    ) w# {. F- v" V: J: N0 _: I9 D+ s
  70. dma_addr_t dmaphysdest1 = 0;
    & l: F3 n& t9 [% e. q7 l( V8 b
  71. dma_addr_t dmaphysdest2 = 0;
    3 ?) T+ [( m9 Y' g& G
  72. & P8 x( P+ Y, e! [
  73. char *dmabufsrc1 = NULL;$ T! ~2 Z3 m& [5 S
  74. char *dmabufsrc2 = NULL;. Z( ^& Y* d' T8 f4 Y* W$ h
  75. char *dmabufdest1 = NULL;
    2 |: O' [. ?' m
  76. char *dmabufdest2 = NULL;
    4 M; y3 v: {: |/ q7 }( s/ X
  77. 0 q4 T! J1 _, t
  78. static int acnt = 512;4 |; r1 g7 Y" Q: i. y
  79. static int bcnt = 8;0 Q8 p# j4 G4 F9 ]* G4 U; W
  80. static int ccnt = 8;
    $ C. b5 g) H' y
  81. ; ^9 Y9 a! t; {3 z. [
  82. module_param(acnt, int, S_IRUGO);
    & L( `! o2 R9 n( [$ C
  83. module_param(bcnt, int, S_IRUGO);0 d; X( d; U% @7 k- s1 Y0 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; A& _5 g4 u9 u* Z

+ {  \6 }  I+ e* }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 N$ K4 K; w7 G: g9 C2 Y; l) R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& g6 u2 a* B  x9 L6 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: {+ E% P  i) I$ ~4 f9 J. E& H

; t$ |" H9 w+ x# R4 P- R
0 U- L! Z1 S- [( M1 c5 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 21:24 , Processed in 0.037087 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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