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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ q; ~1 e+ v+ S- K. _5 Q/ a7 v
  1. [code]EDMA sample test application& \; J9 [& A( J
  2. /*
    - T7 |, \- v' t( o
  3. * edma_test.c/ U2 B6 m- j- N* a0 S1 d- a8 C6 U
  4. *, d' \, B  r4 A* S8 P9 b! H: y
  5. * brief  EDMA3 Test Application
    , I& C5 ^  n" n
  6. *4 u8 q5 V2 `7 L" l% _, U( r
  7. *   This file contains EDMA3 Test code.
    7 Y4 s) M/ C+ x" t) k" e
  8. *- B, m4 M* h- ^+ H4 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + u$ J& X! R7 _0 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / F7 t! Y% c3 r3 d6 q, U
  11. *         TO CHANGE.
    # o; }2 D) j1 H3 |6 e& f" s
  12. *
    4 D6 h# L0 }& `9 Y2 O, R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & }0 q/ h3 W: H" Q% D$ l
  14. *
    ' y. S) L3 F3 v  g( R
  15. * This program is free software; you can redistribute it and/or9 q; e2 y, L" w' |0 g5 R' l
  16. * modify it under the terms of the GNU General Public License as
    & [2 c) g4 E5 }, b$ R
  17. * published by the Free Software Foundation version 2.
    5 P4 R# x% U$ j5 W- R* h
  18. *2 [/ X$ S* |- i  }3 {- A& c# a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . z1 I' S3 v3 ]3 _
  20. * kind, whether express or implied; without even the implied warranty
    & R0 p. a* O" I; O- T/ A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ k* `6 d  s8 p8 l8 e, L4 }
  22. * GNU General Public License for more details./ i$ e9 m' f& c' i: U
  23. */. I! }9 O* I$ Z3 U
  24. + e$ V1 k% ?" z9 y: D( X
  25. #include <linux/module.h># e- {2 O6 R# [/ Q% N2 X3 R$ u# A
  26. #include <linux/init.h>. `0 ~# L, I" \) |6 i# [
  27. #include <linux/errno.h>
    $ A" h3 o: a7 b2 E* i3 k
  28. #include <linux/types.h>
    ; g' f! r* x( E5 |; U
  29. #include <linux/interrupt.h>5 w% \6 m. d) \' C2 }9 T" [
  30. #include <asm/io.h>  S7 ~6 F+ z& a
  31. #include <linux/moduleparam.h>
    ; O' o$ O4 a1 t6 q
  32. #include <linux/sysctl.h>) M9 h1 s) i% h) q1 h0 x
  33. #include <linux/mm.h>
    . W( P0 k: k9 d
  34. #include <linux/dma-mapping.h>; a1 _9 H+ x8 \1 f
  35. # |9 X6 j  q( t3 D
  36. #include <mach/memory.h>6 y; ?% U0 a/ F. m2 g
  37. #include <mach/hardware.h>: L8 i. d6 ?, P  t' U$ K* G
  38. #include <mach/irqs.h>
    # b% y  I1 Y2 N8 D  L5 ~
  39. #include <asm/hardware/edma.h>
    0 R0 G  c7 W- t* J; A5 D* b

  40. ) s. z% _0 P* c& n& r- m2 H% l
  41. #undef EDMA3_DEBUG
    : W0 V$ e5 E* d( |- Z
  42. /*#define EDMA3_DEBUG*/
    7 Z) p0 \$ P' b) _7 n. u& z7 _

  43. $ ^3 Z2 q, v+ B% y* D
  44. #ifdef EDMA3_DEBUG
    . h$ P2 }, ?- ?9 _3 ~( I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* P6 y8 S" E7 z: t) j0 O/ z! K( z( [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . L* u  p1 \$ |1 N9 H( D* x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * }' f' i, |7 `8 S, G7 Z1 M5 |
  48. #else7 {! r. `. n% G" V  j: m! n( Q; o, o
  49. #define DMA_PRINTK( x... )8 s6 O1 f. J8 d: Z
  50. #define DMA_FN_IN
    $ ^# s: j0 q. M4 z0 Q
  51. #define DMA_FN_OUT( q+ ?, B% w, j, c+ Y* W
  52. #endif6 C! H) T/ [. E8 B. @
  53. 1 ~* E, b+ h# M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' p! d0 N& _* Y5 I3 N& I
  55. #define STATIC_SHIFT                3
    * R- \0 X+ Z/ M. x8 d6 s
  56. #define TCINTEN_SHIFT               20; ~; G! G6 q" k5 _+ B* b3 V! U8 ~# a( O
  57. #define ITCINTEN_SHIFT              21. O; n0 V2 x8 P" {5 |4 B2 ^* ?
  58. #define TCCHEN_SHIFT                222 F( U0 B- |- `8 t  E4 E
  59. #define ITCCHEN_SHIFT               23
    , b' ^; w! b" {0 t/ z; V1 l

  60.   r) Z& m4 {: c
  61. static volatile int irqraised1 = 0;
      }+ ^% Y! W) Z: M1 d
  62. static volatile int irqraised2 = 0;3 N  Q- ~6 l: x4 a( r

  63. % L0 O0 ^- q" f* D/ {0 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K, M6 T; m0 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) i. Q% D7 @: n" V/ h. O, _, u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r' u* N/ X! p2 @$ l9 C

  67. ) z# w/ z. }9 W) _
  68. dma_addr_t dmaphyssrc1 = 0;
    / _0 X& T/ Z1 ]% t
  69. dma_addr_t dmaphyssrc2 = 0;4 ^9 V' M9 O5 d' p8 H" r
  70. dma_addr_t dmaphysdest1 = 0;
    ( e# G: n( \, U" z5 E7 C" U1 x0 z3 t+ H
  71. dma_addr_t dmaphysdest2 = 0;
    # \# Q6 ]1 F, Y9 n6 e* v8 O  I

  72. 9 K0 e( {( u+ J8 N- {5 A2 z
  73. char *dmabufsrc1 = NULL;1 s2 g/ w$ s% h( V4 p$ d
  74. char *dmabufsrc2 = NULL;; H6 n. H% i- w( s4 K( ~+ O; F3 K8 s
  75. char *dmabufdest1 = NULL;
    ) S+ f( R) ~6 A8 H  v
  76. char *dmabufdest2 = NULL;# W" r4 t2 |5 \) L% o, m
  77. 9 m$ O" V" D# G* p6 ]& e2 {
  78. static int acnt = 512;; g, N& f- H9 I6 @) P  m' R
  79. static int bcnt = 8;4 A  u8 C) t  l2 b  A8 j
  80. static int ccnt = 8;
    4 Z( r6 S7 P' Y7 e6 b! p' b0 m1 K( e9 K
  81.   _* y7 v; V6 Q6 Z" K. ]
  82. module_param(acnt, int, S_IRUGO);
    # k# P! u3 W+ e6 v; k$ C  e
  83. module_param(bcnt, int, S_IRUGO);' z$ V9 r5 D% `% s* a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 q& H) k9 C% r# m% r/ G; f5 B5 r8 m! V5 E, d/ i  Y0 t5 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 g- L( j0 o* a7 o' e1 X) E2 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 `" R. V: S# H. H* G5 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 p: F. G0 ]( g. h3 F4 C" U4 T' H

! u4 c8 M' m. O5 Y+ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 13:33 , Processed in 0.040179 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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