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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 Z3 S. y9 J; [8 W$ H
  1. [code]EDMA sample test application+ J% J& X9 z2 a- N, P, f* ?
  2. /*+ I7 x+ K, s( t# L& o/ w6 m
  3. * edma_test.c
    " ~0 i$ @/ f$ h8 r/ k. \; g0 ^
  4. *" y, {! ~, I* [! [
  5. * brief  EDMA3 Test Application
    # \4 u8 r, V  _) x5 g
  6. *
    3 ?( ~5 s" w7 \
  7. *   This file contains EDMA3 Test code.
    0 ]$ o, R' Y1 v2 ]# n  x$ r" G
  8. *
    . M5 \/ k: Q5 n( r. l/ K# X2 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 a; Z) B: q, z) a; e! m1 S8 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. X8 j5 {( X. H$ N3 j# a& W
  11. *         TO CHANGE.
    2 ~1 c. g  _/ Y' d( k4 H! h# Y
  12. *  b: y" p+ u- N  b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # Z, R" ?. m: f# Y4 }9 W) q
  14. *
    6 p' H2 j; R  ?8 e  L# h
  15. * This program is free software; you can redistribute it and/or7 ~9 t0 t6 q$ H/ h
  16. * modify it under the terms of the GNU General Public License as% l2 n5 d/ i: o: `( ]
  17. * published by the Free Software Foundation version 2.
    / T4 M- v$ U/ Z( I1 z
  18. *
    , r; `: h# l" i  W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 A3 m6 u2 H" X0 {( N
  20. * kind, whether express or implied; without even the implied warranty
    * l. X1 C5 a; C5 x1 D" l* n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 _: Q: n2 w, d6 M8 q5 {2 d/ p
  22. * GNU General Public License for more details.
    ) j+ c( |1 q' u" W$ n9 H% W4 z
  23. */
    4 b2 D- K4 W+ g5 |8 Y6 X, O: p
  24. # A. E$ g2 ~+ V
  25. #include <linux/module.h>( ?0 y# m8 W5 ?: h1 P
  26. #include <linux/init.h>
    3 J% B% F4 j+ U( P% N0 x* v
  27. #include <linux/errno.h>
    ! R; {4 b/ O! \5 K* q
  28. #include <linux/types.h>
    ! y' S8 N6 g* Y" |/ a6 O5 g. V
  29. #include <linux/interrupt.h>- h- n8 w. ~0 y1 e4 c+ g  I
  30. #include <asm/io.h>
      J( _3 O) z0 W: j7 b
  31. #include <linux/moduleparam.h>/ R& D( [& Y! U. k
  32. #include <linux/sysctl.h>1 F; G6 @" _1 t* g9 U
  33. #include <linux/mm.h>
    3 s- j. E, x7 {7 M" |; V; R
  34. #include <linux/dma-mapping.h>
    # I* z6 d. f& w6 P4 _& S, R- r9 Y
  35. # C+ L0 u; b8 i2 T
  36. #include <mach/memory.h>
    ) s: I% i/ O6 X* J4 F$ [
  37. #include <mach/hardware.h>5 u7 y; k; u( t- I
  38. #include <mach/irqs.h>
    ' S) j1 Z0 x$ U) I9 u4 @
  39. #include <asm/hardware/edma.h>! h- A* k! q6 v3 V8 \
  40. # y6 Z! p' p- O) {
  41. #undef EDMA3_DEBUG+ [3 H1 l$ b3 F* @
  42. /*#define EDMA3_DEBUG*/
    , J. J/ y! L# x* u$ ~0 y
  43. 5 {5 T( {5 |( r; e+ T% E
  44. #ifdef EDMA3_DEBUG
    3 o- e* R- R, |: \  t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 G; I: _; T* A+ |/ v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * f2 N  h1 e* g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      ~& o; c  v) M! @7 L2 f
  48. #else
    ; O1 q/ I+ ?- a' L
  49. #define DMA_PRINTK( x... )
    9 R4 C1 Z) E8 c
  50. #define DMA_FN_IN
      ^% N+ c4 B: z7 Z& O5 P3 u2 B& u+ g
  51. #define DMA_FN_OUT3 |2 @5 I! s. J, ]; g) M
  52. #endif( r3 y) f' U, b4 G

  53. ! S0 O4 X$ O. ]1 X7 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ @4 {, k+ E- i) c6 r! x: J
  55. #define STATIC_SHIFT                3
    3 j3 e& y# ^3 ^5 f: P& p
  56. #define TCINTEN_SHIFT               200 S, G8 ?& O/ L7 J! E7 w$ v+ o* d
  57. #define ITCINTEN_SHIFT              21
    ! C: r6 e- }- W$ R. ?
  58. #define TCCHEN_SHIFT                225 E4 b7 t/ I# z9 R
  59. #define ITCCHEN_SHIFT               23# T4 W& M& I) V

  60. ) W7 _4 s& f5 B
  61. static volatile int irqraised1 = 0;
    - n3 y/ z# H2 ]- _# s5 R
  62. static volatile int irqraised2 = 0;8 C# [0 y  {$ O# x8 o: Q' _

  63. 8 F- \5 s, ~& J( H: F: V7 e% y1 O6 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 T7 F! \) i4 A9 x2 O8 ~/ f1 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 _, \/ `+ L# K) W, o, ~" g) v# p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 P2 V2 i: p4 A( y) O2 l

  67. 0 z& c0 b% }2 F; a
  68. dma_addr_t dmaphyssrc1 = 0;. ^! h6 K# d; F9 n
  69. dma_addr_t dmaphyssrc2 = 0;" @4 T" H; p( H8 M
  70. dma_addr_t dmaphysdest1 = 0;% a% F0 n0 g4 O9 @
  71. dma_addr_t dmaphysdest2 = 0;- K8 ^  m( }, i, x

  72. % i$ n/ \$ S& A/ L
  73. char *dmabufsrc1 = NULL;
    4 O! G( W2 D1 K, Z2 J# D9 r: t- ^- Y
  74. char *dmabufsrc2 = NULL;3 i" J3 x9 A# I  [, ^6 s
  75. char *dmabufdest1 = NULL;
    : N" H) y. i0 q- P% W
  76. char *dmabufdest2 = NULL;. v7 C# |6 y; l% m  M: E3 T0 r+ X* b
  77. + k8 W7 n5 j. E9 I' T) U- t6 h/ N
  78. static int acnt = 512;
    $ x8 ]3 \0 A! U
  79. static int bcnt = 8;! ]  d! a( l, q( n  Z
  80. static int ccnt = 8;
    3 i1 {! c: I* M% `6 J

  81. , ]7 a) |1 y4 P, l9 m+ L" E) l
  82. module_param(acnt, int, S_IRUGO);1 Y" k, U6 w: f3 K5 X
  83. module_param(bcnt, int, S_IRUGO);
    * ~2 Q& J( R& u" S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) H* r3 G7 ^1 g7 c+ O9 B1 \: Q6 I; e8 m5 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 [" [9 f% o" |7 g, _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* s7 n* F. o' Z) ]! @6 U, p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. X! u" G1 [1 C7 V& H

( N6 M. @3 J8 ?4 }: d/ e. l7 m+ U5 S& W% Z2 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-12 20:49 , Processed in 0.040237 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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