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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % d% a- E, v/ b0 |0 Z8 T& q
  1. [code]EDMA sample test application
    - C5 l- q, `  w" H4 S
  2. /*
    . U9 g0 P: l: O  Z! X* p- l
  3. * edma_test.c: u: C7 _5 H9 Z0 M# k, z
  4. *
    , _7 H8 Z. z; _7 L2 Y% L2 u+ r
  5. * brief  EDMA3 Test Application
    ! j. X& B3 n- ^5 p! d6 e7 e
  6. *
    7 A# \/ n  B4 ]- o+ d
  7. *   This file contains EDMA3 Test code.
    2 x* ^1 [# \  e3 E
  8. *- E/ o6 L5 o0 A% Y7 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' H' o6 ]1 L, Z- E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 N4 L0 d8 w2 o. a; e2 M) F
  11. *         TO CHANGE.1 x" i% l) Y' E% g4 U
  12. *9 B7 A$ h/ T; F+ ~7 B2 R; i. q4 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( [. B# z: A7 B/ ?8 ~4 c
  14. *
    0 c% Q7 R$ A5 G3 k0 }+ R
  15. * This program is free software; you can redistribute it and/or
    2 Q) s. ]$ j& S, Y9 i# v
  16. * modify it under the terms of the GNU General Public License as3 a! J$ g3 |0 ~: \
  17. * published by the Free Software Foundation version 2.
    ( M4 v4 o+ L  p5 z: m, `
  18. *
    4 |; |3 A7 }0 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , U: ]% y" t# j4 W; `* d. C
  20. * kind, whether express or implied; without even the implied warranty
    ! F; Q$ X/ }$ [; W* e$ }9 F3 s8 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 M$ d' L" a$ P: i- X' M* s
  22. * GNU General Public License for more details.
    ) x, j" C# u& J
  23. */
    & u) R3 n+ H1 e
  24. . e3 O3 u" w6 q
  25. #include <linux/module.h>
    # _  p9 D# L) j1 \' l4 x
  26. #include <linux/init.h>
    & e( v! m4 z& W
  27. #include <linux/errno.h>, a9 D& z: ~' O& b
  28. #include <linux/types.h>( V, [! m1 E1 k* C+ y$ N6 H
  29. #include <linux/interrupt.h>  W" a) [) ]" T2 D- y- `
  30. #include <asm/io.h>$ M6 t+ n) I  |# Y0 E" ~
  31. #include <linux/moduleparam.h>/ E5 q# b6 P, s" P
  32. #include <linux/sysctl.h>
    $ ^' a- E5 J$ t5 ?" \% Z
  33. #include <linux/mm.h>
    7 {7 x: x. g) o& F3 L$ R
  34. #include <linux/dma-mapping.h>
    ' r; D# l7 w# r( K+ c

  35.   k* B9 [0 S5 k( s; Y
  36. #include <mach/memory.h>
    5 s: C0 a" U, e! G: V( d8 ]4 X
  37. #include <mach/hardware.h>7 v* z% o5 K: N4 |$ Q+ I
  38. #include <mach/irqs.h>
    2 U4 d2 l5 M& i
  39. #include <asm/hardware/edma.h>
    ; W. C8 b4 A8 M0 |( N
  40. & A! H& }+ r& ?! y+ ~9 Q% m4 P# p
  41. #undef EDMA3_DEBUG7 O. i! ?. _; G4 X% z( |
  42. /*#define EDMA3_DEBUG*/4 }4 H4 ?) t. y# p& K

  43. 6 x) O  u/ d2 `% F
  44. #ifdef EDMA3_DEBUG( b% e9 n/ ^# K" U$ V* ]2 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 p$ M) o  w0 [8 Q5 y) i7 p! }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 W% g7 q0 {0 r- `. E- Z) J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- ~9 [6 F$ L  K& [
  48. #else7 l) A) w1 }' A# `' ?
  49. #define DMA_PRINTK( x... )
      {" Y$ L; r+ Y9 r' |. C) v
  50. #define DMA_FN_IN) {2 ^% e7 m. U" u, M
  51. #define DMA_FN_OUT
    , Q' S  W* e$ G3 K
  52. #endif
    5 `& G/ P$ f" w

  53. 7 N/ n3 O6 g3 H$ w! \3 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & S& L: A+ F& f+ N2 y
  55. #define STATIC_SHIFT                3
    0 l6 |# l7 r/ ?
  56. #define TCINTEN_SHIFT               20
    2 A; M3 ]1 E; R9 B- `! |
  57. #define ITCINTEN_SHIFT              217 R/ S% p# ]( A; j# y
  58. #define TCCHEN_SHIFT                22
    ( V% F2 f- }- Z- M  \
  59. #define ITCCHEN_SHIFT               23' M7 b0 g  V: r9 B" ?- b1 S
  60. 6 W5 n- ^( ]+ i: f
  61. static volatile int irqraised1 = 0;2 ^; O$ Y- g1 q( t
  62. static volatile int irqraised2 = 0;
    3 t. n8 D+ x5 _; E$ Q" J: q+ Z
  63. ; g6 f5 g3 d+ L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k- E+ w& e3 v! ]' q5 B) b+ O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + F( Y# e% k6 ~" o9 e' w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 V( S9 q* S9 E9 u# i

  67. 9 L' I. E; c; M9 b% I" Y6 s
  68. dma_addr_t dmaphyssrc1 = 0;
    $ d# L* ^) x. N$ }6 O
  69. dma_addr_t dmaphyssrc2 = 0;: G4 ?8 E0 B  @& B" h
  70. dma_addr_t dmaphysdest1 = 0;
    9 u+ F; X4 [. N. E  K
  71. dma_addr_t dmaphysdest2 = 0;8 @3 f5 G% o" Y- I

  72. ' q/ ^  o& s1 ^3 u- E
  73. char *dmabufsrc1 = NULL;- M; E3 V7 o8 D! E/ x( _9 [9 {
  74. char *dmabufsrc2 = NULL;
    % K  f9 R* |: J, F- x# x
  75. char *dmabufdest1 = NULL;4 H, p* t. `1 J* B2 E
  76. char *dmabufdest2 = NULL;" y! ^* Y; f0 k5 P9 `8 ], W

  77. ! j' L* I! K; s$ O, s9 {2 x
  78. static int acnt = 512;9 t- z3 i1 x4 I; [* @/ V
  79. static int bcnt = 8;! J. a; w8 _( B+ S; u8 X3 @
  80. static int ccnt = 8;# ?% @( o# B) q7 k
  81. : @! U- {  v: Y, M% Q( U
  82. module_param(acnt, int, S_IRUGO);
    % N  z) m' b# q4 S% s# w' v
  83. module_param(bcnt, int, S_IRUGO);3 _5 q3 S& ~# ~; G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 c9 j. p/ R  N& ]  v9 A

5 f- m- j* ~  b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 i: U/ v3 O6 t+ G. W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) c$ i  [5 W7 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 \' S# ?+ `2 x
/ n' y: O8 s9 f3 n, \7 H' a% Q8 W" ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 01:54 , Processed in 0.039277 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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