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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  L+ G' ^4 O2 P, u- g6 B2 x# D6 Q
  1. [code]EDMA sample test application
    . t  n( y6 a$ E. f; j
  2. /*
    ( v& A7 u! T0 |- n
  3. * edma_test.c. |  a" n. T0 ?. b
  4. *: Y3 J' [; b( R% a1 q& P
  5. * brief  EDMA3 Test Application
    ' s3 X: {' u8 _8 s0 s
  6. *
    1 t4 N3 b2 _1 F- H0 J. E0 L; u
  7. *   This file contains EDMA3 Test code.+ y. _7 B9 i- }0 {
  8. *
    & J1 t3 ~" _0 {1 I9 |0 \: _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * q) o( l% F* g" ?) G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / H5 _, K2 M  q$ n- Q4 k! N& o
  11. *         TO CHANGE.5 }; g2 c* g1 V% o& i4 S, c
  12. */ ]# N( s; V; b; E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ^) w% x7 a! {/ s( f" G
  14. *" p% \; c+ R- J0 V  {; L
  15. * This program is free software; you can redistribute it and/or8 E8 m1 K1 v. n- O
  16. * modify it under the terms of the GNU General Public License as& N8 @( _6 @& Y" W; h4 ~, f4 n
  17. * published by the Free Software Foundation version 2.
    ; o* l7 Q$ Z" \% }3 z
  18. *
    0 @& z& R" ]6 D; o6 \, r' K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ e) k8 k" Q! D7 d  L
  20. * kind, whether express or implied; without even the implied warranty# }) m0 B$ |/ J/ Q  F/ a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; m- R! }" z2 l2 p' c4 g  `
  22. * GNU General Public License for more details.
    8 j5 B; z) ]6 b" e: a
  23. */
    ( M7 X" M9 A6 E+ R1 D( J
  24.   u. C4 ^1 f; T
  25. #include <linux/module.h>* |4 l/ F, [0 |  h
  26. #include <linux/init.h>
    6 d: D& N$ O. H0 a8 ~% o+ u, k9 [& ^$ s8 }
  27. #include <linux/errno.h>
    + E/ X# |6 j- K$ j) p( R
  28. #include <linux/types.h>
    ( d' G- {) Q/ N
  29. #include <linux/interrupt.h>
    * z' A( Y" j; r6 U' B. x! }3 U& z8 I
  30. #include <asm/io.h>+ W8 d% g" U2 s- n# `$ s0 j& i. U
  31. #include <linux/moduleparam.h>/ v+ W1 P8 s  _9 t
  32. #include <linux/sysctl.h>
      ?5 U  s0 @/ K+ {
  33. #include <linux/mm.h>
    & }; g) B+ ]5 v; `7 o
  34. #include <linux/dma-mapping.h>3 h  O$ f2 ^% T( h/ U

  35. : y5 M) @% k2 n3 m7 S/ Z3 Y
  36. #include <mach/memory.h>
    + L& D# T: A5 s. n2 ~* z" A! X
  37. #include <mach/hardware.h>. {; j' _; S3 x: d( f* J) N3 e
  38. #include <mach/irqs.h>0 L& p5 K- H: V! N& Z6 ]4 d
  39. #include <asm/hardware/edma.h>
    5 H! l5 x& \. n5 z- a6 g

  40. ( _7 m4 }; ^% r% G- I  K
  41. #undef EDMA3_DEBUG( u0 }9 z4 B- r/ N4 K, w5 D& _
  42. /*#define EDMA3_DEBUG*/1 O" ^! Z' W6 S2 I
  43. ! v% c1 W) |/ p8 ]3 x( l" Y
  44. #ifdef EDMA3_DEBUG3 R; p3 u: i' {# U; `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), k& ?3 I( P$ ~$ p/ J$ T/ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 h3 q" |/ k: q, I4 i+ G$ [% R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  |$ a( L* ]0 g2 Z
  48. #else. c4 P: c: b0 J& P# _
  49. #define DMA_PRINTK( x... )$ @& V- H" k+ N5 b- K
  50. #define DMA_FN_IN
    3 w2 ]2 b: D8 D1 o
  51. #define DMA_FN_OUT! D& j# Z" n: p/ s) l" Y
  52. #endif
    1 E. H) A' K* k  ^  n

  53. # l. L5 t1 i9 H5 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ F' q& _: h3 `2 _' r
  55. #define STATIC_SHIFT                3
    / O7 g7 x$ A1 J  I6 B0 V3 E3 A
  56. #define TCINTEN_SHIFT               20
    , h  A4 i6 J7 l* [  w5 Y
  57. #define ITCINTEN_SHIFT              21& u! Z/ c/ H' S1 H) S8 \3 g( n
  58. #define TCCHEN_SHIFT                22. z7 M/ X: \1 i% f+ [2 P
  59. #define ITCCHEN_SHIFT               232 `: p% q) E$ n/ L* l
  60. # L- c1 }+ e4 @0 x9 l, K9 K( }
  61. static volatile int irqraised1 = 0;: o! t* @, ^3 ?* T' t
  62. static volatile int irqraised2 = 0;
    7 t9 X3 {" e  U$ S

  63. % \( z# y  e4 g* M$ j& M2 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 T2 s2 d( j! C+ M3 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) t8 H2 S& ]" V- u1 w2 j/ V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n9 X+ A" C" T$ ~: P5 U& ]
  67. 8 y# C6 Y$ P# V, G7 W
  68. dma_addr_t dmaphyssrc1 = 0;
    % P4 T$ b- z) d& K; I
  69. dma_addr_t dmaphyssrc2 = 0;
    % ?- t& r! `" C  o3 a# G& P
  70. dma_addr_t dmaphysdest1 = 0;
    / C, ]1 |* k3 q
  71. dma_addr_t dmaphysdest2 = 0;
    & i1 Y/ K* s3 }: O) I, ^

  72. ; c1 [% ?' b5 j& Q  s3 ~" Y6 \
  73. char *dmabufsrc1 = NULL;
    0 |& p3 A) D3 _2 s, x, M
  74. char *dmabufsrc2 = NULL;
    ; ~9 M7 d/ d% [
  75. char *dmabufdest1 = NULL;
    9 x1 q8 d: E- K7 [# `
  76. char *dmabufdest2 = NULL;- [1 l1 k" x' F! ^+ H  O
  77. ) \, ^. J# s7 z! @  h% l
  78. static int acnt = 512;
    : O& D2 w3 C" ]6 X
  79. static int bcnt = 8;# U/ m+ T9 x( {( e+ _, y
  80. static int ccnt = 8;
    * A6 ]( H4 o9 q! ]3 [1 \$ }
  81. 6 \* i- _; ~; y  N/ @/ j' V/ L9 Z
  82. module_param(acnt, int, S_IRUGO);
    0 q5 H2 t; J3 R+ _+ w1 k' J) B- w
  83. module_param(bcnt, int, S_IRUGO);
    & D& Q6 v* k8 c* `! q1 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ \9 [" F' m3 |) r8 r( x
1 b+ _1 }6 @& N( H: F- N' h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 k/ U) g8 I( q4 M! j& ^; A8 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 x- z4 R* q5 U" j3 p; v. l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- J( U. |5 P+ X( H3 _, `
2 j: y0 s! X4 T% ~) q  A: N  V- d( s
, N) Z5 {, E" t8 K( ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 21:49 , Processed in 0.037770 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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