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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; C+ r# w, |$ W3 t
  1. [code]EDMA sample test application8 a! ?/ h# p3 b+ U2 Z' }
  2. /*
    & }  f. F6 }% O9 v( J. o
  3. * edma_test.c
    + W; Y# z% i$ M4 W; i/ B5 X5 I0 a
  4. *
      T0 k' l" ~) t+ I9 l
  5. * brief  EDMA3 Test Application
    2 _0 Z  z6 R- l8 ^. r& ?' Y8 \* H
  6. *
    0 L3 _0 D5 Y) K0 A8 J5 b
  7. *   This file contains EDMA3 Test code.8 t2 z0 T5 e# g" S. k+ \
  8. *# E9 v4 [! w& [$ O2 _& t' t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 e& \# T/ m8 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * V( W- N4 _6 n/ w' v" f, Z( G
  11. *         TO CHANGE.  y9 F8 }" C+ E; a/ l
  12. *
    4 u8 s' U& n5 \7 |) F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) o3 m  b% x# J# c
  14. *
    % ]3 O7 s6 `4 u; g! D+ V
  15. * This program is free software; you can redistribute it and/or
    ' g* V% Y4 D& E7 o$ v" ?, g& j
  16. * modify it under the terms of the GNU General Public License as# a7 `+ `) l, l1 b7 Y( F+ b0 c
  17. * published by the Free Software Foundation version 2.% C& o9 Y" l5 _* Y
  18. *
    2 O% R1 |) V7 X5 v% E  \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J: ]& N  G8 H: f
  20. * kind, whether express or implied; without even the implied warranty) s( W" V' V. @' W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ s) Q8 Z6 s7 [
  22. * GNU General Public License for more details.& y2 g4 _8 V7 h3 C
  23. */' S0 t" d4 K1 n; ~- U
  24. 9 ?; b3 K+ l" G+ T( `+ v& N: w1 Y1 I& `
  25. #include <linux/module.h>9 X. @) z: c* ]' F7 l
  26. #include <linux/init.h>" v0 ]/ h* s7 J& w
  27. #include <linux/errno.h>
    8 [; H0 E* P# e) I, F
  28. #include <linux/types.h>
    6 w( K3 w" D* N2 L7 K( b7 o
  29. #include <linux/interrupt.h>
    % V* R8 V0 p! q4 Q4 Q
  30. #include <asm/io.h>
    3 r7 b; i4 A) L! v7 k4 t- D
  31. #include <linux/moduleparam.h>$ N7 A4 D' p& o! C
  32. #include <linux/sysctl.h>
    ' B+ R& G! o/ O4 e. k: q3 I. K' f* I
  33. #include <linux/mm.h>
    % @4 U' x6 @9 u$ B$ P" a4 m& I* {
  34. #include <linux/dma-mapping.h>
    & J: R, p/ v- D/ X  X

  35. ) G/ G% F, q% b
  36. #include <mach/memory.h>0 x  C/ S2 q- k% J2 \; Z
  37. #include <mach/hardware.h>
    1 B& ~9 J% y" @+ W
  38. #include <mach/irqs.h>7 [% x, h& y( |. X) v/ ~, a7 G$ g
  39. #include <asm/hardware/edma.h>- z* q" R3 P9 N/ ~- G3 R
  40. / _& n1 [3 W, @) j: p: s+ n+ J
  41. #undef EDMA3_DEBUG
    8 t% `9 _' F: v" A" a* g8 Y: D
  42. /*#define EDMA3_DEBUG*/9 e; T# F( W# M4 L- ~

  43. ( x- A/ M" C8 P( k2 `2 s; i. V* X
  44. #ifdef EDMA3_DEBUG( G) d7 |! p6 p0 g& E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* i  B4 m# ?- q& ?; s+ [3 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 E1 v8 l" `, i3 @+ d4 r- w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ s$ {+ d7 S4 M5 w/ s, k
  48. #else
    ) N$ @5 w& z* V
  49. #define DMA_PRINTK( x... )
    9 D* Z; [3 c. Y7 D) A* ?
  50. #define DMA_FN_IN
    * o: W( ?1 _* d3 V
  51. #define DMA_FN_OUT! ?& H4 k% w1 f8 \
  52. #endif1 `+ e& ^4 [: z% [7 W2 T
  53. + [% e- }$ s8 U; R: u2 A: A  ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 `+ F6 K: W. w; w, ~9 R) d; Y
  55. #define STATIC_SHIFT                36 `) F0 r; H2 ?$ p
  56. #define TCINTEN_SHIFT               205 n  @2 i- w, b: @
  57. #define ITCINTEN_SHIFT              21
    ! A# K# U; n5 Z: ~9 Z/ `
  58. #define TCCHEN_SHIFT                22
    5 p9 G2 J: z9 Q& i4 l0 H4 v; [$ s
  59. #define ITCCHEN_SHIFT               23
    0 l' V& ?+ |1 m- q/ o

  60. # G! y6 D/ @  A+ V, c/ Q* P7 y
  61. static volatile int irqraised1 = 0;
    8 c0 q1 D% Z# p$ [
  62. static volatile int irqraised2 = 0;+ I" p: h  Y1 g
  63. ' P8 P) C( X) S, n2 U; c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i) W* G& m9 W; ?' `# w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / r5 t  o3 N* N3 s, L5 t, B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }4 q, F/ V7 ?! ^3 o
  67. - _: w0 u3 G1 D, N" ]" K
  68. dma_addr_t dmaphyssrc1 = 0;
    $ L+ X9 B' P  t, T9 h" L
  69. dma_addr_t dmaphyssrc2 = 0;- Z, ~$ k- `% u6 `
  70. dma_addr_t dmaphysdest1 = 0;; k* r. J& w4 c; `' I) G2 y/ v
  71. dma_addr_t dmaphysdest2 = 0;
    4 e0 H' j2 _4 i' m7 x
  72. ; B+ T6 a7 |$ \
  73. char *dmabufsrc1 = NULL;
    % Q2 V; j2 z, _* F4 V, d+ z
  74. char *dmabufsrc2 = NULL;
    : Y0 I3 u2 j0 k. q3 R. e& H
  75. char *dmabufdest1 = NULL;
    3 x0 L! z9 l: @  y3 y
  76. char *dmabufdest2 = NULL;
    2 H3 h3 x8 `/ {3 j4 e

  77. : x- M8 Y! Y& ~' S; ]6 C
  78. static int acnt = 512;
    * o% ~7 E- T/ T9 p
  79. static int bcnt = 8;
    ! Q. Z- p; E: }% D' o* I
  80. static int ccnt = 8;) M3 H) B. w# f/ k8 q0 O
  81.   R& K( y7 q0 v$ z; m/ s1 c/ `
  82. module_param(acnt, int, S_IRUGO);( Y' [+ q9 }, a( `* Q' @) A
  83. module_param(bcnt, int, S_IRUGO);# E9 ]3 P/ j# s" E1 I3 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 G1 H- x! v$ z  V! R
; K, \; ^8 t  w9 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" F" B- O  S, e' j1 a3 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# m- j& l& i4 T; e. X+ P6 V# a+ b& c* l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& R; v+ X7 y) T9 ^) T
- b2 K; G7 ^- n

" a/ b$ K& r6 `! [% t8 ^# e. b5 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-9 18:56 , Processed in 0.037449 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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