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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* a! ]9 D. Y' D- {; W1 {5 T. c! {/ _, W
  1. [code]EDMA sample test application
    ) w% P* H: W8 m: N" C; q: r' }
  2. /*
    3 }$ m! N$ u' ^. O$ r+ p! q
  3. * edma_test.c7 m, B+ R$ d" K4 G* B
  4. *
    7 U/ n0 t# @: y- C" B5 U. P
  5. * brief  EDMA3 Test Application* y/ B, K* Q8 c3 N+ S- i
  6. *
    + |2 J7 ~( A  B' v9 b) T# s
  7. *   This file contains EDMA3 Test code.4 d( W6 a+ ~: |3 D- O
  8. *$ R, d' I4 X  `$ x$ J, q5 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( F- m+ A4 @+ b1 Q, m( u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 O7 u: Y0 f/ H8 w9 f
  11. *         TO CHANGE.0 f9 O1 ^4 O) x" J. S6 b1 v! ~
  12. *
    * R' S+ a! |5 d& W+ z- ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 f8 W% S# \6 m6 v
  14. *. t! K; U' l- [1 A2 O: _8 X
  15. * This program is free software; you can redistribute it and/or
    $ B! T; `- L" P* d2 Q7 T& L
  16. * modify it under the terms of the GNU General Public License as8 B6 }1 w# e8 H# V- |9 K' C
  17. * published by the Free Software Foundation version 2.
    1 B0 x( ]6 f& E$ i% Y
  18. *
    : e' e% X( E. g: G  j, f2 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& b+ p* a( h% D( W6 U
  20. * kind, whether express or implied; without even the implied warranty
    " p' ]) S, M' n1 Q; X& U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / P: ?! G& G. `( u. E" B7 J
  22. * GNU General Public License for more details.6 f  W$ J7 K" l# ?2 g0 K# I* T
  23. */' p( E! c6 G& i& [8 ^3 L9 I

  24. 2 l! i7 N0 C- E9 t& B
  25. #include <linux/module.h>
    % S/ }2 e) {, T7 [
  26. #include <linux/init.h>
    " h. Y3 l3 m$ ^
  27. #include <linux/errno.h>
    # {; |9 a# f0 f
  28. #include <linux/types.h>
    : \5 [! a" m  m6 H6 O
  29. #include <linux/interrupt.h>& k. X0 |/ J- c  Q9 {8 O6 `2 h
  30. #include <asm/io.h>& _' y' Z/ k1 u9 j6 k
  31. #include <linux/moduleparam.h>8 O8 u: k0 S! t+ M
  32. #include <linux/sysctl.h>8 I' X4 J. v! C" N* T# ^
  33. #include <linux/mm.h>' v2 F/ q' A: Q5 B2 V2 z: w
  34. #include <linux/dma-mapping.h>/ \. M- |; M  s

  35. # i' @8 Z+ l: ]; ^6 ^( |1 d, z
  36. #include <mach/memory.h>
    * `; G1 A# n" |
  37. #include <mach/hardware.h>& ~9 {% a, B8 P( z2 x! L  T- b
  38. #include <mach/irqs.h>
    * F4 n& x6 c+ r7 @* Y
  39. #include <asm/hardware/edma.h>
    ) B0 y" `/ p1 h" t% j9 i2 Z. w
  40. * `4 u2 c" ?2 a: O' U2 m
  41. #undef EDMA3_DEBUG8 ^9 O3 |: p. i7 _
  42. /*#define EDMA3_DEBUG*/# ^; V$ x1 ^# l0 P+ d" @" p

  43. 0 t' p8 R9 h2 ~$ Z* l, z1 x2 J
  44. #ifdef EDMA3_DEBUG
    9 _% F% @# ~$ S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ]) v9 N* `  j+ Y2 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' H4 x/ k$ ~2 l. I8 a7 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 [* s0 S* N8 J9 j5 ^6 T
  48. #else& g: B% w+ ]5 e8 t8 V5 l- _3 H
  49. #define DMA_PRINTK( x... )2 |- f1 F; `7 t( ~3 J/ w3 X6 g& [% s
  50. #define DMA_FN_IN
    1 f, @6 M$ X! Y: _7 `' q% d
  51. #define DMA_FN_OUT0 r- Y9 e9 ~3 }" m
  52. #endif* r0 `4 \0 @* s) |# S
  53. " J0 W. i; @% I, [2 t( C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- V& Q/ \$ ~2 O0 e0 s  }' l
  55. #define STATIC_SHIFT                3
    " j% \% Z+ @# `& f( |
  56. #define TCINTEN_SHIFT               20
    # j  v) h( i# D2 W- a) p  |: f
  57. #define ITCINTEN_SHIFT              21* R5 \; ~# @9 B- {  t1 p, {
  58. #define TCCHEN_SHIFT                22% y. J( w+ g4 n  A& }
  59. #define ITCCHEN_SHIFT               23
    6 ~% K/ D% f' r; Q% T* X
  60. 8 W$ s( y, H5 ], i0 q3 V
  61. static volatile int irqraised1 = 0;
    9 {$ L9 D6 ^8 X5 q
  62. static volatile int irqraised2 = 0;1 u3 z% n! i1 M4 G

  63. , q' o9 [- F' L' @4 }$ }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & D7 _" S% X  K! u& |! }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ p, \8 D$ g6 H6 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p" o) m1 l( }0 _/ Q1 G$ {

  67. - z1 n3 ~) b) a( I
  68. dma_addr_t dmaphyssrc1 = 0;4 A3 H  E! s# ]; V( u# x
  69. dma_addr_t dmaphyssrc2 = 0;( W4 h. D: B$ Z: ^
  70. dma_addr_t dmaphysdest1 = 0;
    : z5 q4 S( d( B: D# `
  71. dma_addr_t dmaphysdest2 = 0;
    ( b) t# Y2 _4 g" ?; F) V

  72. : R7 C3 u+ w! b, e7 b% a9 V
  73. char *dmabufsrc1 = NULL;
    / V9 o4 U9 \4 U) b* k7 w
  74. char *dmabufsrc2 = NULL;  M2 _+ j$ ^0 \& ?' t+ V! m
  75. char *dmabufdest1 = NULL;$ c/ l5 ~/ X" j7 w% F
  76. char *dmabufdest2 = NULL;
    ) M+ F5 P" |/ m; j

  77. ( Y5 E3 O6 o2 N$ [9 C# i
  78. static int acnt = 512;5 o- y5 t! k' e1 X  I5 H5 ^( r
  79. static int bcnt = 8;
    - Q8 s4 k9 k' u5 g" t: L
  80. static int ccnt = 8;' J  M% y6 m( k/ U% U% w
  81. ) J0 }1 B! F. {2 T" ^" ^0 P
  82. module_param(acnt, int, S_IRUGO);
    4 t5 w4 ^+ }( d6 B# f7 _. b
  83. module_param(bcnt, int, S_IRUGO);1 ~, Z$ r( y( A/ o9 S, E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% x# e. a  W) e' `0 L5 E5 ?
0 q9 G- `- \" }0 J3 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# s4 g2 L% {3 x" [( k8 {7 T8 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 r  B0 m, Y/ x" h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 G  c: Y2 D+ w! o1 a. x

. ]5 @  y: Y  t' l! Z; v( c% r: e& f8 |' m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 11:03 , Processed in 0.044406 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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