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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 \3 U1 J; ]1 i9 T" a
  1. [code]EDMA sample test application
    $ @! p3 ~3 x& B! F0 h
  2. /*! b7 D% X) N# b. t8 v- [
  3. * edma_test.c  t5 L# L! L1 ]! k: d4 L/ c
  4. *& p0 u( P" ?, y
  5. * brief  EDMA3 Test Application; b1 j- Y* g  Y/ q
  6. *0 v, |( E+ ^+ [7 I. |8 b
  7. *   This file contains EDMA3 Test code.1 @7 o& S; I" Q8 o$ Q3 I0 F
  8. ** p: D2 {+ g; m- T: w6 @+ O( K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) v) D# V3 [# G% c5 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " n4 a4 p& K- J. U' F
  11. *         TO CHANGE.# A* h9 m0 b2 b9 o
  12. *
    ( N( x. Z" {# J+ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' a* [, B% {' {! C
  14. *: D) x2 J5 S* q
  15. * This program is free software; you can redistribute it and/or  |: Z/ n" z( O$ I) m& q2 v
  16. * modify it under the terms of the GNU General Public License as
    & `5 y* I1 s7 U- Z( _- |( u5 r) |0 s
  17. * published by the Free Software Foundation version 2.
    % k( N, t+ O: G* `/ f6 ]8 h3 f
  18. *
    , Z- H* j, x( a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 @. ~; N- p! k; K5 k: u
  20. * kind, whether express or implied; without even the implied warranty0 P9 S, k& @; Y8 l& ]2 B% v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( `" w" q' ~* z7 H! a3 t* ]
  22. * GNU General Public License for more details.+ @( F9 P  Q5 f' t+ y
  23. */
    * q* O! K% Z) W* A# [6 h
  24. / M) O2 z0 C* a) A7 _7 t* W: m
  25. #include <linux/module.h>
    5 ^9 m+ D: Y/ k! h/ W3 Q( _  ?
  26. #include <linux/init.h>' {& v" |% `# i5 S
  27. #include <linux/errno.h>& E& E$ V9 p; R8 R
  28. #include <linux/types.h>, m; \1 _* o$ y3 K. f
  29. #include <linux/interrupt.h>2 K5 }" K- n) @9 q9 m. j8 |
  30. #include <asm/io.h>
    . }; E' \" Z& ~8 S4 c( s0 R2 r' Z
  31. #include <linux/moduleparam.h>$ Q4 B* u3 I* w
  32. #include <linux/sysctl.h>, m: C( A4 u, h
  33. #include <linux/mm.h>
      E( ^5 P" q' e/ u/ y
  34. #include <linux/dma-mapping.h>( M& d6 |8 I, ^. J, H& t8 [
  35. : e$ x8 b+ C. u5 k; t7 u) Z' T) {! y* s
  36. #include <mach/memory.h>
    + }( m$ y4 P) E; N
  37. #include <mach/hardware.h>6 S- Q" b' `; p& V9 d/ [
  38. #include <mach/irqs.h>. ^& V7 A/ i7 F' q3 ]$ c7 G4 `9 o7 _
  39. #include <asm/hardware/edma.h>1 m. I# x# l; M+ X
  40. % e* q" a7 D% W$ L; ]% g1 b, C
  41. #undef EDMA3_DEBUG1 m, d& o" ?* U, @6 Y
  42. /*#define EDMA3_DEBUG*/' Y6 S' g4 ?, t

  43. 7 Z2 p; K8 C& `9 |
  44. #ifdef EDMA3_DEBUG
    ! p3 J# \% }3 m& k6 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - Z0 I  ~/ J. }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * ]" K6 m5 P# z# Q* g) s0 }* E& i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X# _1 O- w# k# x# y( O
  48. #else3 y! C1 u: ~, Y" z7 ^
  49. #define DMA_PRINTK( x... )
    & ]" @; b. U: R" p+ e' `' V$ E
  50. #define DMA_FN_IN
    . Z% w1 Y( B& p. m1 v
  51. #define DMA_FN_OUT1 H1 @* q9 z& C! V( w6 y1 R
  52. #endif; }! `$ j+ ?+ x1 D- I

  53. 9 Q" r  S- }) ]& X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): `% H! W  J( g; y- D4 f
  55. #define STATIC_SHIFT                3
    ) d  l) l8 g1 [- S2 ]2 V/ o! ]
  56. #define TCINTEN_SHIFT               20
    % X& E3 f; Z2 g* }0 q: e# q5 D( W
  57. #define ITCINTEN_SHIFT              21
    # v6 U4 m8 s) _) C8 h- @: F8 L" B' t% `
  58. #define TCCHEN_SHIFT                222 C3 F6 h% I) W5 X
  59. #define ITCCHEN_SHIFT               23
    7 W- {  K2 i1 H

  60. . F& I; d5 c# u
  61. static volatile int irqraised1 = 0;
    & O  d6 ?8 ]2 k7 ~' I' k& j9 O. U, H( w, U
  62. static volatile int irqraised2 = 0;4 `/ a$ y9 T$ [7 B& k- j. R( l
  63. 9 \! z4 k; o8 B' h/ r) @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 Z/ ]# t" T* E: w: N( ^2 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 }; P# n9 E4 }% D1 v/ w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i, Y" |; F# @* R2 ]6 }

  67. 1 ^6 y# ^  h% D3 F) l$ y, m
  68. dma_addr_t dmaphyssrc1 = 0;& ^* H9 c5 y2 v; {8 e- c. ^) \1 K
  69. dma_addr_t dmaphyssrc2 = 0;9 J5 P$ P. c0 q% }! x' m
  70. dma_addr_t dmaphysdest1 = 0;) L; X' O3 O  t' b% \  }
  71. dma_addr_t dmaphysdest2 = 0;! m# B: t  v5 u, _8 Y

  72. 2 P/ @, @! C7 R  n! K
  73. char *dmabufsrc1 = NULL;
    : l+ h% |7 A/ Z) j6 c0 w9 b
  74. char *dmabufsrc2 = NULL;) J- E. N5 T& C2 p
  75. char *dmabufdest1 = NULL;% k$ O* r! u: \) Y( [% w& n
  76. char *dmabufdest2 = NULL;9 [: f; d) \: L
  77. # Y+ c% W- c" u7 o
  78. static int acnt = 512;
    8 J7 Q) X, g, F: V1 L+ m+ S8 f, y
  79. static int bcnt = 8;- T) S1 @+ }8 m
  80. static int ccnt = 8;5 N. D9 f9 t" P! Q6 n
  81. " H' ~  Y1 t( @6 e% q3 c; o
  82. module_param(acnt, int, S_IRUGO);- E0 D! q" ]2 l
  83. module_param(bcnt, int, S_IRUGO);
    4 u3 A' E% J" n0 N" }7 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- ]4 _2 y1 _* l  }1 |" H) u( _

4 ~, r' i! x4 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 o- G* Q8 P& U8 B# Z/ Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% c6 b, g# e! K! ]  k$ X, H% J+ _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; h: n: g3 }4 B

, \3 D% d) {& S0 ~! G" p; X3 y1 m, j7 O5 Y  T$ ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-13 01:07 , Processed in 0.044815 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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