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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& P- S6 y/ V# R+ ~: r2 w
  1. [code]EDMA sample test application+ j; `( k$ |# r4 C- a4 S$ B
  2. /*
    - ^" X1 _9 `$ T# i
  3. * edma_test.c% H, t; g2 Z, _7 o
  4. *
    # I0 Y4 p8 ~, _& n8 Z) L
  5. * brief  EDMA3 Test Application
    0 t  q" Y! y3 I
  6. *6 e: ^' h& q. @# J: p, U
  7. *   This file contains EDMA3 Test code.  ^4 R- H" }4 ]# t+ n% [2 B! n- x+ B; H
  8. *1 p7 o$ H( z/ e8 W& }7 q: v: M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 O! e# y4 M* c+ P1 d/ w" G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 E2 c4 v, x) E0 ?. {4 k
  11. *         TO CHANGE.
    % }+ I) \; a) d& n- k# L
  12. ** S' T1 O7 D/ B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " K( h! |2 I- n% D% h* Q3 }
  14. *
    ; k/ R- o2 \2 T
  15. * This program is free software; you can redistribute it and/or0 r* Y/ K9 w, T: Y8 c/ w7 N( h9 ^- P
  16. * modify it under the terms of the GNU General Public License as* i. u# {! L+ u9 C4 x
  17. * published by the Free Software Foundation version 2.2 n' J5 w8 U4 Z' ?% a
  18. *. @: U4 }) w; R/ a7 b- F' V! w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- Z8 l4 `7 p3 g) G( V  |. A" o
  20. * kind, whether express or implied; without even the implied warranty
    # U8 ?. o& l5 f3 T6 b$ w$ K: t! s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . k5 ]8 j: d" y
  22. * GNU General Public License for more details.2 Z: c% R+ N9 V0 t) b" B
  23. */# d8 Y' l& |! {
  24.   }  z+ M/ z8 R; E
  25. #include <linux/module.h>9 _. H, W" U& L- D
  26. #include <linux/init.h>
    ; C" O+ w  p- Q+ R
  27. #include <linux/errno.h>
    . ?* ?' N7 `  _8 C7 n
  28. #include <linux/types.h>9 ^) d! l& V0 y6 V; Z
  29. #include <linux/interrupt.h>& ~% H5 S3 H& a
  30. #include <asm/io.h>
    % a! e4 U  {7 r% p' h
  31. #include <linux/moduleparam.h>- f8 Q4 h' T5 m7 x& p5 x2 s6 v$ ~
  32. #include <linux/sysctl.h>
    - I3 }2 y6 `* A, y! {, n
  33. #include <linux/mm.h>
      u; X9 s( e  `* y" K: Y. P* n
  34. #include <linux/dma-mapping.h>
    ( o" W; L' I9 x; A, j* N( i+ L
  35. & b0 v- F* r! l9 n8 ~+ A% u# `
  36. #include <mach/memory.h>5 M6 K6 K+ {" }, l4 a
  37. #include <mach/hardware.h>
    7 U2 x; m8 [% V7 t* h( b
  38. #include <mach/irqs.h>" }1 |+ [# K% W. Y1 F8 a# x
  39. #include <asm/hardware/edma.h>5 T2 z8 ?# A% t

  40. 7 W6 Q3 d0 e( H4 E# t: s
  41. #undef EDMA3_DEBUG
    8 i- Z6 O. f7 P8 B
  42. /*#define EDMA3_DEBUG*/6 x1 T9 ~* u. c: @
  43. / N2 }" \7 `3 k1 r# M# X. ~
  44. #ifdef EDMA3_DEBUG
    : H% U4 p$ {8 M* N( t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); j% v0 G$ X# a; [0 h- Y7 F2 R- w8 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). P" J( }- u3 K- \- ~" ^( J6 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , l" p# A: i' ?7 k7 j& g
  48. #else& Q4 S+ W/ Z6 ~% E
  49. #define DMA_PRINTK( x... )
    0 T4 v" x% Y! l. P7 g# F: |' \
  50. #define DMA_FN_IN
    3 J* e3 `4 ]) x# `3 o6 Q/ ?. e. H
  51. #define DMA_FN_OUT
    * L! h2 s4 n6 S7 X9 I% L
  52. #endif0 A7 h4 |$ @& A
  53. 0 q! o! O: }% p( ?! {3 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 o$ t7 w1 l  _) _% h% `" I
  55. #define STATIC_SHIFT                3
    7 `+ [& U& G/ [& z7 ~& B2 ]! N
  56. #define TCINTEN_SHIFT               20  k( ?$ d6 C; U+ c# R2 K& w! S
  57. #define ITCINTEN_SHIFT              21
    7 a. {8 Q/ ]9 C
  58. #define TCCHEN_SHIFT                228 O6 s0 E  C" z$ |( o7 g
  59. #define ITCCHEN_SHIFT               23' A0 j/ @! Z! F% X9 C

  60. , y/ E$ }/ T6 x
  61. static volatile int irqraised1 = 0;
    ) e" c$ c# C+ c/ P
  62. static volatile int irqraised2 = 0;# ^9 j) k8 g: {% l3 v4 o
  63. 1 S+ t: `6 H7 j' v2 b6 s, y, ]% A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Y  k4 [0 o" W7 S/ d9 P$ T9 F5 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . r# @- G8 e* t- l4 H# C, p6 \2 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v' b: ]% y3 a! R( |6 f% D. F

  67. ! j( o; @$ U2 L& b* i5 c; L6 f
  68. dma_addr_t dmaphyssrc1 = 0;1 z8 K- P. T6 ~# l6 S" \  h; j( f
  69. dma_addr_t dmaphyssrc2 = 0;& O6 A/ g! L. E$ o, x
  70. dma_addr_t dmaphysdest1 = 0;
    - k/ ^  p9 S& I# Q. R# A
  71. dma_addr_t dmaphysdest2 = 0;
    ( k1 k9 p1 I  z
  72. 5 n. h) o' H' y. I0 @6 ~; E! X( n
  73. char *dmabufsrc1 = NULL;
    + @) _8 c! }9 B- W! f, F. G* ^
  74. char *dmabufsrc2 = NULL;5 k6 p8 J+ e+ ]( a9 w/ l, s  ^
  75. char *dmabufdest1 = NULL;  A# H+ U0 u2 S3 G3 G' K' R/ O
  76. char *dmabufdest2 = NULL;9 t& ^2 c( Q2 Z2 v. B3 z! [

  77. : }- `0 m  N. z& ^& ~8 M
  78. static int acnt = 512;
      K( `" u7 Y+ F. H) O7 _$ ^$ l$ [: E
  79. static int bcnt = 8;
    ! x' n9 ^  B! A
  80. static int ccnt = 8;% ~$ ?& c$ T) T" L0 L# }4 z; Q
  81. - Z- ~: u- D( r8 A
  82. module_param(acnt, int, S_IRUGO);
    0 k$ u% \& V2 i1 A4 Y: G
  83. module_param(bcnt, int, S_IRUGO);- r! }6 R1 C3 B/ n# H9 \& s: a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: e6 B2 y; b7 E  ~) w) u
) C" m$ s/ x: r- @9 z( P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: B+ Z" }& O0 `. O7 ^0 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 m% T! k1 T- f/ s" _: {- Z9 ~$ }' `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  o4 _6 `( U( S9 s( M3 |$ j
/ I8 w: I2 g6 w+ c, B) _
) f; a5 _. p, D3 R$ _  W4 ~% L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 00:48 , Processed in 0.047926 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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