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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 R+ ~8 }2 S+ w8 z9 N8 O' u
  1. [code]EDMA sample test application+ a" ?8 e8 v8 v/ E- e$ `
  2. /*7 y+ {. h/ S" N, q- q8 ~
  3. * edma_test.c
    ) b( K, i. W9 g6 K' M
  4. *
    5 s- `1 ?9 B) o) f; j2 }
  5. * brief  EDMA3 Test Application
    ) p3 r% q& }4 d& z5 D% R# M6 F
  6. *2 x: \9 l1 {2 A$ S0 M) [3 C; p* y1 I
  7. *   This file contains EDMA3 Test code.
    $ J2 d- C& D: ?% m/ N+ F. X; N
  8. *
    ' u% Y1 f( N  i/ l* v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 n' s% u0 ^* ?5 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 E" e+ D( J3 X: v& Y: _- }
  11. *         TO CHANGE.; b8 @& o0 @! |6 @7 R
  12. *
    8 i- P: }( \5 l8 T2 N" \) u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      M: W! e( A$ _, V
  14. *
    1 q- A9 N0 L9 P/ L2 O) I3 g8 q
  15. * This program is free software; you can redistribute it and/or& ]' X% r* V$ E: P& {- m- ?! T- x
  16. * modify it under the terms of the GNU General Public License as! ?9 `3 Z, S% p0 K1 ~6 p( h
  17. * published by the Free Software Foundation version 2.
    7 t" v8 V! z2 F2 r4 c" Y
  18. *& r+ @6 K- t7 V( ~; {* [& N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, }( e7 d! e6 Y! j- Z
  20. * kind, whether express or implied; without even the implied warranty( Y  V' s' E$ Z) }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 b% r1 ~! W  n, E
  22. * GNU General Public License for more details.
    1 i9 A& g0 U6 p1 b; D9 ^; n+ M9 k8 u
  23. */4 C; x( g+ v5 M- a- q

  24. * T' g3 ]5 D! A/ }2 d; k
  25. #include <linux/module.h>0 f. O5 v, Z& B  c
  26. #include <linux/init.h>
    ( h1 d6 ^& g8 @- \! C- D
  27. #include <linux/errno.h>4 o0 ^$ F6 b6 X1 x/ R9 O; K
  28. #include <linux/types.h>( x/ p0 X7 v1 X
  29. #include <linux/interrupt.h>2 n8 R/ z) @& l) |. ?; Y
  30. #include <asm/io.h>  t3 R9 p& I; F3 `( S) ]2 F. U
  31. #include <linux/moduleparam.h>, o. }+ k7 k4 V( n, a
  32. #include <linux/sysctl.h>
    " _$ \, @% }2 R: K; [5 Z* d
  33. #include <linux/mm.h>6 u9 j3 E. J; c9 c
  34. #include <linux/dma-mapping.h>+ l8 [/ d7 M+ q7 k: f

  35. ( n* Q7 c3 M0 n; l5 r
  36. #include <mach/memory.h>
    % C' y* q% f* G9 C, Y
  37. #include <mach/hardware.h>* t! M& d! }; j, r
  38. #include <mach/irqs.h>
    / j: i; X  H- g% c: l
  39. #include <asm/hardware/edma.h>
    0 Y; f8 ^' S3 ?2 S9 J

  40.   a2 K9 W2 j" C' C# [  H5 \# S
  41. #undef EDMA3_DEBUG( @8 U; M4 p+ ^/ C5 J! ]0 ]
  42. /*#define EDMA3_DEBUG*/
    7 C: [% S+ h7 \# Y8 ?) z

  43. 5 U- I. Q5 Z# F2 h
  44. #ifdef EDMA3_DEBUG. ^3 e& I: s4 `, f' T, r% U. V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : c* [% l' o& R2 ~% b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# n+ k# I$ C% ^) q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) w2 z# `: O! M2 h, a! R
  48. #else
    , R4 J8 Y% D" P
  49. #define DMA_PRINTK( x... ): E( o! q2 U# n$ v4 J
  50. #define DMA_FN_IN
    , U; w( |# w# h1 `3 I: V) z
  51. #define DMA_FN_OUT
    : E: n2 E4 y/ q& B: o' J  W5 b! X8 x
  52. #endif& b" @1 Z- H$ q! Z% S9 m/ ?

  53. - _" K2 R9 q+ y' ~3 x4 Y4 k7 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' T2 x3 [8 ?1 K$ R9 M0 z8 |. }
  55. #define STATIC_SHIFT                3
    ; K9 N9 X1 k9 P' ~" h
  56. #define TCINTEN_SHIFT               20
    , @; ?+ Y! c- R+ l6 Z
  57. #define ITCINTEN_SHIFT              214 _6 T2 h- n7 Q- M9 u+ _( U
  58. #define TCCHEN_SHIFT                22' ~0 m% d! s: w2 O
  59. #define ITCCHEN_SHIFT               23- |; C$ c  I9 @# X! G
  60. : P6 A* W3 m! q4 L# s
  61. static volatile int irqraised1 = 0;
    % f$ b7 e% l, y+ V) A
  62. static volatile int irqraised2 = 0;4 V2 x  h; l1 C. T4 w

  63. : A* \+ w7 Z+ T8 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a6 `2 v1 C9 D6 v0 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  i* F+ c  `/ e$ R5 E0 L% R4 _$ k" l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W) Z% H+ x: i+ u2 Q) N& O' B; d

  67. + g7 ~; c  `6 D  O
  68. dma_addr_t dmaphyssrc1 = 0;, |6 m! F. c7 V3 ]9 O2 ~) t# D, z
  69. dma_addr_t dmaphyssrc2 = 0;
    4 }# b) T6 k/ z- N  Z( [
  70. dma_addr_t dmaphysdest1 = 0;8 D, m, ^& K. n! K! y
  71. dma_addr_t dmaphysdest2 = 0;
    & v6 j, g/ I4 A& C

  72. : ~, ^6 P+ ^, o& \3 ?6 _
  73. char *dmabufsrc1 = NULL;9 T; t! u- W  G1 Q* X
  74. char *dmabufsrc2 = NULL;
    6 J& E) P/ a( q7 i# M9 o; ?" K
  75. char *dmabufdest1 = NULL;
    $ l; e  h% A9 N; O( t% u$ U
  76. char *dmabufdest2 = NULL;% x4 R4 r7 z; a! i1 U

  77.   s# I  q4 _/ e4 |  N& `
  78. static int acnt = 512;  D$ Y  J& ?( f' ~) N/ ~& L; _5 V
  79. static int bcnt = 8;
    # e- s  q% Y3 @( U+ \7 W0 Z) j
  80. static int ccnt = 8;
    . v; r4 P# [8 Q0 G  b- r2 E
  81. 9 h) [6 w5 i* t; d
  82. module_param(acnt, int, S_IRUGO);" m( p( @  f, B) n: A& J
  83. module_param(bcnt, int, S_IRUGO);
    ( ^5 D. {' G5 G' T* r% i% K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ Y0 S5 p, j9 @6 `) y4 O3 `/ s) x: a; T' K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ A. _6 \. i- m3 g- Q3 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Y; r/ Y) L& w9 }. r7 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# x6 D9 b6 R, f5 W0 d* i! n

3 d; B) [& e; ?; K% h7 d. ^; b! X* Y8 U  i: p1 h0 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 01:00 , Processed in 0.041950 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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