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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 v! \7 u5 }# w, S8 p9 _; l
  1. [code]EDMA sample test application" T( _. a' L5 d7 U2 m
  2. /*
      f+ W: b1 {4 |9 f7 Y2 h9 b
  3. * edma_test.c
    $ y2 ^5 m% I# T1 I2 b
  4. *
    1 p& I2 u1 p3 ]$ ^7 y) g; V2 ~
  5. * brief  EDMA3 Test Application1 w3 c9 `( W3 o6 P  P
  6. *
    # d- u3 h1 n4 t
  7. *   This file contains EDMA3 Test code.
    ' H7 p! W7 V5 i; E% e1 \
  8. *
    ( i" m8 T8 q5 ?% o, j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ \( C3 ~7 B% N5 \; U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + t1 D5 E/ v( k5 f% O: V
  11. *         TO CHANGE.2 M; d$ d7 n6 a( x
  12. *
    ' H& [4 w% h- s; E5 @4 Z# v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" X+ N; Y( w1 o$ _: e+ O
  14. *
    5 o7 O2 b" r( y/ f: E
  15. * This program is free software; you can redistribute it and/or& `0 T3 i2 s; v# v4 e) u
  16. * modify it under the terms of the GNU General Public License as& P% q/ c7 p3 `$ y8 b8 R; |( A  b
  17. * published by the Free Software Foundation version 2.
    8 u# F$ s, x5 `) `+ t
  18. *
    ; j6 V( `0 ^( y% P6 ]3 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 R- \) F2 H- J0 \7 c
  20. * kind, whether express or implied; without even the implied warranty
    ! }7 h- Y2 F# q7 _# ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 p3 u3 d3 I: U2 i7 z
  22. * GNU General Public License for more details.2 c$ v& b5 @( o% n9 X0 `
  23. */
    # r# p# O& C$ {# e8 E9 x. d8 ?
  24. + _; ?8 L  R2 c8 v' u* S0 \' ?7 v
  25. #include <linux/module.h>2 n! u& \2 {: k( U/ L
  26. #include <linux/init.h>
    ' E, w+ n9 z" Z6 b
  27. #include <linux/errno.h>8 b. E& m: Y; t- M8 m: g7 b$ V- a
  28. #include <linux/types.h>
    ) o& ~0 c7 S) x* H! d
  29. #include <linux/interrupt.h>
    % m3 Z' }' i! U; e1 h) m4 L( L
  30. #include <asm/io.h>
    & Q+ e/ d/ K8 d; g
  31. #include <linux/moduleparam.h>
    ) w+ B5 H" n6 U1 J' @, @( ~: x
  32. #include <linux/sysctl.h>
    - F4 J7 S, r! `' J0 j2 z" ?
  33. #include <linux/mm.h>
    % W1 a; z# |1 r* C9 w  d9 L$ h. Y
  34. #include <linux/dma-mapping.h>- A, r/ \! }/ @9 ^  {9 C

  35. 9 `$ Q8 [9 `8 n7 `( w
  36. #include <mach/memory.h>
    ) ?% U6 R3 c- N* L: B
  37. #include <mach/hardware.h>. ^) b& {! T6 z( t) i1 c
  38. #include <mach/irqs.h>
    9 G" G2 R1 H( b2 a6 p
  39. #include <asm/hardware/edma.h>
    : I6 {) a. h7 O) P( j

  40. 3 i  {( K9 U2 C" i$ o8 ^
  41. #undef EDMA3_DEBUG
    & K3 J* \* @. |( f8 e# U
  42. /*#define EDMA3_DEBUG*/! h( m6 p) @' l

  43. : ]; [$ }3 x9 f, ]
  44. #ifdef EDMA3_DEBUG
    2 c* R, _1 }, j) y1 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( e8 K: h$ P3 J  J5 o2 g* t5 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 ?  X/ Y& f6 u( F! f! P$ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " J+ g# q2 H4 n; s2 r
  48. #else: _. Z, f$ y8 u: j  `
  49. #define DMA_PRINTK( x... )
    8 N8 r' W. U& S1 E/ }
  50. #define DMA_FN_IN  T' \( P: c7 u) D
  51. #define DMA_FN_OUT
    * H3 L* T$ B/ b$ a# w# P
  52. #endif+ S* [: \( S" i  t

  53. , {) Z( A; _4 v. e& x- G8 s3 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 S4 v! H% ~& C3 C
  55. #define STATIC_SHIFT                3
    * x2 a% b4 S7 z3 d: z
  56. #define TCINTEN_SHIFT               20! w# P$ L! n9 `$ w/ l
  57. #define ITCINTEN_SHIFT              213 D, g# {- `9 _4 f) [7 T1 S
  58. #define TCCHEN_SHIFT                22. G/ ~6 P' k$ F$ U' e5 w8 e
  59. #define ITCCHEN_SHIFT               235 I$ R( k" E' V8 u) c$ w

  60. ) R& |& N1 S% |( j; S" m, M
  61. static volatile int irqraised1 = 0;/ V/ s4 R, A; q& @& f: p
  62. static volatile int irqraised2 = 0;
    + m$ ^% x0 E% \! W$ ~
  63. ) H4 c& W; d. i5 V! y+ G3 Q7 k4 N) T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & B4 M$ M( ^$ n" e0 d9 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ v: D! P/ m# R/ a0 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 j6 |, c. V# T5 B' ^3 Z  l
  67. 8 \# @3 u7 E5 I% C8 X
  68. dma_addr_t dmaphyssrc1 = 0;
    3 R+ W3 _. Q% E( r& b+ F. l
  69. dma_addr_t dmaphyssrc2 = 0;& X- e  T8 h1 O4 _, U2 G
  70. dma_addr_t dmaphysdest1 = 0;; t4 q( D  W" x
  71. dma_addr_t dmaphysdest2 = 0;5 s; |9 I, u- T; p6 O/ ?* i/ G

  72. : X4 a0 B6 }# |
  73. char *dmabufsrc1 = NULL;7 y2 A( F% h3 [- c+ Z4 p
  74. char *dmabufsrc2 = NULL;
      M* i; y' }( o% A; w# e
  75. char *dmabufdest1 = NULL;. W3 D" d) _: ~3 L7 @1 L6 Z
  76. char *dmabufdest2 = NULL;  }8 D6 s2 N8 e# m5 y

  77. 7 J# G0 r4 H" X" _( u' w0 K) N
  78. static int acnt = 512;! I/ s( }  {6 v% v: M/ ]+ q
  79. static int bcnt = 8;
    + {& P1 e4 z, {: g5 X6 r$ n3 |
  80. static int ccnt = 8;
    5 f+ c* i/ y1 @3 T8 v

  81. 9 B2 [/ Q& g9 p3 [! o
  82. module_param(acnt, int, S_IRUGO);
    ( W7 J1 i4 ^; ?; E8 \5 Q4 D
  83. module_param(bcnt, int, S_IRUGO);! j' P3 _5 e& K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! H4 E- n$ [5 F( t
0 c" f7 b: n- S, p  F8 F( u$ F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `: P7 n' L+ L, s; g7 Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 L/ u  h7 c1 l1 c% y# c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 K7 ?3 y/ \0 z+ W$ F3 S3 g, g  O, D" e* z

6 W5 ]/ T: x1 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 15:23 , Processed in 0.041514 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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