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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; K* ^0 Z7 m( C, {
  1. [code]EDMA sample test application
    ( x- [" M3 T8 J9 F# U, N
  2. /*
    8 ?4 Z) ~4 x) R7 @# S7 Z) N+ {
  3. * edma_test.c2 G1 [- E% U& ?$ a( Q! S, ~
  4. *
    & h! \' A, E5 \* |7 X6 m- L: I
  5. * brief  EDMA3 Test Application
    / \! V4 I' |& ~
  6. *: m0 {/ \1 B3 C! x7 i7 W
  7. *   This file contains EDMA3 Test code.3 U6 e# s8 n, {: d6 T
  8. *
    2 Z: \! Q3 i  b, a4 _# Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , E3 X2 r0 v; i; U9 ^3 _& U: `, T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- [# g2 b# l6 y
  11. *         TO CHANGE.
    4 v; P) m) Q$ m* p) D
  12. *! z& D/ J$ A, t! i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% }9 J; l& P2 I. V: Q
  14. *
    - i% H4 ^; b( [1 H
  15. * This program is free software; you can redistribute it and/or$ O% s, c5 }  v5 j: B5 E
  16. * modify it under the terms of the GNU General Public License as
    % q) Q, O5 ^$ w  z( I
  17. * published by the Free Software Foundation version 2.& \, h) v' I2 e  X, Y5 T9 k) s# {
  18. *& y: r6 C  |& B2 g: [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 k) l0 N% n) n3 W6 w+ _4 _; [
  20. * kind, whether express or implied; without even the implied warranty9 C% V* v& p8 m) l) ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 P$ L+ \! X- f6 t0 H
  22. * GNU General Public License for more details." C( |4 w. f: E' X: F4 _( A
  23. */
    7 O& g4 F) ]1 R

  24. & f5 y7 [, c) f3 S& g
  25. #include <linux/module.h>
    % ~& A7 w7 y: f) H0 p  a6 b
  26. #include <linux/init.h>
    0 Z: j4 J( [3 q
  27. #include <linux/errno.h>/ ^* A  r; i3 `5 m* \+ d3 N
  28. #include <linux/types.h>
    $ G* `; U/ J& G
  29. #include <linux/interrupt.h>) R6 R  h* S- L$ Z) j& @5 h( ^
  30. #include <asm/io.h>
    / S' b& ~( z/ t* H* i% W0 u
  31. #include <linux/moduleparam.h>; i3 }5 `' H6 Y7 p5 g
  32. #include <linux/sysctl.h>$ v5 Q7 S& t, Z- U4 G2 m. R# m
  33. #include <linux/mm.h>! E$ `8 ~0 t8 `/ P* a3 @0 V3 G
  34. #include <linux/dma-mapping.h>- j7 d* F  a, a" t8 w
  35. & f! x: I! d5 L4 n
  36. #include <mach/memory.h>" U8 H; K8 \) U# Z* Q" j; k1 m
  37. #include <mach/hardware.h>
    5 n# _4 ~$ H1 w$ ?0 N+ H
  38. #include <mach/irqs.h>
    * o3 x' j% m3 I
  39. #include <asm/hardware/edma.h>
    ) i' c  b& g7 f) p5 Y+ f6 F

  40. ) D& V3 F: o! g& ~4 S9 U8 i
  41. #undef EDMA3_DEBUG
    1 R9 i1 S. ]0 X+ {
  42. /*#define EDMA3_DEBUG*/
    1 [. q" i4 P% P. ~/ N" T

  43. 2 r4 H* e/ r- ?& A2 [, y8 h
  44. #ifdef EDMA3_DEBUG
    1 S9 m! a% a! k( N' y  F8 e. S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 [7 R" \; _: Q% c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " Q) n# b: }; e( f0 K# `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 x. l4 `0 e- V$ D' R
  48. #else
    2 F, v  @3 M& G5 o
  49. #define DMA_PRINTK( x... )
    - }; C! G' q7 ~, [, s0 C( f
  50. #define DMA_FN_IN; R. D7 R0 R% b$ ?$ Q0 N
  51. #define DMA_FN_OUT
    7 \# e- M: _% j% x0 @& S, S
  52. #endif- c' w4 q0 i5 _. H  I9 c
  53. ! ?- i, {+ v8 l: x: F; K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 k2 K5 o& r& X5 t5 s* s# P# }
  55. #define STATIC_SHIFT                3
    ' D- i# m1 ]7 g
  56. #define TCINTEN_SHIFT               20) u/ `( O/ N3 J! G! `
  57. #define ITCINTEN_SHIFT              21
    * C7 I8 k- r) A8 A
  58. #define TCCHEN_SHIFT                22
    . X* k4 Q9 s$ g3 K4 Y$ [
  59. #define ITCCHEN_SHIFT               238 W! J, f, k1 a$ b( X+ }8 ^0 j% Y6 _
  60. ' B+ Z4 r" [$ d$ g9 ?  d" l* ]: u& A
  61. static volatile int irqraised1 = 0;6 h2 x0 A0 d5 P" K6 o. s$ d9 z2 I
  62. static volatile int irqraised2 = 0;4 c/ |* }9 E' z, q! x
  63. ; {/ o' q) w6 c) H. W9 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B, {% m# b% k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 A" i4 A# g2 }$ a3 ~1 `/ u( x) `8 H2 W7 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [( }- l2 B& u# o9 E
  67. : u2 Q' N4 l& r7 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    ' `5 W: x* N& `0 }5 |  }
  69. dma_addr_t dmaphyssrc2 = 0;- s. `/ ]4 F# y* b2 D
  70. dma_addr_t dmaphysdest1 = 0;% P; |4 H; a6 g- n
  71. dma_addr_t dmaphysdest2 = 0;  _- C( R  f( H; `

  72. ' k! y) j4 M8 }6 w4 q$ r4 C9 w
  73. char *dmabufsrc1 = NULL;2 L. K( V* U3 y3 e1 r( a; q' W
  74. char *dmabufsrc2 = NULL;5 \, g$ w/ f2 G  x9 F. g
  75. char *dmabufdest1 = NULL;
    + e& c0 H6 ~5 S5 R! e. o2 Q
  76. char *dmabufdest2 = NULL;! a. r; {+ `- U7 m1 q

  77. 8 A& B/ U+ \& j0 V, k5 y# ]
  78. static int acnt = 512;
    0 x2 ?! [) d4 K
  79. static int bcnt = 8;
    4 x8 C- x5 f8 H3 P
  80. static int ccnt = 8;( ~4 U8 v9 ?; A% ]

  81. 7 {  J1 F/ f/ l, d' t% U
  82. module_param(acnt, int, S_IRUGO);" ^. i7 s7 h' f& |4 [' a
  83. module_param(bcnt, int, S_IRUGO);
    0 B9 ^+ R( V  C/ e& U( z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% [. _" n. N2 @( s

  p4 M4 F: a( R0 M, @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. S/ R; d' m6 b; t! iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: N2 \: y$ l$ p$ ?: l3 h* w. g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ~3 ]# G% }. L
- N& B: ?9 Q, R1 J; ~' i! f  y/ a
& B" b! \+ Q! q) C' c1 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 00:10 , Processed in 0.041245 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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