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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / W; `6 b( a6 c5 N7 A; W4 e
  1. [code]EDMA sample test application4 l, e* X) h1 A8 O% Z" p
  2. /*, P* f7 r- d6 i
  3. * edma_test.c
    / G+ J7 a6 ^+ r( O* E% a+ H
  4. *, Y# c- S' }7 ], M$ d  W8 O" {0 E
  5. * brief  EDMA3 Test Application" {3 P6 W' Z/ Q+ P# O7 r6 O
  6. *
    & {& |' O& K1 S7 j
  7. *   This file contains EDMA3 Test code.
    - \+ d$ G& S3 g* ~/ C# ]( [" J* S
  8. *
    , M( K( A7 G0 L* W( Z3 ~* t2 d9 S$ A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 C9 T+ t3 s+ ~/ K3 U! `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Z5 d" B! M9 `# l. b/ T$ m
  11. *         TO CHANGE.
    6 S( a4 F2 Q+ D" H  k$ x2 I8 x
  12. *
    6 C, q0 F; k. n3 W& D9 k  S( ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : |6 ?- x- R! T8 B2 z! v
  14. *+ P8 f8 P7 u' U' c9 g" I7 Q+ z6 Y
  15. * This program is free software; you can redistribute it and/or7 i4 A" g1 @; b/ b5 O  X2 w
  16. * modify it under the terms of the GNU General Public License as; h* `% A) O) n! \" F% Z" ]1 M
  17. * published by the Free Software Foundation version 2.
    - [- E5 X  c1 e( l
  18. *6 m3 Q( ^: f) G% a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s. e% }) f: D- M" V- F
  20. * kind, whether express or implied; without even the implied warranty
    ; k) q" d5 N* c! {9 R' E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 D! {2 k) u* f% ]- a4 G: f# t. S
  22. * GNU General Public License for more details.
    ; ~6 E' U% N/ j. ^; k* v. z3 V
  23. */0 l/ V& |. @7 g9 z, t

  24. : r, n, |$ a) I* A. m! R
  25. #include <linux/module.h># I! ~  \7 p  [7 ?! B, N
  26. #include <linux/init.h>6 `1 C. o1 q. R
  27. #include <linux/errno.h>+ z+ o6 ]. Z7 v; m. I. g: O
  28. #include <linux/types.h>2 l2 F5 h! r- L8 h# _9 l; A* i
  29. #include <linux/interrupt.h>
    $ b" n3 ^! E1 H. p8 v8 s7 M
  30. #include <asm/io.h># O% V( a4 x/ q9 f
  31. #include <linux/moduleparam.h>6 N# Z6 `/ v% X- O; X8 d
  32. #include <linux/sysctl.h>+ D* e9 u5 ~1 f$ o: }! o% X2 d
  33. #include <linux/mm.h>+ m! [# z9 n- k4 N- `( O, X
  34. #include <linux/dma-mapping.h>) c- X3 p& i! O7 j% D
  35. # l1 [8 G7 y! n) d& o% g8 ]! a
  36. #include <mach/memory.h>
    & n5 w. n% A6 Q; e$ P; Y" F+ U6 ^
  37. #include <mach/hardware.h>
    ! H+ F$ _% E  r9 I8 o/ Z, t
  38. #include <mach/irqs.h>
    6 w7 i, U1 g8 M* {' j4 q  l
  39. #include <asm/hardware/edma.h>
    " n; d+ l9 y5 c* Q- X9 ^( R

  40. 5 e5 i, m% |7 B) z6 D3 A4 j/ W
  41. #undef EDMA3_DEBUG
    $ e8 ]! H$ l# J3 s. ~# p. n  j
  42. /*#define EDMA3_DEBUG*/; ?4 T" l6 d2 V% C: j& l% C

  43. . I+ ~$ K7 X; q! e$ E
  44. #ifdef EDMA3_DEBUG
    % w' [0 M, P3 L3 }( b0 ?: Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 i/ ~$ O) G3 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' R/ v" B( O1 S# O, p% T5 _" {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 s, Y& F% G: }; X
  48. #else
    ( V& h3 }4 P! E- }! B2 C4 n9 ^
  49. #define DMA_PRINTK( x... )/ A" U# p7 h+ v8 ]" M" x0 ^
  50. #define DMA_FN_IN
    ' w1 E: {! V4 F0 }- k$ x
  51. #define DMA_FN_OUT  V9 E% @- Y# p1 G( r. g& Q
  52. #endif* w1 w. V5 k. ?0 [# d
  53. ! o% w7 y3 g: v" c" K! b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 Z) A1 W4 i* U- b  i9 y7 h# }
  55. #define STATIC_SHIFT                3
    ( l4 i7 A( |) C! N- `& O7 k
  56. #define TCINTEN_SHIFT               20
    " w. g- B7 l# B2 _  Y8 Z3 f
  57. #define ITCINTEN_SHIFT              21
    & X  b9 ]1 y( B
  58. #define TCCHEN_SHIFT                22
    ! `# S' U/ Z: A( N( M2 B
  59. #define ITCCHEN_SHIFT               23- n* T0 Y3 E/ ~
  60. ' ~2 F% P% E; ^' {
  61. static volatile int irqraised1 = 0;
    ) g7 T, E( j7 d" Y) p$ x8 {8 x
  62. static volatile int irqraised2 = 0;
    * x% |: k0 A1 ]5 p
  63. 2 q; |0 a6 X- v) f/ y3 m5 ]+ j1 ?( E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( N6 G* s1 R% J0 I9 C7 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! t0 o: D, A5 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 r, l, J. V/ P

  67. 4 g2 R1 x9 f( [
  68. dma_addr_t dmaphyssrc1 = 0;$ ?* n4 M: L: Z5 G4 d
  69. dma_addr_t dmaphyssrc2 = 0;
    + N+ e/ s/ r& ?2 O* }& F  E
  70. dma_addr_t dmaphysdest1 = 0;
    & Y+ Y5 W/ O& Z5 ]  Q# Y! c
  71. dma_addr_t dmaphysdest2 = 0;1 ^% h6 T; |" U3 M$ v  T% M. f  D

  72. 2 F% |+ @# I/ Q* L
  73. char *dmabufsrc1 = NULL;$ J5 H7 W$ ^* J8 m, H
  74. char *dmabufsrc2 = NULL;
    ; N2 ]- T# G+ w/ K$ E: p
  75. char *dmabufdest1 = NULL;
    ; d- c9 _% P! m$ Y8 r4 A7 O: H
  76. char *dmabufdest2 = NULL;! @- Z: b" @- P. m0 z% _! ?
  77. * q( u" d/ ~+ v1 i1 N
  78. static int acnt = 512;8 _9 e7 _/ a' B/ l
  79. static int bcnt = 8;
      X. s- r& H6 x. i8 _
  80. static int ccnt = 8;
      o: E1 J4 {; H7 u7 g+ {
  81. : Z( C5 l- a/ i% R5 w3 S
  82. module_param(acnt, int, S_IRUGO);+ l  ~0 n% s# p4 j7 e
  83. module_param(bcnt, int, S_IRUGO);
    3 t* n  Y" m3 _6 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 T; Q% }  ?  C
4 s0 Z' ?2 S. X/ x; u9 g% i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* p- f* t1 s/ b1 R' q  N- t$ x- e) _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; z6 ?8 z6 G) {& c7 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 E+ V6 U5 V/ e) w" q' W9 v
  T3 H, }: [. u5 g
- {0 H" Y+ g2 K/ L& R# h( L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 09:11 , Processed in 0.038634 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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