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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 V+ H3 J8 k3 E+ q% {7 y( ~5 O
  1. [code]EDMA sample test application0 a5 D8 D- ?5 H" P- P6 c4 D
  2. /*# D* K5 o7 G" M# w; G0 X. L, E
  3. * edma_test.c
    , l# {9 D* ?3 a( K8 l% K
  4. *: o0 R' a) J, |7 ?; Y
  5. * brief  EDMA3 Test Application- x. }; n* N" r/ X7 n. K2 `0 h
  6. */ B5 }9 f* \/ @1 p, u- k
  7. *   This file contains EDMA3 Test code.
    ( D, ^( [. z2 l; @1 H
  8. *
    8 e' g  o( u4 |6 G9 q7 |2 S9 T  k* }5 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 O1 r3 U  Y8 Z) V9 r" v  w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 @4 j; I9 P! v* e- @( l% }0 t; m
  11. *         TO CHANGE.
    / j# I; G) b" j
  12. *
    " h! `7 U: M2 |% |: k$ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : [8 \) G9 M+ N- a6 }
  14. *) ], q+ p- d- l# I% a  O2 x6 z
  15. * This program is free software; you can redistribute it and/or  G! W* w4 C/ j6 d
  16. * modify it under the terms of the GNU General Public License as
    / I) `# v. T: ^! {
  17. * published by the Free Software Foundation version 2.
    : a/ u6 r! ?4 f
  18. *  W7 ?7 |+ Y; W! Z7 t& k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * d" N0 ~0 L. M  o) I
  20. * kind, whether express or implied; without even the implied warranty9 W4 k# h! I) p/ F! ~, X6 M/ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; a5 Y- b/ G) [. m
  22. * GNU General Public License for more details.( v9 i+ E+ N9 k/ C( p; H
  23. */
    # I4 @! t& a" t) O/ e  r5 w
  24. 1 j/ I- w+ q2 Z. z+ E$ t
  25. #include <linux/module.h>
    ' m! }2 Z% ^0 A7 V! D/ h
  26. #include <linux/init.h>
    : R( W/ X0 h' [; h6 {/ w
  27. #include <linux/errno.h>; M7 C7 J% ^& ]  H0 R+ [9 G
  28. #include <linux/types.h>+ x" s# c7 ]- j: y. ]/ Q9 d. ?& u
  29. #include <linux/interrupt.h>
    * o8 M0 `) {3 o9 o) z
  30. #include <asm/io.h>6 O6 }% J$ L' C$ K) `
  31. #include <linux/moduleparam.h>
    ( X! T) z( G( v; [" A" L
  32. #include <linux/sysctl.h>
    ! X6 a# W0 Y0 J8 O2 y% ^
  33. #include <linux/mm.h>" `5 H) E- I7 [' J/ A' \0 P
  34. #include <linux/dma-mapping.h>
    ) k" l+ `" K5 h- J: V
  35. 4 N. |# ~( T* M2 W4 \  y; [+ S
  36. #include <mach/memory.h>
    ! {; f# ?# m' P. Y; s- ^
  37. #include <mach/hardware.h>
    ! H6 n8 h& F! v6 o' g
  38. #include <mach/irqs.h>
    + A+ o" R/ ^$ m6 K  T. x! l
  39. #include <asm/hardware/edma.h>
    * t8 c4 l' h% y2 @4 @- C3 R' \
  40. 5 a4 O0 Q  j+ Y) K
  41. #undef EDMA3_DEBUG
    / d5 d) @( X( r1 N
  42. /*#define EDMA3_DEBUG*/) \+ ]! `" f& t' Z4 k* ^, k, }8 C6 D
  43. - U: J' f7 d8 M3 b1 M
  44. #ifdef EDMA3_DEBUG  ~: z+ p: P' l% L) J. p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Y  e) E, V, }/ f( U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % M9 J$ {) ]# ^8 D4 m: X( c6 U5 p6 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): I" C* v( ]; z. W8 u
  48. #else
    2 v0 u3 d2 F0 q/ K, K& A9 q
  49. #define DMA_PRINTK( x... )
    7 g. ?0 P; E  L( Y. U) j; ^0 C
  50. #define DMA_FN_IN
    1 q$ s% W  p0 j5 m
  51. #define DMA_FN_OUT
    2 a# c8 x- I. Z' @0 [2 M
  52. #endif
    * O+ @" U% y. i$ T* U2 p

  53. ( b. b5 k; b- Y) F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + {; t- H6 v. z% T+ G
  55. #define STATIC_SHIFT                3
    7 M& t( h: E# i
  56. #define TCINTEN_SHIFT               20; h$ `0 R$ ?, l; K* f
  57. #define ITCINTEN_SHIFT              21
    " u6 a( e. a0 B1 F
  58. #define TCCHEN_SHIFT                22% k& K- O. z* q3 F4 |+ B6 n
  59. #define ITCCHEN_SHIFT               23* M! F4 D' X7 S. |+ W

  60. 7 k( v$ q, ~" w4 ~% B$ g
  61. static volatile int irqraised1 = 0;7 x3 U2 m# V! \. F
  62. static volatile int irqraised2 = 0;
    ) t4 Z5 W0 `: i0 i6 Z
  63. 2 \0 w8 {, Y1 y8 E# Y$ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( p) }: o; b4 j% \; ~; h# f! {( R% N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % H$ ?) ^8 ~! m& H$ E# z/ w1 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; l0 j+ g4 {% t5 Z* q
  67. ( m. c& s3 y+ s, T' R
  68. dma_addr_t dmaphyssrc1 = 0;
    : v% R/ l* |0 b6 g
  69. dma_addr_t dmaphyssrc2 = 0;
    5 n6 P" v! x, Q" F: z. w" D
  70. dma_addr_t dmaphysdest1 = 0;: n5 d5 {7 T4 w* Q$ }* b0 l) e) }, r
  71. dma_addr_t dmaphysdest2 = 0;
    : H9 }1 H) Y" a* t, N

  72. ! Z3 Y9 r; m& a
  73. char *dmabufsrc1 = NULL;7 S" f& K3 r5 L: A- ~
  74. char *dmabufsrc2 = NULL;
    3 C) L9 q/ f6 Y2 B; _- H* m" w: d
  75. char *dmabufdest1 = NULL;/ d, V, _& i6 n* k1 F* N1 q) L
  76. char *dmabufdest2 = NULL;
    0 {6 a& l9 B& S% r) w
  77. 6 v' F, c( [  `8 h& Z2 p
  78. static int acnt = 512;  [6 Q; f, g; ]* N$ D6 ~* Y# w: n
  79. static int bcnt = 8;& ^+ ?( o8 G* v% ^) s. e
  80. static int ccnt = 8;
    8 H' b0 E. u; E6 M

  81. 5 m% E0 N9 n9 D$ ?. a9 V
  82. module_param(acnt, int, S_IRUGO);
    % A9 P& b( y6 [
  83. module_param(bcnt, int, S_IRUGO);1 J5 `8 W7 n( {# f& _; Q$ u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' ^' @3 {  A3 i, w0 ]7 b  G7 u5 R
. {5 k8 _0 [% @) F- v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ e# q0 {# G  G2 f' F; ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& g3 b( T- Y9 n! t5 n8 `. n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 u; E/ \2 \# H4 p8 l
, [) A2 F9 g2 g4 v5 ~5 e+ Y
' ^* |9 S2 I4 M- r2 h& P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 10:55 , Processed in 0.036907 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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