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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 S  S2 q* U$ L  A
  1. [code]EDMA sample test application
    4 u2 ]& d4 d( M; a
  2. /*" s1 Z, k# _8 N: Y# A
  3. * edma_test.c
    3 L/ g+ t# r9 b
  4. *( s1 V  r  n: l7 V4 _
  5. * brief  EDMA3 Test Application. ~- G6 P. |/ t
  6. *6 H, ?3 o+ o2 ]( H  F
  7. *   This file contains EDMA3 Test code.
    . ]/ u6 n, i9 a, v
  8. *
    * E+ W- A- I2 l9 {' C# G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 l$ I. F; w# O4 H; G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, T, N8 k8 N8 M1 Y! W
  11. *         TO CHANGE.
    $ U) e6 ?4 e1 y7 k
  12. *; s  r. v6 |: ]% d% o: a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 u& @% _( G: ?- v& T
  14. *# o3 H" N, g6 p9 {
  15. * This program is free software; you can redistribute it and/or3 k# s% t4 W5 {# V0 J" Q
  16. * modify it under the terms of the GNU General Public License as/ [/ Q! ^6 \8 A- f
  17. * published by the Free Software Foundation version 2.1 _, n6 [( y8 ^8 p. o8 p
  18. *
    3 d9 B! u/ X& E7 d- C! s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! _" ]3 z+ Y6 F. o  e* k
  20. * kind, whether express or implied; without even the implied warranty4 S$ a# D; D1 ~; F+ r7 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- H2 ~( v% b# o
  22. * GNU General Public License for more details.* n& C7 ?, E+ {. z; P
  23. */( H" \9 l1 {- a" {: S# E* K$ a; R
  24. & |$ [& ?  O# Z- c$ Q( n/ Z0 Z
  25. #include <linux/module.h>2 b+ s/ V  \7 ]! J# o1 M! ~
  26. #include <linux/init.h>
    " _( Y1 l( w/ [9 C+ g
  27. #include <linux/errno.h>
    & R: T1 c& f4 O. i. I
  28. #include <linux/types.h>
    % _4 F; t& V0 O4 X$ [1 w
  29. #include <linux/interrupt.h>
    7 ^3 e1 l8 z5 W' x+ f
  30. #include <asm/io.h>8 {; i7 g* z( U- [5 ~9 r' I2 ^
  31. #include <linux/moduleparam.h>0 X6 J; ]! l4 z
  32. #include <linux/sysctl.h>! K7 O& h' l- K- D5 S5 c
  33. #include <linux/mm.h>, x( s1 c# C5 i4 m+ _  n
  34. #include <linux/dma-mapping.h>
    6 D: O% \& h$ S5 `
  35. 7 [- d' d7 D$ h% C) w
  36. #include <mach/memory.h>
    6 p+ A6 z* j8 ?% C, @$ R
  37. #include <mach/hardware.h>
    2 n# a4 p6 q3 V. ^
  38. #include <mach/irqs.h>4 P; G! s' E& q4 ^+ s" p
  39. #include <asm/hardware/edma.h>
    5 F$ S" c; s! u

  40. 7 b# ~" ]( s5 C  m8 D( z8 _' f
  41. #undef EDMA3_DEBUG/ P- {3 g' l' `& k5 Q
  42. /*#define EDMA3_DEBUG*/
    % l4 Y6 b- X# H* }' I8 {1 S
  43. + n4 I, I% i6 C9 j2 J- r. {# [! R
  44. #ifdef EDMA3_DEBUG
    ( I0 b  n: h' N# U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 |! P; x/ q4 C! @# X, R/ B- v1 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 u8 z4 u7 i, W; z; w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ \5 J0 w, @0 C) m3 d
  48. #else5 S4 x1 J( {" G1 J' ~' F1 S
  49. #define DMA_PRINTK( x... )9 k. q) }/ }: O
  50. #define DMA_FN_IN
    & L! Z+ V, m  J  |" a
  51. #define DMA_FN_OUT
    % P/ x6 K: V5 E" z; M  K, ~, a
  52. #endif; n+ w/ z$ ~; v% \0 [* C
  53. 7 N; }- Y. t! {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& e1 n# Q$ X. n$ _* a: h, P
  55. #define STATIC_SHIFT                3, K1 J/ V% v, R* |. A
  56. #define TCINTEN_SHIFT               205 k' P6 q! Q3 H( n) m- m' O# W
  57. #define ITCINTEN_SHIFT              210 y1 w2 Q: C6 ~  k( `1 A  n
  58. #define TCCHEN_SHIFT                22
    5 W; I% H. p- H* s
  59. #define ITCCHEN_SHIFT               230 u+ z7 |7 E4 U! x
  60. 5 t( v) j, l& g  f8 s  A! I- X! y1 _
  61. static volatile int irqraised1 = 0;& R) T& `4 j9 q+ `1 m1 {% V
  62. static volatile int irqraised2 = 0;8 r/ g0 }+ q0 D' b0 }
  63. % y7 w8 S/ j0 f$ L3 [0 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 H+ u, I6 b/ p5 W! n4 U' ~% G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ B: D2 [; M9 z% d! z& i- O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ d: G  T5 X. A4 a/ p0 v$ C" R% S
  67. 7 }5 _, }! R! F# a% p$ d; I
  68. dma_addr_t dmaphyssrc1 = 0;
    2 F, j4 j9 p" p: L4 A
  69. dma_addr_t dmaphyssrc2 = 0;0 H4 C5 B( s1 z( i. w
  70. dma_addr_t dmaphysdest1 = 0;
    * z% n" h7 P# j& ^- b. k+ L# r
  71. dma_addr_t dmaphysdest2 = 0;
    / l& O& C* D4 {  Q6 p
  72. 4 r! ^2 d' G  V
  73. char *dmabufsrc1 = NULL;9 J6 H( c( @9 ~1 C. j4 J- p: q  a( v
  74. char *dmabufsrc2 = NULL;
    + v; v6 m+ m! w
  75. char *dmabufdest1 = NULL;
    " W9 U3 a5 x" N, x7 z
  76. char *dmabufdest2 = NULL;6 o4 D: h4 ]8 I- R; f" e) ^0 d3 j# B

  77. 1 {& G' j  s# n# f
  78. static int acnt = 512;
    # F0 L0 K# P6 T: J8 y7 u) g2 j
  79. static int bcnt = 8;) h& H& ?3 u5 l; B9 R! `3 s
  80. static int ccnt = 8;, E# f3 s; Q- k; ~
  81. ' p3 Z2 L$ L. u# j# Q; `' q
  82. module_param(acnt, int, S_IRUGO);
    1 |2 U7 C: J. J) m* W
  83. module_param(bcnt, int, S_IRUGO);  ?  X4 _- S$ T1 h  k8 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; I. H; \5 b: t9 f+ T
! S8 V+ f. V1 @8 ]: Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 Q, F/ y! }1 i8 Q( _7 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 b0 k8 f  Q1 o$ u# h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Q7 x* L* T/ T# @' _( }

, U& k0 P+ O$ J" n) z/ [& a/ J% a1 {# B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 16:38 , Processed in 0.038502 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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