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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : k1 a8 |  Q" a7 U* l, m
  1. [code]EDMA sample test application
    % z+ }7 B- s" m( u
  2. /*' [1 r) r2 U% B- S7 m9 ?6 W
  3. * edma_test.c4 @& Q$ y1 O7 n* z" J
  4. *
    / ]1 T+ R0 i/ J2 J# }
  5. * brief  EDMA3 Test Application4 k: G- ~5 o+ d: \
  6. *
    $ t% A# w; A" l2 ~8 ]3 }6 g
  7. *   This file contains EDMA3 Test code.4 g4 m5 Q' O0 W* d  v' q0 _/ t: f' T
  8. *6 a2 \. I% _/ e) F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 a9 j& o' E& X% ?. z0 |2 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % d5 J4 C9 G$ U
  11. *         TO CHANGE.  p, k$ L5 i# X: Y+ e" Y
  12. *
    ; [2 |- V( h# \! N$ S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 Z9 }, L. H' o4 E7 d( p; U
  14. *
    4 q2 z3 \& w+ ~
  15. * This program is free software; you can redistribute it and/or
    / v, g% Z8 b0 l% `$ F6 e
  16. * modify it under the terms of the GNU General Public License as
    1 I& Q% ~7 i, w. K! r
  17. * published by the Free Software Foundation version 2.7 g: o) w9 z( A" k2 e, c% ?
  18. *# E' f5 z( T$ S  g7 m9 X! ~7 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ G7 s3 T) u3 I1 N$ c5 L% v( M0 {6 g
  20. * kind, whether express or implied; without even the implied warranty
    # y+ u: e7 X, O. |" K$ g9 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * J8 H! g$ x7 N$ Z
  22. * GNU General Public License for more details.# H+ H9 b3 H" }) v1 f4 _
  23. */
    % A$ |6 C* ^; ?" b* n+ \
  24. 8 R9 @4 b8 S. W
  25. #include <linux/module.h>
    ; j: I0 s0 l# `: Y
  26. #include <linux/init.h>0 ~- e* l) d/ m2 p: w
  27. #include <linux/errno.h>; O, v4 W( p1 Z
  28. #include <linux/types.h>
    / H* \+ y8 i5 `3 u$ o) @5 V! O
  29. #include <linux/interrupt.h>
    : Y+ N8 k( _: i' G1 C
  30. #include <asm/io.h>( l2 t' i# E- D" r& n: C
  31. #include <linux/moduleparam.h>
    7 ^' p0 C1 |0 w% J7 [6 w+ F
  32. #include <linux/sysctl.h>
    - x9 F: C4 D, I( q6 j
  33. #include <linux/mm.h>+ K7 O( k! K4 J2 @" a: R
  34. #include <linux/dma-mapping.h>
      I- k9 n9 c4 r# ?9 r3 D5 [5 K+ C
  35. 8 Y, I" }, n# B8 ]
  36. #include <mach/memory.h>
    7 m- n" Q, `" D
  37. #include <mach/hardware.h>5 [4 U8 u* ^+ ]8 a  A5 M
  38. #include <mach/irqs.h>
    8 Y) P0 ^; X- ?& }& w6 y
  39. #include <asm/hardware/edma.h>1 |) r5 v# m% \- I2 Y  N! b
  40. 4 G7 n5 f3 M7 Z4 O7 o# r
  41. #undef EDMA3_DEBUG4 Q# w& _# P, ^/ }. q( t- i
  42. /*#define EDMA3_DEBUG*/
    6 P3 }  D( f. g

  43. . [/ r/ k8 [, [( X! g- w: X  S6 ?# o
  44. #ifdef EDMA3_DEBUG
    2 f- z! h% i" b4 T' \  m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! d. m$ Z9 x: N; O7 r* C) v6 ^! y) K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Z1 A# h4 M% N  L0 c6 q, ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - C( B0 q4 |6 p: `, e
  48. #else9 R: T6 B+ M% O9 |1 r# c
  49. #define DMA_PRINTK( x... )
    ! m) p) h2 ^, Z3 U+ g
  50. #define DMA_FN_IN9 ^, e* Q; k! J3 k  N
  51. #define DMA_FN_OUT& g0 Z: R- W: b. O6 H, w% a
  52. #endif, D( [$ F. K7 c! Q2 P

  53. $ X# v* u8 E* s' P% @  c& D! v0 ?5 d; u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" M  T8 U+ z. s/ p
  55. #define STATIC_SHIFT                3
    # G; n$ w5 [/ L; _. `7 Z
  56. #define TCINTEN_SHIFT               20
    % q1 N6 h+ J  w  a- _1 b
  57. #define ITCINTEN_SHIFT              21
    4 L- {7 }7 n/ U" r. A
  58. #define TCCHEN_SHIFT                22
    - V" q0 h0 T7 n6 o9 i, ~3 h5 r
  59. #define ITCCHEN_SHIFT               237 R* Y* Y* |: P# w
  60. " K3 S: G# w9 N; {  r
  61. static volatile int irqraised1 = 0;
    3 w3 {" e) N( n) F
  62. static volatile int irqraised2 = 0;
    - |# r- J0 E4 M1 s
  63. 8 M7 m$ \! p4 w% v# ]- M0 D; H* f& f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 L' z+ q: |, \7 r1 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ M) k' f5 G$ e+ {6 b* F2 Y2 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; w0 q9 h8 }3 N

  67. 1 t" Q+ g. p9 c
  68. dma_addr_t dmaphyssrc1 = 0;. l3 ?" E: N6 y5 T
  69. dma_addr_t dmaphyssrc2 = 0;
    ' Q; {( b: j2 i; C6 ?: K7 k
  70. dma_addr_t dmaphysdest1 = 0;
    8 {6 ]  t+ U! @2 `0 d2 ~( S
  71. dma_addr_t dmaphysdest2 = 0;0 e! ]9 P$ n; r4 }- `
  72. 3 z: ^  a: i. l  v, ?
  73. char *dmabufsrc1 = NULL;
    + i8 _% z: s! f7 \
  74. char *dmabufsrc2 = NULL;% W7 {" P2 ?; a- n& w$ b
  75. char *dmabufdest1 = NULL;
    $ o# i8 I) D: D; g) r
  76. char *dmabufdest2 = NULL;  Z3 g. y) R, I( m6 S3 h

  77. ! V6 G6 `/ x- g- p
  78. static int acnt = 512;
    , w) ^/ r" q( r
  79. static int bcnt = 8;) C% _7 I3 }% |3 w/ V1 r9 t
  80. static int ccnt = 8;
    $ H) _0 Z& I- P% p% e

  81. 6 m" Z8 z! {& H
  82. module_param(acnt, int, S_IRUGO);
    $ S/ c, b/ v# v9 h- S( A$ d
  83. module_param(bcnt, int, S_IRUGO);# a; ~* K  Q$ l# P* x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  @9 O8 G( X5 U# l" v: y4 B
8 x( X. t" Y5 J& E' c0 q. e( n: @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* H- N$ F; M- o4 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 R7 `$ |: P. I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" v, `& B: q. M1 F% K
0 _9 ~+ @9 X5 v9 r4 V- j
' v; q, d# b7 L* S5 b; P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 02:28 , Processed in 0.039764 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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