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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 h- v% D& R) c* y6 [% d
  1. [code]EDMA sample test application& N7 X% f7 N: G
  2. /*  J# n: ?5 n, O9 I! z( @
  3. * edma_test.c
    2 v% U8 X- m- A. J4 d* P8 N- R' X
  4. *: g; k6 ~+ o. o' Y% U# U
  5. * brief  EDMA3 Test Application$ [8 s: C- k1 F6 C( H3 L
  6. *
    1 W/ X$ E& ]- Z7 L
  7. *   This file contains EDMA3 Test code.7 Q3 W6 N5 F/ n9 h1 p+ X
  8. *" ^! t% }9 m; R' H! A3 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 k# h1 [, ^% U/ u( x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: t8 I( V' Z& l" Y/ ]. G# f' O. N
  11. *         TO CHANGE.1 t' t1 d; I3 t$ h
  12. *
    ! C6 [/ Y4 M- Q) A3 u, A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ]8 Z) W7 g5 Z4 A! L  S6 G" p
  14. *
    . ]1 Q7 p* O5 p. W. p; d
  15. * This program is free software; you can redistribute it and/or
    1 [) R/ S* K( E2 S; z+ X
  16. * modify it under the terms of the GNU General Public License as
    . U. K- F: A8 _8 H8 K" C
  17. * published by the Free Software Foundation version 2.
    , g% o7 P, j$ i$ U& m
  18. *
    5 d4 D5 b& X3 A' o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* I" d7 i( J- d( M8 @: D
  20. * kind, whether express or implied; without even the implied warranty0 u6 j1 {2 p0 W7 F4 f7 x! e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 L  F- G6 j9 m9 ^( k6 p) {
  22. * GNU General Public License for more details.. c( H% [4 I& v$ Y: A; w! W( _
  23. */4 V) A( p  m, _3 Y
  24. ' J* D; W* f5 b& [
  25. #include <linux/module.h>
    ! i, Z$ a. u* i3 \! x
  26. #include <linux/init.h>
    7 @0 i5 Q* [5 ~  Q" U  }
  27. #include <linux/errno.h>7 N4 A8 X8 ]+ Y. m9 \
  28. #include <linux/types.h>. E( x7 O8 w" i8 i- N* ]
  29. #include <linux/interrupt.h>1 w- c% X! K. X. E
  30. #include <asm/io.h>
    ' S1 ?& ^* p; q" y' w2 h6 {& [0 c) F
  31. #include <linux/moduleparam.h>  W3 \- Y0 o( j3 m7 H4 O
  32. #include <linux/sysctl.h>
    6 e& {- l1 N5 E
  33. #include <linux/mm.h>( [, c; B; m) r  A
  34. #include <linux/dma-mapping.h>
    0 m+ ~" U" B+ f

  35. , w5 b% E+ }. |$ J7 f, h6 w
  36. #include <mach/memory.h>! R5 s, }: Z( D6 q  c, L
  37. #include <mach/hardware.h>
    : U( i6 r  S  T& Q  U' h2 O6 Z
  38. #include <mach/irqs.h>. l( m% R4 X% M7 s/ e
  39. #include <asm/hardware/edma.h>
    / Q" x+ M$ E) O

  40. $ W3 ?6 r) m- [. v. U. Y2 r1 E
  41. #undef EDMA3_DEBUG
    ( I6 {1 V6 l6 X  I
  42. /*#define EDMA3_DEBUG*/
    ! ?2 r0 z7 v# ~! b; Q& g- A
  43. , j  g& R1 r* M( n  H6 q
  44. #ifdef EDMA3_DEBUG
    % E/ |/ |4 Z+ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) k! i0 b7 S: V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % l, M2 o9 p# x# f* ^7 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 |0 h. H6 I; X6 h+ U% S1 c. t
  48. #else
    / K2 H3 m! G+ F$ F& \
  49. #define DMA_PRINTK( x... ), W' `" b- V* \; F0 B
  50. #define DMA_FN_IN
    ) ]! w1 [5 ~! I* b0 j% {( a
  51. #define DMA_FN_OUT" Z* r5 k0 w5 ?, c$ j/ z9 s
  52. #endif
    5 o; ^5 [! ?/ x
  53. % i) r. G0 V0 X0 z1 s: l6 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 {+ i) r' {$ u' @  K
  55. #define STATIC_SHIFT                3( A1 t3 Z( p  h$ C
  56. #define TCINTEN_SHIFT               20; B% f" k" v1 c7 f* S- g$ e
  57. #define ITCINTEN_SHIFT              21* `0 x5 {+ x4 G/ O4 T( T
  58. #define TCCHEN_SHIFT                22
    6 m2 X: e3 l& Y9 }' f% l; g
  59. #define ITCCHEN_SHIFT               23
    : p; q/ U; `+ ~9 D% e
  60. + o* w! }& s' r# e* i' E
  61. static volatile int irqraised1 = 0;. ~- }# }8 M# ]6 T
  62. static volatile int irqraised2 = 0;
    : {  |1 p* B' t' a' D* i# P

  63. & j2 K% s7 x: ~. `: C) Q. ]6 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `( B1 E( Q1 v* Z: V$ a( |) V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / }8 ?6 {2 n* a, ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 a4 E2 J" x/ `3 _9 u
  67. " }/ h7 l% ]2 i" ~
  68. dma_addr_t dmaphyssrc1 = 0;! {0 L; \* r% _3 j8 F) m
  69. dma_addr_t dmaphyssrc2 = 0;
    % [5 ?( b6 z+ L4 e- D5 ^
  70. dma_addr_t dmaphysdest1 = 0;
    $ I% R5 G0 t  F
  71. dma_addr_t dmaphysdest2 = 0;
    1 N  m% {; r( o' N/ u6 p# ~
  72. 2 c1 R* j- X& N/ q- C2 ^& P  V
  73. char *dmabufsrc1 = NULL;
    . f' L  K0 X  g1 ~2 O. v) O" o
  74. char *dmabufsrc2 = NULL;
    ) T# Y- ^) o1 Z7 y9 p
  75. char *dmabufdest1 = NULL;
    ! ?9 {; S5 L/ S5 ?9 S
  76. char *dmabufdest2 = NULL;  s$ x1 {1 G" f: P3 U) G. ~: _* W

  77. * e  {4 e- g2 `- ^& v
  78. static int acnt = 512;
    3 i# I' M) w) ~9 ~' w9 p5 k- t( _
  79. static int bcnt = 8;8 y+ [5 a5 o' S* A; d2 h
  80. static int ccnt = 8;
    * h4 j0 \8 q5 c% d% o
  81. : D( Z; m! z' f8 B: J
  82. module_param(acnt, int, S_IRUGO);" n, Z+ c0 V: H, Y  K" v
  83. module_param(bcnt, int, S_IRUGO);( d, u2 h5 ?0 U  j5 D* g) ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ K+ E9 Q: F( D
% _: l+ R# G  N/ I9 N9 J. F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 y. _* t1 s$ ^% S" A. t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! k9 f1 S' T# P' }5 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- F; h: P5 s( J) ~
0 ?" @( @: E  J  E0 B

# r1 W& K* \" n2 S. \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 23:01 , Processed in 0.038967 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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