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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , f/ K: ?, l' o; l3 g
  1. [code]EDMA sample test application
    ( d8 C; \% a) P% g7 N9 k# K7 T. Z
  2. /*
    $ @% A. G/ p) O1 N( p
  3. * edma_test.c" W/ r0 f4 m$ q2 I/ ~/ x: y' k
  4. *
    , K  _- D% [1 x! V' u6 L
  5. * brief  EDMA3 Test Application
    . h/ {9 }" a( |- ~1 }9 u
  6. *8 O- y. o, i9 n: t/ q& S
  7. *   This file contains EDMA3 Test code.
    % s$ d" {, \3 G6 r9 a* J* y4 f% a
  8. *
    . |1 e( R  B' E8 q* `- o( G8 ]- S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ l2 w' u' K" b; U3 ^- R# s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " C1 _, }& B& Q& B0 i8 t
  11. *         TO CHANGE.
    ) Y. I3 V) z1 P& x5 Y
  12. *' H1 p6 p+ C! G$ M( ]7 y( b/ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, O0 m, L0 t6 G6 Z, N# f( S- w
  14. *. O, _  `# B& v+ _& ?, j
  15. * This program is free software; you can redistribute it and/or
    ' L, j: |' y. r7 A* U8 q0 G
  16. * modify it under the terms of the GNU General Public License as
    / G1 h# p. |+ y8 A, }! P
  17. * published by the Free Software Foundation version 2.2 q) ^! s4 Q( h1 J
  18. *
    ! R2 |- R9 C) P: X5 |8 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 M8 e: w; _7 b* M+ u0 j* }
  20. * kind, whether express or implied; without even the implied warranty
    ! ?6 V* p% u$ T8 ~+ H& V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % B- p, _7 m- h9 T
  22. * GNU General Public License for more details.* g! |6 V* E/ f2 u2 C& s$ s
  23. */
    1 B! H4 Q* r0 m5 Q/ n  {7 P
  24. 8 T' S: E+ e  ^
  25. #include <linux/module.h>$ K5 u  |+ ^! |$ |0 B
  26. #include <linux/init.h>7 a! I9 U( s' d
  27. #include <linux/errno.h>* S1 a. D- T0 `" f( c5 U* U
  28. #include <linux/types.h>
    . ]1 e9 k% P* {8 s" r2 n
  29. #include <linux/interrupt.h>, _8 T# Q( n/ }) g* d  k" O
  30. #include <asm/io.h>- x! m9 e8 T( C
  31. #include <linux/moduleparam.h>. [8 p" T7 x3 [  b! l4 X8 i
  32. #include <linux/sysctl.h>9 y& g. I7 E2 w% J! K
  33. #include <linux/mm.h>4 j! j0 L$ p" _- W; W( e: {' w
  34. #include <linux/dma-mapping.h>9 f/ ]/ Z, j. d* P

  35. ' D% W' t) Q0 E6 X8 ~
  36. #include <mach/memory.h>
    $ n+ E. V. ?6 w2 y4 K5 v
  37. #include <mach/hardware.h>
    . r" F2 T  W2 V: z8 e
  38. #include <mach/irqs.h>4 H* g' y$ v+ B) h, N% _
  39. #include <asm/hardware/edma.h>
    3 t+ D4 g% ~$ V* s8 q. `, E
  40. 1 @: V$ ]( U3 E9 s$ e% e! R& U
  41. #undef EDMA3_DEBUG
    ! f8 g% F( ^% ~! M
  42. /*#define EDMA3_DEBUG*/% Q- K# h% h2 v
  43. + n8 t6 ]/ z+ I* D: W
  44. #ifdef EDMA3_DEBUG) O& z' Y, d, ?, W# J/ ^& v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). I  {' u' W7 _6 o6 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) G, n; I; B. F4 A) t0 F. m( b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). e3 |0 j: h8 {
  48. #else
    + {5 e0 T" R/ h$ v+ z
  49. #define DMA_PRINTK( x... )
    ' N( r$ `/ a8 v: y
  50. #define DMA_FN_IN& B# W0 M0 f6 O3 M$ v
  51. #define DMA_FN_OUT
    / [% k. N6 s& V- [& \/ i
  52. #endif4 ]+ i; Z5 Y' T1 D* h, z
  53. % }3 ]) I2 c: U. E1 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), o5 `( a& _' m* a% ~
  55. #define STATIC_SHIFT                3+ F& i  b  C, j  j# G+ m  @9 Y' J) a
  56. #define TCINTEN_SHIFT               20
    ! X) |% X- q$ B
  57. #define ITCINTEN_SHIFT              211 I, T/ _* W4 P2 {% s6 \, k7 i. h
  58. #define TCCHEN_SHIFT                22
    9 e' _( V1 @$ u; S" N8 Y
  59. #define ITCCHEN_SHIFT               238 m, u* u6 s9 N1 M# w! c% t8 S
  60. ( Z% f; _% [$ _3 M+ \7 Z# |$ T
  61. static volatile int irqraised1 = 0;: D& Y. U$ B7 G
  62. static volatile int irqraised2 = 0;, K) G, c5 @. l* L+ K
  63. + d. k" }, w! z' w' R/ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 f  G% ^1 p" ^. b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  [/ k4 Q1 y8 g$ u5 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : d+ e4 m- S5 Q

  67. + E) `5 K5 e0 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    7 K/ l- H; d, C0 C7 ^
  69. dma_addr_t dmaphyssrc2 = 0;% ]1 `; P* y5 t4 D4 |( v( Y, M
  70. dma_addr_t dmaphysdest1 = 0;3 S: w/ U3 Q$ X5 S
  71. dma_addr_t dmaphysdest2 = 0;1 `3 x- h; z  h: ~

  72. 3 o4 [) x3 y. `" h: w$ k2 c
  73. char *dmabufsrc1 = NULL;+ M& X- T3 N. c6 A
  74. char *dmabufsrc2 = NULL;
    % K& x6 D% R3 c+ a5 s6 z
  75. char *dmabufdest1 = NULL;
    - \" l1 \( g* @7 `6 z. h& n1 _
  76. char *dmabufdest2 = NULL;" g- B$ D) j2 G. D& h3 c3 X
  77. 4 P5 o4 I0 c; U) b, o
  78. static int acnt = 512;
    & j/ T! o( K6 z4 F2 j
  79. static int bcnt = 8;
    ; u- _8 z3 E8 ~0 y( r
  80. static int ccnt = 8;
    4 [7 ]9 A5 f+ {, n8 v8 _- t: @

  81. 9 p8 p- i- A! z! }3 Z
  82. module_param(acnt, int, S_IRUGO);- C+ c$ ^$ s0 `8 U5 w
  83. module_param(bcnt, int, S_IRUGO);) G) E9 o4 @& ~4 ~3 c2 i0 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* D4 t* e8 c$ d' ^& R' j! h! Z4 r& `7 A3 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, v9 L2 W) `' V. P- Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ R9 z' ^1 ~0 R( R. z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 v; X% j2 ~- S" _4 e8 g' i& s- Q* b; ^0 z- A$ s( w
* W+ ?1 ?5 N* x$ T7 T0 U* g+ K( E4 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 05:26 , Processed in 0.064420 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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