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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " h  V0 ^5 C2 F
  1. [code]EDMA sample test application+ _, f% M) o) ]: Z* G
  2. /*
    0 d/ t% L1 P! w5 L( \1 t
  3. * edma_test.c
    * g( _$ }3 y+ o6 [; ^7 Z. Y+ ?
  4. *3 s8 G: Y0 v* U3 H0 m0 @
  5. * brief  EDMA3 Test Application# ?5 c/ Q) [/ W7 e
  6. *
    6 E! H5 C0 L6 n; Y7 ?5 E! \8 ?
  7. *   This file contains EDMA3 Test code.- d# u7 ^! h5 W3 K  m7 O) H
  8. *1 a3 [7 X. e/ _8 d5 t" L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      k: d  ?; x0 \2 m6 ?2 z- d. q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / [0 A3 I2 ?, w
  11. *         TO CHANGE.
    9 [+ t7 X4 y# _. O0 }
  12. *
    9 w* J( |3 n$ Q( l3 Q3 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' i$ i8 s3 x. A* G: D/ X) E
  14. *9 r, i7 @# |1 k1 H6 R; f
  15. * This program is free software; you can redistribute it and/or- H) `" ?/ `/ Q0 _  ~8 I. H9 \
  16. * modify it under the terms of the GNU General Public License as! @% Z" R; @' {8 t. H! h
  17. * published by the Free Software Foundation version 2.
    : f8 V. j/ ?, u
  18. *# T! H4 j% e2 s2 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( |; u' B( j: u# U7 D/ P/ o
  20. * kind, whether express or implied; without even the implied warranty! p9 {1 V$ N& F- c& U6 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( y: u# z4 \8 Z( m7 [/ j+ z6 O
  22. * GNU General Public License for more details." Z0 u$ d- d, B, @* t
  23. */* t  V  d. u* E) [9 H* j+ f
  24. ! h: F& O: h" y8 R% I
  25. #include <linux/module.h>2 T1 M2 B/ H7 v0 A+ U/ j
  26. #include <linux/init.h>
    ( O! p" y6 j) X
  27. #include <linux/errno.h>
    0 O! U9 W  X4 x0 c, S# ?1 c% a' P
  28. #include <linux/types.h>2 g. B: \  _4 y) i
  29. #include <linux/interrupt.h>
    3 L1 D# d  y8 T4 ^- d, J1 y( z
  30. #include <asm/io.h>
    , [% z+ [% s" o$ y9 K) \5 Z
  31. #include <linux/moduleparam.h>4 M" y4 v% ?. i" e" y
  32. #include <linux/sysctl.h>
    7 n3 l6 y8 N3 S1 B
  33. #include <linux/mm.h>
      u' V5 v3 t0 b" b: ~: a4 m2 d6 a& M$ g
  34. #include <linux/dma-mapping.h>/ s% w3 ]0 @  X8 |6 P( j0 }+ v

  35. - V. o/ M% q+ D  n9 Z! u0 C
  36. #include <mach/memory.h>
    # q$ ^$ n2 x# i% y7 ~
  37. #include <mach/hardware.h>4 `! t# \* l+ }( r4 f
  38. #include <mach/irqs.h>
    6 |( J% u2 G4 I* Q: X
  39. #include <asm/hardware/edma.h>
    8 ^6 @- V+ v+ ^- O1 w. Y
  40. 0 p' M+ ?( C4 |5 m
  41. #undef EDMA3_DEBUG* b, e* f+ f! h$ k* `/ F
  42. /*#define EDMA3_DEBUG*/
    - e9 h  O% h; K) c/ t

  43. ; K& c+ J. H8 W  D8 R
  44. #ifdef EDMA3_DEBUG0 k1 o5 Z( q; u6 i/ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 l* _6 ^! D7 A7 Q# F9 X7 b! Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); {- }- M) ~* R/ J+ e( t/ c6 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : ~5 g' x/ n2 [0 E8 U9 L9 D
  48. #else8 P  z6 M: T4 }% w$ t
  49. #define DMA_PRINTK( x... )! G5 b4 n# N$ ^+ C% |$ P
  50. #define DMA_FN_IN: H& F. R5 o" k) t% S/ ]4 Z
  51. #define DMA_FN_OUT
    4 J% V: X4 h- G; |. W4 W! X
  52. #endif
    $ @3 @( m) R# m6 |5 i
  53. 0 w" @+ O8 i, P  n% u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): ~3 F) Y5 V% C: f' A* u
  55. #define STATIC_SHIFT                3
    # c5 E# J3 a  h0 [, ^/ c
  56. #define TCINTEN_SHIFT               20
    9 f. b# z! b1 {# U& v! L- x
  57. #define ITCINTEN_SHIFT              21& A. `; t0 \  q. T
  58. #define TCCHEN_SHIFT                22) k. T6 z8 v3 Q: k
  59. #define ITCCHEN_SHIFT               233 d' g$ @1 n) |; R+ d# Z" Z6 O$ X

  60. # W# _6 t, V, n- `4 j- o
  61. static volatile int irqraised1 = 0;
    4 P  Y; ~9 M; E0 b% R
  62. static volatile int irqraised2 = 0;
    . n, L& @7 `9 i" {
  63. # g6 N9 l. N3 W/ r7 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u" t5 p! n: P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W2 E- D: o  P3 R* t! I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. o4 V1 f5 z/ f9 Y8 s6 o4 }  y! Z( w
  67. 2 p% k! G# b0 V+ ?* n
  68. dma_addr_t dmaphyssrc1 = 0;7 @' c' ?# Y# N% t
  69. dma_addr_t dmaphyssrc2 = 0;
    0 R, y; F& I2 ^1 K2 x' F
  70. dma_addr_t dmaphysdest1 = 0;
    8 B/ O: x( v) P1 T
  71. dma_addr_t dmaphysdest2 = 0;
    0 v$ Y( u+ P( K6 m! g0 I

  72. 3 C* V2 L/ x+ b
  73. char *dmabufsrc1 = NULL;5 G- w# j3 w0 D. I; [+ }( l
  74. char *dmabufsrc2 = NULL;
    $ b, W& c# H+ \: s0 W) i
  75. char *dmabufdest1 = NULL;
    / r8 L3 h, e, L0 x
  76. char *dmabufdest2 = NULL;! X% ~" f3 Z% [' U5 J
  77. : {3 r& t7 y7 N5 I4 ^
  78. static int acnt = 512;
    4 G" J/ x( F+ W
  79. static int bcnt = 8;
    & j; ?4 I- L  r& {$ E; b
  80. static int ccnt = 8;
    4 d2 ?" _$ F. D2 L  x

  81. . ^# |2 Y/ v1 d) @0 `* V5 q8 l
  82. module_param(acnt, int, S_IRUGO);2 Q% N5 s; d. R
  83. module_param(bcnt, int, S_IRUGO);
    2 V. g0 U# U# D( R' F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 }" e. i/ S8 W. K) T2 {

- M9 o- P! N* d/ D2 c- q: M  h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% y9 Z0 p8 K+ K1 [: K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' o  r. [$ }! y2 c/ g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x: D  e0 b6 q0 Y  V% x0 S

: L+ K& S* y. w" `
8 z/ N1 F4 X+ r9 O) N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 20:34 , Processed in 0.038338 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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