OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 g& y7 t: x+ ^9 p: D7 d) I
  1. [code]EDMA sample test application9 R' ]8 T8 y& {8 F
  2. /*
    $ o& I7 r& b& V6 S4 G
  3. * edma_test.c
    $ Y2 p+ K% S+ d
  4. *
    * _2 a! J  o% x5 v  k
  5. * brief  EDMA3 Test Application! }" |! v8 U. i) c* L' \
  6. *
    2 {7 P3 L+ V( i/ `* i' h* F4 a
  7. *   This file contains EDMA3 Test code.
    4 q: A; P2 N/ T) ]5 u( M; O& L+ H
  8. *$ F. }* _8 @3 {1 L$ O: K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' o7 A% G$ x2 j0 a% k* T9 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % m5 d, `9 X8 g4 O
  11. *         TO CHANGE.
    " H" J: c, d7 y* G- N
  12. *4 d/ j9 \. t" c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Z, o* f6 G/ M* M! H* n/ g0 j  r
  14. *
    - j& e+ H  C: M! ]
  15. * This program is free software; you can redistribute it and/or
    4 `1 j+ i2 V( o
  16. * modify it under the terms of the GNU General Public License as' ?6 C# e/ A2 O3 x* N. i6 m
  17. * published by the Free Software Foundation version 2.
    - ^- ]% ~% w9 `  Q8 j) k7 e
  18. *9 l- F* s( ?5 I5 R8 X/ P; u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      b, h8 ]' k0 W
  20. * kind, whether express or implied; without even the implied warranty2 ?0 ]% q- ]- R& c4 _% D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 z6 T5 t) o3 H, m+ M8 I
  22. * GNU General Public License for more details.% e  T4 u4 m4 u$ w
  23. */
    " E; a2 R" W9 O2 m# S& m1 l

  24. % {5 B: j, X+ e
  25. #include <linux/module.h>, [6 _# ^, H* Y- h  _; `8 W( q- ]4 B
  26. #include <linux/init.h>
    0 i- G" M3 z# Z
  27. #include <linux/errno.h>3 h$ t4 g* U6 C! F* I  [- S2 J
  28. #include <linux/types.h>
    ( U4 z5 M+ g- M
  29. #include <linux/interrupt.h>& ~1 Z) N$ k. U+ C! o  E+ |4 W
  30. #include <asm/io.h>
    $ ^2 T9 O2 f; _+ ?
  31. #include <linux/moduleparam.h>( s  M* g% a6 Z* R) L! B) [( ~: Q
  32. #include <linux/sysctl.h>
    $ G# V9 s$ D- C8 F
  33. #include <linux/mm.h>- D  ^2 M9 t1 {0 I2 \; [+ w
  34. #include <linux/dma-mapping.h>
    ( n& C0 N  ^0 s/ _
  35. 2 f: Y3 c% ~+ W1 W  }$ _
  36. #include <mach/memory.h>
    9 R/ M# @, q6 F) P
  37. #include <mach/hardware.h>2 x/ i# e8 U! ^, W5 {9 m, o% ~3 z- U
  38. #include <mach/irqs.h>
    3 J. j0 g! \6 {' s
  39. #include <asm/hardware/edma.h>
    + {* ^3 c7 ?+ t2 l  l/ I. b

  40. 7 v! T9 F8 o. h0 O
  41. #undef EDMA3_DEBUG/ _4 |" o  q7 x" F: j0 ?
  42. /*#define EDMA3_DEBUG*/
    + [- r% ]* U0 [7 H( W) r
  43. % E2 D4 \+ |0 f5 w! J; Q
  44. #ifdef EDMA3_DEBUG1 s8 v- K+ `: T( U# W7 Q2 s; p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% L9 B$ }  q  [3 ?8 H) T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 \  m7 q" n% G" [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % K! H, M# q; u" ]
  48. #else
    ( R8 ~& L" n( A" K
  49. #define DMA_PRINTK( x... )$ f. ^* i9 B5 G! T0 Q' m
  50. #define DMA_FN_IN
    1 j% R, x+ ?9 r% p+ B  a
  51. #define DMA_FN_OUT
    5 q% \$ z! h  j) ^% S
  52. #endif
    * h( m1 x, G& V4 F' J% |# Z9 m/ F

  53. , m/ r4 u9 }1 B3 F3 B) ?, H# L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 B* H2 T* r- {& M1 f* R
  55. #define STATIC_SHIFT                3/ K* u1 _( i% n$ A6 X& `
  56. #define TCINTEN_SHIFT               20
      t. k. C$ _! o& K4 z
  57. #define ITCINTEN_SHIFT              21
    , H; O. E$ Q% A
  58. #define TCCHEN_SHIFT                22
    ) y3 d. @6 s' ?0 Z$ h! R( N
  59. #define ITCCHEN_SHIFT               23
    $ A- L/ J) l, {

  60. ' I" h+ ^2 g. N3 G3 P
  61. static volatile int irqraised1 = 0;
    # S& p7 k6 F: g$ {1 C5 x
  62. static volatile int irqraised2 = 0;
    $ j+ f( I+ c8 u4 b. r9 h; ]

  63. ) R, d) r' ]& g* C$ E) `; e- T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f3 D$ L4 w! ~' [. R) F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ \) B+ |. [  Y* n! U0 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A$ ]( K* |/ Z4 H

  67. 4 e& A4 H* U+ t
  68. dma_addr_t dmaphyssrc1 = 0;
    # H- p# V# ^) p' P9 h6 e+ P
  69. dma_addr_t dmaphyssrc2 = 0;6 c) x9 I" J! h9 U6 I. g- T
  70. dma_addr_t dmaphysdest1 = 0;
    6 u" Z* B2 M' F1 m
  71. dma_addr_t dmaphysdest2 = 0;
    - N/ C2 t$ w6 N( ]

  72. 3 C  v9 G( W" h5 }3 [, s+ j
  73. char *dmabufsrc1 = NULL;
    . h; E& F* I4 c5 `
  74. char *dmabufsrc2 = NULL;9 F- g# f7 W! v8 S8 F
  75. char *dmabufdest1 = NULL;3 {! o8 |2 x) k4 g8 E. k
  76. char *dmabufdest2 = NULL;7 g! M9 r+ C. j
  77. , F0 k0 \5 z. _  N8 u1 R
  78. static int acnt = 512;. m/ `; k/ e9 P5 c3 Q; I; k9 S
  79. static int bcnt = 8;
    ) z1 F  R0 H/ |) r! F/ F) Z
  80. static int ccnt = 8;" J  K8 c( f. F
  81. 9 s9 M, B3 J. Y) I
  82. module_param(acnt, int, S_IRUGO);/ p7 T/ f' R3 R
  83. module_param(bcnt, int, S_IRUGO);  L! {* |. z  r3 c0 m$ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 }# ?  w! }, h# l$ X' q6 |" t' o

: `5 M$ _+ r/ H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" v  I7 v* b* d) G  I& t. |3 c. l- Garm-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/ U0 i) E- t3 n4 a5 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* k& q0 u! O" X: i( D& [6 ]: c  h6 P: h, T

- L' {* _- C  e1 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 02:19 , Processed in 0.039519 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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