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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 Z) {4 g* k2 }8 F& Z6 l
  1. [code]EDMA sample test application5 }  \* s$ E. [% h
  2. /*
    5 T5 B% [# q" t( I% S5 p" L* }9 \* i
  3. * edma_test.c9 o# ^  c/ F+ s" ~+ |! _
  4. *- a1 [& ]& i! c, P& o. t+ K- Z
  5. * brief  EDMA3 Test Application( Y8 G' ~8 T1 S% U% m' ?0 [
  6. *, j  ^2 P1 d* J6 S- x% f) L
  7. *   This file contains EDMA3 Test code.
    % U5 ^, c' ~; a) ~1 ]/ r
  8. *: I& Z( V+ [: [& g9 H4 |& {5 I2 M2 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 H% V# _9 {5 T8 l) `3 K) A/ o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" G: t# C6 l) X& `% a8 w; s8 b+ a
  11. *         TO CHANGE.9 t9 r7 @3 _2 ?& J# W
  12. *
    ) x+ h0 x' V6 {9 w- h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 K% q5 o7 U" [% j" n& x, }# Y
  14. *
    " V* d' }3 c: c2 h
  15. * This program is free software; you can redistribute it and/or2 Z- t" d/ ~+ C2 E
  16. * modify it under the terms of the GNU General Public License as3 `5 d1 a% @7 z
  17. * published by the Free Software Foundation version 2.* k/ {) D* [& w$ {
  18. *' w9 Y7 ^6 [$ B0 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . l1 V! N' t* j4 D: P# B3 L3 T
  20. * kind, whether express or implied; without even the implied warranty9 m# E/ u, g: `# n8 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # J0 Q/ ^. l/ X* L0 s# |
  22. * GNU General Public License for more details.
    7 z! P7 d/ m1 g5 ^
  23. */
    # z! h7 u8 h, L! p) b  ]

  24. 1 g; L( t; B; c" `2 e
  25. #include <linux/module.h>
    ! t/ I5 O" b; L, v
  26. #include <linux/init.h>
    - D7 P! |2 i$ n( r. F1 ~
  27. #include <linux/errno.h>
    ' V7 [' \8 x' X, |
  28. #include <linux/types.h>
    ! V. B5 _% o# {. V0 g) R4 y. L
  29. #include <linux/interrupt.h># A( ~* f. Y; f# G  c2 f& u
  30. #include <asm/io.h># Y3 h. l; `; E+ [
  31. #include <linux/moduleparam.h>9 Y* t3 P- t# J( W2 v3 f
  32. #include <linux/sysctl.h>- x% \" r$ c- z2 L; k
  33. #include <linux/mm.h>
    " C: C7 e* z. d$ Z$ s
  34. #include <linux/dma-mapping.h>4 U; y: m* u* C  h( A3 }1 S9 }
  35.   D) p  {2 k' a: [3 R+ j4 Q2 c
  36. #include <mach/memory.h>
    4 E9 N% s4 P4 l/ D$ C9 E& d; _
  37. #include <mach/hardware.h>
    2 D" {5 f* _: D2 I! D
  38. #include <mach/irqs.h>; W/ S6 Q8 ], O) \* y4 M" {5 R
  39. #include <asm/hardware/edma.h>
    1 p' F$ i, M' V3 W& J' Q3 g
  40. " |  S% s' Z+ ^8 n# t" K8 k( e
  41. #undef EDMA3_DEBUG
      z  D8 u" _: Q
  42. /*#define EDMA3_DEBUG*/
    9 h) i; P" u0 l  ]- C* {
  43. # U' S7 B" [- a) B& O( [4 q( s
  44. #ifdef EDMA3_DEBUG
    , a2 u4 Y8 ]7 {6 P1 N* n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 m' i# Q! q+ b" a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( {$ D& q. @& T) t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " Y) p0 T3 n) p, v$ g4 h
  48. #else( M6 {- o, Y  }
  49. #define DMA_PRINTK( x... )
    2 a$ p) h, b9 S* |
  50. #define DMA_FN_IN
    " m/ I  c4 b6 K' D6 q) h1 X/ O
  51. #define DMA_FN_OUT
    # c( s% z1 p# R1 n, C3 C. w3 T
  52. #endif  @" K: A3 B9 x: M3 y' f% t
  53. , {8 o4 `7 _+ U9 }  e2 B  r( o, v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 f  {4 k9 a" k1 B/ X* G' {
  55. #define STATIC_SHIFT                3
    % M, c  T8 p+ ~* I# M
  56. #define TCINTEN_SHIFT               20# ?9 z% A% V  r1 W1 o
  57. #define ITCINTEN_SHIFT              216 E: r" E3 R+ N  x6 C5 _/ E6 k
  58. #define TCCHEN_SHIFT                226 V6 b0 C4 x6 H$ f! j
  59. #define ITCCHEN_SHIFT               23
      P/ X0 [& O6 `4 h" [* x0 a
  60. 8 a/ x1 F) f+ N/ j
  61. static volatile int irqraised1 = 0;
    - C! l8 L" V$ D8 }% Q5 G# R
  62. static volatile int irqraised2 = 0;
    6 }* Q  d3 h* I

  63. . P$ V. J' P$ g( D% x8 ~, i4 A1 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 c# V  [1 {9 V+ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' @1 a  c) {9 J/ O- T7 M% h; r$ k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A# J# W4 M( _/ ~/ n% @7 Y( t" w/ H
  67. 9 M' ]: w& g2 [1 k- `, Z: S1 s& V
  68. dma_addr_t dmaphyssrc1 = 0;
    + E3 x' i6 ^3 @) ~& k; V. Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ) u4 G4 G$ \+ v9 C0 h1 `) p2 z: ^
  70. dma_addr_t dmaphysdest1 = 0;, A4 H" X( `0 Y
  71. dma_addr_t dmaphysdest2 = 0;
    2 T. [+ N4 y& }/ g) {
  72. : n$ s0 K8 {, E* w
  73. char *dmabufsrc1 = NULL;
    % U! T' F7 ^, j
  74. char *dmabufsrc2 = NULL;* x. W8 _$ @% b2 t3 T2 I1 n
  75. char *dmabufdest1 = NULL;# z5 D* c1 j: B5 ~
  76. char *dmabufdest2 = NULL;
    5 W4 E4 v3 p1 l; `9 c8 ^( |  g# {
  77. ( z: {' F3 x& `" t; N
  78. static int acnt = 512;, E" c0 W0 |/ m' N; _" C1 }- V, G
  79. static int bcnt = 8;
      ?% E) H9 p  x
  80. static int ccnt = 8;  u' v2 p6 \( I5 {

  81. $ F( ]' g$ V# G
  82. module_param(acnt, int, S_IRUGO);
    : x4 ]4 @9 D- X  e+ h& |. r- R5 K# P7 z
  83. module_param(bcnt, int, S_IRUGO);7 N* U; ~5 t: R/ \& {9 D8 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ d4 V: p+ r2 {6 a7 Q
% G  O9 ]. e8 R6 n( A& c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 Y. q2 @9 l; Y* warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  K6 Z1 N8 ~5 L' h5 K& \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ R% A# X% M, b8 _  K7 O4 K% h
( _& {; R, a' C4 {, s

8 z& `) H4 ?" s$ j6 k  G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-29 16:13 , Processed in 0.041433 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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