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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 d1 i9 y) O' J% V9 s/ d/ O- f
  1. [code]EDMA sample test application
    $ L( Y/ P( ~7 y6 L, i4 v
  2. /*
    & J# t! a' ~' R0 J1 B
  3. * edma_test.c
    # V% M( L4 ]; o  L, @. `6 B% k) H
  4. *- K# X# G0 ]0 Q' U+ f
  5. * brief  EDMA3 Test Application) b( U% U1 r- U. P
  6. *" ^; ?4 i+ J+ `- Q
  7. *   This file contains EDMA3 Test code.
    6 `! E3 V, o% S6 F/ a" M+ R7 E
  8. *' v# g% t8 d7 `; O2 b7 a$ h( }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 Q" _0 Z9 I) _, q) l8 v" h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) N/ S- c) ?" Z* b0 O
  11. *         TO CHANGE.
    " O9 N! x. G3 D' X
  12. *7 S4 r; K9 a' q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 X+ d! j3 K* u# b% I, c
  14. *
    , S! {+ z7 o; `, [
  15. * This program is free software; you can redistribute it and/or3 b4 V8 q# B5 [5 H- K& E
  16. * modify it under the terms of the GNU General Public License as
    ! a" T, @, `/ j" F7 B( H( l
  17. * published by the Free Software Foundation version 2.% X* i- ~7 s! `* B
  18. *
    & N6 l+ g$ N2 W! z4 |' c6 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& r) d; y1 \6 A# ?4 D) D" D
  20. * kind, whether express or implied; without even the implied warranty
      S& C/ j5 @: F1 ?5 |& C: X" B# `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 L- m# J' n0 c  T
  22. * GNU General Public License for more details.! M5 y7 b- V1 U, C/ R# s
  23. */7 c6 c, ~7 y4 _

  24.   T4 F8 ~+ V; P( l0 c
  25. #include <linux/module.h>
    # h4 s: R4 a4 O2 b+ e% f: S
  26. #include <linux/init.h>
    - X4 V5 a( h: M6 h
  27. #include <linux/errno.h>
    9 y4 \( U- y' v5 G! z
  28. #include <linux/types.h>
    - m5 u3 {6 f. n& I# X
  29. #include <linux/interrupt.h>
    ( O5 U; Y6 g% ]
  30. #include <asm/io.h>0 q* \) ^- n- N" U$ Q# C, P! n& o# y
  31. #include <linux/moduleparam.h>) H4 X  v" k7 B2 c9 W
  32. #include <linux/sysctl.h>
    " K. S* n* Y, }% q, {, X  I, r
  33. #include <linux/mm.h>  l2 B0 P! {  m# k/ g9 A
  34. #include <linux/dma-mapping.h>
      B1 @. \) E: c5 N  j
  35. 0 ]$ ]' n/ w: H
  36. #include <mach/memory.h>, U; M7 i- V8 E7 W9 s
  37. #include <mach/hardware.h>
    - n( r& ?7 m8 B8 S0 ]4 {  E# v
  38. #include <mach/irqs.h>* j- J5 {9 s& B" L
  39. #include <asm/hardware/edma.h>& S1 {8 Q6 e, }+ s9 H; k
  40. # K, i4 b0 o1 }- B
  41. #undef EDMA3_DEBUG
    % m( z4 u. E' A2 D+ e' n
  42. /*#define EDMA3_DEBUG*/% o8 e. n) P7 g

  43. ; f8 r3 D  m0 n; j1 F
  44. #ifdef EDMA3_DEBUG
    8 S1 K. X- e+ j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 N7 U  }* v# L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 N1 W! q" F& g; S$ V" [- c% j5 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 F0 V4 \/ B$ H
  48. #else
    7 m* |- K: t( d  I/ i' o
  49. #define DMA_PRINTK( x... )
    . p. M; s# N4 p) C! K. n# {
  50. #define DMA_FN_IN
    0 @' B" o; n4 S& k; J/ \
  51. #define DMA_FN_OUT
    3 W$ v8 @( L, J; \
  52. #endif7 K( ~2 i, t, V9 I0 Y
  53. " [, N$ D7 f4 J1 i9 C+ L. O# K- }. A8 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; C2 |/ p, |: u9 ]/ M" y
  55. #define STATIC_SHIFT                3
    8 P7 ]% Z. e% L9 l/ |+ D$ Z
  56. #define TCINTEN_SHIFT               20
    $ V2 p' U5 x9 n) V% G$ z0 L9 H4 O
  57. #define ITCINTEN_SHIFT              21
    ( R# L) @6 M2 i8 S% Q0 k* F( d, n% y( T2 L
  58. #define TCCHEN_SHIFT                22- l1 y$ ]* |. S$ s9 w" W
  59. #define ITCCHEN_SHIFT               236 d* ^8 n5 B" n

  60. 7 F# y' k+ [) ]/ y& Q; @
  61. static volatile int irqraised1 = 0;, s3 ?2 k8 y1 d' z8 o
  62. static volatile int irqraised2 = 0;
      w# e% j) I. S) e

  63. % I& K: y& e+ G9 T1 n5 X+ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 H) ]6 H, [7 a* }1 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H2 Z: s- w: g5 b, z( D+ z: S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ X4 W. L5 y+ A% @! j2 B
  67. # K8 H7 X2 F  S5 X! W
  68. dma_addr_t dmaphyssrc1 = 0;
    1 O5 Z2 S9 Y0 p/ }9 X
  69. dma_addr_t dmaphyssrc2 = 0;
    . Y- o1 K% @3 d1 \" R
  70. dma_addr_t dmaphysdest1 = 0;
    2 o8 R$ C! `) d6 K, i0 R
  71. dma_addr_t dmaphysdest2 = 0;
    0 o( |, i5 u4 F& \$ i8 W% @! B# v4 Q
  72. ( A6 g+ R2 v4 ^8 p! I- H( e" Q$ p
  73. char *dmabufsrc1 = NULL;
    $ h, ~* A. s0 K8 d; Q: o' ?
  74. char *dmabufsrc2 = NULL;
    , _6 ?/ ]9 B+ Y+ J+ f
  75. char *dmabufdest1 = NULL;
    : C; _; W8 c' }3 Z: f. }# G
  76. char *dmabufdest2 = NULL;
    2 L1 p0 k+ A' h9 H4 |

  77. 6 Z4 p# A& E0 d0 H
  78. static int acnt = 512;
    ( i$ a& Y) |, N' H4 C1 `
  79. static int bcnt = 8;9 P0 G( c: E" h0 \; j0 S
  80. static int ccnt = 8;6 n4 k: |6 A* k) l
  81. 3 ?; Y2 d. Z0 ]" D
  82. module_param(acnt, int, S_IRUGO);/ Q5 N' h% }4 E2 q& I
  83. module_param(bcnt, int, S_IRUGO);
    0 |6 P% e$ O8 ~; }7 F& I& B- X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 `3 G$ Q( \# A$ l- Y' U/ X9 q
" R+ ^& T) D* R! P; I- f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 D' g/ S! _% U4 |. P8 z4 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% c8 D5 @- V7 v0 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ S6 d. K- g5 p  Y" q, @2 W6 |
& L# c' n+ r: ?2 {  C* N

8 Y, M9 D, C5 q0 T6 @+ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 13:45 , Processed in 0.037588 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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