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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 r1 w, R, A1 R$ k8 l
  1. [code]EDMA sample test application2 |3 h" y* S! Z
  2. /*9 B) k: i+ d3 W8 D4 a3 {
  3. * edma_test.c
    ' H2 g) r9 B8 w1 F) k& o; Y  b
  4. *" a! n4 C* `, F! U% ^5 b+ s' r8 ]
  5. * brief  EDMA3 Test Application) k: L0 C6 ]+ |
  6. *
    3 r6 Q+ Z( s# \
  7. *   This file contains EDMA3 Test code.' U+ G/ C5 E  A! p) E
  8. *6 i+ y/ w/ l& I8 n, k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 L" j! H* x' f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' K6 v- m  ?# X8 @% K3 A
  11. *         TO CHANGE.0 w. E8 [) E2 g# j# _- a
  12. *
    5 ]1 L* P  ~9 ~9 A. P0 d5 m9 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ^7 `% f( d% s6 Y$ K' b7 @
  14. *' L  X8 s! L; D6 x5 |
  15. * This program is free software; you can redistribute it and/or
    6 m! n2 M1 |% t! [* j4 a: n
  16. * modify it under the terms of the GNU General Public License as; v, G9 y2 s" d& ]
  17. * published by the Free Software Foundation version 2.$ T' y, C1 H+ {3 ]1 G
  18. *( c& Z9 J' F' N4 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ a3 `. ~+ ^7 j* k& D2 K$ u% z
  20. * kind, whether express or implied; without even the implied warranty
    7 s0 r, H" g: U, m- V8 x% l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # ~. T$ @& M9 P( W
  22. * GNU General Public License for more details.
    & w- \- C, U9 b+ ^* j5 c) i7 Q
  23. *// Z- Z( Q8 B3 {8 _  F6 I

  24. ( B" D4 _' F9 U: t5 ]
  25. #include <linux/module.h>
    3 M; X' I* S! \2 m1 q6 C! W
  26. #include <linux/init.h>6 O7 l* n9 f& R, q
  27. #include <linux/errno.h>
    - m( U4 G  S# m" {% N# y0 [
  28. #include <linux/types.h>! n, l+ g' Q- h, F, M- V8 X! a
  29. #include <linux/interrupt.h>3 ^+ G1 d7 p; g3 t7 s4 @% \1 e! h
  30. #include <asm/io.h>
    1 v1 S9 h6 S4 g4 T; G
  31. #include <linux/moduleparam.h>
    / r' T: P1 f! T+ u1 }2 Z4 v" T
  32. #include <linux/sysctl.h>
    % u) P+ F4 Q! S( N* W& n/ O- E
  33. #include <linux/mm.h>
    / @% q* u1 c, m+ W4 X
  34. #include <linux/dma-mapping.h>
    9 S! @# y: o6 `

  35. : U! G7 w- \; g5 d/ d7 M% f
  36. #include <mach/memory.h>( t" L6 V4 O% w" P% s- F
  37. #include <mach/hardware.h>4 x! V6 n% s0 t4 D  I; m% n3 p
  38. #include <mach/irqs.h>( r1 a0 T3 I# _/ a
  39. #include <asm/hardware/edma.h>; w; U3 Z3 i# R
  40. 2 R+ Q0 g6 z: `' M9 H" G
  41. #undef EDMA3_DEBUG
    4 q  d6 @3 E/ i* Z3 R% g: F; w
  42. /*#define EDMA3_DEBUG*/
    7 ?2 ~3 u( u( ^/ W) ^

  43. : e' N4 b" K8 Q( A/ E6 b4 d, s5 V5 k
  44. #ifdef EDMA3_DEBUG
    , L& m8 N) v4 A& \: V0 K. C2 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 _$ G/ d- o- b0 u7 H0 L! D. g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " |1 ]& `0 x6 S7 p. I8 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' c; |: Y0 A, D/ A( g4 h8 C1 ^( w
  48. #else7 a! J# G" |6 z8 @% Y  N" i8 @
  49. #define DMA_PRINTK( x... )
    9 P1 r8 l& B5 E/ s& ~
  50. #define DMA_FN_IN! ?# e* j1 u+ M: x3 z
  51. #define DMA_FN_OUT
    ; p2 k) F) |( D( v5 v! w
  52. #endif
    5 i) n* v- t- V/ h
  53. $ m3 U$ z  x3 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 }$ S6 W8 D0 M. X
  55. #define STATIC_SHIFT                3" I3 Q" [' M5 l0 @% [
  56. #define TCINTEN_SHIFT               20% j1 U+ Q6 u7 w. @# n( o1 l
  57. #define ITCINTEN_SHIFT              21
    + A' M8 Q3 H# D- ^3 r# H
  58. #define TCCHEN_SHIFT                22
    & T/ T) B9 M7 M  m+ P
  59. #define ITCCHEN_SHIFT               23
    ! v' }( p' ]+ C1 K/ T) d
  60. 4 Y/ d' u' t' l% s/ q$ g
  61. static volatile int irqraised1 = 0;* X8 i" c4 S0 T3 C0 `% b$ p: P
  62. static volatile int irqraised2 = 0;
    2 n( P- v  \6 m) t0 e
  63. 9 t& H* b* @2 p  t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \; U) q( s/ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( m! S) o# S) K9 P: e$ [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( }: Q3 Y1 l' b3 x0 x2 v! e% P

  67. . S% ?" |0 {" y
  68. dma_addr_t dmaphyssrc1 = 0;
    / T4 ]& F% W* [" a) ]
  69. dma_addr_t dmaphyssrc2 = 0;7 v  u+ s7 c1 T: t/ n# e4 _
  70. dma_addr_t dmaphysdest1 = 0;9 G/ y. S& N  J% v7 v
  71. dma_addr_t dmaphysdest2 = 0;
    ! z: k# v$ ]) h8 a2 k2 ?

  72. . z: M9 x) {. f9 v. J- s2 B; n' c
  73. char *dmabufsrc1 = NULL;- ~6 H7 U- B: F$ u) x
  74. char *dmabufsrc2 = NULL;
    * v+ W8 g' G0 X& ~
  75. char *dmabufdest1 = NULL;) H! ?6 R! T% G& n4 V
  76. char *dmabufdest2 = NULL;) ]1 C& X5 H1 G8 A# s! f( `
  77. ; s& x' u1 l1 t& t
  78. static int acnt = 512;% n  K9 k2 Q: T1 C  L7 E- j( O3 v  D0 `
  79. static int bcnt = 8;% \( R2 y7 G) T( a, n
  80. static int ccnt = 8;1 E2 k. m, G; R8 @6 q3 W# U, ^

  81. 2 M3 M( e- [- t, @  c$ k2 a3 r# g) |
  82. module_param(acnt, int, S_IRUGO);
    + _7 q. w$ E, n+ b: @
  83. module_param(bcnt, int, S_IRUGO);
    - S: ?" S/ E& ~  c- E2 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 K$ S* x0 @0 @7 K& ^

) C' s) X2 Y5 e( z1 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# w8 d2 r  ?- s3 A1 I2 ]& parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  {6 Z" }; N2 C! b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% Z1 J6 o0 e! c
$ N4 U% I2 X  l/ v2 g  \* E4 d6 G( `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-25 16:31 , Processed in 0.043860 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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