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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 g3 }" n; g& b% I2 V" h
  1. [code]EDMA sample test application" b6 F. a4 U4 E& Z3 O' |
  2. /*
    / r. b3 o+ E) V4 N, \' V
  3. * edma_test.c
    ! r: x0 s: P% J
  4. *+ N& H# g$ u! C0 k% I
  5. * brief  EDMA3 Test Application* c0 R/ f& F, f$ d
  6. ** L9 b4 g, M+ W: z  p
  7. *   This file contains EDMA3 Test code.
    & d, v# F; R5 N" C! W6 W) u
  8. *
    " `7 ]: ?7 ^  Z' l4 K) y6 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & S  k( ?. i9 Q. C/ e- q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 U( L' P3 g" [) v5 G: a
  11. *         TO CHANGE.5 `6 h; p5 N( O* p% W0 G) e
  12. *9 [9 l8 w9 R: L. P) s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, j# C4 q, c4 ?
  14. *' U3 D2 a' G! Q  b; o# S
  15. * This program is free software; you can redistribute it and/or
    5 t4 z/ {# r5 e- u
  16. * modify it under the terms of the GNU General Public License as
    2 T: U7 a% T$ G* t4 L- ]# k
  17. * published by the Free Software Foundation version 2.
    1 j' [, f  m4 n$ d) g. J; T! Z+ Z
  18. ** ]; J1 x% ?% M6 x( Y  O, _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# {' p" X2 w- X8 l+ _
  20. * kind, whether express or implied; without even the implied warranty; X+ T/ Z& ~  P; f. u( x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' q% x1 W' c  H% e9 y6 }
  22. * GNU General Public License for more details.& g7 Q5 s: |- y& q. J3 T) P
  23. */3 a5 `0 p/ L. {, f  Q$ A4 ^" s3 [7 A
  24. 6 h; N0 M# K' u1 P8 s  J. N
  25. #include <linux/module.h>, y' C. H7 h) L- ]! `" p
  26. #include <linux/init.h>
    0 G+ q" z' s1 g9 ?# B9 Q. D
  27. #include <linux/errno.h>
    1 H4 e% }; R5 e/ x: K
  28. #include <linux/types.h>. \- V: N0 w, m* v% r
  29. #include <linux/interrupt.h>* i' h* n: O: i# b( E& S0 ?
  30. #include <asm/io.h>
    9 m# @- v) l4 o* l4 n# `
  31. #include <linux/moduleparam.h>- b2 j: k$ k1 c& [" s$ O* H( y
  32. #include <linux/sysctl.h># n8 N! @8 z& V. o7 q. B
  33. #include <linux/mm.h>
    5 N  s: F/ B5 q+ J/ U
  34. #include <linux/dma-mapping.h>
    , x9 a2 N3 s0 w6 x' [6 H

  35. # ]9 O+ |' F8 F& Q0 K
  36. #include <mach/memory.h>
    , ~. y6 ^9 y" I" W4 ]0 S
  37. #include <mach/hardware.h>) `0 O. b  b7 E3 r8 p
  38. #include <mach/irqs.h>) q% K; S  m& A' G/ r% @1 [! Y3 _9 w8 N
  39. #include <asm/hardware/edma.h>
    & ^1 ^- B& s6 h* x+ ]2 c1 \3 E

  40. 3 Q/ A2 q, C* q- F( D" D
  41. #undef EDMA3_DEBUG5 }1 z6 P. Y0 T- s
  42. /*#define EDMA3_DEBUG*/
    , G2 M! ~" g7 F, W8 [& S
  43. 8 o- t+ M5 P/ H5 q
  44. #ifdef EDMA3_DEBUG4 K9 F& ^) i: M* Y/ b" g3 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" Q8 L. a- F. b2 H2 V: V% G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : s. K4 L" b) o5 ^  o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" _2 _4 [" ~- C8 n+ R8 [
  48. #else
    - t  e9 u! ~7 m2 C# F  ^& ?- {, x
  49. #define DMA_PRINTK( x... )
    - z! R9 Q( K( \3 D) `: J" c
  50. #define DMA_FN_IN" X9 A$ n3 G1 n' T5 s" v; V* F
  51. #define DMA_FN_OUT
    ! J- Q5 d; d; P# ]( C3 [0 Y; a9 }+ b' s& a
  52. #endif- L: B2 a# ?: A# [) p2 e
  53. + l8 L5 _- R+ g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ {9 \4 _  ~& t& |2 c
  55. #define STATIC_SHIFT                3$ F% z3 }0 }5 _% u: N
  56. #define TCINTEN_SHIFT               20
    * P* j: O1 w4 C# Z6 F) N
  57. #define ITCINTEN_SHIFT              21
    $ ?+ P$ a: V+ G0 P2 i0 z$ d
  58. #define TCCHEN_SHIFT                22
    3 I: C* P5 s+ E6 Y- Y' [
  59. #define ITCCHEN_SHIFT               238 u0 V0 w- l& y$ @

  60. ; n3 A% B# \' _. f# G3 {- R
  61. static volatile int irqraised1 = 0;
    ! P; _6 D' L( K: _
  62. static volatile int irqraised2 = 0;
    % `1 x: W6 `$ a0 S' |3 ]5 [+ p
  63. ( ~* J3 }& R+ \7 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. w; d- m9 q7 \/ D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 G# f7 |+ N6 \9 G! z" A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 b& h8 r2 n6 J6 Y

  67. " t5 ]) E! V3 K6 P+ S6 U! D  L, l
  68. dma_addr_t dmaphyssrc1 = 0;1 i3 @6 O* v, k% n4 R0 f, @) o
  69. dma_addr_t dmaphyssrc2 = 0;
    - t6 O$ ]+ e/ b) f
  70. dma_addr_t dmaphysdest1 = 0;. A5 d% [. Z; n7 u9 h% J2 Z
  71. dma_addr_t dmaphysdest2 = 0;! j2 G- P; p4 N& v
  72. 7 W( j% X2 b  M3 q; G0 K! v
  73. char *dmabufsrc1 = NULL;% B$ s2 @9 R/ F+ T! }
  74. char *dmabufsrc2 = NULL;
    - P) d! Y4 c+ x: h" h3 `  _  ^
  75. char *dmabufdest1 = NULL;2 T/ C. i! T/ A/ O0 w8 d7 w- M
  76. char *dmabufdest2 = NULL;9 ~( [; O# q3 _: S6 Q# r
  77. 1 H' Y" C$ N1 ]% u
  78. static int acnt = 512;, h' D* e" i  k4 v* A
  79. static int bcnt = 8;
    7 D. O$ y- v6 q* D0 W; ?
  80. static int ccnt = 8;
    1 G9 `6 M$ N3 G2 g' z" s
  81.   `2 k; I2 C3 j/ a; C, c, t
  82. module_param(acnt, int, S_IRUGO);0 d3 [- n: P& k. t( E. |+ x# Z- J
  83. module_param(bcnt, int, S_IRUGO);; U7 s' n1 J8 H- a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) @. E: b+ s. @+ u- g/ M( Q* H, L# G7 H9 A6 A& J# ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: k$ B3 U3 i; a! C7 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* l1 [& f. [' z" g/ R& {" v$ D+ T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 ], b/ K' q6 o; z7 `' u4 T( [% {  d  L7 C0 R

& v$ u! ~9 A1 _7 a0 n3 E( r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 22:31 , Processed in 0.038494 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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