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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# \+ ^3 a+ M9 \' }
  1. [code]EDMA sample test application
    " J) I, E) X: L. a( k+ D& K
  2. /*
    3 f: r4 C7 p) f
  3. * edma_test.c; W1 n; j: D0 H0 q
  4. *
    ; [, `' h; x. S) K4 N9 d
  5. * brief  EDMA3 Test Application
    % W5 J- B3 m- t1 Z$ w0 Y) R
  6. *
    " ]. P( D! u/ Q7 H3 F! u* K
  7. *   This file contains EDMA3 Test code.1 ]% Q( L2 n1 S/ \% x
  8. *3 g7 v3 I: ~+ @/ G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 o- K0 Z0 m& m% ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 T: L8 T2 _% C. K9 B# j, @9 f+ p
  11. *         TO CHANGE.
      u$ v6 G; D7 F8 l/ b, @# r
  12. *
    4 V" r& c+ Y( Q3 c. `2 d+ s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 S& ?9 g) A! _- @
  14. *
    ' I# N% _. `0 ?$ M; t. I
  15. * This program is free software; you can redistribute it and/or# r7 P( k: e. f
  16. * modify it under the terms of the GNU General Public License as* i% c! f3 ?! E, h- }
  17. * published by the Free Software Foundation version 2.  Q: F* B6 C1 N, e, U% `
  18. *
    3 i0 ?3 }+ o2 Q1 b0 z  n6 \# K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- P- K* i% ^( Y; \& ~0 }
  20. * kind, whether express or implied; without even the implied warranty
    2 n, k4 T5 \  f) ]& [" Z7 @" N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " L! V( o4 o  o
  22. * GNU General Public License for more details.
    3 D4 q5 c  b! L- g
  23. */) y) ~4 r" q! ?, b" w9 C

  24. 6 _6 ]! f. q- E4 [. g
  25. #include <linux/module.h>
    ) n: ^3 n) X  k3 a
  26. #include <linux/init.h>
    : y/ W1 B3 O5 k2 v3 X
  27. #include <linux/errno.h>5 U. M* i. {4 r2 p8 _' B( r
  28. #include <linux/types.h>& [5 q1 H7 B2 G/ O
  29. #include <linux/interrupt.h>
    ! t; }0 s% ~2 j& d/ \. W- z
  30. #include <asm/io.h>
    $ d, a2 I; a  j& y1 V% D" S: T
  31. #include <linux/moduleparam.h>
    . L" B# y4 W# v0 a3 n
  32. #include <linux/sysctl.h>! {/ e+ [+ K; O6 b7 j7 e+ Y
  33. #include <linux/mm.h>
    0 ?" `$ B) n4 r9 d( Q
  34. #include <linux/dma-mapping.h>
    # _. B; j9 A4 g) g
  35. ( b2 q  Z8 S$ m) Z, @: M! c7 N2 _
  36. #include <mach/memory.h>
    & o6 j6 U3 E+ X+ F; m
  37. #include <mach/hardware.h>* M  f; v3 V+ p8 c: x. D& I
  38. #include <mach/irqs.h>1 D6 p# y) M; P9 m& i5 ?9 b
  39. #include <asm/hardware/edma.h>5 ?4 _( }4 _2 \/ r. K

  40. : ?5 {3 X) S% z) V
  41. #undef EDMA3_DEBUG
    & q% F7 ~; O- J, H5 h
  42. /*#define EDMA3_DEBUG*/# W/ P' {+ z% i' n) I3 \

  43. 6 G4 d( e% L' R5 i: h. n
  44. #ifdef EDMA3_DEBUG
    $ g! h9 h4 u; w- d! k3 v/ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 e' [. |; N9 m3 I3 o! B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ d* t9 I: e. M. e$ Y  G, `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! U1 _2 F0 B, B- y/ j
  48. #else# Z/ t; J; f- u- d( g: }
  49. #define DMA_PRINTK( x... ): d) z% y6 Q, O5 f
  50. #define DMA_FN_IN5 w. ^& q3 f: j
  51. #define DMA_FN_OUT
    3 J* k! U1 P6 I) w5 ~- p
  52. #endif
    , G8 o* V3 _) y9 B# G

  53. $ O/ O9 o( k1 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) F% W* j+ }& X  d
  55. #define STATIC_SHIFT                32 N5 ?2 t  D- I* k) M' Y- `! |( H
  56. #define TCINTEN_SHIFT               20( i# D% a. v5 j+ S3 \/ X
  57. #define ITCINTEN_SHIFT              21
    9 g( Q& n1 E/ f
  58. #define TCCHEN_SHIFT                22
    " c- d9 _" g( \* v7 g. S' B; e1 X" T" N
  59. #define ITCCHEN_SHIFT               237 ?* c; k! y" Y1 V) o4 ]' }3 H# A( R
  60. % |9 n! f$ y+ o3 y
  61. static volatile int irqraised1 = 0;
    ; `. b: C9 I! P: y
  62. static volatile int irqraised2 = 0;
    : g: }" V8 g, l' v1 f

  63. " C- X. @. E& _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 @& P5 |1 f4 t' Y$ w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' `- Y/ P) W: K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 \. O% N( I* @& ~) ~! M" C; X* _6 I' [
  67. ' X! G$ }( X4 \# N$ y& J- U' ]
  68. dma_addr_t dmaphyssrc1 = 0;: q; |& l  ]0 q. J3 J) `2 m
  69. dma_addr_t dmaphyssrc2 = 0;: u/ u3 E. S5 e+ v- E& B  }; e& n
  70. dma_addr_t dmaphysdest1 = 0;# L$ `- X5 e  u0 g7 X* z
  71. dma_addr_t dmaphysdest2 = 0;
    7 l) }/ Z7 `+ N7 C/ s; K
  72. ; Q/ r& K* k" p. s, F9 T
  73. char *dmabufsrc1 = NULL;# a0 P; z- F& G: a
  74. char *dmabufsrc2 = NULL;
    " t* v' y/ q- s9 m, N2 V
  75. char *dmabufdest1 = NULL;3 Z, i, C( d" h# J6 ~' e
  76. char *dmabufdest2 = NULL;
    " }' n6 s, T6 J

  77. $ x1 k8 A. C7 x
  78. static int acnt = 512;7 i& c4 e( ^/ E
  79. static int bcnt = 8;* A( Z! R0 H9 i$ R* }/ s, u
  80. static int ccnt = 8;; e6 U: D# ?! a

  81. 8 R$ o2 x( }" n/ ?# t
  82. module_param(acnt, int, S_IRUGO);
    ! ^+ V; v* @3 L
  83. module_param(bcnt, int, S_IRUGO);
    ' F, o1 z- H( S6 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& R+ S7 j1 ^; t' \2 y
2 I" |, V3 [3 y# {- o! N* a1 u0 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; z' r9 M6 |9 l5 z/ v# h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: S  |$ r# C6 M! o- j+ v& _8 L, r/ _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 N4 `  B6 n8 n" G* K+ ~1 y. r8 e: _" M: X! o! Y1 a
8 \+ G! I6 E4 M0 C- y2 j" i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 18:01 , Processed in 0.039824 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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