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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 F- X% f* O) w8 X7 y/ M0 _- _
  1. [code]EDMA sample test application- T- m- W! e% f+ T
  2. /*
    ( L* G" w- t2 J
  3. * edma_test.c+ L1 r* _! x$ @# D9 C9 j
  4. *
    : z" I' O: F- @# W2 e/ L& S
  5. * brief  EDMA3 Test Application
    / e# i) S( N, N" S# Z
  6. *
    ( |  }. _' Y9 ?3 I+ o* j- c
  7. *   This file contains EDMA3 Test code.
    9 C( |5 G$ N  g' k
  8. *
      h+ V' G/ T4 E: p; ?3 Z! l! M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 H+ p+ u2 f4 E$ u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + C- A! i1 s6 {, [: e* H" s( n- T( \
  11. *         TO CHANGE.6 q! q+ u% c# Z0 u
  12. *
    " Q: P, e2 ~3 a. `! \4 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( i. g% {2 A+ F8 a' g' I7 Z
  14. *" ~7 V& U* b* m1 T. P2 N
  15. * This program is free software; you can redistribute it and/or7 \! a: l+ X0 j# X: f
  16. * modify it under the terms of the GNU General Public License as: h) F( R$ w' T/ l- _
  17. * published by the Free Software Foundation version 2.& T5 _/ w0 G$ `
  18. *( [# D: E3 E' U8 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 h$ k5 h# G8 D0 n9 f
  20. * kind, whether express or implied; without even the implied warranty' Q: g- [1 }0 K1 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 F) X& L" ^& d
  22. * GNU General Public License for more details.& T; s  v4 m" @1 ~1 U7 K# u
  23. */. J# u5 {% r; z+ E! Q
  24. - Y. k. Q3 c9 v2 p: [  p
  25. #include <linux/module.h>
      `% v( \4 N7 w2 c( N
  26. #include <linux/init.h>) K% T3 Z9 ^+ w* V
  27. #include <linux/errno.h>
    8 j0 h/ j; i, k$ l1 V
  28. #include <linux/types.h>
    ' S- u# S. }/ X2 N) c
  29. #include <linux/interrupt.h>
    ' s, Z. \2 D# _& `- @$ |
  30. #include <asm/io.h>' H. g0 W# ?8 F* e2 k  A8 e4 F
  31. #include <linux/moduleparam.h>' g! N' L+ G4 |6 f1 I% Z
  32. #include <linux/sysctl.h>- u% e+ V# L3 k8 N3 ?+ f4 ~
  33. #include <linux/mm.h>
    + g2 ^8 R9 D) o2 J8 F
  34. #include <linux/dma-mapping.h>% i6 P* S# l- w1 [/ P! s3 ]# G
  35. / M% l5 H7 k5 u+ o" G' D8 `
  36. #include <mach/memory.h>
    ! e% i7 ^1 f. @1 W1 Q
  37. #include <mach/hardware.h>. Z, I8 Y( {7 }) n! p; y
  38. #include <mach/irqs.h>% L9 w9 X+ ]. @! `+ z7 s% _
  39. #include <asm/hardware/edma.h>
    6 U- R. _2 B# K2 c: e1 q$ N
  40. . F4 {) n% g; _2 F, d
  41. #undef EDMA3_DEBUG
    : e) r" k( S$ X& ?' E* P, d
  42. /*#define EDMA3_DEBUG*// Z2 o8 b( {, Y, T) Y

  43.   I: x* I3 i3 t, `, T- [6 q
  44. #ifdef EDMA3_DEBUG" X0 k2 Q  _2 W8 E& a1 L: S- Y& d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( w+ b+ D: e- Z! g6 {& ^+ V6 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . }# F' x/ M  N8 Y9 Y" M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 U! J* }8 a: N( L) E
  48. #else
    3 h' a; O+ h+ H
  49. #define DMA_PRINTK( x... )
    , M0 `9 B2 r5 p4 F
  50. #define DMA_FN_IN) w5 u: f- m6 l
  51. #define DMA_FN_OUT( Y1 @3 G+ j; j6 s2 U
  52. #endif
    . p: _: I' D+ B9 m' j2 W7 f7 ?
  53. 0 m, q. X& _( Z- \! z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! x3 K7 M! o( h7 u
  55. #define STATIC_SHIFT                3
    $ x$ g# m- H/ R4 {8 \
  56. #define TCINTEN_SHIFT               20/ C9 `$ b& X7 ]
  57. #define ITCINTEN_SHIFT              21' Y4 a; X( F8 W5 A0 ]* n( p1 M
  58. #define TCCHEN_SHIFT                22+ d- m' ^3 m9 Y: L( x
  59. #define ITCCHEN_SHIFT               23
    2 r% Q* v5 b  Q

  60. 4 s9 G6 _9 J" I. J) z6 }
  61. static volatile int irqraised1 = 0;
    6 u6 E) m* h' N4 S( w* P1 t; p7 O/ p$ `
  62. static volatile int irqraised2 = 0;
      Q* z3 M, p" d
  63. & d; s( g! P1 J! W$ v+ Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, `5 [6 N0 _( ]1 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' P" C2 D* \5 I) J4 u( j! n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! d4 W7 r  N+ ]1 ^# [
  67. . I3 Q2 Q; s& M% b
  68. dma_addr_t dmaphyssrc1 = 0;; y5 \7 w% _4 |% S* v, S% M% v4 j
  69. dma_addr_t dmaphyssrc2 = 0;
    . r- i6 r6 d8 q. E* q
  70. dma_addr_t dmaphysdest1 = 0;
    8 f( |9 B+ q2 ]& A. c& c; l
  71. dma_addr_t dmaphysdest2 = 0;
    2 R* D, i+ ~5 G$ r% h% R
  72. 4 y! M; k& l# G3 P/ F9 s6 ^1 C
  73. char *dmabufsrc1 = NULL;9 s% U, N& m3 \" f- ^. ]
  74. char *dmabufsrc2 = NULL;
      Z9 ]" G, Y$ }
  75. char *dmabufdest1 = NULL;
    & w9 z, \- o* o, S
  76. char *dmabufdest2 = NULL;
    * _* h: u/ a9 L3 X

  77. / P% F: V4 ^* V' V
  78. static int acnt = 512;! v! _; T8 c- S* g: s
  79. static int bcnt = 8;7 M) @9 r. S( [$ Y/ C
  80. static int ccnt = 8;, f" }, _/ m9 u( _, L

  81. : V2 @. m! E* s+ Y7 Q9 s" z
  82. module_param(acnt, int, S_IRUGO);$ b4 ~* K. q$ b* F5 O) ]+ Q; X" g
  83. module_param(bcnt, int, S_IRUGO);
    $ {' M: S7 O  _" b$ r) d) |7 x1 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  W( ]$ v6 E* ~) M+ y9 a4 P' v1 R; D( J. k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- @1 W/ y( }$ h  q+ v/ t! F6 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, }: R: j& t$ `' Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 K. W1 e! ?2 Y& y( Y5 F
, X, z( c* b) f9 w# V/ m
. ^. L& k& D  Q4 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 12:05 , Processed in 0.040214 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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