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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 n3 @+ m) R8 w8 s7 D
  1. [code]EDMA sample test application% U& [/ }# T7 J1 G
  2. /*; V# {2 n! G9 x# Y6 F; Q1 [- `" T1 s
  3. * edma_test.c' j- o& B) c9 C) x( l3 o
  4. *) p% E1 _! a* Z5 M* v! ?0 g; q
  5. * brief  EDMA3 Test Application/ n9 J2 ]# a* C3 N* |1 V
  6. *3 O& H" D' h: M5 H0 r0 {$ |
  7. *   This file contains EDMA3 Test code.( o0 B* ~7 \2 [. _
  8. *: Y* K& F' {6 c$ x* s! Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 x2 x" B) c+ k% U; _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  {2 S/ g8 Q$ N$ h
  11. *         TO CHANGE.
    6 C# v' D4 D1 d
  12. *; e5 q. l* x: u3 o: A1 l1 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 i0 _$ J: d. b$ Q5 X
  14. *
    - Y6 n; }+ C/ F2 R0 u
  15. * This program is free software; you can redistribute it and/or
    3 o/ E7 W% m5 S1 s) Q0 [- E
  16. * modify it under the terms of the GNU General Public License as, T8 c8 M2 L9 b$ F" j$ a) C
  17. * published by the Free Software Foundation version 2.4 W# }$ ?+ q1 A. ^
  18. *# _' y# A& r. G3 \. i+ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 b7 J0 G3 Z7 @1 d& p7 V
  20. * kind, whether express or implied; without even the implied warranty* V' A5 C( }& [( a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # Q) B6 t( S/ d: R2 D, M
  22. * GNU General Public License for more details.
    ( g$ r5 j, q  A. {. f% @
  23. */) \, u, N, S! d$ z
  24. * y) [3 ?' l) K) f9 p
  25. #include <linux/module.h>
      H- h& P; N, b! Q4 d0 G
  26. #include <linux/init.h>
    ) r; ^& Y, n+ ]( d6 M# ~+ a& Y8 W
  27. #include <linux/errno.h>
    & I, x+ |, h  U$ w( e# E7 P
  28. #include <linux/types.h>0 c+ A6 [! q9 w, d6 _
  29. #include <linux/interrupt.h>5 Y9 f& H+ l  K, a% a' ]' T) Q
  30. #include <asm/io.h>
    - b/ ~4 D1 O$ L  X
  31. #include <linux/moduleparam.h>3 d/ z1 o$ p& I! e
  32. #include <linux/sysctl.h>
    7 V- H3 C, w$ g9 x9 @
  33. #include <linux/mm.h>
    # b) U+ H9 J+ ^1 e4 `, d
  34. #include <linux/dma-mapping.h>
    / w& X) f4 O/ a
  35. . ~" K. D( x, z% I
  36. #include <mach/memory.h>
    # N# a" s7 C- g
  37. #include <mach/hardware.h>
    / n: N, f5 _, v: X
  38. #include <mach/irqs.h>( I5 I# [7 b4 W7 P( ~9 O
  39. #include <asm/hardware/edma.h>0 O+ T- E& b9 Q, o+ n/ ^
  40. ; g' q6 i" k' x: P$ L
  41. #undef EDMA3_DEBUG. u& }' v, G  H1 G7 j# U' y! u: Z  |
  42. /*#define EDMA3_DEBUG*/1 q8 J- P7 i5 Y5 B+ v- s/ d, S
  43. ' B  F0 q4 t) z
  44. #ifdef EDMA3_DEBUG& c9 m! f: X3 f! Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ V% L( J! `' H6 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); l/ [/ ^3 I, Y2 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 V% Z" |3 F& p5 q" x( Z. d6 T
  48. #else. b+ B# R0 `9 u/ X
  49. #define DMA_PRINTK( x... )
    6 W1 D0 x" F4 @0 ~
  50. #define DMA_FN_IN
    % M& B' s/ w8 Q2 }& i
  51. #define DMA_FN_OUT
    9 ]+ B8 A) S+ L+ y( i
  52. #endif
    9 l( i9 h5 a% t, E6 G% h; N+ ^

  53. ' e% T% U% l# V! W- w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 c* b. A' ^3 ?
  55. #define STATIC_SHIFT                3* Y2 P4 i/ R2 \
  56. #define TCINTEN_SHIFT               20
    4 b2 C, y) g; M8 O/ f- j) \8 d$ ]) b
  57. #define ITCINTEN_SHIFT              21, B6 t& s" `, W5 Q; G' w
  58. #define TCCHEN_SHIFT                22
    7 H! B- Q5 D0 @; Q  `
  59. #define ITCCHEN_SHIFT               23# L1 ~5 m; W! H- e

  60. : ~5 M9 y* l0 ?: ?: _8 Q* G. v
  61. static volatile int irqraised1 = 0;
    % V: H  l' r& g& t4 h
  62. static volatile int irqraised2 = 0;# \  b( \6 E* M: n6 d0 \

  63. & Z4 \/ K) n+ ^$ l- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s( L3 Y- P. D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # K% Y* _8 b. F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( a6 b! Q# ?0 m4 P4 j
  67. " [/ I0 {1 U2 a+ @/ G
  68. dma_addr_t dmaphyssrc1 = 0;9 v8 C$ `, Z; o& ], n2 c2 u& I
  69. dma_addr_t dmaphyssrc2 = 0;
    . C; J' b$ `  S4 b4 D) E
  70. dma_addr_t dmaphysdest1 = 0;
    ( R* A4 j* V# h7 v7 t7 B  V
  71. dma_addr_t dmaphysdest2 = 0;
    $ j# x- Z/ g' t5 \
  72.   K7 }. T* c2 d( I; B
  73. char *dmabufsrc1 = NULL;: C2 y4 E& g2 ^% ]  ~0 y
  74. char *dmabufsrc2 = NULL;7 N  t; W$ W( R; n0 e1 U
  75. char *dmabufdest1 = NULL;
    / t! w% k2 C; y% Z. v
  76. char *dmabufdest2 = NULL;/ W$ N4 |+ q% q3 {% o1 I

  77. 5 ?4 `# j+ A9 f
  78. static int acnt = 512;4 S: ^8 j- D1 h. a+ f
  79. static int bcnt = 8;" S! R8 v( p- }
  80. static int ccnt = 8;! U; V7 }1 \4 U

  81. - j9 [+ w- d) J1 r
  82. module_param(acnt, int, S_IRUGO);
    * {6 e' K9 w1 C3 Z$ r" N6 G% u
  83. module_param(bcnt, int, S_IRUGO);! d  [% Z9 }; N* X# Q, V, c/ Z1 ]- X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 J6 T4 v" {+ L( ?9 B9 u- C9 q
* ~/ J+ [3 l* \- z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 I7 e, H; C* U9 V2 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! [+ L; f7 g+ b3 m4 ^3 u' `: h5 {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 z* O: ^& I$ K6 i2 v( u1 J

1 q2 F5 }6 J9 ^5 c' E  Q! j# T7 \8 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-28 19:07 , Processed in 0.048487 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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