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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 y7 \4 J% W( a8 U, e5 k
  1. [code]EDMA sample test application
    & [4 h* d5 b0 H+ A$ K
  2. /*$ V; d! F4 F: L% j
  3. * edma_test.c7 F7 r6 W  ^2 {2 W4 h4 f  V
  4. *+ |3 w' T/ Y8 P: E; x) ]
  5. * brief  EDMA3 Test Application# E% v2 f& z9 Q; y2 _
  6. *- O, A# N5 f( i) H
  7. *   This file contains EDMA3 Test code.
    ! ~, j0 a# [: A5 c+ u3 n& ]( g
  8. ** ?+ n" B3 Z/ C- O5 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . f, k1 P% m6 J  x% C0 i* v$ N, B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * l, I. U  `. ^
  11. *         TO CHANGE.
    4 P# h( c3 i# }6 S5 t
  12. *
    ; l. z- q/ f, O' ?: m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - U+ f( B7 X3 d" l: ~
  14. *
    ( N3 d  t. o( D
  15. * This program is free software; you can redistribute it and/or
    2 c' l/ `$ i# e5 f5 U6 [+ B' i: y
  16. * modify it under the terms of the GNU General Public License as% i6 n! A7 t) g8 t. \0 v
  17. * published by the Free Software Foundation version 2.
    1 p7 s' c3 p& P- ^6 Z' S
  18. *
    $ r5 F& L; Z  B) T  I4 f, _% ~2 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) h, D' X" O) t; V$ D) y
  20. * kind, whether express or implied; without even the implied warranty& |" E- K$ d# i8 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 G/ P& T& R6 \) f8 i0 ~; M
  22. * GNU General Public License for more details.* n' |# |3 D- i9 Q
  23. */
    / J9 j9 A- n' H( c% l2 E

  24. + R7 J3 |0 Z. I' T7 D
  25. #include <linux/module.h>; `, e7 z3 B/ i# K. d* g  V) q
  26. #include <linux/init.h>5 G3 [" H: z' m' D4 O& U
  27. #include <linux/errno.h>
    , U! @; w6 h4 h  C  N/ H5 H
  28. #include <linux/types.h>
    / `$ X5 ^% f  B% N
  29. #include <linux/interrupt.h>
    : d$ N# F* g" K" g" n+ _. J) H
  30. #include <asm/io.h>
    ; Y9 K7 |. Q5 n- g5 i' g
  31. #include <linux/moduleparam.h>( v* s0 D: s$ J& \. z
  32. #include <linux/sysctl.h>
    6 L. ?  P! j( f, u8 g
  33. #include <linux/mm.h>% L2 `) \* t9 F  ?5 F% v; J+ Y" D7 e
  34. #include <linux/dma-mapping.h>
    ( V4 |4 K. b3 T7 H  H" z& A3 v% M: ~
  35. : H" b1 {% b% a" S
  36. #include <mach/memory.h>5 t6 x: T9 N( S% z. a
  37. #include <mach/hardware.h>
    6 Z+ z2 R# G& p8 I: K
  38. #include <mach/irqs.h>
    9 |% W- {) p( b, E$ U( l
  39. #include <asm/hardware/edma.h>
    , M8 I7 {8 s$ U& ^* I  Y
  40. , J8 t1 W8 x2 x8 E3 w8 ]+ x0 s
  41. #undef EDMA3_DEBUG  e5 K  u! X9 u, G
  42. /*#define EDMA3_DEBUG*/
    2 @! e" C4 ~7 _4 \. {

  43. / ]0 t9 ~1 X9 L  Z
  44. #ifdef EDMA3_DEBUG; W5 S# b" v, I' H( I: @7 {3 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): q; U2 k7 }" `. F0 V4 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 B  p8 {2 a* O- k9 c$ t: Q+ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 u1 L: A" R( L" \* x$ o0 N9 C1 N
  48. #else
    / x% U' s# o6 Q9 q: ~
  49. #define DMA_PRINTK( x... )6 X- H6 k  V1 o0 Q2 ^8 ~* S7 }
  50. #define DMA_FN_IN5 k: {1 ?  e5 C* a! l8 n2 b
  51. #define DMA_FN_OUT& f' `( ^2 n7 W  N' ]
  52. #endif/ s! u0 M# D& ]4 u1 I5 r

  53. ' m+ i+ Y4 N* o% Q3 ?! B2 D) D4 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % \+ ?  O: @1 p. `7 R% t
  55. #define STATIC_SHIFT                3
    & I7 |3 i) g) @% x, n
  56. #define TCINTEN_SHIFT               20
    0 f: P# u2 {9 s* F5 ~
  57. #define ITCINTEN_SHIFT              21/ a9 n$ o) u3 P& D# B5 D2 ]8 K7 M
  58. #define TCCHEN_SHIFT                22! D, l4 h+ E9 |8 H% i
  59. #define ITCCHEN_SHIFT               23
    4 e( `1 d- `8 I  B( X% P  ?
  60. ' h( g: }& ]# v9 ], I' s
  61. static volatile int irqraised1 = 0;
    3 i1 _6 p1 h' e
  62. static volatile int irqraised2 = 0;
    7 c1 C7 Q* w' d4 y7 O

  63. # I$ G1 j1 ?7 ^) K/ |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % u( d( l: g* [* A0 e  r, G7 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 l, T  R; F& g2 w# m0 U5 t2 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; J6 Q: R( ?! {
  67. % G7 E7 G, D6 t6 x- C7 n
  68. dma_addr_t dmaphyssrc1 = 0;
    5 ~+ ?( g+ t3 C/ t, J
  69. dma_addr_t dmaphyssrc2 = 0;! X0 f2 I9 ^' `% `$ D
  70. dma_addr_t dmaphysdest1 = 0;7 k$ g$ L, V) `. g6 E. c" }* Q
  71. dma_addr_t dmaphysdest2 = 0;
    ; ~: X2 c$ m6 p9 y

  72. 8 \1 `7 N7 |2 c6 D3 [; c
  73. char *dmabufsrc1 = NULL;
    $ z% S: u1 b; N
  74. char *dmabufsrc2 = NULL;
    ; M1 t- b7 V4 [8 ~: k
  75. char *dmabufdest1 = NULL;" ~$ M" G; N$ w: t5 V! q
  76. char *dmabufdest2 = NULL;
    3 w- l/ X7 T2 M1 m$ t
  77. ( ]5 Y2 ~, k' Q& M/ i
  78. static int acnt = 512;
    3 C7 B' x1 r# z4 w$ ^7 L9 {
  79. static int bcnt = 8;5 q1 R& R& t0 B6 H
  80. static int ccnt = 8;
    5 A  @" \7 `/ |# }
  81. % N8 j* S# w0 k, D4 L" a* Z9 D- d
  82. module_param(acnt, int, S_IRUGO);
    2 `1 c; Z# @# Z( D; R$ b4 y
  83. module_param(bcnt, int, S_IRUGO);% I' f# y8 @8 Z& C# s6 a2 o: x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 c  E3 i/ ^* F3 w" E4 k

2 M7 R3 h' Y' A5 h0 |1 \  @* [$ a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% ?  c. u: z. F3 _8 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ Q6 }) `9 B2 c( Y9 S4 G. q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 e8 V0 o) v" c/ X
6 a5 ~& T0 B" |! H, k! ?1 P: k
$ x* F! u0 c! M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-23 21:51 , Processed in 0.046003 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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