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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 w8 e! A# \$ K
  1. [code]EDMA sample test application0 t  @, a% S) H0 e. `% k
  2. /*
    + t' m1 Z/ u5 f9 @1 E: ^* T+ m7 y
  3. * edma_test.c
    ; j3 I# B% d- j8 s: P
  4. *
    ! C8 D! Q" y8 a* V0 z3 l
  5. * brief  EDMA3 Test Application( B% E" N: R) a9 o
  6. *; Z5 q$ |' A  W
  7. *   This file contains EDMA3 Test code.5 I8 F& Q7 `  E$ L
  8. *
    $ t. d& K* a6 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; T. ~. |, T! s. `* m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& H2 x6 U: j1 u' c# a7 x
  11. *         TO CHANGE.) E$ f7 v6 x; W. N
  12. *' W2 Y5 U  U7 ?& _4 j/ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * v8 C  k: t7 [* h9 K3 P: G& j
  14. *
    $ c* i6 y% M* R. G5 l- b3 Q) }
  15. * This program is free software; you can redistribute it and/or
    7 b. W+ i% }7 Y
  16. * modify it under the terms of the GNU General Public License as2 E( n1 R# z5 O( L+ S0 v
  17. * published by the Free Software Foundation version 2.
    1 d8 F. @# i2 s! H# L
  18. *
    . ~0 P% a4 j" Q8 t0 u+ C( o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 ]5 N4 w- S0 [& C. k) _
  20. * kind, whether express or implied; without even the implied warranty0 \$ l6 E( }/ q) r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 S$ O) p: X% Y7 t
  22. * GNU General Public License for more details.
    + g& q8 U& C: T# V% d6 x( p- Y
  23. */
    2 `9 a4 j, |9 R) D* s: q% o
  24. + R" R& `9 U3 q9 ~
  25. #include <linux/module.h>& D; \* g& I$ z: S
  26. #include <linux/init.h>
    ' \* w2 n# \/ n9 o
  27. #include <linux/errno.h>
    , {! ?  O# C/ ?8 E; [/ [
  28. #include <linux/types.h>
    + l2 \9 o* ~! C3 D  E  z
  29. #include <linux/interrupt.h>
    0 M8 t+ \1 z  f- r% q
  30. #include <asm/io.h>7 J2 W7 l8 m, y+ Z0 _8 O" B
  31. #include <linux/moduleparam.h>0 d) k* p. v! o9 `1 O9 S5 t
  32. #include <linux/sysctl.h>+ ^0 G. H$ s8 ~- I# N' u
  33. #include <linux/mm.h>, E1 I. X" v- M/ T6 S4 ?% ]
  34. #include <linux/dma-mapping.h>
    ) I5 H4 y+ d! g0 d* w
  35. * x; ]0 |4 S8 m* d, {
  36. #include <mach/memory.h>8 K! A" ]9 W- L
  37. #include <mach/hardware.h>& n) O, [/ l$ m3 G# |6 q9 _7 x
  38. #include <mach/irqs.h>
    , P* y9 e9 @9 w  t5 a1 Y
  39. #include <asm/hardware/edma.h>
    , G0 D+ T; _4 z4 Z; @4 l2 S7 X0 Z

  40. - e0 o6 F2 w1 c. G. M
  41. #undef EDMA3_DEBUG) V. S% R( G: x. {" h' A. h
  42. /*#define EDMA3_DEBUG*/) s2 ]/ K5 |) Q; v: Y+ y4 N
  43. 8 q* ^0 _6 a5 E  q( m( n$ X
  44. #ifdef EDMA3_DEBUG
    % u9 S$ P7 [) x! _  i8 R  R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' u3 }$ Y1 S8 U, _! |' c, V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( E3 M5 f* C0 Q+ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 _1 a+ J9 ~+ ^" ^/ {) z; Q. l+ \
  48. #else+ f8 ^9 S3 T( I  c
  49. #define DMA_PRINTK( x... )) w4 {) H# B7 i# Y
  50. #define DMA_FN_IN' O! [; n4 e# @5 \! y
  51. #define DMA_FN_OUT
      e$ B3 E; E; O) q" A& m9 I% N: S
  52. #endif
    8 w4 z" O1 ]/ l+ b* S! ^
  53. 7 n" W; K  j4 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 D# Q" A( a$ p$ z# k! j( X# O
  55. #define STATIC_SHIFT                3
    " o$ W& i6 h% ]% A' Q
  56. #define TCINTEN_SHIFT               20  X! V; l) ]9 z$ J! {6 @
  57. #define ITCINTEN_SHIFT              21  t: a& i6 m$ R" ~% X! M  _
  58. #define TCCHEN_SHIFT                22
    " K( ]1 Y3 ]( m0 X: q
  59. #define ITCCHEN_SHIFT               23
      v% r% N- ^% ~% O
  60. 3 A& L/ Q2 @: z5 F
  61. static volatile int irqraised1 = 0;$ Z/ x( A0 W: r# v
  62. static volatile int irqraised2 = 0;
    / [$ o: i1 c2 v9 f% A7 H

  63. 7 ^; M! Z& P  N7 L5 l+ p1 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ?0 [8 f% h2 L( W1 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* K( H( V: R& Q+ o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& [9 c; X. i8 @. A1 b* v

  67. 6 t; _; o# @" L
  68. dma_addr_t dmaphyssrc1 = 0;( @5 x$ j8 P( @: c; Q
  69. dma_addr_t dmaphyssrc2 = 0;
      v- H  K% [8 U3 ^1 S% ]1 a, r
  70. dma_addr_t dmaphysdest1 = 0;
    ) q9 N( ]) K. Z3 @: p
  71. dma_addr_t dmaphysdest2 = 0;" B+ H! X! ~8 J' V0 O
  72. ' @6 F8 M+ D& k% N4 [- _" K
  73. char *dmabufsrc1 = NULL;& ]( M6 h' n3 c1 Y0 }
  74. char *dmabufsrc2 = NULL;
    6 Y* p6 Y: P$ z5 q# q0 F! t
  75. char *dmabufdest1 = NULL;
    ( W% H! {$ r) l+ D4 W
  76. char *dmabufdest2 = NULL;0 X" s0 e2 X! z
  77. . {0 @2 r( T2 c  m
  78. static int acnt = 512;
    4 O$ @8 J4 {$ S: [( ~, |& D
  79. static int bcnt = 8;* w7 o( \; k) h# B0 h8 T
  80. static int ccnt = 8;8 B) @4 Z* r% R  P
  81. # N0 W" |$ x5 Q! e) J- g
  82. module_param(acnt, int, S_IRUGO);: T$ j! R. w3 ]  f. _- p6 F; l" h% G
  83. module_param(bcnt, int, S_IRUGO);$ M% ^+ I) q  r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' \# G, O4 b% y$ E! `+ u2 r( Z$ W
3 e) }9 m" V- h! t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! a7 @# v* d! r) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 p. Y# F0 Q  E3 a/ S) F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 f5 F% R: w9 i! ]1 d
' T; {, n: D8 ^: J' s  Q: m7 D
# U$ p+ x4 Y6 |2 e6 x5 W0 k/ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 07:06 , Processed in 0.046308 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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