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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 C6 |5 E# R- k9 |
  1. [code]EDMA sample test application
    0 e- y7 R- `6 \, E8 Z" U0 l
  2. /*
    ; T; p) v: L% a
  3. * edma_test.c
    ) c2 q# B9 K& S9 R! j
  4. *4 N6 y1 x. Y' S
  5. * brief  EDMA3 Test Application
    6 d  u$ u$ ?/ J8 t
  6. *
    $ A1 z2 l: R  D' y# q. d* ?/ b
  7. *   This file contains EDMA3 Test code.
    4 [3 M- e/ P$ c- K
  8. *; o6 p8 p3 \6 m) V4 S( c! d2 `% G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " U$ X2 D) s3 |. K+ O. `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 y9 r8 N/ S0 E; {+ F0 A
  11. *         TO CHANGE.
    . w- F! h% z: H9 O
  12. *9 v* A, R1 D2 }" Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 S; Q9 B# S/ Y* |3 {
  14. *
    7 g4 x; C1 O& O  k! |7 @
  15. * This program is free software; you can redistribute it and/or3 R; S& p( m' ]$ c
  16. * modify it under the terms of the GNU General Public License as
    * m) b( I+ m5 v6 }
  17. * published by the Free Software Foundation version 2.
    % S1 e6 i; c* N/ G* @
  18. ** ~! S- s# H2 T3 U" ~) {/ Y# D% W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % \$ j/ s0 |# f1 T/ w3 g
  20. * kind, whether express or implied; without even the implied warranty
    , D8 E% |; b5 G/ W+ T0 }  n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + p0 [: Z. E6 `) A$ v9 }; V
  22. * GNU General Public License for more details.
    6 M8 Y2 U' B' r% R) j) B: \
  23. */7 |, ~( g# V8 _" i/ a; v" f' M3 \( k
  24. ; Q  n3 ]+ t  k  r2 e& B
  25. #include <linux/module.h>
    / U1 X$ p1 R0 D7 L- D
  26. #include <linux/init.h>
    1 ]3 |  A$ c  t/ h$ E* u- E) \6 e
  27. #include <linux/errno.h>- X" Z( u: {( {# o8 }
  28. #include <linux/types.h>
    2 [7 z' i5 ?; I
  29. #include <linux/interrupt.h>; g. `& U: N3 m2 t) G. r
  30. #include <asm/io.h>) E: \6 ^! p% }% P1 C: J
  31. #include <linux/moduleparam.h>
    " s+ _! u  B* ?
  32. #include <linux/sysctl.h>: H( ]. U$ f( I4 J& w* u+ j
  33. #include <linux/mm.h>. Q' q6 _( U- b( g, q8 ~
  34. #include <linux/dma-mapping.h>
    ' m! u# g! N0 W% i: X

  35. : \! F8 B" p' ]3 ?# H  B* z
  36. #include <mach/memory.h>9 P4 w5 O$ M& Y: i; D2 v
  37. #include <mach/hardware.h>
    3 j5 M# u% A4 l1 O6 f' e; l
  38. #include <mach/irqs.h>
    , z1 h# I' a6 v+ [: |( G' t/ a
  39. #include <asm/hardware/edma.h>
      t2 h8 {' L3 X' i1 T( \

  40. 3 j) z/ N7 b# M& {0 w9 W
  41. #undef EDMA3_DEBUG8 {& A& u. `! p) k, J
  42. /*#define EDMA3_DEBUG*/
    ' D) ?+ ?! ]* D6 ^/ u

  43. * M" y' |5 r) z: d, k
  44. #ifdef EDMA3_DEBUG
    ; u( l- q0 r& |5 V' x7 \; V& B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! F9 h5 b6 T6 H' \7 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): L" ?2 ]- [6 e: J, D/ w6 l* w" @- v0 I- q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): m7 ]+ x, L1 n  a0 i7 X# a
  48. #else
    9 M. s2 O. o  [5 T
  49. #define DMA_PRINTK( x... )
    4 Y4 |) p1 J) a) w* a, }! g
  50. #define DMA_FN_IN( A( i9 g+ o! V& ~
  51. #define DMA_FN_OUT# j6 `2 c7 S( i8 p, C. |4 K
  52. #endif
    ( n+ o, T! W, o: w# X6 J
  53. # A/ t4 `; `9 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 E2 y: c$ t1 C7 y& U& i. S
  55. #define STATIC_SHIFT                3
    * A+ e  ?& h4 G3 r/ a9 ~
  56. #define TCINTEN_SHIFT               20" y" K3 c( m; |0 F1 n
  57. #define ITCINTEN_SHIFT              21, b- U& y% j6 n9 m0 ]/ [6 T% \2 b1 K
  58. #define TCCHEN_SHIFT                22
    7 X9 ^7 ~: y! ]3 t% ~1 U4 P8 V
  59. #define ITCCHEN_SHIFT               237 q& }$ q" g/ C, J0 q

  60. 7 @$ a  [* k$ T0 W" W7 w) K6 u
  61. static volatile int irqraised1 = 0;4 ?: s% d! S5 l
  62. static volatile int irqraised2 = 0;# K/ G3 i$ B. z9 A
  63. ) u8 _% P% G( l9 Y3 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j0 P3 T" R1 j! c6 b& \7 p( Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I5 D, H9 D$ J% h5 i$ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 W. J% Z0 _+ h8 k. e% w' G" r) w4 i

  67. * `, z! w6 A: M' b) i) I
  68. dma_addr_t dmaphyssrc1 = 0;5 u, n' U" e  s: J- {. l7 t
  69. dma_addr_t dmaphyssrc2 = 0;
    $ X7 E" F8 `! W. M" R
  70. dma_addr_t dmaphysdest1 = 0;* P- S: z+ P/ r8 Y
  71. dma_addr_t dmaphysdest2 = 0;# s" {8 Z; r' E& Z( h# q
  72. / J/ D3 G3 {3 V% ^# m! X# M5 F
  73. char *dmabufsrc1 = NULL;/ @( a3 Z3 O: u( s
  74. char *dmabufsrc2 = NULL;
    ! h, H9 G& |- n8 K8 ?
  75. char *dmabufdest1 = NULL;/ \' M# _; u9 ^
  76. char *dmabufdest2 = NULL;
    - N0 S0 B$ l* q  S8 k
  77. 8 b9 x3 }  v1 j, f2 u
  78. static int acnt = 512;
    + ]$ H1 ?  L; ]8 N4 D7 w8 |9 k
  79. static int bcnt = 8;) g" [4 N- C: `; P
  80. static int ccnt = 8;) i4 ?/ b  i: w

  81. % e' j8 H- }0 x8 b- z1 C( g
  82. module_param(acnt, int, S_IRUGO);: x$ S" X6 I8 [4 b+ Q' V9 m  |
  83. module_param(bcnt, int, S_IRUGO);
    2 g' P3 M7 l) u" u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 F  u: M& i) Y: j& ?& k. d: ~8 M  N& X; Y/ V! V9 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& |5 k7 V7 g  F' U' L( a- \. s" @7 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 s3 I) N  _# V9 b2 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 b. t' v* k; O" u" z% a1 o

9 R1 R9 S4 Q9 H! m- \( N+ S, d/ Z% o& O) t) h' S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 21:49 , Processed in 0.036795 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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