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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + [) G2 ?7 X* [# f
  1. [code]EDMA sample test application$ A" X8 P& H6 ]5 P
  2. /*
    . T2 a- g  O! T$ \" \1 v
  3. * edma_test.c
    4 s$ M( }/ i* o% _% X
  4. *4 W+ o0 g! _# _  c$ R0 @/ p( C% q
  5. * brief  EDMA3 Test Application
    : M# w' H9 Q9 i, U, g3 X
  6. *
    . f8 Z1 m0 ?  J/ E8 T" S
  7. *   This file contains EDMA3 Test code.  D: _+ E0 B3 n4 _% e7 H/ r7 f
  8. *, {; b* X5 L' c" V: {$ U+ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' x: L2 J8 G0 G/ {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 M& c  m% k/ N+ k$ `
  11. *         TO CHANGE.
    4 a- a8 b2 C6 W( o
  12. *" G1 X( Y/ F: e% V  A# \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 O( F$ z8 }% P: r) }! L2 R
  14. *
    ' \7 V6 z% V2 I8 d
  15. * This program is free software; you can redistribute it and/or3 {4 T3 n: A7 ?. K; E4 H
  16. * modify it under the terms of the GNU General Public License as
    ( B% F! ]1 ^) E. t
  17. * published by the Free Software Foundation version 2.! y7 Y+ @0 M2 l
  18. *
    ) _" v% w" `" @4 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ M( U5 z3 P; O: ?0 L7 Q  B6 I) M
  20. * kind, whether express or implied; without even the implied warranty5 B$ U# d" E/ X$ S* o) D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& d. R2 ?7 P2 G, E% ~
  22. * GNU General Public License for more details.( R; e7 N' ~( Q0 E5 v8 c( K# j$ e5 i
  23. */# b5 v% `3 a& p$ y/ R* d# W  |) [
  24.   a& j! F/ x% E5 x+ ]+ `
  25. #include <linux/module.h>! ^4 V1 C/ @0 J( J! b
  26. #include <linux/init.h>- u; l/ g6 D% N* N2 L
  27. #include <linux/errno.h>
    % z) h7 j% P/ w  B
  28. #include <linux/types.h>$ ?/ m7 _  X; C1 ?" d4 p
  29. #include <linux/interrupt.h>
    6 M0 @  V  j; ^+ S
  30. #include <asm/io.h>; l3 C. V* U* |7 x! w( |& `  B
  31. #include <linux/moduleparam.h>% r  ^4 |. A+ L3 ~1 I9 @4 B
  32. #include <linux/sysctl.h>
    0 ~' V6 ^4 b" A% j6 R2 b) E; ?
  33. #include <linux/mm.h>
    / D' [& a- F  d# C
  34. #include <linux/dma-mapping.h>
    6 c( f: [, N* U- Y
  35. 8 B5 D3 s* E+ g- o5 q
  36. #include <mach/memory.h>
    5 F" c0 d+ s. A6 L# ?; J1 Q
  37. #include <mach/hardware.h>
    ) J8 b4 v, g# p, K9 O
  38. #include <mach/irqs.h>
    8 C0 j8 V3 _8 W7 n
  39. #include <asm/hardware/edma.h>5 u- Q* G$ A2 s3 M& i

  40. # Y) ]0 q4 I4 K+ C8 A1 [) T
  41. #undef EDMA3_DEBUG/ b; e! w& r3 _
  42. /*#define EDMA3_DEBUG*/% t9 Y/ K+ ]5 T8 P8 T! Y1 s5 F

  43. ( P8 i: c* I' v" L
  44. #ifdef EDMA3_DEBUG' l, T- i8 @7 g/ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % W7 p  y  ?+ N' i# _  D. ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; ?1 [% U0 @" _4 K  O8 q8 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' E& l. P" N) m+ n0 O/ f' w4 a
  48. #else
    : V& w7 `! f, H/ Q/ h$ s. b
  49. #define DMA_PRINTK( x... )
    # b9 G9 e% N7 P' {. ?
  50. #define DMA_FN_IN
    # L& [/ x3 _2 F- @7 O8 c
  51. #define DMA_FN_OUT/ i2 d' S2 u0 c9 X3 P) G
  52. #endif1 \6 c0 @4 s5 M- B! ?- x

  53. 7 i; f9 d2 A3 h3 ?+ ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): ^: f& t, V, P; I4 ?- e/ H
  55. #define STATIC_SHIFT                36 `9 u5 c% j% l" |! o$ z
  56. #define TCINTEN_SHIFT               20
    6 i( @2 U$ a) M' M, n
  57. #define ITCINTEN_SHIFT              21. y: D! w1 ?/ o7 J- Z7 y
  58. #define TCCHEN_SHIFT                22; p8 p6 W- m: q4 r  t
  59. #define ITCCHEN_SHIFT               23$ C' i5 c. h4 T+ U0 E& ]" B
  60. " y4 ?7 Z3 P( L# B( k8 q9 A
  61. static volatile int irqraised1 = 0;
    0 c( j4 [' L; _+ X4 o1 i' A9 s
  62. static volatile int irqraised2 = 0;
    3 G& h7 H3 l) `% H
  63. , C5 t4 Z7 z' L; r  y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 v8 K; f' j9 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 d9 I$ G; k* j1 ^# u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - e) Q' A$ s( T  b8 h
  67. 7 d6 q+ B2 n$ y0 I# N2 ^; m
  68. dma_addr_t dmaphyssrc1 = 0;
    . h* E% c9 `2 X8 z
  69. dma_addr_t dmaphyssrc2 = 0;) C* A/ o/ {+ F. C  [
  70. dma_addr_t dmaphysdest1 = 0;
    ) B; j, \! Y, n1 S) v# C
  71. dma_addr_t dmaphysdest2 = 0;
    7 q: T" ]' d0 ]# H) z' O

  72. 6 j# C( U8 i* `/ w, T3 n* ~
  73. char *dmabufsrc1 = NULL;: L" p* V: n; r* @( R
  74. char *dmabufsrc2 = NULL;1 F# v1 l4 {7 y3 L
  75. char *dmabufdest1 = NULL;
    : z! @9 g' [  N8 m$ F: s* A2 ?9 O7 M
  76. char *dmabufdest2 = NULL;
    . N" L& l4 Q) J( w

  77. 3 V# u$ M) q5 \$ u4 C- x' y" S: {
  78. static int acnt = 512;
    " [* E. N6 V0 }; d# R7 J
  79. static int bcnt = 8;* s7 Q. n6 C7 G1 r
  80. static int ccnt = 8;
    2 T$ y  n4 t$ @9 H9 ?: O1 f7 i9 x6 o
  81. $ j2 G" d' e% e9 s9 C) s
  82. module_param(acnt, int, S_IRUGO);
    5 f" d  c4 I- |0 R
  83. module_param(bcnt, int, S_IRUGO);
    . w- Z& f  `7 \) p4 J" @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ d- }% w7 ^% L! a' E* R& o/ T
8 u0 ^# g* t1 i  T$ C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ^" l9 }2 ]& R% parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 A4 G4 Z$ C7 v0 V2 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" k0 C+ f( o( Y" \! M% f$ v$ v( T
  a# w# M0 r1 N/ ^0 B% C& D' W; ^. `$ D& o9 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 19:00 , Processed in 0.044775 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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