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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! t% j, |- w1 N" E5 m
  1. [code]EDMA sample test application
    . p2 ~0 X; s* _: c* E; s+ R
  2. /*
    8 H$ ~; W$ k' U) P& \- i0 y. r
  3. * edma_test.c
    - a$ U$ b  w2 a4 b
  4. *
    ( G3 S: V+ a: T
  5. * brief  EDMA3 Test Application
    ; y+ L& Q3 @8 k( U/ n: s' G6 P! W
  6. *; u0 \6 g3 j2 C. p8 w
  7. *   This file contains EDMA3 Test code.+ [) g! X4 ?2 S4 g0 G
  8. *
    0 I7 L  I+ U: q0 [; y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 ]  ?" X* Y/ W2 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * \" `. \; v6 q
  11. *         TO CHANGE.
    / x2 ?, O0 Y' T; p% }* ~
  12. *
    8 \/ X7 I$ m; x4 Q0 U. M- B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' M) ^" x$ e2 g7 v' F7 ^4 O9 I0 T0 Y
  14. *
    * x: k: k4 ^2 ^3 D7 L$ e( A# M3 S
  15. * This program is free software; you can redistribute it and/or
    + N, C" s6 f# _$ X3 v4 L
  16. * modify it under the terms of the GNU General Public License as
    ) j. c; z& h# H4 p5 O/ j; L! z
  17. * published by the Free Software Foundation version 2.% D& n8 m2 s' a% ^9 d& B/ v" a* W6 ~
  18. *
    % m! V9 L; g: Z& y# j+ S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 m5 T! D  B% Z9 Q+ [* b8 T0 u
  20. * kind, whether express or implied; without even the implied warranty
    2 e# `7 q, |. A7 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 ?$ {* e) E+ e+ B; c" A
  22. * GNU General Public License for more details.* B$ Y4 D, q( k( Z! d% t# a' ?) t4 }
  23. */
    " W/ H( C  R3 u
  24. ) P0 ?2 V; k8 W( ?9 }% c. s
  25. #include <linux/module.h>, `" D" t6 ~. v8 L; e% y% u7 G
  26. #include <linux/init.h>; Z4 O0 m7 W+ f; r
  27. #include <linux/errno.h>! G1 f* u% _  v: ~9 y
  28. #include <linux/types.h>6 w+ e% N( c0 n
  29. #include <linux/interrupt.h>: X" _9 g' v; P1 k- Z9 I1 q
  30. #include <asm/io.h>
      u% x0 F- p0 h
  31. #include <linux/moduleparam.h>! j& N0 S1 q" q* B8 U' I' D4 n2 X- v
  32. #include <linux/sysctl.h>
    2 ~. r5 {2 ~4 r( K* l6 k
  33. #include <linux/mm.h>: A% m% e0 I; G+ u$ _5 a+ E5 \
  34. #include <linux/dma-mapping.h>' M1 H: I' a6 S) A3 c, G7 i( n

  35. ; {- W- o% D: r. v
  36. #include <mach/memory.h>
    & i* u0 g7 _2 r
  37. #include <mach/hardware.h>
    ) S' l/ X8 Q; I. l
  38. #include <mach/irqs.h>' n$ O# A' ~4 \8 L& m- z+ r7 `  p- y
  39. #include <asm/hardware/edma.h>
    9 L/ P: U, Z3 b7 x8 _- j% L

  40. 3 r0 }! |: }' ~, g* J- [
  41. #undef EDMA3_DEBUG
    4 T: `( P) L: F# l- n) Q& u
  42. /*#define EDMA3_DEBUG*/
    7 h$ }7 F0 |. z: \
  43. $ \2 V# k$ o9 p3 z
  44. #ifdef EDMA3_DEBUG# e9 ]1 K: }; S, @* A; ~; B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), V* C+ Z' v8 O4 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 j+ D: _, q2 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! C! ~% _+ m* D
  48. #else
    2 X% T* e! k* x. c, |& m. A1 g" X
  49. #define DMA_PRINTK( x... )
    2 R6 F! t$ a* E: n3 f
  50. #define DMA_FN_IN9 Y& @$ @: w4 W3 r0 q
  51. #define DMA_FN_OUT, [' }  a: H# \$ E- \
  52. #endif* U% R% c: a# x% C& ?/ J
  53. 5 K1 `- z' c3 B" Q6 T' ?4 J7 o8 O1 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 J5 V( F: n) g  y8 d; O& v  s( h
  55. #define STATIC_SHIFT                35 ~9 }1 f: h* R4 U* p) K; |( w& G
  56. #define TCINTEN_SHIFT               20& [& z7 c; f; [! [  f9 |8 k
  57. #define ITCINTEN_SHIFT              21
    , R) W3 N( G1 t( H4 @. v/ `
  58. #define TCCHEN_SHIFT                223 K3 ^. W2 ]. g; ^" U; v6 L
  59. #define ITCCHEN_SHIFT               23- s8 j7 ?- ?# q$ s
  60. & P) A) p4 Z  E
  61. static volatile int irqraised1 = 0;6 U0 P0 T8 z% `$ O
  62. static volatile int irqraised2 = 0;
    # e( I6 j/ Q$ q/ l! M' A6 X

  63. . w( ^' @9 O# |; b  E: J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; J: j# d; L" y( F' N- S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r6 v- g$ a* ~/ ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 B: V9 R; s2 e

  67. 2 C; L) _+ Q3 |/ n- k3 S7 w# k
  68. dma_addr_t dmaphyssrc1 = 0;
    2 N2 f% Q5 E9 e( C) [. P
  69. dma_addr_t dmaphyssrc2 = 0;
    ; J  u6 l6 k( w$ E/ s4 d  t6 g
  70. dma_addr_t dmaphysdest1 = 0;5 {" c  d( b+ d# H
  71. dma_addr_t dmaphysdest2 = 0;  M1 B9 }4 T8 L; _( c& r, l4 j

  72. % v/ B) O' g. ?# h1 k9 l
  73. char *dmabufsrc1 = NULL;' ~1 ^# T& |( I+ h4 D
  74. char *dmabufsrc2 = NULL;- ~; {8 `) W# m* {) y* Z: R
  75. char *dmabufdest1 = NULL;
    % Q. O" ?- M7 F
  76. char *dmabufdest2 = NULL;
    / x. h6 C" I3 G: R# |" [) U

  77. $ p/ G0 j6 D/ I" ?, Y4 T
  78. static int acnt = 512;) U) r! Y' Q' [
  79. static int bcnt = 8;
    ' z+ k6 R) d& g/ o
  80. static int ccnt = 8;
    ( j* A& r7 ^+ J" e! X5 g0 X5 f- z6 U7 o/ x

  81. % t" L' X6 Q& N) }% \5 ^
  82. module_param(acnt, int, S_IRUGO);
    8 _" \* G2 ]% z
  83. module_param(bcnt, int, S_IRUGO);4 v7 x' k. w! g1 U/ Q3 V! y# ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" U- o' T$ I( }5 s; d6 _
1 T! j' O' T" Y1 q) J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 @. [3 Q! c4 C' Q7 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 O+ `2 c* n2 ]8 I8 X) l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 v. F; D+ U0 Y, t: E$ `; O
% {& r; a0 u" H. r  j$ Q. Q. o3 O0 g; t; m: J7 z& b9 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 00:28 , Processed in 0.040724 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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