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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + I) v$ \5 @+ ~7 r6 a0 v
  1. [code]EDMA sample test application/ o$ l. p. B- o. `5 T; z
  2. /*4 J* ]2 Q, N, r. [  H6 k* Z: o$ X: b9 f
  3. * edma_test.c
    0 m" q: h3 l" A5 _0 T) F
  4. *
    ; o, N- [3 R# b! W* z
  5. * brief  EDMA3 Test Application9 `: [8 \, l. l/ ^1 n# n$ M
  6. */ v3 q" p2 X' x( {: H
  7. *   This file contains EDMA3 Test code.2 {5 e; }9 F0 T
  8. *  }9 Y  j! Q5 W7 D5 R) a/ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 g, F$ A, {! z, R6 W! ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; S8 y6 G6 _( l6 E, B: O/ n
  11. *         TO CHANGE.
    ! w  _: R* i& j1 x; l# ]5 H6 x
  12. *, G6 B: _  o4 d$ i6 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' {1 `0 k0 U6 V5 X' u- p
  14. *; q2 H3 ?/ \) \- _0 I/ Q- j
  15. * This program is free software; you can redistribute it and/or4 o* B: D9 J9 l' q
  16. * modify it under the terms of the GNU General Public License as3 |! T$ Y" {- K6 A
  17. * published by the Free Software Foundation version 2.
      x) d4 O" U3 ^# B; Z2 c
  18. *
    / ]/ Z) _# r0 I( W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& }# z2 Z0 q1 k, m3 M3 u7 J
  20. * kind, whether express or implied; without even the implied warranty- r* J0 Q. R# J3 D' n; W) v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 S3 a( [" N/ |. z# N- @
  22. * GNU General Public License for more details.
    7 I9 e) l" H: ?5 N/ J3 ]
  23. */( J9 O. O5 D8 ?. G' N7 s

  24. / G1 n& z1 c) O- M! c  ?2 i. p
  25. #include <linux/module.h>
    ) @7 \2 }  R' k, K5 M0 G6 {- V
  26. #include <linux/init.h>( Q9 C& ~% g; |; d: A& |+ U3 s
  27. #include <linux/errno.h>  W/ _8 H# J* n7 X1 X
  28. #include <linux/types.h>( ?  s& f5 P  q" Y' U6 }
  29. #include <linux/interrupt.h>2 E4 k. |' T" z: G
  30. #include <asm/io.h>, ^2 U0 x. w  S5 h: |0 u6 L5 V0 }  a
  31. #include <linux/moduleparam.h>, ^& p" j5 z, r7 m6 j5 M
  32. #include <linux/sysctl.h>
    / N, c0 R, M& r
  33. #include <linux/mm.h>
    ! t( l6 N% `, l0 c( U
  34. #include <linux/dma-mapping.h>
    9 v( l2 s( R/ x) j8 t1 u
  35. 7 K" h3 t9 T1 c. d* i' S
  36. #include <mach/memory.h>6 E- _1 x/ C/ ^- S# h
  37. #include <mach/hardware.h>
    0 r0 h' k0 z# p/ u
  38. #include <mach/irqs.h># ^6 ~7 Z  u+ d; a. c
  39. #include <asm/hardware/edma.h>: }4 k, p  @1 Q; x

  40. - j" z) p/ `1 a$ K" z
  41. #undef EDMA3_DEBUG
    # R  V* w) v8 h
  42. /*#define EDMA3_DEBUG*/- H0 k; X- b* P4 G' s" \

  43. 4 D3 i1 i5 B6 T9 Q" ]) ^
  44. #ifdef EDMA3_DEBUG. P+ K2 D* z% n. a* D- @6 l: }  z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 v+ U( I% V; A. M; E0 f" V; Y7 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D1 U: L/ V. n( U" x+ b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f5 s. Z' n3 ~& \4 E3 [
  48. #else- R2 L+ N! N! @* T
  49. #define DMA_PRINTK( x... )
    ( e  @! p2 W9 @
  50. #define DMA_FN_IN" K; [3 p0 Y2 L
  51. #define DMA_FN_OUT
    % e$ S' d! t3 x/ _) \" L! L3 U
  52. #endif( g8 m6 ^, V) h; I
  53. # F  r  C2 V. c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 C# Y. k- \( R) t9 Q! F! y) `3 g
  55. #define STATIC_SHIFT                3
    7 A; L3 X6 _" R
  56. #define TCINTEN_SHIFT               20& h. F8 Q8 E4 a0 y- Q' X
  57. #define ITCINTEN_SHIFT              215 \8 A- V. L, H$ Y6 `
  58. #define TCCHEN_SHIFT                222 V- @- ?6 j; h- R5 E) C" }/ O
  59. #define ITCCHEN_SHIFT               23
      B/ ?4 f! P. D# R/ Z
  60. 3 f0 D3 M% M! \' R3 s! l
  61. static volatile int irqraised1 = 0;3 ~9 u( p' }7 l( r  X1 e2 O! a
  62. static volatile int irqraised2 = 0;
    7 R! h! Z  ?! ]/ d/ Y3 s) J

  63. # U8 @9 x; h: X0 J4 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b( W6 v. u2 X3 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }( }( L1 e7 \0 U2 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - g# a5 A$ y) ]& N% ]

  67. 9 v0 n& Q- i3 v5 X
  68. dma_addr_t dmaphyssrc1 = 0;' U! v" [0 B) G) i+ _; T: P0 |
  69. dma_addr_t dmaphyssrc2 = 0;/ N5 w( v% [2 `8 p
  70. dma_addr_t dmaphysdest1 = 0;
    + g7 L: O) c! ?1 L
  71. dma_addr_t dmaphysdest2 = 0;
      e% p, g4 E+ i$ D7 n% L

  72. 9 Q1 }, i; U* U. \
  73. char *dmabufsrc1 = NULL;
    $ q, z% p! w/ u: x! V: Q$ P
  74. char *dmabufsrc2 = NULL;
    % O4 f7 M  K" u
  75. char *dmabufdest1 = NULL;, R5 n( Y9 o3 R7 ~
  76. char *dmabufdest2 = NULL;
    4 a) @! t- i1 Z3 O5 i
  77. 0 M% c% N* y! e. T5 P, h. [
  78. static int acnt = 512;2 B9 }" C. [; Q' c, H0 \8 t) \2 I9 @
  79. static int bcnt = 8;
    # o& i3 w3 X/ {
  80. static int ccnt = 8;; x5 x; [- O" C  _( D( e
  81. 4 Z: S6 t& R/ i2 E: u8 P
  82. module_param(acnt, int, S_IRUGO);  b1 N+ A& N3 \; r
  83. module_param(bcnt, int, S_IRUGO);
    8 P/ v7 ]7 c8 {3 M4 S# W* `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 s' b* k9 g& z$ D3 D" ?4 r' t* C' M* ~8 W& R2 Q  O" L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 g  S4 @/ N# q8 D! F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 Z" E  w% \4 ~* G+ Q" r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( h; M  X4 J; g0 u0 l/ |5 _
+ w/ }* x' j  c/ e, f
% Y0 d- {' h5 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 05:11 , Processed in 0.039210 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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