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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J2 s* p& W+ o: O- S- ~
  1. [code]EDMA sample test application
    : `) \9 q3 [2 o; D) u) L4 c
  2. /*+ g$ c- D6 n. S: C# n
  3. * edma_test.c
    ! S: b9 E5 ~- [# o- }* O9 M  m& Z3 w
  4. *- X) l2 r( d" S3 Y/ d, J4 k
  5. * brief  EDMA3 Test Application; z+ h# D2 ~( Q+ n
  6. *
    # y9 N, }- F! Q7 i0 R1 Y+ C
  7. *   This file contains EDMA3 Test code.2 }- H. `1 }5 r% y
  8. *
    0 k: R2 Q$ H6 ?/ r* ~7 t" `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 T( I. {) o* c# c: z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + y# B4 f$ O+ h  n1 }5 v; \
  11. *         TO CHANGE., y& R5 ^; n. O; j. S
  12. *
    . w; ^+ e+ D6 N) \+ S' U% b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) L6 s. W) N4 E- |" t, g
  14. *1 p) k# b- m" r$ G. Z0 z
  15. * This program is free software; you can redistribute it and/or- f8 t# _9 t) h7 H) Z4 l5 Z
  16. * modify it under the terms of the GNU General Public License as/ P/ h$ }7 {! X8 `5 T
  17. * published by the Free Software Foundation version 2.
    9 p$ Q7 }# s; \" a( ~; y1 @
  18. *1 e% D2 l6 c( e1 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) g* o; H, t1 X" I9 \9 Y
  20. * kind, whether express or implied; without even the implied warranty6 g$ i8 J; L8 g. x+ [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( E$ Z9 C  I* w; F2 w3 ]  E. {
  22. * GNU General Public License for more details.
    ) e+ N4 R1 g( G5 X* Q5 Q: l
  23. */) e; l" \' Y* V( ^1 G  B8 _
  24. " }+ x! t* z% [9 ]9 w' B
  25. #include <linux/module.h>$ S+ W2 a  ?3 n
  26. #include <linux/init.h>/ g5 x  J- @( N3 [- B5 [) ^( ?
  27. #include <linux/errno.h>+ b" z7 l2 S3 R2 T
  28. #include <linux/types.h>
    ; y9 Y" x3 P2 N" q" ]  f4 h
  29. #include <linux/interrupt.h>
    , e. q3 J: l' A* h( Y
  30. #include <asm/io.h>, v2 Y3 G/ f6 g. t4 o/ Q
  31. #include <linux/moduleparam.h>) P, D: C' W9 V  W5 V( S
  32. #include <linux/sysctl.h>
    ! {: D1 U9 _' _# g) G1 Z) x
  33. #include <linux/mm.h>) L$ d9 K6 i$ H% j; B! n5 m& g6 A) ?
  34. #include <linux/dma-mapping.h>
    8 M, _* e! E0 I6 J& d6 z' f
  35. 2 b1 f8 r' P/ h9 {3 K8 k
  36. #include <mach/memory.h>6 g4 q" _4 ^+ Q& Z$ S0 d/ w) B
  37. #include <mach/hardware.h>" \7 y5 ^1 e8 [  I1 f
  38. #include <mach/irqs.h>  W) {2 S# |& g
  39. #include <asm/hardware/edma.h>3 F. q0 D2 _7 n/ A
  40. % V  X  }0 i" z5 M) O" A
  41. #undef EDMA3_DEBUG: f4 k% {  m) V* ^2 V
  42. /*#define EDMA3_DEBUG*/# P% p! L3 A! r1 |. O
  43. ! x& E6 B& m  ]8 l. G5 j+ w
  44. #ifdef EDMA3_DEBUG
    & i& M2 ^4 j# I0 H" J, F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' H0 d/ Z. H& |/ j  K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 \5 Q; d' M) {$ X9 z! J( O7 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). A, Z2 u  K' j( M+ ?( Y. ]0 X1 N7 h
  48. #else
    8 V3 _' G7 l( b- r' }. I, J
  49. #define DMA_PRINTK( x... )' B8 X0 ?9 _; L( m- Q9 r, S
  50. #define DMA_FN_IN
    / q' c6 P6 h/ [' b2 A5 k! ?- k4 T
  51. #define DMA_FN_OUT7 D! X! T+ q3 i4 s/ a
  52. #endif1 I" j9 h! T$ ~' h

  53. 6 \2 t2 D. T! |2 |3 H" j$ \1 G4 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 O- r/ h. Q7 q4 f) [* y
  55. #define STATIC_SHIFT                34 R* t! ^# S4 o! _# e6 L
  56. #define TCINTEN_SHIFT               20: }# P3 j2 W8 i4 g+ b5 N; Q
  57. #define ITCINTEN_SHIFT              21
    3 K9 n  r0 Z4 E& P
  58. #define TCCHEN_SHIFT                228 ^/ }. d, ?4 J2 Y
  59. #define ITCCHEN_SHIFT               23
    ' V( p, S) v3 m2 B/ ~/ h0 c

  60. * C7 L8 X( _9 k3 Q& o" ^8 r
  61. static volatile int irqraised1 = 0;
    & R, }# i8 h* @$ _& |
  62. static volatile int irqraised2 = 0;
    : Q7 k' _2 U5 b" D  O3 a  H
  63. ! B" f8 k1 l6 t. G. G) y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X6 {+ r$ q# t- ~; Z) K0 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& t7 l7 n; U9 |4 K+ g( R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" w0 D0 [/ ^( D; b3 f2 F

  67. : B) A: @; E) k
  68. dma_addr_t dmaphyssrc1 = 0;) o: Y! q: K6 x# a0 n" f6 L
  69. dma_addr_t dmaphyssrc2 = 0;
    . S+ c$ P) r6 X0 |. l' ~
  70. dma_addr_t dmaphysdest1 = 0;
    " E* m) w- k9 G6 {1 @& e$ m
  71. dma_addr_t dmaphysdest2 = 0;
    + z4 W: ~/ s  K4 d9 i) r6 [2 y- |: I+ c
  72. 9 J# Q7 }. I. S% Q, w* b" v
  73. char *dmabufsrc1 = NULL;
    % s# `9 I0 m6 I1 q/ _
  74. char *dmabufsrc2 = NULL;
    : p1 o) V0 T1 H& Q
  75. char *dmabufdest1 = NULL;5 k& H2 @3 k- E7 [5 w. ]
  76. char *dmabufdest2 = NULL;, w' |/ Q! a. t/ a

  77. 2 a9 v3 d3 G4 R9 c/ q& e9 f
  78. static int acnt = 512;$ D$ b# w: o+ K1 Q6 d
  79. static int bcnt = 8;
    % q) X3 x& j& D& v# \- C6 n# v+ r
  80. static int ccnt = 8;' J: a% @0 A! s; }7 E

  81. 0 O/ V( @) B0 s7 G3 ?
  82. module_param(acnt, int, S_IRUGO);% E! b' Z4 |: L4 C
  83. module_param(bcnt, int, S_IRUGO);
    8 S; f. C% g4 [2 Y/ n" n5 U: [' i4 S4 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" s; x: `. }( W% c" z1 P& Q& |3 a7 g7 b0 Y* ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 l! x/ J7 J4 ^  a& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ A- Y1 u/ ]3 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c1 Y/ |1 A0 S
, U1 c1 `. l, x4 C' z7 A) s1 n& e4 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-13 08:12 , Processed in 0.038359 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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