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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; B) t/ |/ z) ~) B) c
  1. [code]EDMA sample test application
    ! B, x. |! q2 r3 N8 ^" \
  2. /*
    2 w( s0 }  u% M3 I* S$ t, R
  3. * edma_test.c# @" V. c: B% p5 R
  4. *4 h. O5 A' D3 M+ U& @6 U/ g
  5. * brief  EDMA3 Test Application& @+ B6 C" j0 l" u, C, ]2 q! ~' d8 ?
  6. *  a1 N, h- w% b2 m
  7. *   This file contains EDMA3 Test code.. s+ `7 `. t  ~; @) B
  8. *
    5 Y' O* d* F( H/ M. T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) R( T! I0 j2 [: [' C# F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / u% v; G" j# F7 i7 O+ w1 X
  11. *         TO CHANGE.1 R- M# s6 G4 P8 z! t* p- d5 U
  12. *
    - J& A9 M, T7 l2 E' G( @2 h. u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K" {: o! H" K) m3 @. b
  14. *7 E7 k- p% R; C, c6 t* s! q
  15. * This program is free software; you can redistribute it and/or
    % J0 G4 Q5 G  O* j
  16. * modify it under the terms of the GNU General Public License as
    % i; H, h2 g( z* v
  17. * published by the Free Software Foundation version 2.
    4 u9 k! E1 u/ R. M' K
  18. *6 |! x* @5 w  ^# W6 ?+ y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, [" ]0 D0 R8 Z4 X" n( Z5 o
  20. * kind, whether express or implied; without even the implied warranty
    . u" m+ l' D0 w! S, N( p( B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 w! s3 P; N4 K2 g9 `$ t
  22. * GNU General Public License for more details.& ]# O  h1 U9 d+ `
  23. */3 }' P+ f. i2 r1 c. E  f5 E. x

  24. ! K0 x! D/ n- s: R$ f/ r! A
  25. #include <linux/module.h>
    9 a1 |& N2 b: `. [; Z5 T
  26. #include <linux/init.h>0 S7 h$ f2 y# o
  27. #include <linux/errno.h>
    : p6 j& k% @) {+ t
  28. #include <linux/types.h>
    * j2 O* Y1 @5 G1 r: w9 i
  29. #include <linux/interrupt.h>
    ) l0 X; x' I# S% t# F) ?. k% w
  30. #include <asm/io.h>
    1 @/ h) }1 k' A. c- L& S
  31. #include <linux/moduleparam.h>
    - Q/ ?' x7 p# P/ W5 }$ n( Q5 F) W( c; V5 P
  32. #include <linux/sysctl.h>
    * ]8 p5 L, [" m0 @7 m& ?( M$ r+ l
  33. #include <linux/mm.h>
    7 u" B$ t/ E% O
  34. #include <linux/dma-mapping.h>
    3 T- E4 X( X: A
  35. ; M. C/ Z4 H8 X# [
  36. #include <mach/memory.h>
    " O& T! Q* w) w$ p
  37. #include <mach/hardware.h>' W- I8 N  ~5 F+ i) d3 [
  38. #include <mach/irqs.h>0 ^0 P8 s! J. j5 j; I& s
  39. #include <asm/hardware/edma.h>9 B# `' \# R; W# V+ h  x5 K! I
  40. $ ~6 O, R; I0 ?; }. v  A
  41. #undef EDMA3_DEBUG' V; S/ x9 x% b8 B& k% N& x
  42. /*#define EDMA3_DEBUG*/$ N: e" d# E4 n0 n5 x

  43. % Z) e: R$ A; y+ v. W( U
  44. #ifdef EDMA3_DEBUG! |  N+ ~8 i% ?3 c5 J" c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , P2 a* `( e, {& e9 Z% _! a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % N+ n, h4 S6 [# J" v( A" a' X9 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# M3 a) K% q1 T% |" x# ]" W
  48. #else
      W! p$ M& @. S, H
  49. #define DMA_PRINTK( x... )
    ; x- T; D* a) f% E* I$ p5 o
  50. #define DMA_FN_IN7 m" P' b0 K2 J$ I7 S. D1 y- M, a
  51. #define DMA_FN_OUT- n+ {& b1 L- w% i7 Q
  52. #endif
    # R0 g" d9 h0 F! D' J! B; o5 n: ?

  53. 2 E3 W# B4 V, p+ g" ^2 ^$ B9 w! g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 p2 D, t4 i7 k2 w" V5 W- j
  55. #define STATIC_SHIFT                3. g4 s0 K+ S2 W9 ?" {5 P  h  {
  56. #define TCINTEN_SHIFT               205 C: p  R( ]7 U
  57. #define ITCINTEN_SHIFT              21
    & J9 P6 D5 j  }
  58. #define TCCHEN_SHIFT                22
    % j7 }, E  n; \  p! `& Y5 \
  59. #define ITCCHEN_SHIFT               23
    9 ~) b' x8 I$ a

  60. : Z8 i( l: ?4 M
  61. static volatile int irqraised1 = 0;. i7 `& X1 K* C" @/ x( o; U; |
  62. static volatile int irqraised2 = 0;
    - r9 p! D, J" H. L3 h9 p$ D6 c
  63. # {& a6 b, Y4 i# P$ G& ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. b5 {: I& y8 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 E; Q' ]! @, h% N. u* d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a# g: e+ a6 Y1 C9 N, u- p
  67. $ T8 E. C' I: N) E5 |' ~2 |
  68. dma_addr_t dmaphyssrc1 = 0;/ Y! X* B4 ], z2 r  I
  69. dma_addr_t dmaphyssrc2 = 0;% m' p% A8 V  ^! W. |( ~
  70. dma_addr_t dmaphysdest1 = 0;
    9 G( v; s  T! ^' I/ O0 _( M/ t
  71. dma_addr_t dmaphysdest2 = 0;
    % O& {" D7 p- m* `3 E) Y, L& A

  72. , @1 M& G' k7 |; V" w4 m1 [" w
  73. char *dmabufsrc1 = NULL;3 n, h9 b5 M, O* K: ~  I
  74. char *dmabufsrc2 = NULL;
    ! _( y: U" P, n0 R5 O% z# O
  75. char *dmabufdest1 = NULL;
    , ^; Y6 h$ r- E0 K; E/ [- M
  76. char *dmabufdest2 = NULL;
    , Q6 m) y: T0 m
  77. / Z" p, q5 k, j5 b8 x; I
  78. static int acnt = 512;
    9 }9 h& ?$ d6 x, D$ i5 X( s6 q
  79. static int bcnt = 8;
    ' ]9 b: {. Z6 u
  80. static int ccnt = 8;
    / t' D4 e( G( `& s$ z( |% s' Q) ~
  81. * I! W% H" G/ X
  82. module_param(acnt, int, S_IRUGO);9 x8 i2 o" O* [! t& z9 ]! Q3 x
  83. module_param(bcnt, int, S_IRUGO);6 S) \  Y- K8 t" k. _8 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 A9 K# O  u7 p: v0 N
& @+ N2 g7 n2 h4 {0 h# {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* j5 s. a( k- c6 k8 L1 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  z0 ?& \: b  B& e  e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ B. `3 r5 C+ C6 I! w* k2 k( B: B: s
- y! _6 c( C0 ?! P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 19:02 , Processed in 0.039735 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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