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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 D! k/ K) A8 o# K& K2 s5 u
  1. [code]EDMA sample test application
      q# K6 l- K' C" V, x
  2. /*
    ! N3 z1 @" |2 I, ?
  3. * edma_test.c" k( {! _$ V8 F" N1 @) P
  4. *
    3 A7 ?. v+ c7 c! m* o2 t7 K: C* X6 x
  5. * brief  EDMA3 Test Application. o9 ^& b4 F% v7 u# H
  6. *
    5 C5 c# M6 o( n3 V- f3 b
  7. *   This file contains EDMA3 Test code.
    % X' P* e3 |; t# S  c8 ~
  8. *
    : n% h2 U9 `. D- q4 @( g4 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 A8 D: ]3 w6 O( v1 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . f- ]! T1 G- j2 Z2 ~8 n$ D5 }
  11. *         TO CHANGE.
    ( O5 R3 ^+ B$ q8 h
  12. */ O1 Q0 D, `* k0 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . X7 u, i! p  O2 J
  14. *( u$ q5 Y& g% l3 X
  15. * This program is free software; you can redistribute it and/or
    ! z8 r4 ~. \/ x+ k" b7 `' ?
  16. * modify it under the terms of the GNU General Public License as
    1 Q7 t8 e) u" Q7 S9 |
  17. * published by the Free Software Foundation version 2.
    ; A" S: R& l0 [- n# B) n
  18. *
    & H0 \" L# y7 b" ]4 y& I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 h; q8 E0 P, N. S
  20. * kind, whether express or implied; without even the implied warranty
    4 N: q6 C% O  m. v8 f8 K! v3 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , s3 |4 h6 B- p0 v* B
  22. * GNU General Public License for more details.& \) `/ m1 Z2 u4 W6 G2 T0 _6 G" ?
  23. */
    9 t0 l) t8 X, O! ^! X" {4 H! I8 p
  24. " v. `) J' M' w* D  c/ [
  25. #include <linux/module.h>% y/ m7 V! u! T: T
  26. #include <linux/init.h>' X+ g+ q1 P" H
  27. #include <linux/errno.h>- N2 f2 x' ?0 g& r! J
  28. #include <linux/types.h>1 h( J; o% W% p; w6 t& I
  29. #include <linux/interrupt.h>, R! {( \$ z+ V% J% @7 o* c! L
  30. #include <asm/io.h>
    ' b4 e+ y2 \- b8 _- H. e, t/ F
  31. #include <linux/moduleparam.h>) X6 F/ U$ L& \1 U" y1 y4 q+ K) J
  32. #include <linux/sysctl.h>3 s/ j: K* z# L' s' ~
  33. #include <linux/mm.h>
    3 Q! ]& A% v0 v
  34. #include <linux/dma-mapping.h>
    / J" ]7 U1 L5 p' l7 y5 M# v* p

  35. 1 |1 I9 E$ w% B  d6 r2 D8 Z6 _
  36. #include <mach/memory.h>
    0 m2 _! X& W- d( w9 |1 ^- S
  37. #include <mach/hardware.h>% ^  Y: u9 ], H& S; }
  38. #include <mach/irqs.h>8 v- Y; \# O' H* V! w* q, t
  39. #include <asm/hardware/edma.h>) |* x" Y6 F: B' g6 s

  40. ( P' ]" G9 p( G5 O3 B
  41. #undef EDMA3_DEBUG
    ! C8 P- o" J$ d
  42. /*#define EDMA3_DEBUG*/- n) }- R+ h3 J: m$ j

  43. 8 J* ^0 L+ B( S7 R( H: n
  44. #ifdef EDMA3_DEBUG+ T2 i5 e. [' z) T" l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- N6 C' f2 e/ Z( U: L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): q8 x6 B( v4 A/ U- C& J7 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' t+ S' S# u3 r3 q' m/ ~
  48. #else8 d& n* d, q9 \# e$ e: Z4 W
  49. #define DMA_PRINTK( x... ), T7 |: y; l7 g7 W' F
  50. #define DMA_FN_IN
    ; k9 G; O$ C- s. T  P
  51. #define DMA_FN_OUT" r* L, y. I0 p& |6 |+ i
  52. #endif; P/ m& P3 `" T; k4 P1 _( ?; t
  53. : t" n8 H2 Y% i4 ^$ \' m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , A1 g1 ]; u* S1 U; r5 e
  55. #define STATIC_SHIFT                34 ?  r3 v0 u' j6 k5 {
  56. #define TCINTEN_SHIFT               20
    0 {; b9 O8 D  A1 S
  57. #define ITCINTEN_SHIFT              21
    ) H% k# U! R, g! s" n
  58. #define TCCHEN_SHIFT                227 l" \4 E! Q" H/ {4 B" S
  59. #define ITCCHEN_SHIFT               23
    . X( O' B0 ]8 p
  60. ( J# [* H5 z& H9 `
  61. static volatile int irqraised1 = 0;5 k6 I3 f& s$ i6 t
  62. static volatile int irqraised2 = 0;
    & c  P" j/ ]$ H" l% r; \5 e
  63. / [5 t2 d9 P- `! \' ~& }" Y* e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V  I0 w# f7 {) Q7 I+ K, A1 K: B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' W  A6 a5 s  c: r( e/ ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % g: f4 p1 s# h8 {
  67. * a) w7 \& J  |0 d+ x
  68. dma_addr_t dmaphyssrc1 = 0;8 `+ x& z- t" |0 K+ ]
  69. dma_addr_t dmaphyssrc2 = 0;- X" m9 m9 i% E! [, A4 Z0 p( M
  70. dma_addr_t dmaphysdest1 = 0;& b" z, i; w3 g( ?( o( F
  71. dma_addr_t dmaphysdest2 = 0;
    ' w8 E+ g6 M) w7 ~# S/ h4 d& N5 }/ |
  72. 7 y4 d$ \9 b( H2 E
  73. char *dmabufsrc1 = NULL;
    % q& P2 V% z+ w2 U
  74. char *dmabufsrc2 = NULL;1 q8 C  f/ b3 y0 f9 R' Q3 y! T! u9 s
  75. char *dmabufdest1 = NULL;6 ?' P% b" n3 ]! {' l
  76. char *dmabufdest2 = NULL;8 A: `# c0 \/ x0 d& ^) c
  77. / y' z" a+ g6 v2 K4 [) R  J
  78. static int acnt = 512;
    ) }- D4 d: U: n0 X0 m, {
  79. static int bcnt = 8;2 ~+ y, x3 V9 Z# U" A
  80. static int ccnt = 8;& |% _- E# J+ z% @, `0 S/ f& T6 c3 Y- _: k( R

  81. ( x. q( C" M( P7 N% ]+ P+ R
  82. module_param(acnt, int, S_IRUGO);
    $ W2 l. K' J. d  l; L1 D
  83. module_param(bcnt, int, S_IRUGO);
    ) ^! I  _! b8 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ z  r5 V) n: @& t) c* E3 G
% d- f( [. r& l2 [0 w; w7 I0 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ [) q2 E5 _7 U# n: G) Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) A+ Q9 i* w! q) _1 M. E4 ?# o+ O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 \1 O* R* A& `
( N6 @6 Z; h' b) H. b  W4 D. P1 R
) L' h3 M, C1 |4 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 00:29 , Processed in 0.042016 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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