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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! c* o! s- L) _' Y
  1. [code]EDMA sample test application; Q1 s3 c5 n) k8 E: M1 q: m5 R
  2. /*! z5 ]9 o6 L6 r8 w
  3. * edma_test.c: x; k" h  ~2 i, G2 L
  4. *) `8 ]5 E* @/ M) H
  5. * brief  EDMA3 Test Application
    $ m+ a. r% Z: k1 t. g) ^1 v
  6. *) Y2 s& O$ `3 j$ g1 c8 s9 _; ?
  7. *   This file contains EDMA3 Test code.4 R( R7 Q2 F  g0 {, p
  8. *+ N) z9 `  C4 Y9 a+ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- c1 Y5 {0 o$ W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 q  V" O7 O8 S/ m% Q/ U
  11. *         TO CHANGE.' C% d# L  D2 A% g+ t
  12. *+ }$ d+ J' Z% d; U2 N7 ^& P) |; `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 e. m. J2 n( h( k
  14. *
    * w% W! m7 B2 q  t5 ~9 N9 n9 W2 v' F+ h
  15. * This program is free software; you can redistribute it and/or
    % ?" x( Y9 e$ r+ ]- W0 @) P; w
  16. * modify it under the terms of the GNU General Public License as
    # E& n5 d- l6 R/ O% B
  17. * published by the Free Software Foundation version 2.6 f1 i2 j/ u! }' V5 U4 F3 _5 d% P
  18. *
    ' E# |6 F5 h1 z# E& F& ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; P$ g2 k% A6 @% D6 Q! ~; s
  20. * kind, whether express or implied; without even the implied warranty
    % Q6 `, E. t$ G! M/ K% _4 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - R7 J- K& D0 {$ }$ S
  22. * GNU General Public License for more details.5 |0 p; G4 H% P8 }0 D; |
  23. */
    $ S4 G: W0 A, w/ D  b% @

  24. 7 o4 p' m" }6 q1 M& T
  25. #include <linux/module.h>0 e' Q, ^6 l% _
  26. #include <linux/init.h>
    0 p6 y! X4 k! F
  27. #include <linux/errno.h>
    $ `% o& ~) K; ?" g3 T
  28. #include <linux/types.h>
    * Z& Y1 m5 z, n0 Z0 k7 q$ g0 w1 ]
  29. #include <linux/interrupt.h>, }( G; {; u- e( M/ s3 o
  30. #include <asm/io.h>  h  d6 `7 D$ n* b- `4 H  s
  31. #include <linux/moduleparam.h>% y/ J9 N- r) |7 B
  32. #include <linux/sysctl.h>
    8 v3 v- |5 a! ?( z- R1 |  F
  33. #include <linux/mm.h>4 p$ Y3 K0 A$ \4 S
  34. #include <linux/dma-mapping.h>5 M" V+ W) D( U2 I

  35. 1 w0 N. s  O9 L8 i9 w
  36. #include <mach/memory.h>
    ! D* f9 S' ^  b' l
  37. #include <mach/hardware.h>
    # z9 m( i# h3 a. V" j2 z) j/ D
  38. #include <mach/irqs.h>
    7 r/ Z: w: {$ B2 E# L2 D( G
  39. #include <asm/hardware/edma.h>0 d* R. @; |6 O9 k9 F
  40. ; h$ R* b8 k* R3 p5 Y0 u
  41. #undef EDMA3_DEBUG/ r3 M, l: B- D# Q$ R; ^1 o
  42. /*#define EDMA3_DEBUG*/8 Y  f% Y" Q4 X/ {3 `3 D7 A
  43. * A4 y' S% Q2 K
  44. #ifdef EDMA3_DEBUG
    2 G& I9 R) f  p" Y( \8 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . p1 ^& Z9 I% M1 E  |) ~  _2 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  C( H% J' q( w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , l2 |2 Z0 w/ p5 |
  48. #else
    ) @: l+ W; H) {1 ^; z: [: E, I
  49. #define DMA_PRINTK( x... )
    5 A* H3 A* Y8 n! x! b8 O  @
  50. #define DMA_FN_IN/ z$ b4 c: P" }( i
  51. #define DMA_FN_OUT
    / }- N. t1 K' d1 F% {
  52. #endif7 h  c! r1 Z1 h( K
  53. 9 Q, i' D; \& M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). @  ^  h$ Y" E% [- d- x( c4 a
  55. #define STATIC_SHIFT                3
      c; z& f9 Y% L! h: M- U
  56. #define TCINTEN_SHIFT               20  r* m5 N5 I. \( b( c, F' x
  57. #define ITCINTEN_SHIFT              21+ o  S/ h- P, @# F* O$ P# O3 r
  58. #define TCCHEN_SHIFT                220 _+ l6 \1 n( I$ `+ V, t$ J* F
  59. #define ITCCHEN_SHIFT               23) m/ D0 g, R' q' Y/ W

  60. . j; h4 T/ x* d# E7 p
  61. static volatile int irqraised1 = 0;
    - E& y- H  z) ~
  62. static volatile int irqraised2 = 0;
    3 p4 V5 T( ^6 b: r' g( _% o0 N

  63. ) b- [4 b8 `, @8 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L: Z' g% J0 {/ N5 g$ C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 d9 K4 x. H1 P$ D2 _9 K& W. C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V) S, Z' G. ~% D: B$ w

  67. 4 f+ n& N/ ~0 c( J0 x4 O1 F
  68. dma_addr_t dmaphyssrc1 = 0;
    + r* W. C$ a7 R- n
  69. dma_addr_t dmaphyssrc2 = 0;
    3 `7 x2 `' C; W" ^: V! Q, @
  70. dma_addr_t dmaphysdest1 = 0;
    ' B+ H# D8 u* [, A% `/ k
  71. dma_addr_t dmaphysdest2 = 0;
    $ M% R" Y7 V. _% f5 l; A
  72. % e/ ~2 B7 w! }. }9 B
  73. char *dmabufsrc1 = NULL;) D# e+ @) _+ o+ W: {' M
  74. char *dmabufsrc2 = NULL;
    9 ^2 \( @" Z' t* q0 v
  75. char *dmabufdest1 = NULL;" q% t& j: W3 ]# m$ v6 b8 y" j" y. p
  76. char *dmabufdest2 = NULL;+ ?1 S$ R5 z  ]: B
  77. / t8 o( B% J: e. \1 X
  78. static int acnt = 512;( |' d% z4 ]5 B& q; }9 o
  79. static int bcnt = 8;! F/ Y* H5 B0 S. J& N
  80. static int ccnt = 8;
    / u5 `9 M7 m2 R# ^  |' |7 q" B
  81. & E" |+ X5 K3 z3 o
  82. module_param(acnt, int, S_IRUGO);' k; b+ ], G3 ?  S; {
  83. module_param(bcnt, int, S_IRUGO);. x+ u8 w4 O- _6 u0 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( s! {, g! t+ L3 ?  Q* ^4 ~% S* f1 T/ j/ q6 l4 W9 S8 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 F: S! z' U+ d7 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; P6 J" \& d# W: u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' y) R1 q0 O% `3 H; O) z# u
2 }% _. w. D( v

. R& C! A. D9 _+ E: V1 {" M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 11:22 , Processed in 0.050241 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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