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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 a' S# [4 U1 m2 u$ b; [
  1. [code]EDMA sample test application# v  o) l8 ~- n$ a; B- U7 d
  2. /*1 Z5 P% t# z* e8 I' C6 L: F
  3. * edma_test.c2 }3 s' B/ V# k
  4. *
    / f" i$ _% X1 V; y- V5 [4 D/ t% D
  5. * brief  EDMA3 Test Application$ E* S) ^: _1 E( e1 j6 x- O
  6. *
    9 i+ P7 C* `1 [
  7. *   This file contains EDMA3 Test code.0 ?2 n* j' M4 h. z5 \) f
  8. *: O. a* ~6 `; |0 K8 T: I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ^" U4 a8 c+ Z1 p: P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" t* R3 `2 g  t
  11. *         TO CHANGE.
    4 v5 q; I3 e& X+ X
  12. *; g9 S% L& {: @3 _5 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 V) |( }4 N& b% T* |
  14. *7 F( E% H* }1 U0 [' m5 G
  15. * This program is free software; you can redistribute it and/or
    2 F' y1 G# q3 c. S5 E' r1 h' f
  16. * modify it under the terms of the GNU General Public License as
    * s5 f  ?4 K2 a3 J2 F
  17. * published by the Free Software Foundation version 2.
    ( b0 M4 U; T6 A, U3 O8 _1 J  z
  18. *
    $ w0 U, p: N) i/ F: \1 u. \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 @4 Y/ n' D6 C; W
  20. * kind, whether express or implied; without even the implied warranty8 e! k$ `0 y8 ?! H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ |5 {# P* u6 J" Z! L' c9 d" j
  22. * GNU General Public License for more details.
    / B  ^, C% J2 x1 L9 G4 N9 }9 Q
  23. */
    9 n( B# I/ u" Z) T" E1 H
  24. 1 b; b! u9 w3 ]- K7 n* K
  25. #include <linux/module.h>; f( i3 H# J, [  T! w
  26. #include <linux/init.h># n( E+ T' H7 e4 i" R! \
  27. #include <linux/errno.h>8 K7 F' I$ z% M0 b% P( @7 Y
  28. #include <linux/types.h>
    ( n3 J( \2 U3 C( k
  29. #include <linux/interrupt.h>' e+ n; Y$ T3 l: E# _) M+ k$ q
  30. #include <asm/io.h>
    ) a- I, P: y7 E( l7 \. B
  31. #include <linux/moduleparam.h>6 Q  V' Y" Y# a: y" R; z! D0 E
  32. #include <linux/sysctl.h>
    ( d7 n9 ^  e" v
  33. #include <linux/mm.h>
    ) t# ?7 }6 v& A$ p
  34. #include <linux/dma-mapping.h>2 ]" t7 A2 U- d4 I: v! d7 ^7 u

  35. " U, ^/ G* q: j0 c
  36. #include <mach/memory.h>" m( L5 o$ e3 X, Z/ u, E2 q
  37. #include <mach/hardware.h>* F0 M3 M2 a* o4 v! s
  38. #include <mach/irqs.h>
    . N9 A) L& u* Y7 R( L; n: L4 R5 Z
  39. #include <asm/hardware/edma.h>
    8 m) S4 |) I# \# y! p
  40. ; L# I- }. V/ o. p8 x! {7 N0 m# q
  41. #undef EDMA3_DEBUG/ ]) U. K3 \+ v  Y+ F% J6 ]- f. w
  42. /*#define EDMA3_DEBUG*/6 B) @  F0 M+ x2 F

  43. ! T: x( f& {( |  w- J( D- c; V
  44. #ifdef EDMA3_DEBUG
    , F6 B+ J+ K$ F! Z$ {4 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% [+ B4 N  b3 W% d- V* u* |$ s' F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 H- Q5 ?9 z. c3 ]' d5 g/ w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & r7 c# F1 V( t0 a
  48. #else$ Q% B+ u8 S) Z" G+ F! q; B
  49. #define DMA_PRINTK( x... )& L3 t$ `& y1 Z! x, S* ?6 M
  50. #define DMA_FN_IN7 [2 E* X0 y- g5 v+ |! r
  51. #define DMA_FN_OUT% Z7 F3 w" v* f$ L3 p1 Z9 p
  52. #endif1 ?# x0 C. j) j# @) L  ^6 S
  53. 4 y2 Y. N  Q9 r; ]. k; \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; Q6 q, u$ b$ a2 ?
  55. #define STATIC_SHIFT                3
    " ^* _! V9 h9 M4 s/ k# {6 Z
  56. #define TCINTEN_SHIFT               20
    5 a  B4 N+ P$ r4 m, G
  57. #define ITCINTEN_SHIFT              21
    ! c$ e: o- H9 T, E4 D
  58. #define TCCHEN_SHIFT                22
    ) h- ?3 ~1 K+ W3 H3 Z8 a
  59. #define ITCCHEN_SHIFT               23
    . x2 h4 |% Z: `2 o

  60. 5 I% x% g7 ~0 u# m- j6 p. W9 d8 ^
  61. static volatile int irqraised1 = 0;
    ! ~& ]7 L' ]8 u
  62. static volatile int irqraised2 = 0;% p+ O0 X& e; H( ^  v1 t/ m5 f4 Z: b5 c

  63. ; L9 D# K/ A7 r2 f  I( a# c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) j0 Y3 {3 B% Q9 ?. l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A1 x3 V7 A  k  w2 R9 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % W5 E" r8 U' r: `8 {) g/ F* p

  67. , n9 h! L  e' D0 \( {; R& j; o' I
  68. dma_addr_t dmaphyssrc1 = 0;
    4 G7 u/ }, j% r. H
  69. dma_addr_t dmaphyssrc2 = 0;
    " d/ g6 E# C9 ], H: u# Z. l
  70. dma_addr_t dmaphysdest1 = 0;
    # n* |; f5 u9 C
  71. dma_addr_t dmaphysdest2 = 0;
    / R$ ~/ l: f' r, ~7 s
  72.   Y, a! I- I" b& u  k, y9 w) \
  73. char *dmabufsrc1 = NULL;
    # n/ P1 d! _, S# B5 B
  74. char *dmabufsrc2 = NULL;
    ( e4 i0 x  t" ~7 {
  75. char *dmabufdest1 = NULL;5 h2 h3 G8 y$ \3 S  s; N4 z0 x
  76. char *dmabufdest2 = NULL;3 x9 y/ ]( v6 c

  77. # A2 ^& X) y) D6 ^8 d) N( x1 E
  78. static int acnt = 512;3 B( T: G) e* ?2 ]0 E
  79. static int bcnt = 8;
      F  r3 b7 @  {
  80. static int ccnt = 8;
    7 w- Q5 y- b6 X
  81. ; l, f6 B& @) \0 X& F$ t# P
  82. module_param(acnt, int, S_IRUGO);  Z( e* o) \) l4 d+ D. S! Z: @) C
  83. module_param(bcnt, int, S_IRUGO);
    ! d: N& L) E; N) k; `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 u1 y* g/ W  X) O7 Z. n( x; z$ F4 E0 y0 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ R3 V9 I, a( k7 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. n1 e1 O2 ?( e8 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 |" C3 k+ b. e/ }5 M& p5 i

- H+ M1 g- P( Z  }* d# ]2 O- g3 r) ]! ]: ]" E; j$ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-4 23:30 , Processed in 0.037611 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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