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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 S& {) |; z0 ^7 r7 e9 A
  1. [code]EDMA sample test application
    , T0 g, b: e* Q) R8 E% \
  2. /*
    # C& B' p1 E5 t% ~* ^# H& ^7 A
  3. * edma_test.c
    ) ^3 }9 k0 B( p) l
  4. *
    / _9 N% c! \: r1 r8 q8 K0 R
  5. * brief  EDMA3 Test Application2 q& K( p+ i# B, y7 U9 J
  6. *
    6 Q1 J# I$ Q9 C% v
  7. *   This file contains EDMA3 Test code.
    ) V2 c5 |$ S3 A5 S, L: ]0 k8 q
  8. *
    + c" R$ c: ]9 E8 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% R( |' n4 \# @% V2 W  h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 y7 p/ f) L* b
  11. *         TO CHANGE.# k6 _: T$ n9 g# f6 b
  12. ** I/ j+ f& F$ c6 [  R- ^1 p1 u( ?- c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - ^# y; c. R9 D* t
  14. *
    $ v& j# p* k5 V% b# }
  15. * This program is free software; you can redistribute it and/or
    8 q' g* m% @  z: }9 ?, k' T- q
  16. * modify it under the terms of the GNU General Public License as
    0 a% ^. c4 H( ]2 W
  17. * published by the Free Software Foundation version 2.
    # u+ m' T8 d* R* T) _6 Q4 J
  18. *  Z! {. I  V, Q/ m; g0 r6 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: b3 k- v0 ~/ ]' k2 M8 {, B# {
  20. * kind, whether express or implied; without even the implied warranty+ F. U7 Q" o) f3 E. u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ R3 `7 |; z/ v/ q0 c& Z
  22. * GNU General Public License for more details.
    + H" I9 a1 l7 n! p+ A1 Z+ K  M* \
  23. */  c& e  x. K4 ~( D( E
  24. 7 S, S2 j1 U6 u0 E% [# w7 i: ^
  25. #include <linux/module.h>
    , F! w. V+ d& b; }6 _$ \& K
  26. #include <linux/init.h>8 _- s4 m& R; Y6 `
  27. #include <linux/errno.h>
    9 K2 j% q! i/ o& v4 W( J
  28. #include <linux/types.h>
    1 L1 e2 T% U$ ~5 u) ?2 u$ ?& G
  29. #include <linux/interrupt.h>8 {" K7 E6 R9 O3 l& U
  30. #include <asm/io.h>, b6 U* F* O9 J" {2 w
  31. #include <linux/moduleparam.h>- L8 z0 c! s7 B4 u. C
  32. #include <linux/sysctl.h>
    5 P" ]; X$ ]* N! `# V* r3 i
  33. #include <linux/mm.h>5 M( A+ t9 H' N, ~
  34. #include <linux/dma-mapping.h>9 h* l# Q5 m5 @8 y0 A3 X4 F6 a
  35. ! ^5 M. X8 ~( B0 {
  36. #include <mach/memory.h>) L5 ]2 p9 \! H. m, [. O: T" c/ r. b
  37. #include <mach/hardware.h># r$ |4 z5 |2 `% ^4 w
  38. #include <mach/irqs.h>
    3 M, @% @6 ?9 W2 P
  39. #include <asm/hardware/edma.h>$ \7 k9 q& N% _) k* B8 w/ [
  40. : d8 p9 K. B& I7 E- l
  41. #undef EDMA3_DEBUG
    ! G9 Q8 v! V- T  ^* Z0 |! m
  42. /*#define EDMA3_DEBUG*/
    0 `2 C2 o& s: p; g
  43. 8 g0 \, C1 u" g& C8 Z6 K" y( A5 \
  44. #ifdef EDMA3_DEBUG
    7 N  [% N, _( V! C* @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " _; ?1 b% o  A. h' x; B  _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 d1 |+ |8 l, |& T! Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& K: E% o  N% x1 X
  48. #else9 |! l; @3 I" a- {
  49. #define DMA_PRINTK( x... )
    ' L& M( M) \9 }1 o  z# c
  50. #define DMA_FN_IN
    - u: c6 r0 |& f* n
  51. #define DMA_FN_OUT
    ( y6 C  [0 X' U/ q1 T, P- A
  52. #endif* O+ t! U5 N6 o2 ?5 f! N; h

  53. ) U- w# S% u8 E  j5 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + W$ m% C$ W: z! x5 h
  55. #define STATIC_SHIFT                3, X. j# I1 u0 @2 J0 C, r# ^7 ]
  56. #define TCINTEN_SHIFT               20$ ~* `; `4 A: e* d  f$ C2 }
  57. #define ITCINTEN_SHIFT              21! Z% g2 p' @. ^4 `/ z* Y7 Q! ?
  58. #define TCCHEN_SHIFT                22
    0 H+ Y- w0 Q) d+ J! ~) h
  59. #define ITCCHEN_SHIFT               23
    * b1 @2 D4 N0 d1 \

  60. 8 u& B  l+ b6 X, W& u* X# R
  61. static volatile int irqraised1 = 0;
    ! z$ g* s# l" S. B  a
  62. static volatile int irqraised2 = 0;
    / L/ [0 D: K! T' N$ U* d$ L
  63. ' s- j5 q6 J) }% R- b: U" y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J% h9 V; d* D) \0 q+ C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( e8 h' `" K2 G# B2 C$ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / q! o) ~1 n! f& J6 J6 l! V

  67.   o3 X0 |$ n- P" N' O; ]$ E
  68. dma_addr_t dmaphyssrc1 = 0;
    , f' W, G8 c" Q, C3 f
  69. dma_addr_t dmaphyssrc2 = 0;9 U- b% g4 w1 @, v( z7 w
  70. dma_addr_t dmaphysdest1 = 0;
      F# \) x  o4 Z1 n: `) a3 Y- j" ~
  71. dma_addr_t dmaphysdest2 = 0;
    ) ?  q' G) M% x4 r2 i  p. S$ h  y3 A

  72. # L9 Z6 H& |/ L
  73. char *dmabufsrc1 = NULL;8 z) W- N0 |0 Y, v# s7 L+ t
  74. char *dmabufsrc2 = NULL;
    2 w5 |$ g" |0 h- D7 M6 f  v
  75. char *dmabufdest1 = NULL;8 Z1 u6 O1 \) L  W" N* S3 O
  76. char *dmabufdest2 = NULL;
    . e4 t7 l# ^2 R4 O
  77. 0 q8 C# j8 f& i8 g" x0 w9 [
  78. static int acnt = 512;; Y3 x: o# f7 O/ O6 w( ^
  79. static int bcnt = 8;$ m+ s7 Q9 w7 Z. w1 D( u* H
  80. static int ccnt = 8;, I  a  H1 D, {) m! g* r
  81. 0 W4 b3 H8 h) h' L/ O( Z8 [
  82. module_param(acnt, int, S_IRUGO);
    1 f9 G5 G/ U: J8 d# c* X9 O1 [
  83. module_param(bcnt, int, S_IRUGO);
    . C4 d# |  K' z- j7 I. p* |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: |; _7 _6 O0 P' E* ~6 H) l( u- u/ J# e" w& u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# {2 z+ e7 j0 R- q: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! j- Y1 d% Y% j+ b4 T4 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, Y, _! o  H& A/ K; ^
# \! J' N7 h# Y/ ?" o# D- }5 ^& [
: O. Q5 j; I! b( @: U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 22:22 , Processed in 0.039209 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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