OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - W3 c$ i+ ^! O. c% l7 y! X
  1. [code]EDMA sample test application
    3 I1 L, J7 \+ R" A" w8 p! i% U8 K
  2. /*. v2 y( m6 C# T5 ]2 W' `
  3. * edma_test.c
    1 W1 A. ?* S6 t1 N$ Y
  4. *
    4 {+ b, N" b; x9 m4 m% h
  5. * brief  EDMA3 Test Application
    : c2 A+ s1 m: I; N) u
  6. *
    + e, `9 T% ^- v  W  v9 [) g
  7. *   This file contains EDMA3 Test code.9 m3 P6 V4 d& f8 j
  8. *
    : V2 C4 U- e- J8 _8 w9 o$ t: F1 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 a0 h, F5 W; Y) m8 b9 h  S  |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % B) s9 m) L# t, V8 r  a1 h$ x' W5 N
  11. *         TO CHANGE.' ^8 Y; _) w" u) V
  12. *7 X" Q* E. a' \9 b9 I6 W6 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) x3 q5 V) M3 g1 t. B0 V
  14. *) k+ g# P% x3 O& P2 b! T$ s1 p
  15. * This program is free software; you can redistribute it and/or
    % h% i8 v  q( k) c% ^( k$ s
  16. * modify it under the terms of the GNU General Public License as: f/ L: _  j& y& p; A/ l' ]
  17. * published by the Free Software Foundation version 2.
    2 A4 c* _$ {  m' r4 ]
  18. *
    / W7 f* X: K$ L: f" P# K' d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 H# w$ Y' V, |8 U/ e% h: H0 m$ _
  20. * kind, whether express or implied; without even the implied warranty
    ' m% w! s  m" a! W, k& o' e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 {+ j3 n8 I7 t. \. @4 t
  22. * GNU General Public License for more details.$ c! V  ]5 v- p* ]7 x8 |
  23. */, X. R- v$ ?3 b; l5 E

  24. 9 \5 @6 V8 J/ _) z/ r, W! ^
  25. #include <linux/module.h>/ H- Z4 \7 l( X/ C) k, f& l/ l
  26. #include <linux/init.h>1 Q" v1 v7 c; `% x
  27. #include <linux/errno.h>. }7 n1 P; @: _- U; C9 U2 _) T$ |+ I6 q
  28. #include <linux/types.h>
    9 T/ Q' W4 I% F. r
  29. #include <linux/interrupt.h>
    ( L  v, n6 {3 y. l  `2 j
  30. #include <asm/io.h># |' I  r' h- \: f. R, w
  31. #include <linux/moduleparam.h>, T( C: n) h$ s
  32. #include <linux/sysctl.h>
    1 J& o$ g- e, P5 r( d' ?
  33. #include <linux/mm.h>
    ) n# E8 y- @0 l3 v: z' k6 E
  34. #include <linux/dma-mapping.h>& S7 V2 w1 A4 s# i' x

  35. ' o) s1 @9 u( J" ?/ J8 r# A! _
  36. #include <mach/memory.h>8 _$ W$ e+ I4 f/ n
  37. #include <mach/hardware.h>
    0 X  N6 J1 f+ I- w
  38. #include <mach/irqs.h>
    7 Z/ w; Z  H% S& m9 P0 Y+ v
  39. #include <asm/hardware/edma.h>% f1 c5 J; ~' P4 M+ ]0 D
  40. 3 E0 q) t" e# ?; L6 P' {
  41. #undef EDMA3_DEBUG1 o% @" [0 G  v% U
  42. /*#define EDMA3_DEBUG*/0 n  w! p. s) q5 h. @" C
  43. & ?. o+ g- y9 H6 G. ?/ Q( ^$ |
  44. #ifdef EDMA3_DEBUG  k& j. B+ {* b( |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , X; L# k+ z& Z2 O2 f; a* C& X0 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( X5 x9 E  x, r5 b, t7 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). A# @+ s. t: h' i& o& B
  48. #else
    - V  e% c  w/ d7 ~
  49. #define DMA_PRINTK( x... )% Y; U$ X; w! e( j1 Q' {% b* r' v
  50. #define DMA_FN_IN# \/ _1 F; d4 V! y( _
  51. #define DMA_FN_OUT
    : q7 ~5 p, ~. i; I& c
  52. #endif8 X* Y( Z) X1 ^! @- y* n3 B
  53. 3 x7 j( `+ V" d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" F7 X, D: r7 E
  55. #define STATIC_SHIFT                3
    + k* F7 h, ?, @$ U8 i) H1 A
  56. #define TCINTEN_SHIFT               20+ |1 L' L& Q+ Z/ ]  M! a! A/ E0 M
  57. #define ITCINTEN_SHIFT              21
    ( z  H3 |5 `) ^
  58. #define TCCHEN_SHIFT                221 E: f" Y$ R9 a2 B+ @3 H1 m; @
  59. #define ITCCHEN_SHIFT               23, p2 J+ x6 p2 d. {' |
  60. ; X) C% D" g% P
  61. static volatile int irqraised1 = 0;
    ; ?7 C4 I: v: P  \) e& s3 i5 [$ Z9 U
  62. static volatile int irqraised2 = 0;
    4 v% G7 \6 w5 Y$ ^- q6 }

  63. . f$ }6 r- Y  o- B# w8 P, ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) C/ @5 a, y4 A! [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' p: z( b2 i* f' ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F: [  S" d9 W( V: X
  67. 8 |5 p1 Z0 ]1 q+ K& W
  68. dma_addr_t dmaphyssrc1 = 0;
    $ r+ }+ _% q8 c* f, i
  69. dma_addr_t dmaphyssrc2 = 0;
    / K4 r4 f8 z9 G
  70. dma_addr_t dmaphysdest1 = 0;/ }9 Q9 e. H/ W; r  I
  71. dma_addr_t dmaphysdest2 = 0;
    ! u8 i* t4 @7 w
  72. / s3 z+ D& u& H: P3 q2 I
  73. char *dmabufsrc1 = NULL;
    . t: l/ \: W* U7 U5 `9 }7 W% `
  74. char *dmabufsrc2 = NULL;4 H& p) j0 T  m  L% s3 K2 C
  75. char *dmabufdest1 = NULL;
      M& ^5 d, x; j# x/ h
  76. char *dmabufdest2 = NULL;
    ; _" i: x. n+ e

  77. 6 H$ V/ L( G1 P7 m( U
  78. static int acnt = 512;
    0 ?  _5 y5 n4 a7 \$ F
  79. static int bcnt = 8;! T! @7 J/ l7 `  z, {
  80. static int ccnt = 8;
    $ I- Y% f) Z6 C3 g3 N

  81. 0 H7 v; t6 H; f5 l' a- ^
  82. module_param(acnt, int, S_IRUGO);7 a7 ~, j3 O) j7 `
  83. module_param(bcnt, int, S_IRUGO);
    : w* l4 ]& T, I7 [1 }# d2 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 ~: z& l- q9 u1 ]& O8 C; J) z; e$ y( q

4 |: z: C* {# Q6 y' [  u% k7 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ k" z2 Z' H9 M! Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; x, n5 ?3 J) h* b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( b6 ], A8 h- ~* @$ Z4 o6 Q) I
- T1 d# d8 j( A8 G& N$ L7 z3 j
/ m' L$ ?9 b+ F4 X' p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 07:08 , Processed in 0.038832 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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