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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  o7 C( v  u3 K% v
  1. [code]EDMA sample test application6 L6 p0 u1 v1 p, e
  2. /*
    ! M. x( n% v- e; a6 N
  3. * edma_test.c
    5 u* Z  J* g% F) u7 a
  4. *2 K1 a* U7 G1 A. p
  5. * brief  EDMA3 Test Application$ _$ E1 \- e: F8 L2 }7 X, L2 C/ N
  6. *
    ! _2 G% c* r6 R4 D+ Q2 g. _7 Y
  7. *   This file contains EDMA3 Test code.
    % k( H' i8 f* B: O5 x
  8. *
    - B6 V0 a$ Q, k6 u! d# y" }  M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 E2 x% \6 B9 z, q! O$ X. x. n: M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - N+ F  K$ t% j& U2 W0 D4 |- ?0 Z
  11. *         TO CHANGE.
    % S. ~# u7 d/ G8 M& C
  12. *
    + h$ V8 q  c4 D4 }, y( M7 R9 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' d/ _. W2 ]' ]# O4 g3 G
  14. *
    6 Z6 s& G7 M' u% L! V2 q$ P' O& V
  15. * This program is free software; you can redistribute it and/or
    6 I: U8 a  [- A6 ~! q; u
  16. * modify it under the terms of the GNU General Public License as) _( b4 P! D9 I8 J( U
  17. * published by the Free Software Foundation version 2.
    8 s+ X8 Y/ T; A# q2 q, M* i, _4 |
  18. *+ S4 c; F" ~+ ~3 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# O- @. f0 E- [  l2 @
  20. * kind, whether express or implied; without even the implied warranty
    / E7 P- H1 j* Z; Z9 \- u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 r( v- \: c! w& P- y+ F
  22. * GNU General Public License for more details.
    2 Y, ?" w2 p1 d# b+ w' i5 b& L4 }
  23. */6 m2 U; j  i2 K' s+ L- V
  24. 5 l0 s9 A; K: p! m  E" ~* M
  25. #include <linux/module.h>
    8 \! x' `6 W5 W* K1 _, l! H) K
  26. #include <linux/init.h>
    ; F% R( g, X4 O" y6 {/ Q0 T8 U
  27. #include <linux/errno.h>6 u6 S. h: K) V! j8 p  ]! c, [* t
  28. #include <linux/types.h>
    5 k4 \, ^( {* S, m* q4 i
  29. #include <linux/interrupt.h>
    7 ^9 R7 S+ Z5 a1 Y& G, D
  30. #include <asm/io.h>
    ! [, |) e9 z8 ~  a; u" v2 T( N0 S0 M
  31. #include <linux/moduleparam.h>8 B' ]9 _0 `" y6 W" C
  32. #include <linux/sysctl.h>3 \3 c" ]+ a8 h  u/ F
  33. #include <linux/mm.h>* Y# e" H( _  B2 n/ P
  34. #include <linux/dma-mapping.h>
    - X& w* g$ Z7 B5 {) o4 i0 m
  35. 4 `. [. h5 [! V% P" a% V
  36. #include <mach/memory.h>
    0 L4 D/ k. L" O5 e8 S- b
  37. #include <mach/hardware.h>
    7 e8 D/ [: [$ h: [% I8 Y6 Z
  38. #include <mach/irqs.h>
    / Q' |  K4 ?! t2 A2 b0 [; G
  39. #include <asm/hardware/edma.h>
    8 C5 t) b) U' h  ^+ S
  40. , k- }0 Z2 E7 w) ]* _$ k
  41. #undef EDMA3_DEBUG9 C# I8 \& Q2 I& x, ^
  42. /*#define EDMA3_DEBUG*/
    3 Y, u1 x0 H& _$ s, z
  43. 2 W3 a0 S% v& b" `0 T
  44. #ifdef EDMA3_DEBUG1 F  Z6 ^1 o% K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : Z6 r* |7 {  q4 y& }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 X0 t: Z5 F" [9 S+ o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 D1 j$ |8 l; e$ R/ K) e% P$ P
  48. #else
    0 `+ ~3 ]5 f) x8 {7 ~, A
  49. #define DMA_PRINTK( x... )& W# Z% c! C. H
  50. #define DMA_FN_IN
    6 s3 H: J* z% x6 N
  51. #define DMA_FN_OUT) U0 h7 X; k# L3 \
  52. #endif9 p; [  a# W0 ~' \. E8 i7 ~
  53. 2 r0 c  }" A0 t0 t- p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 Z! X( B5 x4 v1 P! q' W
  55. #define STATIC_SHIFT                3
    6 U* _/ W% |( @4 V- ~
  56. #define TCINTEN_SHIFT               204 [: U8 }2 x- w$ x. K% F  @
  57. #define ITCINTEN_SHIFT              21. Y4 M  ]$ ^  H) d1 E4 t  O
  58. #define TCCHEN_SHIFT                228 K" U, s# U! h, [4 `4 a0 \
  59. #define ITCCHEN_SHIFT               23) |3 X1 g4 {( o) Y3 a; k, j% t
  60. / u$ M, T5 R- A( M
  61. static volatile int irqraised1 = 0;" m2 O" y6 o9 Y- s' K
  62. static volatile int irqraised2 = 0;6 l( V- k8 w8 Q* o5 k$ {
  63. ' h* T, L( Y& h! R, l; ^( i, s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      v. E2 y4 H" v9 d8 H+ d; H/ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d+ b6 N8 l( p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ p1 P2 r: W$ R# m. u& l! d( `

  67. 3 j5 ?  L* B/ \% n5 a, d
  68. dma_addr_t dmaphyssrc1 = 0;
    9 e+ |* m" u( S0 P5 |* I! l
  69. dma_addr_t dmaphyssrc2 = 0;; U3 K" T& @( P
  70. dma_addr_t dmaphysdest1 = 0;% ^" T/ C5 A2 z0 q4 _$ b& m
  71. dma_addr_t dmaphysdest2 = 0;
    2 O0 j* b% h) w5 ^: d
  72. 3 \* n7 C/ ?$ w* z- t0 c
  73. char *dmabufsrc1 = NULL;
    $ V1 D( y# G* ~$ p3 k& {
  74. char *dmabufsrc2 = NULL;
    5 x- ?8 ~0 J/ w* Y: H* K
  75. char *dmabufdest1 = NULL;& c( P0 p$ w9 }% W5 H' D
  76. char *dmabufdest2 = NULL;
      Q: `" k6 K9 \8 X* L9 Z
  77. % W  ~! U7 I6 S7 O
  78. static int acnt = 512;
    & ]) v1 C6 l& X9 y" U* p
  79. static int bcnt = 8;. `7 [! D2 \' [4 z% e) D
  80. static int ccnt = 8;& Z& K( {  z  N" `

  81. 9 N% q# T2 H/ D) j3 q
  82. module_param(acnt, int, S_IRUGO);
    - T/ O) J: F- @9 ?$ [# \1 \
  83. module_param(bcnt, int, S_IRUGO);
    : y( C- a- `! {6 G9 E4 ~4 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 y6 P) C3 I% o$ _4 h: d) ^7 o  x# ^) ~: p( F( C& J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 q  ]1 ^7 M, \+ [3 M1 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& b8 L+ {4 T" p+ z- X4 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 m! Q1 l- j# {5 }1 U3 n- Z

8 C' F- e8 Q$ D/ J8 j
5 k2 k; {5 @2 c1 t; F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-14 10:15 , Processed in 0.037512 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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