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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 b2 Q, K1 C- x
  1. [code]EDMA sample test application
    ! o  m# V; R4 _1 g2 D% H
  2. /*
    8 @! d! F7 H$ i8 _/ Z: d; K
  3. * edma_test.c
    / D7 M6 l7 |% x( V2 f2 A
  4. *, @9 v6 ~+ K3 ]' Y
  5. * brief  EDMA3 Test Application
    , c+ }4 x' A. i# @
  6. *
    5 Q. T6 M: y; q4 y5 H+ S
  7. *   This file contains EDMA3 Test code.( q8 v0 b: g" Q, ?" U! ?3 c
  8. *) v  W. M8 x& h" `/ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " p3 @0 F# B; e( W: Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 K: i1 \$ U, }8 t6 c9 D& ^
  11. *         TO CHANGE.4 ~4 P/ L0 |  R8 |4 j
  12. *! ]3 x9 D2 c+ V1 L' `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  W- A8 e% o- Q! T2 b
  14. *# j+ F' a2 E: Y; }; O
  15. * This program is free software; you can redistribute it and/or
    2 A9 a5 t% q$ \& b4 Q
  16. * modify it under the terms of the GNU General Public License as
    7 v! z! {6 t8 O: d3 ]
  17. * published by the Free Software Foundation version 2.) p4 U/ h) f: A, f5 M; e  E
  18. ** E2 p7 \9 J/ }7 Z* @& m& {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) l# {& t) B. w  J1 }& k' ~
  20. * kind, whether express or implied; without even the implied warranty/ |# r6 }7 Y& y9 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# Q3 T2 {8 u3 n: _. f
  22. * GNU General Public License for more details.
    / V4 S% V4 @, p# _/ s9 ?: j
  23. */
    0 W. k& S- Z: C- P8 ]
  24. 7 ?6 z9 Q# L) a2 \5 f6 M1 e
  25. #include <linux/module.h>( g. L" o& ?6 e3 ~- K! f
  26. #include <linux/init.h>
    ' v1 P# X1 e3 H4 X, j
  27. #include <linux/errno.h>
    + q- D2 o' ]2 A
  28. #include <linux/types.h>; U9 Y  ?: l  M. l9 Z5 @" I" J
  29. #include <linux/interrupt.h>
    ! P. }( u8 E" U. T- ^; Y8 @
  30. #include <asm/io.h>
    & K, {' F* q3 q, S: ]. F/ s7 I1 ~
  31. #include <linux/moduleparam.h>
    ) h/ q/ _; G1 j9 y# |
  32. #include <linux/sysctl.h>& j6 |! X) K; F$ X- N* C. b. J5 O* l
  33. #include <linux/mm.h>
    * ]* n% g- \2 n# T, V6 A3 c: }
  34. #include <linux/dma-mapping.h>
    5 V# o% N/ ^6 f1 X

  35. 2 p5 j7 K+ h: p$ o
  36. #include <mach/memory.h>
    8 P4 `; n+ Q  H# R
  37. #include <mach/hardware.h>, u! D& e' \7 {& o
  38. #include <mach/irqs.h>. u$ o2 d8 Z& ?5 C8 P$ f
  39. #include <asm/hardware/edma.h>
    . _# O0 I- P" w, {6 F
  40. . D; o8 t  S3 ?1 o3 n
  41. #undef EDMA3_DEBUG( U5 G5 h  J  R( E9 W
  42. /*#define EDMA3_DEBUG*/
    " u# }- c' c, B/ |

  43. / S8 m0 n% ^) [0 |! G+ Z* [
  44. #ifdef EDMA3_DEBUG
    5 F; E; z- N" W- m6 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 u( m5 _; W1 S/ I' Q5 c, V+ T4 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 ~9 Z( A; B7 q: N- y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- L% [+ [. A" `3 U' d3 g
  48. #else4 T* }" d: n" r7 T2 k- R  @! `, G+ i
  49. #define DMA_PRINTK( x... )
    ) d" q; f# ^0 y4 y1 }3 g
  50. #define DMA_FN_IN/ T4 i! b2 h$ A
  51. #define DMA_FN_OUT1 S) E0 t; B' ^) u
  52. #endif
    " [+ U. J+ i/ b* \, w, g+ d

  53. ! y# a! f' B9 P! k7 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 q7 Z9 y/ e2 ~7 c. p. }4 V
  55. #define STATIC_SHIFT                38 S1 l  n, o& x
  56. #define TCINTEN_SHIFT               20$ e6 x# _9 g" i; r7 P
  57. #define ITCINTEN_SHIFT              216 @- E- k6 G) Q4 M; }$ a. K
  58. #define TCCHEN_SHIFT                22
    4 ]: D& w3 e1 B6 L9 U& \4 V
  59. #define ITCCHEN_SHIFT               23( @% P. w. G$ D7 Q0 Q8 V8 v
  60. " ~3 M; |# W& d0 W' `( ?. K8 N
  61. static volatile int irqraised1 = 0;
    ; v4 v7 j* E8 i
  62. static volatile int irqraised2 = 0;
    / P. O" E4 r; }% a8 W+ ]* _* `
  63. 9 ]* L( {$ B$ t- x7 w7 }4 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 c* r; G/ T0 E+ j3 m, E) {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" }1 U& L% V5 K8 b5 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " o" g9 m, C" t& _$ K: b

  67. ( Y# o2 Z6 X: r. z
  68. dma_addr_t dmaphyssrc1 = 0;
    # w+ q( ]6 X# I# h3 q( @- A: D& _
  69. dma_addr_t dmaphyssrc2 = 0;* c: U& G, A2 B* @) {. [+ e
  70. dma_addr_t dmaphysdest1 = 0;4 k1 _7 F7 b  a9 ]: A# e1 g
  71. dma_addr_t dmaphysdest2 = 0;
    * r. m, }, Z+ P; j
  72. . R0 {! P+ w" S" \& ]; c: e
  73. char *dmabufsrc1 = NULL;
    5 G* Z" Z0 R: {) w5 C& e( Y3 h% p) _
  74. char *dmabufsrc2 = NULL;
    . y! N0 K: d$ L6 v0 `8 O
  75. char *dmabufdest1 = NULL;- I4 A2 U6 v$ }6 R/ F: \) ~4 y
  76. char *dmabufdest2 = NULL;, c& e3 C7 M8 {

  77. , D! k* N& N, ?; {% G+ Z# q% P# r, ~! R
  78. static int acnt = 512;! @# f( }; v7 O
  79. static int bcnt = 8;0 B2 _" `2 q9 j4 i
  80. static int ccnt = 8;
    : [1 n; u! O0 w3 j
  81. % k  {+ T$ I& C3 j6 t
  82. module_param(acnt, int, S_IRUGO);
    ( a! r7 ^( H4 K" z# w
  83. module_param(bcnt, int, S_IRUGO);
    6 D9 a/ F( [' J" j: s- f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' M2 d; T1 s% s" `, p' h% E
9 z' {* l3 P( L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ~4 d' S% x/ `, Z: l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ^( y+ K0 T  e0 k  P" e; Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& f4 C1 M/ K& F7 R

3 a$ G* G+ o4 ^6 r- A  H& _( I; {2 ?+ T. C3 x9 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 18:02 , Processed in 0.040104 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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