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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 I0 K$ \& {0 j* q) r4 m
  1. [code]EDMA sample test application' O3 k; J. I/ d. ~
  2. /*
    * e, G# z* f, x  ?
  3. * edma_test.c/ Y2 M9 y' B4 W' m
  4. *1 _+ S# s- r3 m* }; ]8 X+ q
  5. * brief  EDMA3 Test Application
    % [1 R0 r- g# }
  6. *1 m: @4 [  g/ X! R% [6 i3 ?
  7. *   This file contains EDMA3 Test code.4 j  P4 F( r: P9 I! n/ m
  8. ** Z6 q+ ~- x2 k4 U1 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * I0 a; {, T  o! ]* Z* C" k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 Z" L8 q- ?# u& j2 I
  11. *         TO CHANGE.
    , C; k0 B' y! J9 a
  12. *
    # x/ x; g9 q8 B0 O2 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 Q8 b$ d8 E% v( Q2 P
  14. *
    1 r  e; s9 {* c% B- [- G' K# i
  15. * This program is free software; you can redistribute it and/or
    ( V5 h4 I9 Q" A
  16. * modify it under the terms of the GNU General Public License as# E3 Z' t0 _" m2 j( Q. R3 E
  17. * published by the Free Software Foundation version 2.# D/ A0 u# s0 o% ~2 b$ Q
  18. *& X+ j: f0 \! ?; d' z2 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ]% X% s/ t( a# x8 n6 f1 x1 b
  20. * kind, whether express or implied; without even the implied warranty
    1 d& h9 K) N6 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 |7 o, w" i2 h/ ^
  22. * GNU General Public License for more details." h6 b% G/ a; t2 p7 \( |* {
  23. */- R6 o2 l  |9 s1 }' M0 ]5 S
  24. # b$ {) F3 M; t6 E& Y
  25. #include <linux/module.h>! Y' U. \* m6 \
  26. #include <linux/init.h>) u% ?4 r7 E3 _1 f
  27. #include <linux/errno.h>
    3 q  Q5 t5 H  G2 x0 j. Y! O, h, o& h
  28. #include <linux/types.h>8 W- f& F. r1 x3 T' J( m9 ~# |
  29. #include <linux/interrupt.h>; O# e6 c7 o; @4 z
  30. #include <asm/io.h>
    . M7 H* V( m7 o0 S3 e
  31. #include <linux/moduleparam.h>
    % D, ~- H  l$ S% b& B) _! X6 l
  32. #include <linux/sysctl.h>
    9 t: _# Y6 P/ |, _$ |' R
  33. #include <linux/mm.h>( e( h  g: x* D$ X7 P$ r
  34. #include <linux/dma-mapping.h>0 T: L+ [. f; v

  35.   |0 q9 `. s" Q* G# V) q: c
  36. #include <mach/memory.h>
    / q5 J; ^$ [+ N3 A$ O; S6 M
  37. #include <mach/hardware.h>% R3 w& e1 r/ B  Z; U5 `
  38. #include <mach/irqs.h>, N. G5 a  [/ L# _  Q
  39. #include <asm/hardware/edma.h>& x5 O/ b1 J  [7 p
  40. 8 r5 D& w" \2 w' L. _
  41. #undef EDMA3_DEBUG
    ' }$ m3 }9 t, m# V4 |4 L
  42. /*#define EDMA3_DEBUG*/
    2 J' Z5 e: e8 ^. f+ ~

  43. * J6 W7 h' D) J" i
  44. #ifdef EDMA3_DEBUG+ U5 s+ ^  G5 b+ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 b6 k+ ]/ [2 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); R. Y& i7 ], {% L* r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) A  C" i# t4 a% B
  48. #else( g" K+ K( `# E5 ~: p: l7 l9 b2 z2 B
  49. #define DMA_PRINTK( x... )
    8 x. N7 ?" V7 V4 R8 ^
  50. #define DMA_FN_IN- g1 V0 z# q' F, f/ Y4 u# y
  51. #define DMA_FN_OUT
    1 I/ Q. O! d% D+ M7 k1 J3 U% F
  52. #endif
    3 ]: X5 B8 H* _0 Y' _0 z" q: a$ v/ ]

  53. ' Y* c9 m6 w; k1 |- o4 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 k% j, i$ _; {* U. t# T
  55. #define STATIC_SHIFT                3
    % W6 i7 j% `1 O2 U6 O
  56. #define TCINTEN_SHIFT               20& y9 y& z2 r( [* M# D  f7 ~
  57. #define ITCINTEN_SHIFT              214 A  p8 S6 X! T  \4 R$ r4 @
  58. #define TCCHEN_SHIFT                225 o1 h9 ?$ y( j: ^1 s" ^+ j
  59. #define ITCCHEN_SHIFT               23! c- E2 s; L( E( ]) f; p
  60. , ^( R) }7 {4 Z* ^) V* o+ H
  61. static volatile int irqraised1 = 0;
    $ ?; s: l4 _$ `. z! H
  62. static volatile int irqraised2 = 0;- a' w! S# L) |
  63. : s6 I+ a5 b( X! t6 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : H! F6 x4 H! \7 i# \: t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _+ W6 p$ ]9 V/ N3 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u6 |: V+ _3 K/ M
  67. ( z2 j9 E; v7 `) s
  68. dma_addr_t dmaphyssrc1 = 0;3 B6 S/ Q+ [' \6 |. J! |4 B
  69. dma_addr_t dmaphyssrc2 = 0;1 X5 x8 s" O; w' H, K
  70. dma_addr_t dmaphysdest1 = 0;
    9 J: m1 z5 U$ P) s
  71. dma_addr_t dmaphysdest2 = 0;
    5 }/ ~5 [9 y8 N+ e* J# @$ W6 j( N
  72. 0 {8 g4 U8 H9 e; S$ b& P# N; A6 G
  73. char *dmabufsrc1 = NULL;
    5 J% n) q# `" C
  74. char *dmabufsrc2 = NULL;
    * ]5 G' R! H4 {4 |9 k4 d
  75. char *dmabufdest1 = NULL;
    ; w5 t+ H- |) Y2 h4 W. _+ S
  76. char *dmabufdest2 = NULL;0 p: p1 N6 o" y6 e1 k5 W- t3 `
  77. % z2 @0 L7 I; \; A/ m" o
  78. static int acnt = 512;0 U6 \( D& ]& o# L0 R
  79. static int bcnt = 8;$ J. ~& T. w5 [
  80. static int ccnt = 8;
    6 N8 C) E+ ~6 k  D7 t

  81. ) g- ]- J4 E" m, ?
  82. module_param(acnt, int, S_IRUGO);
    / n9 g; o; U' X0 X4 y3 q' r
  83. module_param(bcnt, int, S_IRUGO);( Y$ m) T/ d. b# o9 S' D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 R1 g; U6 D7 V% {$ E, S1 Y" m4 \. p

. g( j9 s" V4 j# y# S) a7 a# S9 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! L  z2 G& x% e; p# }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% w3 c' B0 x5 ^* d4 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 n$ `2 R! y1 s1 o
% ~) K( _: y) I, e$ `; m6 F( D# G+ F/ G$ P" U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-22 23:00 , Processed in 0.042783 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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