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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ u: m* C( p* U' L3 W( {# T
  1. [code]EDMA sample test application6 X: ]" r* S+ \# e/ w
  2. /*) k( ~8 e+ T7 y5 }
  3. * edma_test.c
    - w0 r$ r+ k# }. L$ K: K" Y
  4. *0 O( q1 n' v8 L6 S6 z2 h- J
  5. * brief  EDMA3 Test Application
    ! v$ L( f; Y& H
  6. *, m4 i$ U4 w" x9 n; k- e
  7. *   This file contains EDMA3 Test code.
    ) t0 K8 I0 O0 X
  8. *  }% q1 @; e' W) @& r. T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 _+ Z& r( c$ d; c; W( O7 r: e! ?- t9 j, K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f; a7 i! L8 H/ t7 G& M2 |+ E
  11. *         TO CHANGE.& w5 E3 i) X6 J5 p
  12. *
    1 `6 J& k& T! E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 b  }( D; |0 S0 A: Y5 E) E+ y
  14. *
    8 [' h# N. R- }" g, E6 R7 u
  15. * This program is free software; you can redistribute it and/or! c  }3 @5 T1 I( L
  16. * modify it under the terms of the GNU General Public License as
    9 O9 D, T2 h7 y8 D% T# B  s/ z9 n
  17. * published by the Free Software Foundation version 2.
    ( J( X: ?/ m8 P0 r) v
  18. *
    ; Y. k# |* Q  v* |/ x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 l  m( X- V) L' q1 D
  20. * kind, whether express or implied; without even the implied warranty
    2 n" V' L" U! M; X1 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 ^4 Y0 h& f9 [
  22. * GNU General Public License for more details.5 _) {- }6 K: G1 e
  23. */
    5 N1 [: f% U, J. o+ y" v$ @5 ~

  24. % I9 n8 D2 q. {
  25. #include <linux/module.h>; w0 F  m- u9 K3 M. T
  26. #include <linux/init.h>& f* D9 F8 r, B1 m  U2 w
  27. #include <linux/errno.h>
    7 P: D6 B8 P) d# n
  28. #include <linux/types.h>$ N1 @$ }  i# Z9 O8 p/ i: w$ {; f
  29. #include <linux/interrupt.h>
    ' u% O- }6 J# \+ W3 t3 F9 P
  30. #include <asm/io.h>
      a: `: {' e2 v+ i3 J; q! z* T7 r
  31. #include <linux/moduleparam.h>
    % I) d, _; h& n# v+ Q
  32. #include <linux/sysctl.h>
    5 k- q; n5 _1 [# q
  33. #include <linux/mm.h>
    3 {+ L* H$ o" @! a% X
  34. #include <linux/dma-mapping.h>8 S; n- B2 ]& b* {

  35. 2 V. N* ~1 f4 k
  36. #include <mach/memory.h>
    ! h1 z) S$ b: A4 g7 Z
  37. #include <mach/hardware.h>
    1 W! f: B1 ^9 |( {! }7 e
  38. #include <mach/irqs.h>
    9 V! l" A* H' a" I7 }3 d3 |" q1 d
  39. #include <asm/hardware/edma.h>3 q) \" C0 Q# ]: h3 D% @/ p8 \
  40. " z( ^* E$ [& ?$ o2 u- m4 d2 ~
  41. #undef EDMA3_DEBUG* t6 a7 k3 ~/ L6 G) w' Y5 {
  42. /*#define EDMA3_DEBUG*// w! I8 X' X; |# i3 u
  43. 9 x9 s3 H, N0 s3 G# C- S; C
  44. #ifdef EDMA3_DEBUG3 C" x/ i0 {% u: c9 \+ C4 o2 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( i5 h: o$ {: j- O1 h. e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) S- h+ c  A2 A( r6 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% `! O  ^  z# P: d+ Z# ^  i( ~: w
  48. #else' R5 M$ c/ i/ q7 @7 k
  49. #define DMA_PRINTK( x... )4 M% k) Z9 g( z2 |; W+ H+ D
  50. #define DMA_FN_IN
    # |  z& ~& K4 \
  51. #define DMA_FN_OUT2 r; X- e+ e: Y+ B3 M/ [
  52. #endif! u. ?( F% o8 l' P' P
  53. 0 Q( S0 O7 d' l, ]! n" \/ P* l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! h3 h) b; T/ Z& P6 \' u
  55. #define STATIC_SHIFT                3/ O- g5 D9 y3 M5 \# Z
  56. #define TCINTEN_SHIFT               20- G6 c) E- v4 V: v$ D5 }0 |$ B5 u
  57. #define ITCINTEN_SHIFT              21$ U* i! U% A: z! R
  58. #define TCCHEN_SHIFT                22
    ; V" c/ y  w1 f$ V6 E! J) a* a
  59. #define ITCCHEN_SHIFT               23
    / n, E; {# f1 D/ |$ j

  60. % A9 m, ~' E5 D4 b, M3 G* _
  61. static volatile int irqraised1 = 0;
    ) r" }0 V5 Z9 K" h3 l
  62. static volatile int irqraised2 = 0;6 K8 ^0 q8 R- W$ z) h. d

  63. : M# I+ O7 C- w5 ]( b' D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 |+ y# B, |8 _: N7 @* Y& \+ O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 q+ y, K$ L' i: g  E. [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q- F  N9 _* a
  67. - S' q3 i- q, l6 u' t- v
  68. dma_addr_t dmaphyssrc1 = 0;
    7 n+ A% s* d5 B$ N7 p5 Y" X: ~
  69. dma_addr_t dmaphyssrc2 = 0;3 v8 ?2 t8 Y! s$ _1 Y
  70. dma_addr_t dmaphysdest1 = 0;+ \% C% h% k* V8 e" l
  71. dma_addr_t dmaphysdest2 = 0;# w% m# M1 ^- f: s, o, L5 [. O' t
  72. 3 \2 _$ C! l1 s
  73. char *dmabufsrc1 = NULL;
    6 A- V0 o1 g4 P3 J& d
  74. char *dmabufsrc2 = NULL;, C+ j! U* |  o4 j  U: A
  75. char *dmabufdest1 = NULL;
    + k& I" P: q, |# M
  76. char *dmabufdest2 = NULL;( e3 x5 u. t8 z& p( V, V$ a
  77. ! L/ Y9 r$ ^- O- d
  78. static int acnt = 512;
    4 r7 a& k+ Z) [
  79. static int bcnt = 8;
    + p9 U5 W  \2 ^( H/ Q. w5 F. t  {
  80. static int ccnt = 8;
    : d$ _- H; w' p7 _

  81.   P8 O; V0 N4 `, I9 R2 f+ q: m0 c
  82. module_param(acnt, int, S_IRUGO);
    - F$ M& h0 V/ m2 h" |
  83. module_param(bcnt, int, S_IRUGO);4 ~$ a8 \* D) U' s5 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' z6 o6 c4 M% K3 m1 O6 F4 S
& H/ n- b: N. L. B1 P# m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 u' T" K: d" N1 S" `$ ?. _1 D, @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! Q" N0 U) L6 D0 [2 i/ b, c- T* f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 e( X2 F* t# ^& C

& r, B' Y9 D- ^2 C5 j
" I5 N2 j/ f# b( }" `- H( R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 01:27 , Processed in 0.044306 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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