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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 M# m: F8 R6 d- o1 y) C* P
  1. [code]EDMA sample test application
    " m9 Q4 {' Q' V3 b/ ~0 N  Z0 [
  2. /*
    + @6 e. l- ?% o/ g& C/ R
  3. * edma_test.c+ _$ L1 O7 o6 x( q  H
  4. *; r) D( z1 c  y$ G& s
  5. * brief  EDMA3 Test Application6 F7 M* p; ~* y3 T( e, y" c
  6. *
    $ t" U4 K! J: ]; @  c( f, D, w, {
  7. *   This file contains EDMA3 Test code.9 U/ x4 Q7 ~8 m7 ]
  8. *
    ( j+ l/ ?" U2 ]4 w, |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & c7 S3 i. A6 D+ |9 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 S5 `. y9 j4 o- O+ S( z$ K
  11. *         TO CHANGE.5 Q! D9 `  a5 A( R1 ^
  12. ** {/ c: X+ g) ]8 B# Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 A- s) e! ^* [+ X/ ], |
  14. *
    ( z9 v1 X/ B% W% C% c
  15. * This program is free software; you can redistribute it and/or
    ; E+ H9 J: O4 ]: B& B8 L5 [$ s* o
  16. * modify it under the terms of the GNU General Public License as6 @, K! _% u8 Y; |7 ^, x0 b
  17. * published by the Free Software Foundation version 2.' z* d) E: N3 @% g/ `! v5 a
  18. *
    7 B6 a6 h) Y4 w; \0 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # R1 Y% `, b7 d
  20. * kind, whether express or implied; without even the implied warranty
    ' ^  j( `1 E2 G: v9 P" c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 E: O* z. E7 J6 x! b& ?) ]
  22. * GNU General Public License for more details.
    2 E8 S6 R: l3 w2 ?0 R  ~
  23. */% @  k: S. [( j' ?
  24. , u' a% y  q9 ]( T0 Q9 g# V+ F
  25. #include <linux/module.h>
    9 n9 K! q/ b/ m3 {
  26. #include <linux/init.h>6 K. o' P" Q; L8 ~, @. K# z" j
  27. #include <linux/errno.h>
    $ d: \7 w, G) N5 ^
  28. #include <linux/types.h>
    : D0 L2 y) ?4 Q9 X3 S& W4 I
  29. #include <linux/interrupt.h>9 D4 Z" z# {$ K$ F% u. t
  30. #include <asm/io.h>- M. @/ ?' t6 U5 `$ r! j
  31. #include <linux/moduleparam.h>: ]3 `5 k8 M; Y) q8 ?$ O7 |
  32. #include <linux/sysctl.h>9 Y, u" w8 Q, c1 i: ?% X! O- v/ z7 i
  33. #include <linux/mm.h>
    2 L7 P+ o: D, h
  34. #include <linux/dma-mapping.h>
    ( @( t1 f& r( t' ~
  35. ) A+ C# B: W6 a1 u, |
  36. #include <mach/memory.h>
    , I# b. h; i' Q8 d2 v. M
  37. #include <mach/hardware.h>
    : M* y; ^  h0 r5 J6 ^; G# f
  38. #include <mach/irqs.h>
    : ?1 J% c8 b# m! _
  39. #include <asm/hardware/edma.h>
    0 S+ p, M: A& |2 o' Y" O
  40. & K% `* D: V/ \6 ?9 A, A4 }
  41. #undef EDMA3_DEBUG
    ; D; t+ }4 K$ ]0 ~  ~
  42. /*#define EDMA3_DEBUG*/) Y, W; _8 @/ s! h% Z4 g7 Z
  43. . P  f/ }2 Q; h1 x& ~8 ~9 E2 `$ m
  44. #ifdef EDMA3_DEBUG& e! ?4 n. c4 t) @* |* ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% z0 y, {2 \7 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ~5 H' t! I$ b1 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % m& K) b9 \6 I* G- K4 e1 U$ v
  48. #else
    5 \# f4 }) B0 z; i6 A3 o9 ~( @
  49. #define DMA_PRINTK( x... )
    % L/ R7 o7 I- m# H- A+ E' W
  50. #define DMA_FN_IN. O- g% b! `+ |3 }" q, U6 ]2 q% N
  51. #define DMA_FN_OUT
    ' D$ C5 C7 O7 Q! o6 T. ]9 o& n
  52. #endif  r5 {- e* q4 Z

  53. - f) R  Q- Z3 g) g8 m0 f+ ]+ ?( u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' l: j! C' j! D( p5 D( v
  55. #define STATIC_SHIFT                3
    : \' J9 k9 {) l3 A" ]* \
  56. #define TCINTEN_SHIFT               20
    . p; s8 G* b4 A8 A
  57. #define ITCINTEN_SHIFT              21
    4 n  [, g( B9 o" N' m, Z& L; y
  58. #define TCCHEN_SHIFT                223 x: M4 C1 B; S: q
  59. #define ITCCHEN_SHIFT               235 O& w( S: q/ C5 P. \) J
  60. : d$ [9 h" R6 ^; j# n, @7 _
  61. static volatile int irqraised1 = 0;9 o0 u+ X" [, Q5 C, d
  62. static volatile int irqraised2 = 0;
    , `0 O, T" k4 O
  63. 9 ~3 L8 Y$ D; n! {1 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " F+ g$ N% v4 e) y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 _$ G/ B9 S' V: P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# C3 T9 @% C3 J( V
  67. 2 S; Z5 f! _& G: g7 ~# Q6 Y/ d2 o
  68. dma_addr_t dmaphyssrc1 = 0;1 S, U7 O6 |& D7 _- E
  69. dma_addr_t dmaphyssrc2 = 0;
    - `3 w+ O; O0 S+ K
  70. dma_addr_t dmaphysdest1 = 0;! b4 x0 J8 l" j6 t4 {& b
  71. dma_addr_t dmaphysdest2 = 0;
    0 @. ]7 L/ ?6 ~  I& Q6 ^1 q
  72. * o/ y2 F1 x$ m) @' p: {) t
  73. char *dmabufsrc1 = NULL;$ H; x0 ]' N* U
  74. char *dmabufsrc2 = NULL;
    & B3 Y+ s- u9 Q$ W* k- m
  75. char *dmabufdest1 = NULL;8 G" f1 ~* B: N
  76. char *dmabufdest2 = NULL;# `* x/ E! I% T2 r' v
  77. , z6 Q3 E- ~  ^
  78. static int acnt = 512;7 l9 @7 [5 t8 R" U
  79. static int bcnt = 8;
    : H: Y6 x# D! d; P% ]8 Z
  80. static int ccnt = 8;: b* Y0 t2 o! H8 |& e
  81. * F/ h2 {% u; A  J( d
  82. module_param(acnt, int, S_IRUGO);4 r+ J; Z' ]* u  T+ ]! }
  83. module_param(bcnt, int, S_IRUGO);
    $ l& `/ G, ?& c# C$ E" @+ g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* Q& z: e. f2 X2 z" u2 Z1 |; ?0 d
- `. [( X3 s! y% U' B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* U% O) @( n! w" p8 s9 G7 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Y) b2 F' Y5 D) s7 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 _* L' J5 k; g% T0 O( R$ f
. v6 o+ x& s  ?  k7 ?* p6 N1 u* _! X- b) b; X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 13:13 , Processed in 0.041062 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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