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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" e! w$ Y2 f! \1 n
  1. [code]EDMA sample test application
    9 Q' f- D! b. d
  2. /*
    % }, N( }2 u* ?5 j- l% `9 l
  3. * edma_test.c+ m+ S  _: w! {  V  A3 a8 r" L
  4. *
    / V5 E" H7 Q3 t2 o
  5. * brief  EDMA3 Test Application
    " C8 a/ r$ K3 n% w
  6. *
    : N& ^3 ]8 {, q$ B: K+ n) I6 J, ~
  7. *   This file contains EDMA3 Test code.
    5 L( Q6 t5 {& R2 j# t7 T6 Z
  8. *
    ! w3 \" T0 E' z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! G8 z" F+ S# O4 `$ }5 q: R0 F! |! I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; R7 X: K$ I1 z  y* E, x) p  P
  11. *         TO CHANGE.* R. N5 Z) r0 O+ d* W% j
  12. *
    9 [; k3 z8 u9 a/ Y8 g' M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 m) c6 a* Y' I% u- _! [
  14. *- E: A4 A5 E+ W
  15. * This program is free software; you can redistribute it and/or
    2 u( I$ r# w4 |- S3 r* j/ h
  16. * modify it under the terms of the GNU General Public License as: u: g! c1 g8 a& q: N: @9 M- \0 s
  17. * published by the Free Software Foundation version 2.
    / z3 ^- Q  Z) J7 `; @7 l
  18. *
    0 {1 r! ]! Y6 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & k" s- u1 b/ @) p: Y
  20. * kind, whether express or implied; without even the implied warranty* j% u2 g1 `1 S) @6 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 V& S9 `: {  B- q
  22. * GNU General Public License for more details.2 u+ ?- J# R7 X# X! V3 a
  23. */
    ) s. A& K- \3 I- \$ @/ B
  24. 0 y* h4 u' n$ }8 k( t* Q" B0 H
  25. #include <linux/module.h>
    : j! L  U" i7 ]1 F
  26. #include <linux/init.h>
    $ H) y* v; ~6 E0 Y
  27. #include <linux/errno.h>
    0 O( U+ M4 w  l
  28. #include <linux/types.h>
    8 M1 W  @# V/ x/ W5 N& g' ^
  29. #include <linux/interrupt.h>% L$ H; h& l" x7 T) h# w
  30. #include <asm/io.h>
    4 d$ f5 f' ]! `6 g9 f4 z
  31. #include <linux/moduleparam.h>4 J( W" g% V) L  B3 x1 S
  32. #include <linux/sysctl.h>
    1 ?: _( Z* Q* v6 g7 j4 j
  33. #include <linux/mm.h>- }/ _% W  a" Q: u) s; t
  34. #include <linux/dma-mapping.h>
    0 p1 D9 D0 @) ?5 j1 K( e

  35. 2 h' G5 y7 l) ]5 I  d& x
  36. #include <mach/memory.h>
    7 D* u6 @% w9 X
  37. #include <mach/hardware.h>
    $ }0 \2 Z" E+ W) t' n5 I& w
  38. #include <mach/irqs.h>. K( v9 j* S8 [, ]
  39. #include <asm/hardware/edma.h>& }7 {" N# O% w7 l' L
  40. ! v" F! `; L4 f0 y' ~  k
  41. #undef EDMA3_DEBUG& x0 L4 O$ r( b. F
  42. /*#define EDMA3_DEBUG*/3 p9 i4 u4 Z5 [+ l: r! v2 j
  43. * s0 \) @; z8 E# W" m% u- I4 d
  44. #ifdef EDMA3_DEBUG* ~% M# \! S* w& b! Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ]4 F# l) h+ P) ^: Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 A, b! a0 x9 e; j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) t8 A# p. m  z- I
  48. #else3 Q' O6 Q0 |& B( h2 J& b
  49. #define DMA_PRINTK( x... ), t9 g9 ^4 d8 n* \  ~
  50. #define DMA_FN_IN
    & p* j5 Y7 v7 V, t# X0 o6 K
  51. #define DMA_FN_OUT- A. m; m& }' B) F  F" v2 i4 E
  52. #endif
    7 t( }8 O% n" Y; F4 w

  53. " K* c, b& _& _9 F# p, M$ k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / n4 z: Q6 R" D0 v/ E
  55. #define STATIC_SHIFT                3
    4 G7 I% ~* o  o) x. ^
  56. #define TCINTEN_SHIFT               20
    * r- x8 G8 E% V& |3 T: _' g
  57. #define ITCINTEN_SHIFT              21
    ; P/ z. ?$ [) d$ k: ]# l
  58. #define TCCHEN_SHIFT                22
    2 t# A4 G$ F$ T3 \$ `
  59. #define ITCCHEN_SHIFT               23
    8 B) f. {) }9 z6 Q4 _
  60. 1 J( z6 u5 ~6 @2 l: v
  61. static volatile int irqraised1 = 0;7 y  S8 h/ i/ A# a; }' v
  62. static volatile int irqraised2 = 0;
    & u4 f5 `& {# ~1 g9 i$ U5 j

  63. 4 E8 g. Q# M* K% f. P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - E. u7 D$ F& M+ V& D3 y- R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f! \7 o' Z" f- o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  f, Z$ ~; j( e- U' K* ~8 g" T
  67.   C$ z3 Z( E8 \! o
  68. dma_addr_t dmaphyssrc1 = 0;* p" v. ^& e1 v; u7 v
  69. dma_addr_t dmaphyssrc2 = 0;. K7 K0 F' f0 I/ P
  70. dma_addr_t dmaphysdest1 = 0;
    # T) [# L7 O+ ^+ j$ ~; B
  71. dma_addr_t dmaphysdest2 = 0;( y; F" d0 @$ w4 Q2 A6 f
  72. 0 U8 P+ l6 p$ Q% p& J7 Z
  73. char *dmabufsrc1 = NULL;
    - I& D. C9 x% |1 b% D: s
  74. char *dmabufsrc2 = NULL;1 [" t4 D$ A6 s/ E- e' a9 ]. O
  75. char *dmabufdest1 = NULL;; K2 c! J1 Y9 ~+ z
  76. char *dmabufdest2 = NULL;
    ) V7 C; K9 y3 F. P

  77. , U7 j& x2 E: d8 I) P
  78. static int acnt = 512;
    3 D/ Z% P! I9 _8 h1 u
  79. static int bcnt = 8;
    . b% Y9 v" @' x
  80. static int ccnt = 8;  S' ^" L, S: o7 f* W1 i, R
  81. 4 G2 |& J2 l6 v- a- F' l7 K! F
  82. module_param(acnt, int, S_IRUGO);, w5 V8 C) r! v' `+ d$ `
  83. module_param(bcnt, int, S_IRUGO);
    $ H+ J; j0 _# L4 ~8 C1 k" r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ ^" S  ?! t5 `
7 p% \4 I1 `$ _6 t7 J' W0 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& c+ s, V; l# Z) @1 P+ A, c0 w6 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- z# s6 ~' T5 ~  B. V$ D: A( ]8 Q% W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 e9 n/ h0 h8 @8 B1 F6 @, y
& w' l( w- \6 N' f2 R) w' I/ s4 E; [3 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 11:33 , Processed in 0.038112 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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