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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ^2 n! E& n' w
  1. [code]EDMA sample test application
    ; B8 {% ^2 J* u1 ~7 [5 [, I
  2. /*
    ) K+ ]- [$ p7 I2 E
  3. * edma_test.c. {3 z7 c/ h$ L' f
  4. *
    + [; K% B4 d- f2 }
  5. * brief  EDMA3 Test Application
    ) x  i* I& y, ^( ]7 F. ^9 |  G
  6. *
    0 Q2 n; q9 f5 J9 t2 x
  7. *   This file contains EDMA3 Test code.
    7 I; j5 F4 M' n3 n, f
  8. *! I4 G1 N$ V, Q; H  @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % [( P2 b8 T2 D; W/ L+ f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- O+ e* Z( n( S
  11. *         TO CHANGE.2 z# H0 K, p" H$ T7 @% y$ f
  12. *
    $ C' |5 C7 |0 V+ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ G9 R7 _4 @# \* k, A( X
  14. *
    ( R( n' U# K% V5 u3 y
  15. * This program is free software; you can redistribute it and/or4 `3 ]6 m  b) H
  16. * modify it under the terms of the GNU General Public License as4 y# t: u% l# }8 e0 N: C
  17. * published by the Free Software Foundation version 2.& o$ K7 l" J0 M0 {" Y: q
  18. *+ t$ C( x3 W1 q9 s1 F, W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      v% Y9 V; b0 [% U6 f% y9 d0 _
  20. * kind, whether express or implied; without even the implied warranty
    + b: @9 N% g' j* ^; T% s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 t9 n+ Q; g7 u7 F( N# X
  22. * GNU General Public License for more details.
    - V$ W# Z5 f# Y' C
  23. */+ [( p$ z1 ]/ ?3 {! {0 m
  24. , V6 L% O9 ?0 p1 V. M. t
  25. #include <linux/module.h>/ J' e: c, D2 X: B+ K' k1 L
  26. #include <linux/init.h>
    . E" l3 _  g' G/ J1 m# j# Z
  27. #include <linux/errno.h>" B' D  T; v: W8 @( P; R( `
  28. #include <linux/types.h>
    + c; {! T' x4 o1 {4 D/ H7 B) b
  29. #include <linux/interrupt.h>% n  f% y0 {. w4 J
  30. #include <asm/io.h>& T' e0 t. c0 r! Y
  31. #include <linux/moduleparam.h>
    + K4 `+ a" w7 |. K' N
  32. #include <linux/sysctl.h>
    4 L) m) _( t- T: H& u: p& q
  33. #include <linux/mm.h>9 R7 U. Q# D3 P, w9 ]5 j) w) _* q
  34. #include <linux/dma-mapping.h>
    , e& h' U8 g/ t- k# c7 m- y

  35. , F0 s- {/ H. Q1 U
  36. #include <mach/memory.h>3 L: T" ]- q0 X! V
  37. #include <mach/hardware.h>
    ! l  g, J0 @) P
  38. #include <mach/irqs.h>7 V& Q8 `0 K  ], Y* C
  39. #include <asm/hardware/edma.h>
    0 G" E  S( _0 V& x0 y1 Q

  40. . `6 V) |8 ?7 ?, v4 R
  41. #undef EDMA3_DEBUG+ R$ ]. L8 H1 C. h. l
  42. /*#define EDMA3_DEBUG*/" W9 i- ?3 @1 ^+ @2 w; Z8 _6 |) Q

  43. 6 d2 P1 n( d' o0 E* W- I
  44. #ifdef EDMA3_DEBUG
    * g* W6 y- g: y$ r2 a2 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 Y" h" r2 b6 h2 ^$ C8 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * g, M1 ^  s" K: T0 z& x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 @$ [4 E  [$ q  K9 P1 J3 D
  48. #else$ }. ?, c) X0 _5 D: V
  49. #define DMA_PRINTK( x... )
    4 Z+ v- [# a9 M5 Y. M0 l+ `  L
  50. #define DMA_FN_IN
    $ r0 p( e) ]; H' j' n
  51. #define DMA_FN_OUT
    ) o9 v) ]3 P6 `/ P1 z
  52. #endif5 m  F, ^' U& u! \8 ]
  53. : T; W( }$ U( |/ c% \! j! |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , D# ~+ W+ v( ^! j/ U
  55. #define STATIC_SHIFT                3) a9 a8 f& S* j3 Z1 ]
  56. #define TCINTEN_SHIFT               20- J; g7 s4 P- J/ Y$ q
  57. #define ITCINTEN_SHIFT              21
    6 R) o* X4 f" G3 r/ ]! S7 P$ z" w
  58. #define TCCHEN_SHIFT                22
    ( e1 `; Y/ e! r# O
  59. #define ITCCHEN_SHIFT               23" o) \) s# N/ k' M
  60. 5 v3 I, t$ ~6 s- O% s
  61. static volatile int irqraised1 = 0;
    ( N7 v4 Q6 [- z0 n$ @! B) D* Y
  62. static volatile int irqraised2 = 0;3 d6 N+ ]$ {0 i- ], g
  63. + G5 z% K, T' S" e# ?$ k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C; g0 t! r6 B6 u, x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 b( Q! m" n+ P" v) N7 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D1 R- O9 D" r! F3 s. O% w
  67. ! X. ~9 U* w0 q) }* \
  68. dma_addr_t dmaphyssrc1 = 0;
    - W2 e" V5 P5 l3 o7 s/ \2 B' r
  69. dma_addr_t dmaphyssrc2 = 0;
    " U/ |* P& N2 J4 l* ]9 |
  70. dma_addr_t dmaphysdest1 = 0;6 h- V0 ?. v3 a; r2 J
  71. dma_addr_t dmaphysdest2 = 0;$ p; t2 V4 Z$ W+ ~7 `) H% x5 w

  72. 3 W3 r7 z8 x- ]9 P+ ^5 G
  73. char *dmabufsrc1 = NULL;. b! N# r3 _+ ~9 R; |
  74. char *dmabufsrc2 = NULL;
    2 P7 f1 f$ `' w; d* s
  75. char *dmabufdest1 = NULL;- [; Y# ~+ O- n% M! q0 X
  76. char *dmabufdest2 = NULL;
    : F9 M1 Q* X+ O4 }3 J

  77. 4 ^3 ?; m( d- d" }5 \9 Q- Q
  78. static int acnt = 512;
    ; g1 G8 a: m7 J2 A" `+ j
  79. static int bcnt = 8;* R8 z' P7 Y1 B5 t
  80. static int ccnt = 8;
    . g5 ~1 e8 N+ b$ q
  81. / I+ n# D% P$ A9 U+ I( c; ^
  82. module_param(acnt, int, S_IRUGO);
    - c/ \2 G2 F: Z' }) r+ O
  83. module_param(bcnt, int, S_IRUGO);7 ?( f7 V& Q5 u6 E" d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 Q+ C# L9 W& y- F4 m+ a' Y* @8 Z6 u5 Q2 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 |  X  c8 e! _" p4 B) uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 W- S% u; ]8 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- b* _* W' ~) B0 S! x2 F: Z
3 [  l- {  Q3 K" Y* _' F0 W$ c/ q

6 l& Z- S8 ?' h" ]1 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 07:26 , Processed in 0.039067 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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