OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 w! R. C8 a2 G1 e! Z, m
  1. [code]EDMA sample test application
    * U  f7 ]5 y8 U8 H
  2. /*! y  S" Z3 l6 ?5 h* @- I
  3. * edma_test.c) V4 j( O$ h# [% X' F) m
  4. *
    1 Q2 i$ L; \9 ]: C  d9 \
  5. * brief  EDMA3 Test Application
    6 _( a6 K) {; W6 f0 \/ [
  6. *( i. ?9 x) v4 U7 P7 R! j9 u
  7. *   This file contains EDMA3 Test code.
    2 u1 F4 v/ h. {1 E5 L
  8. *
    % d7 Z& u8 Z( v. n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 D2 r+ u, v) E8 d& {8 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `% m! v+ W: g, g. ], t) _
  11. *         TO CHANGE.
    3 y, y- |( m7 ?' i7 b  D! j! a
  12. *
    ; M" F, h% }- z& `5 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 u& i: A) T/ j
  14. *9 ^* F1 o, ^7 B2 d" n
  15. * This program is free software; you can redistribute it and/or
    ( C2 f) `* s- f. C4 R7 T4 ^, }8 I
  16. * modify it under the terms of the GNU General Public License as
    9 A  P6 b8 \7 O( Z& p# G" O; L8 X
  17. * published by the Free Software Foundation version 2.
    / t: y) E6 A; P9 i6 B( _- G
  18. *
    ) s+ r0 b6 i9 a8 Q3 A( }% g, I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / x$ g) @+ B0 o0 ?- e9 k
  20. * kind, whether express or implied; without even the implied warranty
    ( U4 m: ?* R* l3 @1 q% @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ ?# L% C. h; W- w9 d4 F. M
  22. * GNU General Public License for more details.
    + D* T" C, {2 `' x- w2 h  v5 A
  23. */8 E1 v: Z; `7 g# B
  24. ; ]& z, q7 J0 ^4 S" _
  25. #include <linux/module.h>
    * |! {* X4 y. Q" m- L1 g' m
  26. #include <linux/init.h>
    ' g! u+ L$ @7 k! U6 Y
  27. #include <linux/errno.h>
    4 O4 q+ e1 d5 n% f/ B! t
  28. #include <linux/types.h>3 W' O) G6 ^' {5 Z) W5 n9 b
  29. #include <linux/interrupt.h>. e6 s2 j8 `/ ?  m% _$ K
  30. #include <asm/io.h>
    2 z* K; y  z3 }. E; G
  31. #include <linux/moduleparam.h>
    6 S' q. G! l+ k; D
  32. #include <linux/sysctl.h>
    4 Q" x5 x+ F# a5 ^0 q
  33. #include <linux/mm.h>
    9 O1 x5 F" S* Q5 {7 }2 w
  34. #include <linux/dma-mapping.h># S& ]( {' B3 w- @3 b5 Z1 l# Q

  35. 4 h" p7 h+ f" H$ S3 l! P
  36. #include <mach/memory.h>! q* f* i& r7 a- n0 L5 R; C
  37. #include <mach/hardware.h>" C: ?% {1 ^  K# A& C% S  b
  38. #include <mach/irqs.h>
    ( J' \2 D: D3 K, o: W
  39. #include <asm/hardware/edma.h>
    ) |. G) b- M* X% {
  40. & ?' |, f! S1 s& P3 a# O( B
  41. #undef EDMA3_DEBUG9 \% q( X' i+ D  Z) ]: {
  42. /*#define EDMA3_DEBUG*/1 D9 Z6 n2 H9 u7 F2 S8 M! ]
  43. $ a2 G) ?4 Q- h; W$ r* H
  44. #ifdef EDMA3_DEBUG
    4 R2 _: K# f: Y2 ~2 i) |# S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ o6 f4 }! J8 I! C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' a5 x# w' }2 m) L2 ^* c- A6 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ W" r1 N7 C  Y0 F7 u% C4 O, P
  48. #else
    2 v8 u, q. u8 P& u% l0 Q1 W
  49. #define DMA_PRINTK( x... )1 ]2 H1 X' X0 ~. |
  50. #define DMA_FN_IN
    " ^. p4 E1 i( v4 z
  51. #define DMA_FN_OUT
    * A9 e, C4 E1 M/ m3 M+ d  {1 C; W0 C
  52. #endif
    ) b9 B1 V! p$ @* }+ X

  53. ( ^3 q, e5 ~' _% j; S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 z. [7 I) l- X
  55. #define STATIC_SHIFT                3
    8 l. i6 F$ I2 z* M% H
  56. #define TCINTEN_SHIFT               20
    3 h+ E& q# h, K3 F: j
  57. #define ITCINTEN_SHIFT              21
    ) v0 b! H6 V( u7 w+ w' I
  58. #define TCCHEN_SHIFT                22/ k1 x1 O0 Z8 z6 |
  59. #define ITCCHEN_SHIFT               23
    0 a  I* H( U! }- g9 C8 |2 J
  60. - a* E7 ^8 ?& Y  ]# J0 c! n( u
  61. static volatile int irqraised1 = 0;
    ' r: r; A/ ^6 C2 D9 c6 i' F
  62. static volatile int irqraised2 = 0;
    3 j' \4 c* @( K; {) Z5 ~& W1 J. w
  63. 5 Y# P$ K" w; e, R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ u. L4 e+ S# h4 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ], y  g& b. X. F( E! A5 U2 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 k2 e" P  N/ w8 I# M) N
  67. % J' J5 i+ I7 Z! k7 U! V* q9 Q8 q
  68. dma_addr_t dmaphyssrc1 = 0;
    . z4 a$ K) {8 i
  69. dma_addr_t dmaphyssrc2 = 0;
    ! P: f# L; W0 [, A2 q( G# ]* J/ V
  70. dma_addr_t dmaphysdest1 = 0;8 [* X6 E# K: r& p$ @
  71. dma_addr_t dmaphysdest2 = 0;+ l5 _( Q$ Y6 d' M5 i
  72. / g5 |. |6 X* {' r( d/ b  Y# u3 r) m
  73. char *dmabufsrc1 = NULL;
    & W- [( r9 o; g0 N3 c
  74. char *dmabufsrc2 = NULL;
    % D) \" q7 Z0 L3 Y$ u
  75. char *dmabufdest1 = NULL;
    / K' o/ j9 s* f( N* C
  76. char *dmabufdest2 = NULL;1 L( X7 |5 [& n' y

  77. $ i5 R8 h6 p2 D0 x7 c5 Z& P# k( i
  78. static int acnt = 512;
    - L& Q! U3 w6 Z2 }# b
  79. static int bcnt = 8;8 [' Y# {. _9 [! {6 q. p0 f
  80. static int ccnt = 8;& y2 v7 p- M( n" ], |* i3 i
  81. % u3 W. Z) h; G( Y; d* s7 r( o
  82. module_param(acnt, int, S_IRUGO);
    # v. d% @8 _1 Y3 S7 G& x
  83. module_param(bcnt, int, S_IRUGO);, A. I0 n) F7 x0 x$ s7 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# Y& w( g) Q6 k. m+ R
3 H# q- X. I3 q" J' @) R* X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, T5 C+ h  ~5 E7 L8 u9 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 n8 b1 c8 Q7 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 K$ F1 J5 Q$ |8 C/ p
+ G* t6 w" T( K9 D5 C9 w' v' a/ l( E& H0 m* e: l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-7 22:32 , Processed in 0.037612 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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