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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 H9 s8 W/ l; }. t% Y
  1. [code]EDMA sample test application: ?3 k* s2 s; {5 G; n
  2. /*
    1 K  R" n! O/ p: K( X
  3. * edma_test.c+ H. ?' h! J1 N, ?' Z
  4. *: ]) s5 n& Y3 V
  5. * brief  EDMA3 Test Application* W" j. S$ ^6 S8 J
  6. *- {" F" r6 w5 K- b, m4 M6 q
  7. *   This file contains EDMA3 Test code.
    & ?; G& [! ~7 Y4 O" O$ `
  8. *# z0 s; J3 r1 w% @7 g: f' J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, @$ B; I% f1 x; ?& q% j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / F' ^. C" C2 z( l  R
  11. *         TO CHANGE.0 x2 z' T) r5 R, A
  12. *
    * f* t9 k% M+ f& r6 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 J) S- j; x5 Y' A
  14. *
    ) b$ |! K7 Z  j0 Q6 |! g
  15. * This program is free software; you can redistribute it and/or- r2 ^% \+ L, p+ c1 E
  16. * modify it under the terms of the GNU General Public License as! n& X' u6 m, m' R0 w- V
  17. * published by the Free Software Foundation version 2.0 G5 y9 H$ {/ M7 h& W9 N
  18. *  B% _% `: e/ i1 X4 N  I, x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , a; j+ n5 M% S
  20. * kind, whether express or implied; without even the implied warranty
    , K6 o( q% G) r! N9 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 t- v3 x8 M0 y! a  U/ V: I: q
  22. * GNU General Public License for more details.2 T4 Q2 v+ F# x/ N$ R0 G& W
  23. */
    + ?/ }8 m) }6 A  }) o& a" A
  24. # F: I. r" p* b) E3 p' o$ F2 |  E) n
  25. #include <linux/module.h>& S% _: ~2 h1 k
  26. #include <linux/init.h>, b+ z) t1 E% J# A1 N9 [0 y( J+ Z. z- V
  27. #include <linux/errno.h>
    ; O! P- w8 N5 v: i
  28. #include <linux/types.h>
    * N* `9 B5 V# P2 l! A
  29. #include <linux/interrupt.h>
    7 Z1 F) c% l2 w% a, E1 j. P
  30. #include <asm/io.h>9 w& E- s6 C1 L$ C$ i1 c
  31. #include <linux/moduleparam.h>
    , A' m+ q" _0 K7 g7 f# a
  32. #include <linux/sysctl.h>1 r8 Y2 T9 J  C  e
  33. #include <linux/mm.h>
    ; p& w5 `# Q: R4 k1 t
  34. #include <linux/dma-mapping.h>4 J4 @) v& C5 d1 V  j
  35. 1 J3 \* ^+ _* e! l6 h
  36. #include <mach/memory.h>
    ) f. t% d9 [2 Y. L4 m: c9 F3 P
  37. #include <mach/hardware.h>
    % x8 G! W- j% V
  38. #include <mach/irqs.h>8 s: e$ T8 p- [' `
  39. #include <asm/hardware/edma.h>8 H/ H; W+ \- }" K) ~# `" }
  40. - o9 w( t. ?( G& R) x: ?+ t) h
  41. #undef EDMA3_DEBUG
    ) j# o8 K3 m! @' ]7 ~' ~
  42. /*#define EDMA3_DEBUG*/6 p* j! T" U; k, H/ r

  43. # H6 F6 ^* x- l# I& ?7 O
  44. #ifdef EDMA3_DEBUG* N6 }, I! Q4 H6 r7 w* F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 F: p  d9 @$ n0 E3 p# ?% K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 z! H# j' V. M% y$ H  h- }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " K1 J' e2 Q) a, B( v! G8 H
  48. #else: ]0 d( C/ d) ~/ h" e
  49. #define DMA_PRINTK( x... )
      c1 a" r- L  B+ ^6 f
  50. #define DMA_FN_IN2 X" c' _6 F* v( n4 x% k
  51. #define DMA_FN_OUT& p* Y% [4 J* t& d. J' S; ~
  52. #endif/ P& s5 X+ ?, F" r( Q! q/ H
  53. , O8 |& n1 S/ h4 d# u8 }$ c( s# `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), ]  F! u- O" Z; j& e$ d
  55. #define STATIC_SHIFT                3
    ; t6 @& f: y0 T) C/ y) Q
  56. #define TCINTEN_SHIFT               20, O/ Z0 G  A9 w! {* F' q* f
  57. #define ITCINTEN_SHIFT              21! E1 j% e1 N5 ?7 Y+ j9 y" y: Y9 c
  58. #define TCCHEN_SHIFT                22
    0 r* l: ]0 g2 N+ g# {
  59. #define ITCCHEN_SHIFT               23
    2 l$ |/ o5 g' \; [& p$ i/ l

  60. 2 N, }, L1 F: @' c3 V/ o
  61. static volatile int irqraised1 = 0;
    / c6 P& F/ Y- ~; r
  62. static volatile int irqraised2 = 0;
    * o$ Y8 Q0 S: B9 H
  63. & O- d: L, ?, p8 I4 O9 Z3 ?/ @7 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " Z. a3 H$ q5 z0 L2 q' K7 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 G3 \. l7 K' q# K  Q( E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) `" V' p; Q) ^5 G, \3 T

  67. 4 J7 D$ O4 z8 S, Q: _  E0 P' u
  68. dma_addr_t dmaphyssrc1 = 0;
    4 M5 j" E2 V: B0 p* F$ ?9 A& K: s$ t- b
  69. dma_addr_t dmaphyssrc2 = 0;
    " W2 o  h  Q5 ^; Z. e3 P1 h# n
  70. dma_addr_t dmaphysdest1 = 0;
    & Q( e! `7 H( ~0 t5 G
  71. dma_addr_t dmaphysdest2 = 0;
    5 A% b% A( ^8 [
  72. % w& r  Y, d( P, v
  73. char *dmabufsrc1 = NULL;
    8 w6 v6 K) L/ U; s0 `6 ~- n
  74. char *dmabufsrc2 = NULL;3 O- q: e# M# R$ H
  75. char *dmabufdest1 = NULL;
    : G, k; c, ]; j' F
  76. char *dmabufdest2 = NULL;6 i4 e: Z  a6 e, d
  77. - J  l* q: T1 d0 R6 o
  78. static int acnt = 512;
    - {  r1 E& w8 P7 k/ y
  79. static int bcnt = 8;
    ) b3 @4 r( y* N1 M
  80. static int ccnt = 8;
    9 m5 D& g3 N, `  y+ H

  81. " d- t+ S0 h# R/ C+ f, P
  82. module_param(acnt, int, S_IRUGO);
    3 s; c; ?3 \( S/ G: o. O& y9 z' k! j
  83. module_param(bcnt, int, S_IRUGO);
    + V) n# \" F9 M% [  ~1 p$ R" o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 f+ U: p0 A  _/ G  T1 o2 f8 N* E' I3 [" |/ l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- g+ d" p1 W: G; @% A" R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! g4 s8 l# Q0 S6 R$ W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, s$ ?  J# q% q. V" s! [: O3 \% y# q0 u. W; r: S- D  n5 P4 s

: f% i3 t% r* P! _* M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 06:47 , Processed in 0.038757 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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