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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * n1 [7 c1 ?" W8 P0 `( P( D
  1. [code]EDMA sample test application3 D# c1 f7 T7 ]) Q  {
  2. /*
    , I# g( z8 V5 j  v5 R
  3. * edma_test.c% V# H# [3 ~3 e
  4. *
    " ^& w1 U" B& G4 L& ?
  5. * brief  EDMA3 Test Application2 P- M7 o0 E. `
  6. *
    % e9 g0 j0 |. j
  7. *   This file contains EDMA3 Test code./ }3 C0 A/ |; [4 H( s
  8. *: D* ?8 L" g- W+ W$ r! _, y; Q+ C) Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! r/ o2 E' n, `* a  y, I: l; |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 r4 f' i* M- d- t" R, P
  11. *         TO CHANGE.
    9 u# d* ~* d* ^
  12. *' i) j+ v% F" L% g4 E; b; k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// k* J% \* h3 k) X! k/ l
  14. *
    9 C" c5 `3 |3 Z7 y7 S
  15. * This program is free software; you can redistribute it and/or0 }- f. _6 z* _- y1 Z! i
  16. * modify it under the terms of the GNU General Public License as6 A! j  G/ i3 P% l+ r4 l% t
  17. * published by the Free Software Foundation version 2.5 V3 N8 ?6 l8 H" _) K
  18. *
    2 q. K1 |' Z& K' F( S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 `; m4 H- i& p6 s0 R4 I
  20. * kind, whether express or implied; without even the implied warranty9 r. a3 o6 D$ t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + i3 a( u- k& v- [  N" R
  22. * GNU General Public License for more details.
    # s- i9 F1 s6 n- W- A
  23. */# ?+ O7 J$ Y5 s! E4 Q* I* B
  24. ! Z) G( k6 [" }8 O- ]
  25. #include <linux/module.h>
    $ e, H$ ~* ~* g5 I. a
  26. #include <linux/init.h>
    6 t9 q! y# z, X7 Q$ ]1 I/ N/ j
  27. #include <linux/errno.h>
    ; H* U7 F7 }7 E0 X6 i
  28. #include <linux/types.h>
    / U( g/ r. l2 u, A1 n1 X
  29. #include <linux/interrupt.h>
    2 y% _+ F, q( K$ _7 `/ ~: h/ V& L
  30. #include <asm/io.h>
    $ F: V; |" M5 A7 `5 h' `
  31. #include <linux/moduleparam.h>( ?8 k" e. {: q
  32. #include <linux/sysctl.h>: j( D7 l% S+ v/ v! F
  33. #include <linux/mm.h>
    7 U, M5 v' O4 P$ ]1 b/ G
  34. #include <linux/dma-mapping.h>, b$ g: w  T4 r, b5 i+ S% {

  35. * D" L% B, S$ I* E1 c6 o
  36. #include <mach/memory.h>
    5 G0 a9 p5 r, _5 h  a
  37. #include <mach/hardware.h>
    2 B, |- O0 Q/ R5 G+ o1 P& X" q
  38. #include <mach/irqs.h>
    , A+ x: v& i" v. d  @
  39. #include <asm/hardware/edma.h># P  a: X! ^( Z
  40. * G, B6 y6 b1 D. J2 m* ?1 D7 d
  41. #undef EDMA3_DEBUG
    . x+ `! y# r9 Z
  42. /*#define EDMA3_DEBUG*/
    % [0 U+ T0 X! _' S( [( a9 Y

  43. 3 s- O' j1 ^! s- e4 s$ \; t5 p: _
  44. #ifdef EDMA3_DEBUG: q- L" a9 V7 A: i5 I* T" [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " O) l- T# e% ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " n8 x8 m2 u$ h/ t. m" x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 B- }) r- F8 {  j7 q
  48. #else
    2 k) d: r' A* ?; z! d5 w
  49. #define DMA_PRINTK( x... )# G" B4 k, {+ N" D  `3 H
  50. #define DMA_FN_IN
    . [0 \; g5 P8 p6 M5 L' [
  51. #define DMA_FN_OUT
    # g- \* t) P( m7 E, u
  52. #endif
    ( b3 z+ V7 r1 b! c8 e6 n
  53. , j  Z. Q6 Y% X" w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 S6 y5 |0 n! w1 S( h# r2 b
  55. #define STATIC_SHIFT                3! ]  a% B8 H. f- s( m6 {5 y) c5 u
  56. #define TCINTEN_SHIFT               20& b* B/ Z% n* v
  57. #define ITCINTEN_SHIFT              21
    ; M/ s  \* G- p3 L% k0 j3 L- N
  58. #define TCCHEN_SHIFT                22  V9 w8 o0 _* H% |8 E
  59. #define ITCCHEN_SHIFT               23: n" a, W8 \% n  w, h
  60. 9 L: u4 A! g; ~* p% y1 e1 D9 [: {
  61. static volatile int irqraised1 = 0;
    3 U* z* E( t$ O  s& ?
  62. static volatile int irqraised2 = 0;7 T' m: }# J( t6 B* [- G$ n/ d6 b
  63. 1 H" k- u. B9 y4 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 m& p& f$ |5 a' m7 j$ Y5 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 q4 u* f3 f9 F& ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q+ w/ k2 R; \: \
  67. ! e. j% W+ d4 F2 h& O* v4 q6 d
  68. dma_addr_t dmaphyssrc1 = 0;
    1 F# a) r, J: k$ X, V9 b( R
  69. dma_addr_t dmaphyssrc2 = 0;1 d2 ^, U, B; J( q* P& T8 a
  70. dma_addr_t dmaphysdest1 = 0;
    # F$ [; ?" ?/ z, @
  71. dma_addr_t dmaphysdest2 = 0;6 B6 T: |. F# b. x, ]" E/ {7 x

  72. 3 l4 ~$ M" ]. c6 S! [4 r
  73. char *dmabufsrc1 = NULL;0 M. g! o  J+ b1 ?. @" M
  74. char *dmabufsrc2 = NULL;, K5 r/ n& X* N# y$ g4 \6 N6 c7 f
  75. char *dmabufdest1 = NULL;7 k2 o" K: @2 P3 K, P" K
  76. char *dmabufdest2 = NULL;1 a5 R2 N7 c% x# `9 r0 X

  77.   B+ ^6 `" p1 h7 v. X
  78. static int acnt = 512;
    - \; U, m" n9 ~- Y' `- L" c
  79. static int bcnt = 8;2 e1 L, X! z  g+ u
  80. static int ccnt = 8;* _5 K+ h9 b& V* q  n# f

  81. ! L' L6 `8 H2 S7 x6 M9 ]9 p+ {
  82. module_param(acnt, int, S_IRUGO);
    3 `/ r6 Z  Q7 P$ _7 R5 x
  83. module_param(bcnt, int, S_IRUGO);7 J8 f" H2 B, x  C6 P% g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) [- i6 U) `! ~9 p/ Z

0 |* Q% a/ X  E1 A; R- i, L$ K% p5 Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( _6 s8 }* l% V1 H# k2 t4 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% o* p; Z0 l  z$ f0 h& e6 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 H; w4 R9 |8 n0 j1 ^0 w1 J- R  X& Q" z, l6 n- C

  ^+ Z* h; w% y2 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 01:42 , Processed in 0.036966 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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