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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 a4 m% W; j7 B% y( \6 M- t* ?# d
  1. [code]EDMA sample test application
    , g6 h" {+ n: D' c
  2. /*" T# }: Q* v+ ]" w
  3. * edma_test.c/ t6 m6 Y6 b1 ^5 X
  4. *
    9 `% C8 c$ q6 w+ P7 d' j
  5. * brief  EDMA3 Test Application8 {9 y: {0 v0 Y
  6. *: T0 q9 v! s: G4 r2 u3 \/ F
  7. *   This file contains EDMA3 Test code.$ T& j6 b  \' @8 U, U4 V8 O
  8. *4 N- {9 [' Q- o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; F2 i2 x3 e' k( o7 B/ }% z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 }9 {/ {6 J' n& g, ^/ R
  11. *         TO CHANGE.
    5 |5 J" k5 F1 _5 J4 r6 f( |
  12. *
    ; `& z! P, ^6 J, S+ y# r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; w" A/ [5 |% r7 ~. A. U) g8 x- [
  14. *+ j# z6 k8 H( X9 D. E4 x0 L
  15. * This program is free software; you can redistribute it and/or2 g: Y% r8 d6 V
  16. * modify it under the terms of the GNU General Public License as" z1 P% ]# N# x4 }7 p
  17. * published by the Free Software Foundation version 2.* p2 Y9 M  w' k; b$ s/ x! {
  18. *, r. E8 A% P' b  }: w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ^# N% ?5 u5 {6 g) Q, h5 C
  20. * kind, whether express or implied; without even the implied warranty
    # @7 b+ t* C' m' Y% x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# {+ d# u  c  M" k( X1 n, Z% L7 L6 @
  22. * GNU General Public License for more details." u  l* m- o6 Q% V4 g
  23. */
    1 ~2 z# x9 K0 z0 D

  24. $ z  X2 y- ]& z
  25. #include <linux/module.h>' F3 M& R, _! V  ~, x- u
  26. #include <linux/init.h>
    1 B: \& x% e% D" ~  p* _2 E! L, F  a, E
  27. #include <linux/errno.h>
    # N! j6 y% M9 ]3 k: d' {- ?+ c) m0 ~- q2 ]
  28. #include <linux/types.h>
    3 y# `, J% c4 r/ K& {
  29. #include <linux/interrupt.h>2 y$ Y; K) V5 E) G, l" h
  30. #include <asm/io.h>5 t9 [$ g3 }9 B! \5 {
  31. #include <linux/moduleparam.h>! X9 U2 h0 M2 D
  32. #include <linux/sysctl.h>
    2 p. i4 M; d9 L4 N2 ^$ P
  33. #include <linux/mm.h>5 r/ ~2 N8 f  p, V: n( q* `
  34. #include <linux/dma-mapping.h>
    5 {0 `; G& C/ E

  35. 3 W1 e* z1 d, V
  36. #include <mach/memory.h># p1 Y2 S0 Q9 {# d" X, y* h# K7 q
  37. #include <mach/hardware.h>
    $ S& b( _/ z% Y/ N7 O- X" ?- I
  38. #include <mach/irqs.h>/ F# H7 u8 L: b) e# N3 j
  39. #include <asm/hardware/edma.h>* W: l+ ]; C! J2 z8 j6 H
  40. , `; I4 s* v& L5 T# }- N4 o# B: {
  41. #undef EDMA3_DEBUG3 B+ m- P2 d! W2 {0 B
  42. /*#define EDMA3_DEBUG*/
    7 b( j* S. T. y# X9 A3 a/ L
  43. # H# l) f) X" Z
  44. #ifdef EDMA3_DEBUG) ^: g) n# A  c7 P% `# Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): E$ q1 x! k- a( D) _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # T7 `; w9 {. n8 I" d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      O2 y# J  G. y0 Z/ ~
  48. #else
    # N8 F( y) j  N) k
  49. #define DMA_PRINTK( x... )7 ^- Y2 \! T3 H; H2 C) \5 Q
  50. #define DMA_FN_IN
    . V. O( q/ X$ |$ J1 u7 v- g" ~& d8 G
  51. #define DMA_FN_OUT
    0 X, ~, v9 V1 u4 F; i8 E
  52. #endif
    ) L0 Z( r* p) s$ F6 {/ K
  53. , \+ g7 j5 b( y; g) e% @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      g8 ]6 t5 e, N. A3 U4 N8 |
  55. #define STATIC_SHIFT                30 @/ m7 W$ V5 L# P+ [; K6 t1 ~9 ^
  56. #define TCINTEN_SHIFT               20! H+ v. u" n1 F  L/ G8 L6 J
  57. #define ITCINTEN_SHIFT              21
    $ j/ z, [5 m% @6 F& B
  58. #define TCCHEN_SHIFT                22( q1 |- D" {/ Z- Y
  59. #define ITCCHEN_SHIFT               23( j+ c. {, {# h$ c8 f& y- F5 k( ~
  60. 0 j2 }! i1 D* H; N! |
  61. static volatile int irqraised1 = 0;6 X8 G- K% K9 y+ A
  62. static volatile int irqraised2 = 0;6 f+ v& l3 ^# C, ]) c
  63. 8 H; [4 l% U6 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 c+ y4 ?" C5 i7 H/ S* I1 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) c( {7 `0 J2 @* U; z2 g& O, L( j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + V8 f* ^" S5 S; i, v9 N

  67. - \1 t: v: C/ H0 c
  68. dma_addr_t dmaphyssrc1 = 0;  G" Y' R2 ]) }. _( f
  69. dma_addr_t dmaphyssrc2 = 0;0 i4 ]* H# ^- Z! V9 N/ ^
  70. dma_addr_t dmaphysdest1 = 0;! V4 m7 \- i, E) u7 f, \5 ]
  71. dma_addr_t dmaphysdest2 = 0;9 R3 Z! c! ?8 K% L

  72. 2 W: ^6 ^; c$ ?- `  P* ?( K% A: l* X
  73. char *dmabufsrc1 = NULL;0 A# D' r# K! B( w$ J( z3 i5 g
  74. char *dmabufsrc2 = NULL;* K% d* h, D% T8 U3 a, M0 y0 B; X
  75. char *dmabufdest1 = NULL;5 L  Z4 W5 T# H) ]/ o
  76. char *dmabufdest2 = NULL;: H* v1 q' n& r8 p
  77. , n& n8 H0 ^3 c# w
  78. static int acnt = 512;7 c0 ~6 y& E: g! ^/ W
  79. static int bcnt = 8;
    + N7 z0 T1 h! o7 e! G5 ?. a
  80. static int ccnt = 8;( K* [) e5 c: z4 b8 w$ _
  81. 0 S" G( I5 c' C% ^; e* N$ S
  82. module_param(acnt, int, S_IRUGO);% _! \2 H6 T3 e/ @. `% k  r
  83. module_param(bcnt, int, S_IRUGO);& z! U# ]: n: L# r' I! y6 g( x& A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 z" v, X: K& u- ]! F, y
7 O1 k+ s& \$ x& M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; T# ^. E0 h8 V7 U$ {$ Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' g2 _- m' s4 l1 x7 C7 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ^0 F; W. O, o# F) \' T5 I# H# k) C! ~! J
: ~; t8 u+ k/ j# z/ @* @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 03:23 , Processed in 0.041387 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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