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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , [8 W* s) S" A6 X" w
  1. [code]EDMA sample test application5 J2 o5 C; J" M
  2. /*0 u6 b: k. g* |  ?$ g
  3. * edma_test.c
    7 a. v# u8 V5 I' ]- E- B
  4. *
    - C2 @2 ?4 T6 n$ ^
  5. * brief  EDMA3 Test Application
    + F* v( C" E7 Z9 p& a! X" d* N% ]
  6. *
    2 T& s0 ?6 L) X
  7. *   This file contains EDMA3 Test code.& \& o' g! {- V! B
  8. *3 K/ @1 A+ ~( x) B7 @8 g9 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 {5 \/ t7 V" {- k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / F+ E3 V& g' u$ G
  11. *         TO CHANGE.% i8 ]; b5 i. l' q1 A  J( [
  12. *
    0 w* f' [/ {/ j0 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + `/ ^* Q9 y6 @2 R$ _! O
  14. *" t3 Y- P" _0 D) H8 J
  15. * This program is free software; you can redistribute it and/or
    5 P! @6 H( y/ Q# a/ t
  16. * modify it under the terms of the GNU General Public License as4 ]+ h" p, N' G, ~" \
  17. * published by the Free Software Foundation version 2.! T. `& }8 N2 e) v2 P$ G8 L
  18. *3 r  r0 j7 l$ r# u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 K: u! x; V' K% c' h0 i3 R' J
  20. * kind, whether express or implied; without even the implied warranty/ S3 X4 ], y4 k1 S5 x" t( X$ l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! B0 Q: I- N8 r" ]+ }
  22. * GNU General Public License for more details.
    8 o. O* `. V- U5 i
  23. */" `1 B4 ^- s) Q/ [3 @+ Z) M. ]

  24. 2 w- [& I- l# J" ]; c
  25. #include <linux/module.h>
    , X& x" N. O8 N
  26. #include <linux/init.h>" S2 z: j! V; M4 `( C
  27. #include <linux/errno.h>
    : R3 X  l# ?7 w! W/ e( V* Y: i
  28. #include <linux/types.h>
    1 v$ q; v1 v) s$ V% K6 A
  29. #include <linux/interrupt.h>$ c! o9 e# U7 h6 y
  30. #include <asm/io.h>
    9 m7 }9 t6 c8 X+ r1 n. K% q  Y
  31. #include <linux/moduleparam.h>% q# I2 x! R; o5 n4 [1 S: X
  32. #include <linux/sysctl.h>
    : y6 W$ p$ i  G1 J# d+ q/ _
  33. #include <linux/mm.h>
    " F! q2 S+ a! e4 S6 Q; u' p: h
  34. #include <linux/dma-mapping.h>
    # i9 ~. a7 E; X6 [4 E; ?

  35. % i* W) _* ^; w5 n8 t
  36. #include <mach/memory.h>
    9 }+ _% f' q& t6 O5 Z! Y
  37. #include <mach/hardware.h>. R6 X4 W) o- t9 R& a
  38. #include <mach/irqs.h>9 k8 z1 x  \$ k6 g
  39. #include <asm/hardware/edma.h>3 ?2 j7 Z" O8 R. K2 s+ I6 w
  40. # Q+ u3 R" `, t% ~# O$ z+ L0 ]
  41. #undef EDMA3_DEBUG
      c6 @7 _5 w+ Y& B6 n( I* x
  42. /*#define EDMA3_DEBUG*/
    , y7 D! }. J3 U% `

  43. 3 t* M4 w% K' s3 D- x- j  Q0 G: E
  44. #ifdef EDMA3_DEBUG
    " L; I( r8 x+ z9 T- v+ v/ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , o" k0 M1 f9 N% @; e) V) J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 U! {# k+ g+ w6 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 n' y6 x/ P; p& u6 f* ?$ @" s& S
  48. #else) H! ]' Q$ k3 ?9 K" o3 W( R# ]
  49. #define DMA_PRINTK( x... )( Y9 {1 j/ m0 f3 F
  50. #define DMA_FN_IN( {0 }3 T' I; r1 {6 }' m  Q
  51. #define DMA_FN_OUT
    ' S7 V& W% Y$ C4 u& V. S7 h# H
  52. #endif+ ^, ^" Q& c* }

  53. 5 o4 d; g5 ^4 f* ~- k& P0 U  f0 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 }% p" O* \; r  V* i1 W7 l
  55. #define STATIC_SHIFT                3
    2 r5 x" S+ A7 [/ _0 s0 \& `1 |; ]
  56. #define TCINTEN_SHIFT               20% j0 ]4 i8 w" F- H% z- P0 M
  57. #define ITCINTEN_SHIFT              21
      h* ?- q" |$ m# w6 F/ H4 t6 J
  58. #define TCCHEN_SHIFT                22: O3 n. f2 B0 N. r9 C
  59. #define ITCCHEN_SHIFT               23! v+ w( C( d# |8 f# V, V; s, |

  60. & t. V/ X; I- i/ U% O1 Q
  61. static volatile int irqraised1 = 0;; g8 F& r- t& a7 n1 }3 k
  62. static volatile int irqraised2 = 0;
    * x4 i7 v! j5 o/ h. l) m; w

  63. ( O* ]* v5 T8 v2 B. |9 Z' U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , a4 a- n9 A9 e8 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # a  `' N9 }4 s5 e/ ^, g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u1 z5 _- s% ]- a8 Q
  67. 5 c8 o1 V2 u- Q! `
  68. dma_addr_t dmaphyssrc1 = 0;
    9 b3 ~3 c% o1 x7 S
  69. dma_addr_t dmaphyssrc2 = 0;1 }" E" l6 K+ x8 z1 `6 e. f6 T! ?
  70. dma_addr_t dmaphysdest1 = 0;2 v5 N! Z- N7 J% K' w9 B( K
  71. dma_addr_t dmaphysdest2 = 0;+ ]9 ?& [" Y: G) h" k

  72. % L8 g$ B( b: l6 t
  73. char *dmabufsrc1 = NULL;
    0 l( u- N. @* a- I
  74. char *dmabufsrc2 = NULL;
    8 \6 T& [: @- M6 l( y
  75. char *dmabufdest1 = NULL;1 `; e2 M& M, x5 `. d, A$ q
  76. char *dmabufdest2 = NULL;: i' B6 v* \- b( p

  77. ' J: w0 {  W2 J: p7 q
  78. static int acnt = 512;
    7 z# ?) D! B' @3 Q6 h
  79. static int bcnt = 8;
    , ?9 d: ^8 z; {; X$ n2 l4 ^
  80. static int ccnt = 8;
      `9 O% d; s! L5 a  \/ P
  81. ! ~% s& N$ A2 G
  82. module_param(acnt, int, S_IRUGO);+ c6 p% K  o/ e* P7 `1 E
  83. module_param(bcnt, int, S_IRUGO);
      g# B+ W! \3 G* u0 \8 W7 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% W5 U2 Y: x4 r/ k, {
+ ?  H5 |" t4 M) p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, x, ~7 Y5 h9 p2 N6 C% Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 i/ G8 Y) E; \; A& T" B3 @. l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ?  [; `) U% ?3 j& X$ W  u6 w
; m3 H. @& {, S: F6 l; Q( A4 m
! |, @9 [! D6 u' g5 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 07:00 , Processed in 0.039742 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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