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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ?! I5 _! s/ K  L4 B" C
  1. [code]EDMA sample test application: i7 p- ~) k, ~. C1 @! o+ |
  2. /*
    - i3 H1 J+ x8 c" W2 f
  3. * edma_test.c  ]; ^; c  X; ~4 U
  4. *
    & R% t' h) k$ I
  5. * brief  EDMA3 Test Application4 z/ ?0 k: [0 Q' A3 L
  6. *
    $ T  i+ {3 d7 d0 T  D* f2 F
  7. *   This file contains EDMA3 Test code.' X) e0 _1 k/ W. _5 o  r8 {
  8. */ ^: O1 N) E. A3 n/ ~3 R- g9 D* m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& E4 J, i3 l3 g: ^! J7 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ A3 l$ m3 y. }8 G! g4 W7 f7 U
  11. *         TO CHANGE.. N  F7 Y) `$ E
  12. *
    % N# T4 w+ O4 U5 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 k1 J' R5 p7 _
  14. *, w# b. c, W5 k: X' t' X
  15. * This program is free software; you can redistribute it and/or% N: L% U3 J( c7 _7 E
  16. * modify it under the terms of the GNU General Public License as) i( t+ W! O8 {# S6 E: F. g  Z! C. H
  17. * published by the Free Software Foundation version 2.
    2 i  r0 Q; }2 C7 z
  18. *
    4 K6 e' G: O# C/ q/ w6 f  P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 M1 g( F4 `( w7 G2 @2 T' _/ {
  20. * kind, whether express or implied; without even the implied warranty4 L0 F" r8 g9 }' f# C2 |8 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - f& O" z2 R. X; C
  22. * GNU General Public License for more details.
    $ q* k9 ^/ W4 E$ R9 P) j$ L! g2 ?
  23. */3 n  O4 X  ]& Z5 B# ^0 C

  24. . ^- ~7 N% ~$ k" Q5 M
  25. #include <linux/module.h>
    + E- K4 n4 L6 n' e
  26. #include <linux/init.h>
    / l' n$ P; B3 D  O3 x$ y- w
  27. #include <linux/errno.h>
    6 B. K" C8 t, S4 g8 J! u/ N
  28. #include <linux/types.h>
    , Q) J: T% T; [1 e
  29. #include <linux/interrupt.h>' n" ~- c3 ~! I8 g8 n; L7 M
  30. #include <asm/io.h>
    2 x" ^: h- t$ }2 X" ]* O* N
  31. #include <linux/moduleparam.h>
    ) D, @' K* Q9 j
  32. #include <linux/sysctl.h>" U1 O, ~$ W  k- ?
  33. #include <linux/mm.h>! x8 U  R$ r8 m, D! N* S- l1 z
  34. #include <linux/dma-mapping.h>$ {& f- U8 Z* ^# q; d

  35. ) ^& S& h& C9 ~) c; P4 r, C# c9 |
  36. #include <mach/memory.h>; O$ l$ S" V3 Z4 h' ^0 I1 G1 [
  37. #include <mach/hardware.h>
    : A: r# o9 \6 {; ]& m" u' F
  38. #include <mach/irqs.h>1 ]1 g6 h9 b, _% N; E* I
  39. #include <asm/hardware/edma.h>
    $ k* H0 {6 y% s' h5 m
  40. : G+ @3 J9 }) h. @5 a' [, L
  41. #undef EDMA3_DEBUG. S/ l' I) K. Q3 D1 a+ b( ^* O
  42. /*#define EDMA3_DEBUG*/
    , u- j! c2 A, j. h2 H3 f% q
  43. 3 T# _& [3 P" z' q: m4 R
  44. #ifdef EDMA3_DEBUG. o* X' o3 O( T' G( ?! ]/ Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' n) H4 `; f# e$ F( r9 W5 o6 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 x. o( R( H% k1 {5 x% y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): m# j/ s6 }9 t' s, ^+ S, z
  48. #else+ w% M" a( d; u6 |2 s/ v/ t
  49. #define DMA_PRINTK( x... )
    + @! @* Z- Y, `  ]
  50. #define DMA_FN_IN+ {' p0 k6 W! t1 v8 P
  51. #define DMA_FN_OUT
    ! @  k# g9 n  o' J$ t: l
  52. #endif
    7 V1 D$ v. P6 f. ~
  53. . f+ W  H/ U' ^" I8 C" e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      R, h. y0 @5 G! W  E% X. E
  55. #define STATIC_SHIFT                3
    4 _- m- |; w2 @' p; K6 w* M
  56. #define TCINTEN_SHIFT               205 K7 f1 m- P% G
  57. #define ITCINTEN_SHIFT              21
    / L: }: i3 M1 k0 A# D
  58. #define TCCHEN_SHIFT                22
    5 U1 S. l) J/ R3 T
  59. #define ITCCHEN_SHIFT               23
    + \, H+ f5 X) t/ C  z
  60. 7 ?6 s8 K. e# W& E
  61. static volatile int irqraised1 = 0;
    ; N; x& _7 W6 z: }: }& G9 h3 V9 X
  62. static volatile int irqraised2 = 0;
    6 a; ?5 l  |5 m
  63. 7 P5 P( b; o4 n* v2 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A4 [7 q0 E% {+ C* |% c8 M! t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: u# t- b1 q5 M, c4 Y9 [3 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: W  a+ d. i! Z( p2 b5 R) p6 `8 O

  67. 0 b% [/ A- A- T. {) Q
  68. dma_addr_t dmaphyssrc1 = 0;1 A7 ?/ N* `7 g" e2 u
  69. dma_addr_t dmaphyssrc2 = 0;. C0 F8 J" `1 Z+ D, w0 R1 }, ]
  70. dma_addr_t dmaphysdest1 = 0;
    - p) u% Q# L' s! \
  71. dma_addr_t dmaphysdest2 = 0;
    ! a9 Y* Y* @3 u' q3 G: m  h

  72. + S9 C2 M* w- V, R/ @# U- n) h
  73. char *dmabufsrc1 = NULL;( f7 q- a) o$ K  s' |+ F; y* ~1 e
  74. char *dmabufsrc2 = NULL;
    % t; y2 j! R  U7 A/ W7 g
  75. char *dmabufdest1 = NULL;
    , P, K% t+ i' x5 d) p9 D
  76. char *dmabufdest2 = NULL;2 e* u" [; r# B2 ^
  77. $ J  @9 R$ a! p3 ^9 v9 |9 h
  78. static int acnt = 512;
    & D! }4 T  \5 a0 g) E
  79. static int bcnt = 8;2 T8 y4 o* e3 t; _  A0 A% g9 }" I; Y
  80. static int ccnt = 8;5 W' R  R' j8 k6 Z4 J' U
  81. / i  r: h9 @3 V1 }4 e
  82. module_param(acnt, int, S_IRUGO);; ]4 Y# T9 B: |( e: d
  83. module_param(bcnt, int, S_IRUGO);! ^. C, a1 c2 U$ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 q" w# i3 ^- f8 i
' V6 x- z9 `/ C9 U4 L! H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; q( h: r4 ~+ }/ R4 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ B, v5 V+ t$ w9 k* T4 H( ^6 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ u4 B; j0 y8 R
; W2 ^& j6 M- L& H0 P1 R

, Q6 i; r( _. D( M7 D8 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-5 15:11 , Processed in 0.046121 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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