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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. r+ S' r3 U  A$ ~' n3 m5 E0 D1 f# w5 Q
  1. [code]EDMA sample test application  @' E* {; x( n
  2. /*6 P  F) X/ O4 o( m$ B
  3. * edma_test.c) X" Z* W& {6 F6 O% u
  4. *
    # `& Z6 k/ y" G, V; j
  5. * brief  EDMA3 Test Application
    2 t5 ?6 p" ]$ ~* z- Q
  6. *
    . b4 e) d, X( B) j
  7. *   This file contains EDMA3 Test code.* J: u( \6 @+ l1 {% Z* T
  8. *
    ( \/ g9 ?3 V- l0 g/ E. p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ `+ `& Z4 Y# c$ `) W9 w- Z: ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Q4 ^) x- c3 y( |, Q2 M
  11. *         TO CHANGE.3 ], I8 v; K1 w5 W  \7 Y& K" ?
  12. *+ h# u2 _7 ~* u5 y* }: B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! Q1 n0 O& ~6 ?( T1 n
  14. *
    ) o. |$ b+ k( }) i) [
  15. * This program is free software; you can redistribute it and/or
    1 W  z# C4 }2 s& u. x/ U) q
  16. * modify it under the terms of the GNU General Public License as
    7 c. \# n& t2 X, P  Z' r' }0 }
  17. * published by the Free Software Foundation version 2.
    & H% }3 d, a) {
  18. *: n/ p7 \4 z, y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 S' [' s* y- V& [- j3 X
  20. * kind, whether express or implied; without even the implied warranty& U% ^6 n7 y& J$ Y# {( e" }1 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 U- N0 M# h: N+ X$ b1 V) I# o
  22. * GNU General Public License for more details.7 Q. l1 {4 w: X+ o3 Q
  23. */
    1 {1 C3 c0 C/ P5 j5 A# {

  24. . Y+ N2 n0 R$ G
  25. #include <linux/module.h>( ^' {6 Q7 K0 C1 q( l7 `' s( q
  26. #include <linux/init.h>
    ( _- c$ v1 f8 \1 Y, u2 a
  27. #include <linux/errno.h>
    * \8 c/ r1 w$ O' R
  28. #include <linux/types.h>
    ) {. y# O1 D( H9 k3 n/ B; Q+ d
  29. #include <linux/interrupt.h>3 y8 V# I0 I( A8 n( \
  30. #include <asm/io.h>
    , u. g  b7 ]3 P  z! J
  31. #include <linux/moduleparam.h>% w  B4 Y- H5 ^) M" {" K( ?
  32. #include <linux/sysctl.h>
    ) A# H6 f+ c: |) o& P- x
  33. #include <linux/mm.h>: \7 w# i# W- f5 p" J
  34. #include <linux/dma-mapping.h>+ K# s0 a5 p" {3 E0 [

  35. 5 I7 T- x" a. y: X1 u
  36. #include <mach/memory.h>; d1 b, x6 H4 ]5 O4 O/ b
  37. #include <mach/hardware.h>( b/ h8 p' U" t) j6 s5 M
  38. #include <mach/irqs.h>
    0 s9 o0 h1 {, L9 z( t7 h( ^
  39. #include <asm/hardware/edma.h>
    7 S+ U6 ^( Y9 X7 h2 \9 C
  40. # d* i, M+ h$ |$ g# P
  41. #undef EDMA3_DEBUG
    ' M' }, P, t/ X9 ~6 ?  u
  42. /*#define EDMA3_DEBUG*/
    - p" R; X/ k( _7 b! q! ^
  43. / S5 i: ^3 N# `. S
  44. #ifdef EDMA3_DEBUG
    - Q* N4 Z7 S# Q+ y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! B/ Q' G7 ~  X7 `  }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - ]/ p4 Z+ R- h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - g: {+ P2 e- i; F. G. g7 f$ n1 t
  48. #else% n8 j- q; e# T6 W
  49. #define DMA_PRINTK( x... )
    $ |: I9 v( o: f
  50. #define DMA_FN_IN
    0 D( v. b. r6 F# ~% P( @0 p
  51. #define DMA_FN_OUT( j% [- Z' \: i& }+ W
  52. #endif& s1 S. Y* P* j/ p# J
  53. 9 h! {0 W4 t( \: D) d  n8 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 C" I3 G8 @- s* f, G9 `
  55. #define STATIC_SHIFT                3
    1 {9 S" }4 u( V' T, T9 D
  56. #define TCINTEN_SHIFT               20
    # \$ F$ C+ m9 n) k" o
  57. #define ITCINTEN_SHIFT              21) M* c3 n0 z$ [# h9 b5 r
  58. #define TCCHEN_SHIFT                22
    1 a) V$ F8 o' Q4 E2 `3 z( [0 f
  59. #define ITCCHEN_SHIFT               23
    0 O; x! g4 l* x  s

  60.   W+ h5 j3 |/ W8 ?) V
  61. static volatile int irqraised1 = 0;
    , r! B- @7 ]5 N0 K. z
  62. static volatile int irqraised2 = 0;
    4 l! ~7 o7 f$ y4 z1 D. z
  63. 7 Q' j- h5 `8 D5 i3 \% s. M4 x$ M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 E/ o- I9 W0 _& z5 L& B( N% p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! l# M1 c' ^2 G2 ]; V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) j% y; `( j4 R# D' I  l

  67. % P) T" m/ S: ?$ Z+ G2 j8 [
  68. dma_addr_t dmaphyssrc1 = 0;9 N' L8 d/ m4 Z- k3 ^& L9 F3 A
  69. dma_addr_t dmaphyssrc2 = 0;0 C, t& U# G' m
  70. dma_addr_t dmaphysdest1 = 0;+ [$ |+ }$ s7 W) `# t4 P
  71. dma_addr_t dmaphysdest2 = 0;
    4 Y) q: F- E, Q9 |7 \% S& h' |& a3 w" r

  72. ; ^1 y3 M* O/ l7 n
  73. char *dmabufsrc1 = NULL;
    % h$ @- S$ M4 ?1 S6 y" @) h1 B/ ]
  74. char *dmabufsrc2 = NULL;
    . _1 f) c! z5 U9 P9 F# M* {6 l
  75. char *dmabufdest1 = NULL;
    & x9 g- F& h/ l1 p
  76. char *dmabufdest2 = NULL;9 L' y( Y$ I: b) ^5 B& o% C0 \

  77. : E" t0 W8 ?/ r1 k) z
  78. static int acnt = 512;
    0 v8 |4 {, k* k' P3 O  ?. d- Z  l) R
  79. static int bcnt = 8;. C0 L0 ~& a3 ?0 k0 X- |
  80. static int ccnt = 8;
    - y5 T; N  o! Y- x! Q" O
  81. / @& Y$ Z" \8 G, H( L/ \
  82. module_param(acnt, int, S_IRUGO);
    3 E. O) Z* ]  n# V& H
  83. module_param(bcnt, int, S_IRUGO);
    1 _- ]0 W& s3 b+ i& T+ b' P: y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  s2 N' Z0 n: A% U5 W: M6 ~, ?
" A3 i" C/ V+ ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& b* i) I5 o- }% b, M; ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ ~/ B# k5 P, F+ r, `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& T' b1 b* J* A+ e. e) g9 {# b0 a9 u2 i. U
* d! r) o) K  Q- g, t! B: _+ u" l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 11:30 , Processed in 0.037463 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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