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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' d4 [( Y4 U9 _$ I. t
  1. [code]EDMA sample test application( O; q$ G! E3 s& H
  2. /*- e6 [8 f; Q( f  s! W* Q" ~( A1 L
  3. * edma_test.c
    $ f7 z2 O5 g/ c; `
  4. *4 [, O4 `7 p- B; `9 ^* M6 [
  5. * brief  EDMA3 Test Application# N9 y' E; |$ L3 U
  6. *
    ! [1 n& A0 K. y" O  D3 y+ u
  7. *   This file contains EDMA3 Test code.( W2 H& Q" R% V$ z1 m! O/ M
  8. *
    8 \$ G( h, q* V6 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- I0 d" a" G9 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* b; _/ M- O; B; f& a
  11. *         TO CHANGE.7 Q9 f& X% u/ ?0 G0 M, P
  12. *. r* X* y# ?5 [! E+ L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 Z! s, A0 x! R3 @4 e* L
  14. *
    ! _% y! l4 u6 \) p
  15. * This program is free software; you can redistribute it and/or
    ' i$ d: t7 [8 I+ {' `& {
  16. * modify it under the terms of the GNU General Public License as1 Y- \$ U+ f$ i* B% @# @
  17. * published by the Free Software Foundation version 2.5 I" S$ _9 F: W
  18. *
      x, b% z: N5 k8 i; K6 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . B. f0 Y6 `$ q* A+ }
  20. * kind, whether express or implied; without even the implied warranty' l/ ]% g# B/ [1 b8 z, R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 q0 N8 q. Z# ^, c" ~! Q9 {; H
  22. * GNU General Public License for more details.
    $ Z9 H; q4 J  m: P0 p! l' |
  23. */
    ( Q; Z! ^8 t8 S! f' ~; N% F

  24. 0 W% g( I/ O7 S6 ~2 ?$ P, ~* q5 |
  25. #include <linux/module.h>
    ( W% k+ M+ n/ M$ Q1 L
  26. #include <linux/init.h>  Q+ W3 |: g1 e5 z
  27. #include <linux/errno.h>
    , K) U7 b  T/ o6 n% ^/ e5 m
  28. #include <linux/types.h>) \* c) a0 D4 k: H# U- i
  29. #include <linux/interrupt.h>
    : F& ]4 a. a4 v7 r% `4 n3 n+ x4 l
  30. #include <asm/io.h>
    9 E9 ]# |8 f' V! @4 t& K
  31. #include <linux/moduleparam.h>
    $ \9 \$ Z, X; @% e. C; Q) T
  32. #include <linux/sysctl.h>
    - ]0 T2 {# ^. n9 a  F& c1 M
  33. #include <linux/mm.h>
    4 _1 C6 ]; ?4 R& N  w! {  O
  34. #include <linux/dma-mapping.h>
    9 j& E! T4 n6 W0 D3 d! e
  35. , h7 a2 G" s& ?
  36. #include <mach/memory.h>
    / u; g0 N2 t, B4 ?! b8 S
  37. #include <mach/hardware.h>
    ! K! A4 f4 G* z: H  [+ c( G
  38. #include <mach/irqs.h>
    3 ]: ?9 m% [5 W6 ?  c
  39. #include <asm/hardware/edma.h>! K4 E/ X2 y; {# |

  40. . W5 {/ T. z8 [8 l  M
  41. #undef EDMA3_DEBUG4 C4 j8 G+ j5 U! n" z2 @
  42. /*#define EDMA3_DEBUG*/0 }6 y# g7 o/ X( \- j

  43. , @/ M/ k+ q' {# m  _6 Q3 }
  44. #ifdef EDMA3_DEBUG' S( p# C: D* y% a9 l3 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' g, x: |! n, N3 ]! c% ?# Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  m" M5 H% t# F# p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* x% [7 T; t' _& o( k0 \
  48. #else+ t' y6 E4 k3 u/ i( u- H
  49. #define DMA_PRINTK( x... )
    2 V1 Q: e$ T9 S+ W3 J  B. d! I
  50. #define DMA_FN_IN
    / v$ h& w* l9 Z9 z% c. q
  51. #define DMA_FN_OUT; L' ?  s+ L0 S' [/ j
  52. #endif
    # ^% J# Q1 c- j/ V8 J1 O5 L
  53. 9 F6 G% D, c; X+ k1 X+ L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! W% E0 }; x- j5 q+ F2 ?/ c
  55. #define STATIC_SHIFT                3
    9 Z0 L$ H& o7 o& `; ]6 X" C
  56. #define TCINTEN_SHIFT               20
    6 o" Y, E# l3 F" N; z
  57. #define ITCINTEN_SHIFT              21
    - @* S* E  P9 U0 }+ r0 T7 E
  58. #define TCCHEN_SHIFT                22" V" j" q: x. |: T1 Z
  59. #define ITCCHEN_SHIFT               23
    ; @3 v4 N( A2 k& ?2 L* l

  60.   H' _8 D; C5 v. ]9 D. O% e
  61. static volatile int irqraised1 = 0;" ^6 Q+ |; c3 g+ I/ \
  62. static volatile int irqraised2 = 0;
    # `8 f1 u; S% p# P* r6 V

  63. 7 u1 n1 }' `  h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ R$ s" C) |0 i* \# P5 U8 G7 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - W- G# T( J! ^# ^2 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : f3 O, A7 M& f$ W$ N
  67. % i: J) d" |7 l+ |. c
  68. dma_addr_t dmaphyssrc1 = 0;
    # `: L& c( J% J" z; o
  69. dma_addr_t dmaphyssrc2 = 0;
    4 R. M* a' |; u1 G2 }5 ]) P* d
  70. dma_addr_t dmaphysdest1 = 0;% l1 B! I) F' c* N8 ]! t
  71. dma_addr_t dmaphysdest2 = 0;4 {1 j, m! J* z5 q

  72. ( c# O$ ]/ Q& J
  73. char *dmabufsrc1 = NULL;. y2 l2 J  f5 T3 Y3 o. a( T- t4 I. b
  74. char *dmabufsrc2 = NULL;7 O% @& B- @) C$ n% Z6 S
  75. char *dmabufdest1 = NULL;
    ( s9 z  H, \  i  k
  76. char *dmabufdest2 = NULL;& L! u- h; r% b; o" T- l9 j9 _" k

  77. ' i" u; i7 K. g! Q
  78. static int acnt = 512;
    9 T* [# c! S$ A  c9 _0 i
  79. static int bcnt = 8;
    ( L/ c  i8 f* u2 _1 {  j9 z
  80. static int ccnt = 8;) a, U: b0 r" B5 `1 E, ~

  81. + c- C; B' ]6 u  q4 f
  82. module_param(acnt, int, S_IRUGO);
    * A+ i. X5 b3 c9 e: c
  83. module_param(bcnt, int, S_IRUGO);
      B8 L7 B9 q; r: E0 o& l7 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: w; Z3 x0 m. y1 @
- y5 D. `3 z/ i: @7 D( Y; K0 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 Z7 [4 g+ M5 {$ R  _8 w; \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* X& `8 s" b7 a/ |) _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- e5 J8 g, U- Y  q

0 d4 W( B. {9 K! |4 B4 N0 ]' I/ Z+ [$ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 01:11 , Processed in 0.045760 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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