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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 H) T2 [- @, K% E, `% Y8 B
  1. [code]EDMA sample test application
    " b8 w8 [, Y4 o, s, w  @
  2. /*
    2 x& m" b0 u/ N/ i; F
  3. * edma_test.c
    ' U$ t: W0 g0 i% Q+ R# J( _5 I
  4. *
    $ [7 O3 I6 k) `& U
  5. * brief  EDMA3 Test Application
    : C+ E% Z5 ?5 G6 G% E& D8 a3 A
  6. *8 ?7 w! r$ |( w/ W9 m+ W
  7. *   This file contains EDMA3 Test code.3 D7 |! k2 h5 N# `9 ?2 ~# r2 o
  8. *+ s& H8 {4 M2 B  W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" ^9 U  L; f5 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 o/ U) \& ~: K- Y
  11. *         TO CHANGE.
    - C! h- k: I: B# H& b
  12. *% y4 j3 `; D$ O$ n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ v/ a, i- W" b7 O
  14. *
    / p0 C  o3 P  I- e+ U
  15. * This program is free software; you can redistribute it and/or
    , z# E- Z0 n$ ^8 c
  16. * modify it under the terms of the GNU General Public License as
    $ U* ]5 t! K4 |7 u! V' x5 [
  17. * published by the Free Software Foundation version 2.
    ; Q4 _8 F. z  K" b8 O0 B) O
  18. *
    / z* `  F% h9 _7 }& f& m% n% p: g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  K( O7 w; v: c: V( {
  20. * kind, whether express or implied; without even the implied warranty' w+ k5 o% h' ~3 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 l; m( F- S/ x* u7 n: @4 V  I9 B
  22. * GNU General Public License for more details.
    5 S5 a$ Q  A( @& L3 U
  23. */
    + R& V( W0 R, A- I; L8 n
  24. & ^5 E6 ?1 U( W* N3 b6 Q6 e7 P2 f
  25. #include <linux/module.h>3 z5 U, U, o" U) o
  26. #include <linux/init.h>! t$ T% |1 [, O% U
  27. #include <linux/errno.h>2 E, U2 M+ q5 [* S
  28. #include <linux/types.h>
    * S  m5 I; P* C  c
  29. #include <linux/interrupt.h>1 z6 e+ I$ a! c% r* {
  30. #include <asm/io.h>
    ) ?0 X% X9 `  X" @" {3 [
  31. #include <linux/moduleparam.h>
    4 j( K: W- R+ c0 p; Z% r1 R) W
  32. #include <linux/sysctl.h>6 H' N; Q% J- ?, h8 t$ Y
  33. #include <linux/mm.h>
    " g/ `& Z& U; B2 i& O; T. h) S
  34. #include <linux/dma-mapping.h>9 f0 p* F) m. S
  35. 5 l( C1 K: z( D; D) `+ j
  36. #include <mach/memory.h>
    : ?( T% e$ I. o1 H9 ]' M3 A
  37. #include <mach/hardware.h>" G$ m% ~2 Y9 g2 ]* c' m# z
  38. #include <mach/irqs.h>
    $ Z. \/ X- x# n1 t3 \7 V% U# J% }5 U
  39. #include <asm/hardware/edma.h>& H4 t8 m1 C+ c! \+ O
  40. : z. X, a+ G8 ]" e* Q$ c
  41. #undef EDMA3_DEBUG
    & o! t2 o9 p- l
  42. /*#define EDMA3_DEBUG*/
    5 _" I# n- k/ d3 }7 K+ j) @) z- D

  43. 0 B4 B7 X: ]( v& z
  44. #ifdef EDMA3_DEBUG+ Y5 Q1 Q& _, R# V2 M3 l# ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : @: l# M% e% F$ Q6 @- [2 q$ V. K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), }: ?+ o, ]/ X8 \4 a) m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): u+ c1 D8 A6 l% P
  48. #else; O* P  d7 S% m: S
  49. #define DMA_PRINTK( x... )+ p: t) O$ \, Y& n
  50. #define DMA_FN_IN3 f5 M" {  T  O9 t8 X8 ?
  51. #define DMA_FN_OUT
    ' J- I& @4 h: _0 `0 H
  52. #endif* |. K9 q) x7 E: `2 T# s
  53. ; t) z+ [6 B3 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " p* T  X( s2 \
  55. #define STATIC_SHIFT                3
    ; l; O0 t- i2 [' D$ i; h  d
  56. #define TCINTEN_SHIFT               20
    ; }1 G6 T. `% }7 q" d$ g: Q
  57. #define ITCINTEN_SHIFT              21# ^& Q+ o, f3 T3 L
  58. #define TCCHEN_SHIFT                22
      k: I" G: r3 G% w5 j7 q3 \
  59. #define ITCCHEN_SHIFT               23
    4 y0 c; y+ z2 o

  60. 8 V2 U( X; L, u5 d
  61. static volatile int irqraised1 = 0;
    : z6 p+ z7 r& N7 x5 i' r" }
  62. static volatile int irqraised2 = 0;& p8 U# A! A; [1 M* o5 @+ R
  63. - ?' I9 y& Z) Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \" m6 ^& ]2 P; b& D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ o+ E9 T: q! o9 b1 k8 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : h0 ^. E" c8 Y' r& _
  67. 7 \7 R6 R* K1 N
  68. dma_addr_t dmaphyssrc1 = 0;5 c* u* L' B* W% c& C: B# D
  69. dma_addr_t dmaphyssrc2 = 0;
    5 g* k1 I$ H" P0 }
  70. dma_addr_t dmaphysdest1 = 0;  o- t2 T8 l3 j/ b3 l
  71. dma_addr_t dmaphysdest2 = 0;( W1 i5 s$ x2 {
  72. ' Y* y& @7 b0 x
  73. char *dmabufsrc1 = NULL;
    ; l! }$ C" S4 i, O9 H% [/ c
  74. char *dmabufsrc2 = NULL;
    8 E7 u# @+ U( D! u, t
  75. char *dmabufdest1 = NULL;
    ) L- D) H: s+ D; v  E4 q
  76. char *dmabufdest2 = NULL;7 G% @1 A8 D1 H- C/ o
  77. ( V/ n0 y- y: m4 u; [
  78. static int acnt = 512;$ q: c5 O- I; p1 f2 U' r
  79. static int bcnt = 8;1 g/ x# f5 X. u, u2 W. f6 k
  80. static int ccnt = 8;
    ' u, d7 `0 |* N) W* Q! m
  81.   K4 Q: h, x& ?4 O
  82. module_param(acnt, int, S_IRUGO);7 z& N2 K, g, x  ?0 e* `) b
  83. module_param(bcnt, int, S_IRUGO);9 }, x7 i: N% n  g& M( }: X  E' I* I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 P- ^3 R$ T6 g8 T: M6 r* K5 P  V1 K/ Z8 w6 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 z2 ~* h/ W8 i# p$ k* p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 q/ X2 K9 V) F4 ^# g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 j) r; {5 b5 @7 N5 u8 H  n* F3 a
4 M9 B( M7 q7 V) @
5 k7 f0 V/ R1 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-7 00:25 , Processed in 0.036812 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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