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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ |; n% @( n, V) `/ p
  1. [code]EDMA sample test application
    + O# ?3 }/ C: S; x
  2. /*
    % _  R" ?7 w, U5 l( q+ `
  3. * edma_test.c/ A0 i+ Q5 }8 f1 O
  4. *+ H, a0 `$ ?" Q+ Y+ L1 F
  5. * brief  EDMA3 Test Application  m: ]; _% ~( u  R4 J- E) r( p2 M
  6. *2 ?; H$ e7 K( R: s) n7 O) @2 v
  7. *   This file contains EDMA3 Test code.
    ( _& k+ w5 B$ r$ Q0 V5 s
  8. *
    ( i* g; y" D* ?+ ]8 x" N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      z+ X+ {7 }3 J+ A. `$ h7 c! {' D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: x- @9 {2 N) \
  11. *         TO CHANGE.7 g/ F( P, C) y% H* z7 G) j5 B
  12. *
    % T7 S8 F5 v6 D( H4 F: I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * C6 K, i& k5 t! X, R  l
  14. *( J' H: p* a& v8 a4 ^
  15. * This program is free software; you can redistribute it and/or
    - l7 F' C+ K1 l, k1 t
  16. * modify it under the terms of the GNU General Public License as( y% T: C" N% S5 L
  17. * published by the Free Software Foundation version 2.) n4 N6 }- M5 ^  Q" u6 D+ h: i
  18. *2 ~' [' M- E$ I6 K  j- F6 Y- H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      h; f1 m4 J; N8 y$ b) y
  20. * kind, whether express or implied; without even the implied warranty' k( t7 |. I9 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! n: A6 Y7 r, ]5 d/ ~( d% j; g
  22. * GNU General Public License for more details.
    3 o8 m6 ^: Q0 {6 ?; R& {
  23. */
    7 O0 _+ N/ B) s; t
  24. 6 c% O1 \( X5 I$ z6 q* I
  25. #include <linux/module.h>$ s) _! e7 U5 f2 X. |  v3 q$ ^
  26. #include <linux/init.h>1 |4 b. `" S6 ?7 r; x! O
  27. #include <linux/errno.h>% `, ?% y9 s- J* L4 `- w" ~+ T
  28. #include <linux/types.h>1 R# }1 i  F$ [4 e; U3 [
  29. #include <linux/interrupt.h>( D# P; G( r. \5 o7 t
  30. #include <asm/io.h>- d" Z) v8 n) K7 j
  31. #include <linux/moduleparam.h>
    & l7 k1 i* P& A2 v) ~
  32. #include <linux/sysctl.h>
    , K  X! g/ p  w/ ^
  33. #include <linux/mm.h>
    6 Y6 E) y# e; Q3 D" @! ?
  34. #include <linux/dma-mapping.h>; I+ E; {3 u/ R; S
  35. ( L+ p9 j+ k/ f( M: u7 G
  36. #include <mach/memory.h>% E/ H' D1 [: U" k% c1 O% \9 E
  37. #include <mach/hardware.h>
    9 H; ]* [/ k4 d# P
  38. #include <mach/irqs.h>
    , X( \' s, J  R0 c, H0 v- c/ F
  39. #include <asm/hardware/edma.h>
    4 h8 \$ K6 _5 u7 g, e
  40. 9 _+ C5 d3 k; q) E/ @- K
  41. #undef EDMA3_DEBUG
    8 U: w/ C; h- k
  42. /*#define EDMA3_DEBUG*/& o( C5 P( M, C: c& P. ~
  43. % Z# I. M. X6 [
  44. #ifdef EDMA3_DEBUG4 R- X. L& S( x- Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% U, n# @! Y( d! V. {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# j0 B7 f& t+ r$ n8 ]8 D4 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& m0 m- ~+ H" D7 v4 C8 Y
  48. #else% h) q! r! K; y! V
  49. #define DMA_PRINTK( x... )
    ( N% l, h# S- G+ {9 _) G
  50. #define DMA_FN_IN  i% e# s1 e8 C# w: L) y
  51. #define DMA_FN_OUT
    * Z5 o. M& l; g% A! D' j+ L
  52. #endif) e, J" M! d, U. z8 x- S7 L! A
  53. 9 j: V2 Y+ w4 x. B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' ]* K" N) u+ O
  55. #define STATIC_SHIFT                3* V$ e! h' S; f. L1 C
  56. #define TCINTEN_SHIFT               20
    # |  I- L7 E8 T: {0 F% I3 E+ }5 k
  57. #define ITCINTEN_SHIFT              21
    8 j7 w4 ~( E# @3 c/ ~, O7 T& x
  58. #define TCCHEN_SHIFT                22( D7 T- t- _1 m3 F# K! ], ~8 I% T1 U
  59. #define ITCCHEN_SHIFT               23
    2 b! o5 d1 m& Y+ v; g3 e. ^2 F6 ?

  60. - d8 I  _, d  }7 {8 Q4 n5 r" I3 I, `
  61. static volatile int irqraised1 = 0;
    + h; T6 l! u5 e" u/ B6 [6 g
  62. static volatile int irqraised2 = 0;
    , G* O7 \- s# P3 E
  63. ; G8 O/ V& G0 M, c9 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; D0 W7 J1 x  j8 J# J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; l7 g7 X  M+ r/ ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {4 x. i# u& P: Q

  67. ' Z9 e; `; G2 J2 b! @4 e, i  t
  68. dma_addr_t dmaphyssrc1 = 0;9 o4 j* `" i; }8 x5 H" W
  69. dma_addr_t dmaphyssrc2 = 0;* n( W4 e$ q9 \- N7 A
  70. dma_addr_t dmaphysdest1 = 0;
    $ w( a7 E  }( H  b% ?+ v4 d3 A5 q
  71. dma_addr_t dmaphysdest2 = 0;
    + A. B! i+ N7 @
  72. 9 s9 F4 G% t( s- E/ v
  73. char *dmabufsrc1 = NULL;
    1 a, I6 \: r1 `1 V! t1 K* h
  74. char *dmabufsrc2 = NULL;
    0 s: H) c& Z: k5 @
  75. char *dmabufdest1 = NULL;
    7 C# d- B- g1 b
  76. char *dmabufdest2 = NULL;
    * p; q$ W# |( c6 g1 w

  77. 8 V$ O, z. G( `' T$ Q
  78. static int acnt = 512;
    9 o2 o. x; U/ M% T, l" J  W
  79. static int bcnt = 8;) d+ ]% k7 Z4 E5 W! t4 V: X
  80. static int ccnt = 8;: \# f/ y4 o+ V. `9 l

  81. 4 S- c0 R: k& s7 d& _
  82. module_param(acnt, int, S_IRUGO);
    , V5 D) r6 G: d0 M& O' d. N  u# ]
  83. module_param(bcnt, int, S_IRUGO);
    & ]9 V" Q3 l! f* n. u7 D" A6 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% b( o% T6 V) p" Z/ e

8 P- e# v, b8 ^$ e: U6 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" i, v6 t  Y5 V' a, b% g
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 |; r" ?1 {, B3 t8 W& f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 U* j* Z  e( A

/ Z5 j0 J$ U; ^$ l7 \% s% J& T1 `1 ]0 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 09:26 , Processed in 0.038938 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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