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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / u' T, v1 A; ?( H& U6 B% i; Q
  1. [code]EDMA sample test application
    * s, L4 T% E+ n  _: L
  2. /*
    ' A, M3 H2 z5 [% z" N! L& C9 n+ o( {
  3. * edma_test.c( }/ g7 @* K. H% I6 T3 h8 j# A
  4. *
    5 u6 b* L$ p; E8 ~# }. y9 M
  5. * brief  EDMA3 Test Application, [# w% k6 l9 M' ], o# X( U& h
  6. *
    " t+ B( y2 A/ ^4 Y9 T' g# W
  7. *   This file contains EDMA3 Test code.
    " m3 F. G% [# F) v
  8. *
    5 n7 }! b+ N9 L( W. n8 j9 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' }( S* N6 j1 V( F" g' K4 l9 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W; _* u1 q" j( v; H$ Y) K( N0 {/ X
  11. *         TO CHANGE.
    2 q! _. o6 j* B( b) Z
  12. *& H2 H3 Z: d- n% j( Q6 X2 g4 |9 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 K$ R( T/ S) x; S
  14. *, d' E# G8 t* M2 x$ L1 S* c
  15. * This program is free software; you can redistribute it and/or: U4 z; T+ w& C' Y1 v+ d  _
  16. * modify it under the terms of the GNU General Public License as
    5 M6 K! E$ |2 c
  17. * published by the Free Software Foundation version 2.) u/ l3 }0 X# @. r/ r
  18. *
    " s- O) s3 X9 y/ r: M+ t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 X( J" j# e' h0 e: _' ?0 u6 `
  20. * kind, whether express or implied; without even the implied warranty
    6 }) s7 C; D7 T( q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " c& X$ v, u* Q' S) T$ p) j" `
  22. * GNU General Public License for more details.7 L; F4 l1 w7 N: X/ b
  23. */
    + s8 v9 W- ~( n) S9 t+ f
  24. $ z( B' r* C* I+ `" j' S) f
  25. #include <linux/module.h>
    ' G5 ]3 `) N+ l0 {( L- V' s
  26. #include <linux/init.h>/ F. {# C: Q' R! R- }
  27. #include <linux/errno.h>
    - I$ m3 a# c/ R& w) D! Q+ p
  28. #include <linux/types.h>& R$ h" z+ ~7 @- {( D% v
  29. #include <linux/interrupt.h>6 d; B8 b  r8 P( d& z2 R5 @8 F
  30. #include <asm/io.h>& p( _; L$ S2 _1 o+ @5 b
  31. #include <linux/moduleparam.h>
    3 X, o4 F3 C4 Y& M4 M6 i) v0 |
  32. #include <linux/sysctl.h>
    5 N' S- b( m4 u
  33. #include <linux/mm.h>
    ; D% z: k# |5 z) m8 e# ~/ |0 p
  34. #include <linux/dma-mapping.h>3 i* r8 m" f; F, F3 H

  35. ( _' P8 K/ _2 q& a( z$ m1 J
  36. #include <mach/memory.h>
    $ U# E- Y$ j5 N# E) V8 d
  37. #include <mach/hardware.h>0 V9 N5 a7 e; c/ m; q
  38. #include <mach/irqs.h>
    ) J0 W; y! M6 y4 f) C
  39. #include <asm/hardware/edma.h>
    8 d5 s" l* G+ A/ c% c$ E1 W- S

  40. ) L' P3 k, m9 x5 k7 f2 W
  41. #undef EDMA3_DEBUG
    # Y2 t, J" ^. T/ M! R
  42. /*#define EDMA3_DEBUG*/. f# u0 C6 S2 H( E

  43. / _1 D! K: {4 a- h* ?( f
  44. #ifdef EDMA3_DEBUG+ |1 {1 p, g: ^8 L( g3 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 I; j! d) |5 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 U0 R) L! d8 K2 i  \- T9 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 @0 d  q2 G9 h) M2 E8 m
  48. #else
    - {) ]: S2 ~$ \4 g
  49. #define DMA_PRINTK( x... )+ s4 ?! L: X2 I# L1 d: h4 w( V
  50. #define DMA_FN_IN0 k9 g$ c/ g8 A  V! ?! r, x
  51. #define DMA_FN_OUT
    5 ]1 ~, U7 l/ @+ f3 q
  52. #endif
    8 t: `% r) [' S' g! n

  53. - y) P  Y2 ]2 \+ |! _1 m9 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( D$ U2 a% D& g+ b& c  W, H
  55. #define STATIC_SHIFT                3
    # d6 a1 v, n1 a# K' o2 C
  56. #define TCINTEN_SHIFT               20
    " _6 t: _. d/ t" E- ^  m
  57. #define ITCINTEN_SHIFT              21
    & @$ C7 f' y# y; v& x
  58. #define TCCHEN_SHIFT                22- M. d  m! \8 T' ]% H7 u5 Q/ {
  59. #define ITCCHEN_SHIFT               23+ B! U& Z5 d. ^$ D( K# T; d* x% V7 Y

  60. # V- `. L" N* F" J" D
  61. static volatile int irqraised1 = 0;
    / p/ l( _" o& o% w% d* A
  62. static volatile int irqraised2 = 0;
    8 I5 D7 p; h  u" N/ _. o
  63. $ X1 K, {& Z/ [' W( A& n- m( P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' k( _# E1 W/ Z# w/ E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ]- k" H% F( F3 V; G1 a5 b$ |* G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! @+ U( A2 Z* U2 i# I5 h4 ^
  67. & f* g  J) d# m4 k
  68. dma_addr_t dmaphyssrc1 = 0;
    + Z8 H# a( c  R
  69. dma_addr_t dmaphyssrc2 = 0;+ {/ ?: M0 p% ]8 v2 W
  70. dma_addr_t dmaphysdest1 = 0;
    3 ]" m( P5 P. H1 s' e0 F
  71. dma_addr_t dmaphysdest2 = 0;
    ' c" }; j' F# l- q4 q. w
  72. / r+ R( ^, d- |, m$ C
  73. char *dmabufsrc1 = NULL;
    $ c5 v" |: {- x. `, V  R
  74. char *dmabufsrc2 = NULL;
    % F8 K. L+ y( C" F
  75. char *dmabufdest1 = NULL;
    & d0 U% |8 G  {' U) O/ @
  76. char *dmabufdest2 = NULL;7 K/ f2 }( _9 s8 \5 u" ~  ]- n

  77. ' L# n! j8 T5 q9 G7 A+ h
  78. static int acnt = 512;# ?7 l4 V. k" \3 F& w7 B
  79. static int bcnt = 8;
    3 j; D( K" x7 n' u5 a
  80. static int ccnt = 8;6 z6 X, _, x, q. l) Z

  81. 6 q9 S- M3 `7 V) \% v
  82. module_param(acnt, int, S_IRUGO);. n. L- [2 b2 u- ?
  83. module_param(bcnt, int, S_IRUGO);. [# B6 Y8 m. M. b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 N5 R: o2 g  R2 c3 f7 Q: U7 J' O; K/ A4 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* H! w; Z0 u9 `0 a. Z( j2 Z2 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 j% H+ b# V6 F* H( a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 c$ s; K' X5 s/ U( S1 k! R% i5 T0 W. n

+ A; ^; Y- E4 z; |. v1 Y7 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-20 09:40 , Processed in 0.038474 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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