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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % K9 v. N1 P( y4 d* O
  1. [code]EDMA sample test application7 u8 g( y! s; ~) A
  2. /*- P$ k4 n9 k5 `
  3. * edma_test.c- h/ a/ H, W) |% L) [
  4. *
    7 e* ~: Y( g0 Y2 \  T* M
  5. * brief  EDMA3 Test Application2 C  R  q1 U7 Y5 U5 g" ]
  6. *5 ~, L: G, \: A5 _
  7. *   This file contains EDMA3 Test code.
    5 p5 b. j- G% p+ R9 C: N
  8. *8 @& w6 {# k: W2 @( W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% t( W5 i9 N" ?* i  ^: V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) w3 Z2 W/ D! [/ ?0 p/ ^
  11. *         TO CHANGE.
    , m( }6 c2 Y$ o1 S9 K. e/ L
  12. *
    ' x# o2 S6 W6 ?* z3 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : a% }7 m2 K1 l0 V0 N9 N
  14. *3 r+ C% T( j; N' X2 q# z2 e3 F
  15. * This program is free software; you can redistribute it and/or
    3 {7 g! i2 ?* E+ f
  16. * modify it under the terms of the GNU General Public License as
    9 m! U! |6 W, p
  17. * published by the Free Software Foundation version 2.
    ; i/ v( c  E" M) \
  18. *2 F* |( H' T8 G+ F  @# }9 m. n9 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 S) h+ S3 i: z' Z
  20. * kind, whether express or implied; without even the implied warranty5 T1 [8 r0 k' i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * y$ z, w; k3 T7 X. o" C9 S- f
  22. * GNU General Public License for more details.
    3 [8 i2 W3 k& d% D/ h
  23. */
    , H: y5 |4 C* X- D3 F. v; X

  24. : o$ H6 y8 n4 L& E
  25. #include <linux/module.h>/ s0 ]( Q( E& j
  26. #include <linux/init.h>: e: e) K8 Z- J9 q/ m  H( F! a
  27. #include <linux/errno.h>
    2 |7 _' P$ x" z9 S
  28. #include <linux/types.h>
    " M2 M# w1 L+ `* V( |( N' Q- @7 |( }
  29. #include <linux/interrupt.h>+ U# q8 c3 }. @
  30. #include <asm/io.h>
      u! x; _+ s5 l
  31. #include <linux/moduleparam.h>
    # g: V$ L; E$ @" L, e0 C, A
  32. #include <linux/sysctl.h>
      J" [1 h' ^+ U5 \
  33. #include <linux/mm.h>& c  G. C2 z6 b! W
  34. #include <linux/dma-mapping.h>. u+ J+ S9 a5 j

  35. / w$ [; b  |+ d+ f* k! h  y% u2 \. H
  36. #include <mach/memory.h>
    ; F$ q8 ^" W4 ~+ Z. }+ P: n
  37. #include <mach/hardware.h>6 h( h# N( l+ W2 N9 n
  38. #include <mach/irqs.h>3 C; H1 E! h3 l" O+ ]
  39. #include <asm/hardware/edma.h>
    , T6 l4 K9 i4 F4 y3 K
  40. 8 R* g6 n9 y4 G
  41. #undef EDMA3_DEBUG
    2 I7 ]) w0 S6 W% |  I* T' ~
  42. /*#define EDMA3_DEBUG*/
    ' U8 h! ]  f7 t: c
  43. - G  Q/ C0 E, h- Y1 t# ^
  44. #ifdef EDMA3_DEBUG
    . H8 }6 I4 o" W( o- p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% f7 V  Y) y+ }. ~7 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 _6 {; F% L; i8 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): U- I! _- U3 L6 V* T( R( e
  48. #else
    3 y, i# `9 [( S: L
  49. #define DMA_PRINTK( x... )
    9 C9 r' }6 \4 O$ r
  50. #define DMA_FN_IN
    * ^. ?- ?& B2 l' L$ A. M
  51. #define DMA_FN_OUT
    % j# o- L+ `' w
  52. #endif' ]* f* }1 D/ p/ F( m$ ~
  53. , e: F' h& S$ K) [4 N( S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* j( B2 J7 D( w7 W
  55. #define STATIC_SHIFT                33 u  W& I9 @+ c, M, H- @- u
  56. #define TCINTEN_SHIFT               20
    ' V1 X, P4 N! T8 }& G* v
  57. #define ITCINTEN_SHIFT              21% ~( i) f& v  L' N3 M! j: {% X  c
  58. #define TCCHEN_SHIFT                22, X  ]* L" M2 o9 U
  59. #define ITCCHEN_SHIFT               23
    ) y3 x0 E4 H# {% O: I
  60. & y8 P# A6 f8 {8 @0 V: s) V# |
  61. static volatile int irqraised1 = 0;
    0 u# `* ^$ t/ Y# o0 ]4 }
  62. static volatile int irqraised2 = 0;4 R" o4 y1 F- `. W: h! {

  63. 8 B) D/ H" O* N6 D' L% P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Y: \) M7 v; h) a' J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; k/ l6 J) W0 D4 `( q9 d. {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, S/ n* O" v% [) f
  67.   I' Z6 `7 y1 ~7 [: Y
  68. dma_addr_t dmaphyssrc1 = 0;
    0 B; @5 b7 o8 F
  69. dma_addr_t dmaphyssrc2 = 0;
    ! I" ^$ Y& G' m8 H' \7 o5 i
  70. dma_addr_t dmaphysdest1 = 0;- C5 b. f! B8 o
  71. dma_addr_t dmaphysdest2 = 0;$ v; Y% o0 r8 U6 L( u; X7 q
  72. # S  i. |' Q7 ?4 s" y
  73. char *dmabufsrc1 = NULL;. T+ E( S5 w& j7 W1 p& D  J" u
  74. char *dmabufsrc2 = NULL;
    ; z7 x; [9 M& H3 C( o) ~0 b* D
  75. char *dmabufdest1 = NULL;. M" R: q  f2 K3 I# S3 z
  76. char *dmabufdest2 = NULL;
    ( K8 T9 O& T, X

  77. & I9 Z7 x$ x9 o1 @* P8 s% Y
  78. static int acnt = 512;! l- Q( C7 h" @3 r2 n
  79. static int bcnt = 8;
    9 f* z- T7 R# n5 ~
  80. static int ccnt = 8;
    9 F, P+ U& \- L: K( e: g1 J
  81. 9 m) N  ?8 [2 R- [. s2 t# x
  82. module_param(acnt, int, S_IRUGO);
      c+ X6 t& b; ^/ m5 Z
  83. module_param(bcnt, int, S_IRUGO);* N1 p" P5 t* N, ]- B+ l  n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 e) w5 P' ]# F) U' M% g9 D4 x$ J% `! R" @) x1 J* H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Q* l# \+ m& [5 i7 H0 l, A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 z. z$ _+ B$ i6 k) Y0 |, }! x  C( d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 f) s1 Z% b3 j  U+ o
4 O& P5 R" a# J" {& R# i0 g

3 G1 ?3 s6 o7 @1 X6 v) Y, n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 09:19 , Processed in 0.042577 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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