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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, n6 x8 v* B2 C
  1. [code]EDMA sample test application, |0 H# X* G% a* _
  2. /*/ W4 ^  E! p0 n9 c) P
  3. * edma_test.c
    * w  W; X1 _' k- n, B
  4. *
    5 ?/ U3 E: U6 L; P: \* j2 u4 g0 R3 w
  5. * brief  EDMA3 Test Application
    % l& w/ Q# e- ?" ~$ q6 S8 ?
  6. *
    ) l# K6 ^$ {* }+ d2 ?! W' Y2 r
  7. *   This file contains EDMA3 Test code.1 x. |& U( e; x. J8 ], G1 M
  8. *
    5 q! i0 q3 }" Y4 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * [' v8 W6 J! a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . @" ?2 G1 j* W2 e
  11. *         TO CHANGE.
    : R2 [" Z: w: |: L
  12. *: l7 A. f) O' t% s: l1 ]+ \6 u/ l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 m8 L. j1 w  R; Y) Y0 l4 c
  14. *
    4 z  q! R5 o4 T4 w( T$ ~5 M" }2 W
  15. * This program is free software; you can redistribute it and/or
    / ]' |0 s( I( i
  16. * modify it under the terms of the GNU General Public License as
    * G- }7 M3 W$ A6 a+ _% {% X, g
  17. * published by the Free Software Foundation version 2.0 S1 z) P# t, O
  18. *  t. p, |7 ]9 ?7 w* g4 t6 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Z( p! Z6 l. H6 }; [3 U9 K; R# F
  20. * kind, whether express or implied; without even the implied warranty# p) F, M" s/ a! F5 G  g9 W) W1 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 _6 i( U9 M1 o8 S! x. t4 x8 F+ n9 o
  22. * GNU General Public License for more details.
    # S1 i- q) c1 B7 x3 f/ W
  23. */+ U) r4 ~/ x$ ^& a3 a- R
  24. ! _, ?- Z! x% d9 _$ M3 |- b
  25. #include <linux/module.h>( t7 y/ G7 r% i$ P
  26. #include <linux/init.h>
    9 A& x0 v3 I2 k6 V
  27. #include <linux/errno.h>' p, ]8 J1 V: A1 Z
  28. #include <linux/types.h>
    ( y$ y, u* r' \5 B9 X, h
  29. #include <linux/interrupt.h>
    : \5 b3 d$ t0 z; j9 ?. r& A& `
  30. #include <asm/io.h>
    ' T0 ~) H8 x9 ^  ^% F9 ?
  31. #include <linux/moduleparam.h>
    . Z1 n  a6 ~: v* \; ^, c
  32. #include <linux/sysctl.h>0 j7 |4 J6 Q- U+ p
  33. #include <linux/mm.h>
    9 Y% s$ B; `0 n
  34. #include <linux/dma-mapping.h>
      g" r$ z8 H. |5 ]' ?6 T2 `$ s5 z
  35. # ^. s3 ^$ S6 O" j0 P
  36. #include <mach/memory.h>
    4 @3 s& l! p" o2 K( g
  37. #include <mach/hardware.h>+ ]4 u3 a; |' y$ n, h' P( W
  38. #include <mach/irqs.h>4 ~) ?( O' a1 Y
  39. #include <asm/hardware/edma.h>
    . s1 R8 x  |2 Y- x+ g

  40. - H& V; {! Q; j2 K
  41. #undef EDMA3_DEBUG
    7 P  ^$ _: m5 E9 D: ]& e
  42. /*#define EDMA3_DEBUG*/
    - s. _4 D2 d( `" V

  43. # K) u9 G* I6 K
  44. #ifdef EDMA3_DEBUG* c8 o7 q5 ]5 X, O9 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , }4 E/ ~5 Y7 e4 p6 x0 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Z3 m) Z! U4 K# \7 l: L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 a& ~) z. |9 n0 @  Z
  48. #else0 X. c+ _6 T( i
  49. #define DMA_PRINTK( x... )3 J! A! e# T- a# j0 [
  50. #define DMA_FN_IN
    ! a" F$ d; j& e+ f4 e+ o( `. s
  51. #define DMA_FN_OUT+ b! D! |) n! P' l! f
  52. #endif
    5 p& k5 b0 J2 M4 {, S- e

  53. - o- a$ ]  ?6 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 q2 s$ S& w0 V9 w5 b- G
  55. #define STATIC_SHIFT                3
    8 n3 v9 H9 h1 p' E! _
  56. #define TCINTEN_SHIFT               200 r: [2 x" L5 ~% b% k1 k
  57. #define ITCINTEN_SHIFT              21  V' p9 \: ]& U# r7 P! Q
  58. #define TCCHEN_SHIFT                22$ \. e( o) F( t& ^
  59. #define ITCCHEN_SHIFT               23
    ) W7 z: ~5 e) m
  60. 8 R" X  B' Q3 [( r9 e- `$ c
  61. static volatile int irqraised1 = 0;
    . p3 S/ D/ Y* g0 o+ Y$ O
  62. static volatile int irqraised2 = 0;. @  h# f; d" l6 h; c$ L, S

  63. : r6 ]1 L1 ~0 I$ \1 B" ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * @( e$ W5 o4 v5 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S- _# H8 @2 F1 d1 F( S' x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 W1 V4 t0 n6 B# V' V6 v

  67. / V. i1 s2 g! ^# {3 I
  68. dma_addr_t dmaphyssrc1 = 0;& i' M8 _8 G1 J
  69. dma_addr_t dmaphyssrc2 = 0;
    % s6 w- x- x/ Y6 E% B6 j
  70. dma_addr_t dmaphysdest1 = 0;
    7 M& |# }7 l3 F4 J7 A4 x4 G
  71. dma_addr_t dmaphysdest2 = 0;2 F' j7 s6 r; y% }! i1 P2 P

  72. . I4 k. T  \& f8 D3 t; I- `3 E1 K- T
  73. char *dmabufsrc1 = NULL;+ G0 A5 e1 D' r2 ?8 e
  74. char *dmabufsrc2 = NULL;6 h; k3 x* e2 S- ]: ~1 i# \
  75. char *dmabufdest1 = NULL;
    0 k6 t7 j4 W0 M% B- D1 L+ Q8 B
  76. char *dmabufdest2 = NULL;& w3 N- N! V4 F+ d9 o
  77. 9 {: g, }4 X1 p5 y
  78. static int acnt = 512;1 l1 p! Q" y4 N, o
  79. static int bcnt = 8;& \! H& t3 ]" o  I2 t4 r$ \; B/ P- b
  80. static int ccnt = 8;7 ^0 p& [& G! g% t2 Z
  81. * O9 X8 `! x6 `
  82. module_param(acnt, int, S_IRUGO);
    $ I* Z4 l) H3 V1 n3 E8 }: ?% `
  83. module_param(bcnt, int, S_IRUGO);
    6 h% ~' F( L7 V6 ]) K& C( P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* A  `4 i" }6 U8 \# `% _6 n
0 F' a! X: r5 s: ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 {( |7 ]9 a. m2 |1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ m5 Y, W0 Z0 p4 ~! B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! q  x, H4 z: J9 o$ t
3 r9 I# x: l- p6 }, D7 A. ^2 K: r8 I4 Z7 D

4 f6 V+ S! B( Y0 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 02:56 , Processed in 0.037913 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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