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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ?+ O7 u! W4 U/ {% z- p
  1. [code]EDMA sample test application0 d% S& g4 n  a% @+ P
  2. /*) l$ Q: ^+ X% H+ T4 [
  3. * edma_test.c
    6 \9 ~2 k  R2 {# M4 r
  4. *
    / P! A' M7 x! v8 p& i* ]+ B
  5. * brief  EDMA3 Test Application
    1 q9 v% R6 C% r" O+ G$ f; v( \! t% {
  6. *1 P6 u: {  ~) E* P2 h  W7 m
  7. *   This file contains EDMA3 Test code.
    + e+ L2 s& Y$ D7 _: K
  8. *
    / s; B  C7 S+ B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 ]' G- L9 C9 Q3 v  w. I( d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & t9 [1 N1 B- M4 Z' V; r  @" g
  11. *         TO CHANGE.
    & _+ c5 d( |2 h+ ], ?
  12. *
    8 B6 `$ i/ O  m3 O& @+ a  K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # u; s5 V1 C% K# n9 i% v
  14. */ z8 [6 ^* i; @3 _, G
  15. * This program is free software; you can redistribute it and/or6 q* W, s- B8 X- S
  16. * modify it under the terms of the GNU General Public License as7 ^. O+ T6 ~" H- D* g
  17. * published by the Free Software Foundation version 2.. g7 |4 r) c' Q% j
  18. *
    4 L; z/ B" j3 U. q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 X5 ~$ X, {) H; D) r
  20. * kind, whether express or implied; without even the implied warranty
    + s3 `+ E& ]! b6 h8 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 _; P1 |3 ~4 c9 t' v/ {
  22. * GNU General Public License for more details.; X2 @" `. B/ n& p' F1 J" o4 W
  23. */7 ]  s- w, Z* }9 x# ~" V1 G# ?
  24. : ?! `" f& B1 l* U7 k3 q/ p
  25. #include <linux/module.h>
    + }2 \# C: Z+ p& |1 [' ]$ G( v
  26. #include <linux/init.h>
    4 z) D8 E' ~9 a0 p
  27. #include <linux/errno.h>+ q6 p, [* N  O. `: w
  28. #include <linux/types.h>) i3 t1 n6 h# V6 p
  29. #include <linux/interrupt.h>
    / ~4 k" Z+ x; S- ~" W
  30. #include <asm/io.h>
    1 B& G- D  M9 T9 e0 Q; T& M5 y
  31. #include <linux/moduleparam.h>7 c/ D4 E7 c" t1 {
  32. #include <linux/sysctl.h>) K+ L! n: O% W' W9 }2 v
  33. #include <linux/mm.h>7 [9 e3 x- t+ u2 y! h+ Y% k
  34. #include <linux/dma-mapping.h>9 K2 |2 e. e; b0 @; L

  35. 5 P( W) ]1 Q( \; n! i5 s
  36. #include <mach/memory.h>
    2 u- y" P( p: ~+ |: g& Z; A
  37. #include <mach/hardware.h>
    1 {' [- h4 c) M) S: A2 `
  38. #include <mach/irqs.h>7 T% }# \. d: L7 q: K, j4 F+ ^
  39. #include <asm/hardware/edma.h>
    / M) [0 I) e2 {* ?7 G! D
  40. 7 B# l5 F7 v6 i5 v- c+ p
  41. #undef EDMA3_DEBUG' H! [7 i1 O" ]/ k2 d- t
  42. /*#define EDMA3_DEBUG*/
    0 I( r2 P. `) R5 J8 P; [

  43. : h9 ~' H) f3 C2 L
  44. #ifdef EDMA3_DEBUG
    6 O) B" _, t' T7 C: O$ v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ~& A5 O$ @7 Q! F* ~3 j% \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ x# k9 k; g+ U1 E3 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . b. S) H+ p5 g. e, @
  48. #else
    % R% Q2 U5 {, i8 H5 U6 F$ d% {
  49. #define DMA_PRINTK( x... )+ R/ \) q; `' d# {  L; M
  50. #define DMA_FN_IN( O9 Q! V! a* N! B9 r! u  p
  51. #define DMA_FN_OUT6 d8 q1 _+ P1 a# K5 W0 P
  52. #endif( V- W- ?; N' Q+ \# C/ A0 o8 r
  53. * @) c9 [. c7 k6 |0 e" i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' v9 ]" G0 q1 G1 z+ b
  55. #define STATIC_SHIFT                3
    ; ~  P2 L# ^7 V7 x1 J% h
  56. #define TCINTEN_SHIFT               20
    1 [; X, q3 e) p5 Z
  57. #define ITCINTEN_SHIFT              21
    5 W) A" F' [' J- I& [5 r% @2 J
  58. #define TCCHEN_SHIFT                22
    8 w; I1 P* t, h- G: E! d8 O
  59. #define ITCCHEN_SHIFT               23  Y$ Y0 e& \2 K% c
  60. / o1 ~! o- q/ ^5 q5 X, E& R' B
  61. static volatile int irqraised1 = 0;
    . Y/ R; T: Y6 d- t6 z' b
  62. static volatile int irqraised2 = 0;
    , Y8 Y; ^/ L/ N! }7 o5 t: ?) g& a
  63. 9 z0 X) Y# G5 h& o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 o3 a, K$ y/ d$ [7 q: V! ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @; g! Y! S& q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' p1 W- r4 U: s$ i0 t( e4 @: O1 Z

  67. & y$ ~6 _2 Z. L8 B3 o' o/ P5 l# f
  68. dma_addr_t dmaphyssrc1 = 0;
    " t, W1 ?' B, n0 b0 g
  69. dma_addr_t dmaphyssrc2 = 0;+ {$ Y, R2 G& W) C8 J; n
  70. dma_addr_t dmaphysdest1 = 0;" w2 F8 H; }* ?" M/ s
  71. dma_addr_t dmaphysdest2 = 0;+ x% S( Q& r$ u* I1 u0 _" b) p

  72. ) g6 d  c( S$ W- a# Y$ N
  73. char *dmabufsrc1 = NULL;1 y: C- }$ y4 Y- V( U5 o" _
  74. char *dmabufsrc2 = NULL;4 g2 W  h2 O' `" Y% |6 ~
  75. char *dmabufdest1 = NULL;
    7 U% S' w+ i. U/ S9 U+ U+ J
  76. char *dmabufdest2 = NULL;% i9 m( @2 [6 X/ s

  77. 4 ~2 Y5 I( d& H
  78. static int acnt = 512;
    / n- p3 w' t( _1 |
  79. static int bcnt = 8;
    ) r3 e+ D  p9 Y' H
  80. static int ccnt = 8;
    3 a+ D  N4 q# |
  81. & ~0 C, u# v9 M$ r0 d0 x, O0 R
  82. module_param(acnt, int, S_IRUGO);4 P( w7 }" j: G3 `& C" S( A
  83. module_param(bcnt, int, S_IRUGO);
    ; `+ E% g) G% o! P" K) J) b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 M8 V, ~4 t1 u/ H
$ X# A6 e: m/ z- A, b  {! I% `& A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ M6 J! i8 M4 F6 q' i6 r- E" {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- X5 i6 Y8 Y% I' ^# l* K( M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; A$ g1 J. b+ t- E  q6 u% L8 E
- T' ~" r/ F$ h! x+ j% `1 k2 ]2 q
0 }. [# c1 a$ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 08:57 , Processed in 0.037621 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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