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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 u; Q8 K) J: E! G# o6 ]" R
  1. [code]EDMA sample test application
    ) N3 Z5 O3 |" [$ Y1 t) w
  2. /*
    + [/ G  v9 Q3 A* A4 n, A  G
  3. * edma_test.c( X7 ?- }$ x8 u! y9 B) ~
  4. *
    / A8 c8 p; D0 v- L7 j2 }3 Y, p  k* x
  5. * brief  EDMA3 Test Application) W4 Y9 w, V! U( n- C
  6. *
    2 f( I2 v  B. l0 n* n- P
  7. *   This file contains EDMA3 Test code.
    ! [% Q% h+ Z' T2 q8 p4 Z
  8. *% H& ~- g2 L" T& N* @4 F1 ^3 t  W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . A6 i6 s; |5 R9 Y" P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " }& e$ `, y! F: }$ n3 Y9 C
  11. *         TO CHANGE.
    & s6 Q* U" R% _) U
  12. *( U' M$ B' |4 L5 Z$ P3 I  i( A/ ?: V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 ]1 P, y* M6 G, S" b4 [
  14. *; W% g+ @; T# o9 v" \
  15. * This program is free software; you can redistribute it and/or
    & x% C" T* b7 _7 [2 _
  16. * modify it under the terms of the GNU General Public License as7 n) O, L3 b7 J) ^9 R
  17. * published by the Free Software Foundation version 2.
    $ n$ B& s* u$ O
  18. *
    8 i! D) ?1 S6 c0 c5 x/ f* l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  n7 G, J$ t6 Y4 K% _
  20. * kind, whether express or implied; without even the implied warranty
    , r) ~: C% q' \% a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # F8 q- o- ^+ h' ?0 J$ x, D4 z- `
  22. * GNU General Public License for more details.
      L9 `7 Z0 u% A; Z3 ?4 |# r2 s
  23. */3 P- q. G0 V" x$ o' a0 W9 p6 e
  24. " E8 g9 o6 K7 A+ r
  25. #include <linux/module.h>
    ! a( p! y" A4 m& x
  26. #include <linux/init.h>
    & h5 H+ n' [7 m) k8 [6 p
  27. #include <linux/errno.h>
      F# C/ K% A6 g0 F3 M  p: D5 I. U" R
  28. #include <linux/types.h>
    6 g) |( S1 q8 r* t" {
  29. #include <linux/interrupt.h>" W! E7 b9 D. H4 ^; g: r5 K
  30. #include <asm/io.h>0 a+ t. y; ?: K
  31. #include <linux/moduleparam.h>! u  x0 R6 I2 K5 ]
  32. #include <linux/sysctl.h>
    5 G- `: d' ~$ M( S3 v3 A
  33. #include <linux/mm.h>
    4 p4 ]4 G% V: I6 `
  34. #include <linux/dma-mapping.h>, p* ^- q# K! k
  35. ' l& [0 X1 v! t% O& o5 c8 U
  36. #include <mach/memory.h>, f- `3 H( F% b" V- F3 k
  37. #include <mach/hardware.h>
    & J1 |; Q2 s* \# T! @! Q
  38. #include <mach/irqs.h>
    7 t' d# C; S, v  [
  39. #include <asm/hardware/edma.h>& [+ \- @5 S5 g: i: [

  40. / `) t! Y' B! c4 }' C: v
  41. #undef EDMA3_DEBUG
    1 D4 @/ o0 x( j* Q0 V0 d" H' ^
  42. /*#define EDMA3_DEBUG*/  O: g( @  V0 M9 B* r) i; N- T
  43. $ c; m" f' \, v0 \2 K
  44. #ifdef EDMA3_DEBUG
    . G9 k0 a# d; a/ N1 n6 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 s: g! o+ @1 ]* U# a' _/ [; J+ Q" H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 G9 v2 ]* f" e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; N# I; d$ g( U7 K$ p( r0 y7 w$ G
  48. #else
    ) l# G5 v# y/ [% P0 ^; y! |# v
  49. #define DMA_PRINTK( x... )* L, \# I: Y  ^6 V
  50. #define DMA_FN_IN) V0 E3 i1 z3 u* T1 V
  51. #define DMA_FN_OUT# |9 [1 h; G- q1 q' C2 J
  52. #endif/ U, }' d4 m3 W! x7 `' @

  53. ) g  z0 i) _$ w6 m$ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), F, L- v4 p. f! m. Q3 M8 ~
  55. #define STATIC_SHIFT                3, B" t* }# R2 F: M* ~4 I4 D
  56. #define TCINTEN_SHIFT               20$ Y5 ~1 A& {/ K/ n
  57. #define ITCINTEN_SHIFT              21
    : ]' n7 H. W7 ~* ~. v0 {4 e
  58. #define TCCHEN_SHIFT                22
    0 j3 H- z+ c. U4 k
  59. #define ITCCHEN_SHIFT               231 u, a2 \9 H, Q; J# ?$ G6 z+ v' I
  60. : q! u' W8 Z8 _: `/ Y8 R  f
  61. static volatile int irqraised1 = 0;
    + s# Y  `: `( \3 [; w
  62. static volatile int irqraised2 = 0;+ }( f0 P6 i$ _6 C
  63. + }! ]' p; j: k- C4 e( ]# z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % R5 u- a4 N/ k' F: \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & z  y* w) Q- r1 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ B4 K6 X4 M" h" Q

  67. 6 H, R& k# y' N# J& l
  68. dma_addr_t dmaphyssrc1 = 0;
    / }# m" W# c8 B' v1 T0 F
  69. dma_addr_t dmaphyssrc2 = 0;
    8 C/ [1 W$ W" K( h( j4 A+ h/ X
  70. dma_addr_t dmaphysdest1 = 0;) J( e( ?9 ~+ k3 r. _! N
  71. dma_addr_t dmaphysdest2 = 0;4 K9 @* ?& l% s7 t$ t4 R
  72. 5 u- j: ]& M6 t5 T  _
  73. char *dmabufsrc1 = NULL;
    3 ?& w% R2 T8 L
  74. char *dmabufsrc2 = NULL;' _7 n0 o4 p  i+ H* W
  75. char *dmabufdest1 = NULL;5 Q4 t( l0 i# N0 F+ }
  76. char *dmabufdest2 = NULL;) @  J4 R- t8 M; ]" w  ^
  77. , ^: D% p7 {9 ?+ Y$ N' i4 ]
  78. static int acnt = 512;
    ) q6 S5 X6 {" C- m+ @
  79. static int bcnt = 8;5 c2 _7 [" l- q4 a- ]+ C
  80. static int ccnt = 8;
    & f8 }8 Y. ]5 G) U( C

  81. ' D+ C8 @( v6 h1 ?
  82. module_param(acnt, int, S_IRUGO);2 c6 p& g8 K% U/ Q6 X2 D* s
  83. module_param(bcnt, int, S_IRUGO);
    5 g& I; m, @2 S# H8 B+ t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 k4 t5 |4 {  a( F* f& ~5 V

/ m% r/ @6 u( h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 o9 y: H. A4 d# ^! z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: A* D( x# ~5 ?- K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& l' _8 p2 V3 F3 ^. q. m' x1 }

, L+ o: e, X' j4 b( ?  v8 L9 ^  M0 z* O" P$ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 22:01 , Processed in 0.037577 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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