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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 i. W3 T8 _5 b, i* I0 F; V
  1. [code]EDMA sample test application
    # {( V- F0 O) y% a  v9 ?
  2. /*
    & ^3 u. k9 t- d  b- u/ t
  3. * edma_test.c
    3 ?2 b( a" n  p% ]" z
  4. *
    0 W" S- n! ~! v6 m) T$ P& {+ _9 P
  5. * brief  EDMA3 Test Application
    2 I! P. L8 K, W, H
  6. *
    4 }8 a. I, B. _( {- H1 Z4 b7 J" b
  7. *   This file contains EDMA3 Test code.
    ! j" o4 T. J( f2 z1 }; y+ R& U% ^
  8. *
    ! A$ z1 Q6 G; |1 X6 H1 B$ {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # R9 f9 e  u# h  Q8 K' w( j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 V+ ^+ j# g8 p4 c
  11. *         TO CHANGE.2 s: L5 P7 I, M9 [
  12. *, X& v: y" t+ u; K5 ]: K+ o7 E4 T: j* H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - h" o9 f2 }: G# g
  14. *
    % c7 {' G3 Y; L+ Z8 j" J
  15. * This program is free software; you can redistribute it and/or
    5 d2 y! U) w- |8 \
  16. * modify it under the terms of the GNU General Public License as
    ! O4 f3 S' m: I5 q4 {
  17. * published by the Free Software Foundation version 2.9 o$ p$ @( ]! M! `" ~4 ^' L+ T
  18. *6 s# X/ P) _' P/ F9 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 H. ]: O- d& t+ I6 |3 ]% V2 D
  20. * kind, whether express or implied; without even the implied warranty
    , Y5 A' o  _. [: X  l: ~, Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % d7 P6 R. S' N. P
  22. * GNU General Public License for more details.- e# n& t8 v4 \! G" p
  23. */& r# b# S3 i3 E9 ^: b

  24. ; P$ ?1 q; P. u& G. M
  25. #include <linux/module.h>( q. e5 y3 E3 ^  g; Q3 z% [5 ~
  26. #include <linux/init.h>. A! n) s4 Y; }/ B% t* ?! k2 A
  27. #include <linux/errno.h>
    - \/ N# }" t7 H" \& f
  28. #include <linux/types.h>, X5 U) [  v+ V& \* [
  29. #include <linux/interrupt.h>
    & v' H# O, G, m9 a8 d( k
  30. #include <asm/io.h>
    + l4 W7 ?! C- d6 n2 V: q7 a
  31. #include <linux/moduleparam.h>
    ( Y3 z9 E7 x4 @/ \, I! t
  32. #include <linux/sysctl.h># D. C% R# U0 ?1 a. y
  33. #include <linux/mm.h>
    . w6 b' x9 c( l/ \# M
  34. #include <linux/dma-mapping.h>) j; W+ c7 v( B. a' {' G
  35. $ G8 |4 z6 u1 Q+ U7 u" D
  36. #include <mach/memory.h>
    5 Y( [) t) g8 C* o! m
  37. #include <mach/hardware.h>
    * S* {2 J9 L2 }5 o1 L1 B) l7 E
  38. #include <mach/irqs.h>' ]4 }% Q4 p/ D2 W9 L( S( B
  39. #include <asm/hardware/edma.h>  ^, f: \# n: H* F$ u6 q/ Q2 ^

  40. 2 l3 `2 y1 _( _7 {, O% C
  41. #undef EDMA3_DEBUG
    3 }6 C9 o* A, M& L. p
  42. /*#define EDMA3_DEBUG*/& Q. o. g0 r& e2 v! j) X7 ^% I

  43. , j. T" X) d4 l# @3 t! o
  44. #ifdef EDMA3_DEBUG
    $ r# R" M/ X2 v. V/ z8 H- ~" h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 n8 w3 i2 h# P7 O) [' X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . R0 V5 u. C  P" j* j& n0 J% ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! ?; \3 |  @) a9 u7 ~1 N! n2 `6 r: e
  48. #else; E1 p' U8 z" f  S) P, A6 v
  49. #define DMA_PRINTK( x... )
    3 V2 B- `4 W% d4 @+ q. n$ r
  50. #define DMA_FN_IN
    ( i6 [" T3 e3 b# ]: `( c0 w2 l
  51. #define DMA_FN_OUT
    # g) x# Y' R$ y  w, w
  52. #endif3 a; s8 X+ i# C3 {9 Y/ Z
  53. 6 m- P; J4 [3 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / T/ b& x# `: u1 q# U9 k, {
  55. #define STATIC_SHIFT                3, Y' C. c* \6 s# n$ ~9 j
  56. #define TCINTEN_SHIFT               20
    0 C, X; B8 c6 d7 |
  57. #define ITCINTEN_SHIFT              21
    6 A, j$ a7 ]! c+ ?3 [
  58. #define TCCHEN_SHIFT                223 H. S% x0 i% l; A  z* u" @; r4 w
  59. #define ITCCHEN_SHIFT               23* Z* R/ J, D6 x  q
  60. 5 u$ i; C. ?* a% c) x
  61. static volatile int irqraised1 = 0;9 m5 G- v. }; A( x/ \! g
  62. static volatile int irqraised2 = 0;
    9 X1 c( H4 X, ~( H7 H

  63. - _7 u. ^5 m- Q& C7 z5 T/ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( @; {  t' P/ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 n# e% \" [; q2 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 |2 |( ^. a; n

  67. ! l1 S! V3 J3 q: ?$ Q' z
  68. dma_addr_t dmaphyssrc1 = 0;3 o  W$ p& M  J9 v
  69. dma_addr_t dmaphyssrc2 = 0;
    : ?/ r/ ~8 @2 q
  70. dma_addr_t dmaphysdest1 = 0;
    . k  I! {# e! ^4 ^& X& J
  71. dma_addr_t dmaphysdest2 = 0;( c% t: J$ O" n6 U! y$ W1 ^
  72. 5 D' e7 S  S+ [8 l% }) `2 F
  73. char *dmabufsrc1 = NULL;: [1 Z' {- A  f" _; {7 W
  74. char *dmabufsrc2 = NULL;
    8 Y3 m( X8 T  W! F& a& g
  75. char *dmabufdest1 = NULL;
    . C8 }! p" U6 \" e1 Y3 S# @
  76. char *dmabufdest2 = NULL;
    + i  H1 A1 c& z8 D9 e' v
  77. $ c5 L  ^! f. J3 z
  78. static int acnt = 512;
    ' d: e- j) n% J: p
  79. static int bcnt = 8;5 a) r1 I+ I: |% R: r, D
  80. static int ccnt = 8;/ L2 b  u" @8 P6 q/ Z4 [" S: |

  81. 8 D7 y( g: q. ]" n. h% Z
  82. module_param(acnt, int, S_IRUGO);  m4 \9 a) Z) p& q( P% X
  83. module_param(bcnt, int, S_IRUGO);
    1 e( ~6 D1 T. D8 _5 b5 [" S6 Z8 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ ]7 K$ c* Q" J. s; `$ y0 }
. N1 Z; q  I) W/ F( F4 ~  i. `; p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c( U9 T' G, U( }8 P. I3 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, e- @( n+ z8 l# o, C% {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& P! M2 r+ u' e" I% \# d% l. N

0 l) n  U& Z3 V4 ?$ Q0 G3 B7 @: x  C6 C4 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-19 07:11 , Processed in 0.042212 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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