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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* E; R! J3 k7 \3 m0 K# X9 C
  1. [code]EDMA sample test application" n. V8 ]$ o5 k# p8 O& m3 k
  2. /*& {, l4 A2 G/ J0 M  F( Q+ d2 o
  3. * edma_test.c
    " k+ `& L: V$ E0 p" ?# ~
  4. *
    ) s; k7 z6 p% m
  5. * brief  EDMA3 Test Application
    - v  h3 Z# u3 r+ F) _; ~8 k
  6. *
    8 f6 @# m$ @, V/ j+ I
  7. *   This file contains EDMA3 Test code.7 ]; [; P4 K0 G' w( \" u1 I& b3 w4 R9 o
  8. *
    6 g# ~* l; T4 e, n, D# o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% C. z3 ?9 \% V/ h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 N/ j) v" R7 I& u3 ^
  11. *         TO CHANGE.9 f& D# t  @' v3 J; Q/ L! V8 R/ e: ~
  12. *
    7 g  p  }+ V; V2 k0 L% r" u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + C& W5 V- ~! ^
  14. *' p8 \$ L2 A1 k
  15. * This program is free software; you can redistribute it and/or, U* h  i, K1 ~+ _4 ~. I# Y6 |! y
  16. * modify it under the terms of the GNU General Public License as1 ^' H" A( ~2 R5 H/ W
  17. * published by the Free Software Foundation version 2.' J* t  e1 j0 I: d- g) @
  18. *4 \/ f% C3 d% o' c, `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 {/ n1 \8 @5 ]9 p% s5 E
  20. * kind, whether express or implied; without even the implied warranty8 g2 |9 s) [) B6 t1 ]- K4 w+ [2 _7 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # c0 q- b5 H. `9 i
  22. * GNU General Public License for more details.
    / u! ?; d- }8 f8 M" j/ [
  23. */
    4 M/ n% T1 x* {/ H; |$ R  T! G
  24. : o  u- k9 @0 F, [8 C( c7 L# k
  25. #include <linux/module.h>
    3 r. Z2 h' S( M7 J+ ?! Q, D
  26. #include <linux/init.h>
    ( v0 }: r! F+ n) b, n
  27. #include <linux/errno.h>/ W: u4 k/ c1 O8 ^  f  Y. o
  28. #include <linux/types.h>  @) ^% e! p; s* a+ B0 Y3 A% q8 b
  29. #include <linux/interrupt.h>
    / w6 B$ N% B; i. L
  30. #include <asm/io.h>2 K1 d8 |3 Z7 U! y* ^
  31. #include <linux/moduleparam.h>
    / R" U+ d! _6 ]
  32. #include <linux/sysctl.h>5 \8 c2 x3 N- w: u" }
  33. #include <linux/mm.h>
    ; l: I1 K8 Y7 v3 w1 V" S0 ~' `
  34. #include <linux/dma-mapping.h>
    7 U0 C1 c/ c& a

  35. 8 {: g3 F+ y# G4 p2 S7 }
  36. #include <mach/memory.h>
    , N' ^; a; U6 |+ p7 ?
  37. #include <mach/hardware.h>
    % l- F) m% t  \' ?) O7 }% H2 A
  38. #include <mach/irqs.h>8 q8 [5 U+ _" i- b5 A, X
  39. #include <asm/hardware/edma.h>6 t9 ~! W1 h) I7 N: K

  40. 2 p  ?, q5 B& u0 T7 T+ W% n( @* Q
  41. #undef EDMA3_DEBUG; j6 Z/ z  D3 ]3 g$ Y' p
  42. /*#define EDMA3_DEBUG*/
    0 ~1 U- x  `2 B1 K2 q
  43. + R! e$ ?( M' t7 l" j
  44. #ifdef EDMA3_DEBUG
    2 B: a) A) k5 F" U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). v& I8 ?& _; Y8 d" i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . P/ \' H# O. M4 r" H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ ~/ T: N* e. m1 ]; \
  48. #else
    : j+ @3 h! a" F! `7 c& H
  49. #define DMA_PRINTK( x... ): v8 i  ^0 I' s" @; X: I$ C( d) Q8 R
  50. #define DMA_FN_IN
    8 w3 s9 `- |1 m' Z
  51. #define DMA_FN_OUT$ o4 ~6 T! b7 C- ?1 {0 \, h& T
  52. #endif: y* p  i3 ]4 t; ]2 c, `3 w4 o

  53. - V3 z1 s9 P! h0 b4 ~* h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 s& a. \: N6 w0 P  g
  55. #define STATIC_SHIFT                3
    - O% u3 G5 R2 U& q
  56. #define TCINTEN_SHIFT               20
    7 h) h8 P. ?6 ?0 J
  57. #define ITCINTEN_SHIFT              214 W7 D# \6 L9 k1 b  S
  58. #define TCCHEN_SHIFT                22
    ) k! F/ R8 f- }- U7 R7 T
  59. #define ITCCHEN_SHIFT               23: e: n& d9 J* h/ f

  60. 4 a- z$ r% C2 O8 {, R
  61. static volatile int irqraised1 = 0;
    * {# p4 h' I! d
  62. static volatile int irqraised2 = 0;
    % g" Y. E0 q# v) B

  63. # o# R1 G% {: `3 k/ A, P* c. M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' d0 B& @6 M! P; J" y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  s$ p3 q/ M( Y0 {+ k! O  x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 r& h) V% Z  t9 D$ r) x
  67. 2 a- _% W; G& B" y  B6 K/ W7 R) b+ _$ p
  68. dma_addr_t dmaphyssrc1 = 0;
    1 x* k' c* v! c+ _3 g
  69. dma_addr_t dmaphyssrc2 = 0;
    9 e! K7 [0 I7 x3 Z; j$ P
  70. dma_addr_t dmaphysdest1 = 0;
    ! P6 u" i1 P; w& ]9 j( e: |
  71. dma_addr_t dmaphysdest2 = 0;; l2 ^( [' }, h, n

  72. 9 |8 Z& K! ]  Y  t3 T# y
  73. char *dmabufsrc1 = NULL;
    4 }$ G0 }  _5 H: o* a7 ^9 E
  74. char *dmabufsrc2 = NULL;
    3 ~" d- ~  T" e- `5 n% t$ C
  75. char *dmabufdest1 = NULL;
    / C- V' U6 r9 y- Z6 K
  76. char *dmabufdest2 = NULL;5 I7 V6 a1 {" ?4 ]' y

  77. 8 U- c& s4 U2 z) a7 q5 f* k/ C1 \, j
  78. static int acnt = 512;7 W1 o  \/ n8 l: H4 s1 [
  79. static int bcnt = 8;
    4 m# m/ c) x, L6 `, A
  80. static int ccnt = 8;
    : E3 J/ x" L" I; e+ D9 b
  81. ) X7 y' g* ~7 [, P
  82. module_param(acnt, int, S_IRUGO);
    ; `* S7 D7 F* |
  83. module_param(bcnt, int, S_IRUGO);& v' d7 D/ o0 i  X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  ?& a7 q  A5 b3 z5 L6 v, N. t) {
* y6 p. n6 R' U9 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  h# l" Y  Q- H- A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 W6 Y" X3 y3 d7 @/ N) t, Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, z: v/ N  ~4 d' J

: A1 [! s: f5 }4 ^: U" g: Z: W3 `! e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 05:14 , Processed in 0.039216 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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