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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * E! v6 A8 D* G# t! r" X
  1. [code]EDMA sample test application$ ^+ }' I  W9 t2 b# ]- j
  2. /*
    5 d8 }3 Y0 V7 `/ j; m5 g: H
  3. * edma_test.c
    9 Y$ C9 g- |8 f- Y
  4. *7 ^. w1 w3 N4 Q& y/ s
  5. * brief  EDMA3 Test Application
    ; y' @! z& X& ~4 p* A! Y! I- q
  6. *+ ?/ w8 a5 f9 d9 m$ a+ n+ n# H
  7. *   This file contains EDMA3 Test code.
    & E/ u' }% T" [' M2 @* c: e
  8. *  M- A$ q5 e0 P" ]" r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  L9 a/ I8 I, R% D5 N: r$ G+ F) |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 _6 K! ^3 i- r2 e
  11. *         TO CHANGE.
    , t: _6 D1 A: e, \
  12. *
    % I* S, }7 S- [9 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / Z6 y! v4 T2 [- C4 P8 b0 F3 J
  14. *1 `& J3 D7 E7 \3 {9 k  P4 f
  15. * This program is free software; you can redistribute it and/or  F! _5 E# y$ L! I
  16. * modify it under the terms of the GNU General Public License as# a% @0 Y8 ~; E+ Q# C' A
  17. * published by the Free Software Foundation version 2.
    2 J: {" O6 l9 n/ P, i+ b3 q
  18. *1 R2 @; G8 c% U4 b  ^8 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! @3 ?0 A& p  }- S4 i. [2 ?# s
  20. * kind, whether express or implied; without even the implied warranty
    1 e5 K2 Z: P: d& r* A' O0 E; x0 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& ^# _( H0 ]4 _) r! x
  22. * GNU General Public License for more details.
    3 t9 }" D3 O' D( g9 l- H
  23. */8 i* C: D0 B3 y% s2 y8 `
  24. - B) n& ^- m$ L' H4 d7 x1 r6 ?
  25. #include <linux/module.h>% X  \: g0 `+ g' t
  26. #include <linux/init.h>+ _. y9 n6 c, U
  27. #include <linux/errno.h>( y' {& T; ?# N( x. |0 X/ ?: T/ x
  28. #include <linux/types.h>
    0 d5 j5 l' t" g2 q3 V2 s
  29. #include <linux/interrupt.h>% d8 P4 J% L" P1 j  T% M3 `
  30. #include <asm/io.h>( A0 F0 `8 K6 A
  31. #include <linux/moduleparam.h>
    4 f$ Z! n6 O- e% l- m% a
  32. #include <linux/sysctl.h>
    $ [  a) l9 u$ [, r, o! j2 [
  33. #include <linux/mm.h>
    1 b! p0 ^! N6 ^& B. W7 ~
  34. #include <linux/dma-mapping.h>
    2 M; S& Y6 `, z; L$ u" o
  35. 7 I; S1 W0 v" b) n* C9 i
  36. #include <mach/memory.h>
    2 |1 P# w" m: z( g2 H6 n: C
  37. #include <mach/hardware.h>) g7 i9 D" U% P' X, F2 E
  38. #include <mach/irqs.h>
    - _2 h" j3 D2 {$ S' l0 n2 U
  39. #include <asm/hardware/edma.h>
    , W" f; ]' b5 i+ R4 w  j( P5 w
  40. ! B; d$ I# V; Q* h/ g" A2 N/ j
  41. #undef EDMA3_DEBUG- r0 i) j  T$ Q
  42. /*#define EDMA3_DEBUG*/
    4 j, N, S$ P4 B* n) }, d

  43. ' j7 B2 g+ z2 u. ]2 L2 t4 {
  44. #ifdef EDMA3_DEBUG/ A9 O3 k. v) [; G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). L1 X. c2 Z8 Y% _- S& `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ F/ }* D3 f/ \+ e5 V1 g! ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- \! C+ m5 V( A7 ^
  48. #else
    + p7 T! S: D; U
  49. #define DMA_PRINTK( x... ); }1 }' m3 Y( h* \2 }/ Y$ j
  50. #define DMA_FN_IN
    " [) |+ `) z0 k, H
  51. #define DMA_FN_OUT
    ( x& P3 s: N: {: e
  52. #endif+ T+ }4 o. @; T3 n& Y# C

  53. * K2 B% P  c, T+ c* G/ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 U3 n/ j0 I$ E- N
  55. #define STATIC_SHIFT                3
    $ G. k' n2 {7 b. ~- Q( u+ @! _
  56. #define TCINTEN_SHIFT               20% D# v9 V' M+ U& J* M: e
  57. #define ITCINTEN_SHIFT              21
    5 L% Q  I) C- e
  58. #define TCCHEN_SHIFT                22
    & G/ Y3 L2 W) D) b5 O& r
  59. #define ITCCHEN_SHIFT               237 x" k0 |- u, J* @6 i! n
  60. 8 V/ x0 M* m' E+ P  B' ?: \
  61. static volatile int irqraised1 = 0;: r: h; I* V) i* v. y7 N9 B
  62. static volatile int irqraised2 = 0;% M9 f2 B- D" H
  63. ' J  Q/ m8 A; }8 q9 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c( n( E4 H( J# D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 z) d6 I' y3 _9 P- k, n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      f$ O2 W4 T. _. F7 [
  67. 2 D& \1 q5 F; Q& J
  68. dma_addr_t dmaphyssrc1 = 0;
    7 s" @# E6 s! d9 B4 [) E( ?
  69. dma_addr_t dmaphyssrc2 = 0;
    1 m1 k, K5 e( i' K( r6 B
  70. dma_addr_t dmaphysdest1 = 0;
    9 c1 |" s. K9 _3 v, P$ z) ]3 G
  71. dma_addr_t dmaphysdest2 = 0;
    3 M  C8 {3 X8 z9 Z( u

  72. " `3 x8 L7 M) c
  73. char *dmabufsrc1 = NULL;
    : y, G3 y6 k. z1 k
  74. char *dmabufsrc2 = NULL;) Z/ V! g4 }, j. I9 ^9 a: p' u  v
  75. char *dmabufdest1 = NULL;0 y0 h9 a/ n8 w' F
  76. char *dmabufdest2 = NULL;
    ! k$ L( V' @; k8 k4 d2 z+ P; F( w
  77. / {5 E) ?$ D' ~; K6 u) h; _) E' @
  78. static int acnt = 512;% J/ t! ]4 C" P: z
  79. static int bcnt = 8;
    . j2 }: e+ D- A
  80. static int ccnt = 8;
    5 \' c5 y; Q2 U2 h) {! q
  81. 0 @" R$ w( v* p' E
  82. module_param(acnt, int, S_IRUGO);
    / g7 {! o* t* R$ x4 O& t( V3 E0 b
  83. module_param(bcnt, int, S_IRUGO);
    # Y4 f: Q/ h, W5 b$ [& e1 V* Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- z. s- i" j% l6 B1 {9 B7 z- o& a! g* f8 B& Y3 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 W6 G) W- R* f9 I) g  u. Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* q8 B8 Q, @7 J2 V6 }. q& W) K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 n# ^8 Y7 ^. ~; [5 R& z$ D3 p$ g9 p* p, k

7 q2 t$ h9 M& P$ t, I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-30 04:53 , Processed in 0.041923 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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