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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / o4 r7 R- d0 d- [0 v, c
  1. [code]EDMA sample test application# z9 c; k& Z# A* _# e6 e' n# n& L( g
  2. /*
    4 T0 \  W4 O: m7 f
  3. * edma_test.c
    + n+ D! B) n# L8 L. E7 L4 L) }7 V
  4. *
    6 D6 ^) k1 P  m) s# \
  5. * brief  EDMA3 Test Application
    # ^' {/ J: a% Y& W( `0 j4 ]1 T2 @) c- E
  6. *8 d" p4 _( @9 D) y
  7. *   This file contains EDMA3 Test code.
    1 G& L4 \# e4 \+ |
  8. *4 W& Q" o) O; P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : f( ]( m4 e  t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: c7 k$ f0 [! t" C
  11. *         TO CHANGE.5 q0 }6 \. H! s3 Y+ a6 X3 J
  12. *
    * G" c$ ]& g8 z# [+ N' {+ K) l9 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 d: @) W, A/ ~6 w
  14. *) B, w8 M+ I6 W$ ?5 `, `6 K
  15. * This program is free software; you can redistribute it and/or. @8 X8 H% U. f- W/ a
  16. * modify it under the terms of the GNU General Public License as# ?! r* w# U' z
  17. * published by the Free Software Foundation version 2.. S1 t" H) \2 J. v+ C+ l; {
  18. *
    # M. [2 K. n# H4 G/ {* b% @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" |# D9 N  _8 r2 V, c5 f  s
  20. * kind, whether express or implied; without even the implied warranty  |" k. m# i6 A+ O- u, D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ g1 G5 F3 o* _- Z0 _6 G
  22. * GNU General Public License for more details.
    3 U6 _) l8 D8 E: A$ H
  23. */
    3 c5 ]# P" O; G& H

  24. - ]/ W" T3 N5 Y7 K5 x
  25. #include <linux/module.h>
    5 Q9 P  ?' X9 ^) n
  26. #include <linux/init.h>( K" ?2 ?0 O% [/ _# {" k
  27. #include <linux/errno.h>& k. c0 p6 R* Q+ x/ W. j" m
  28. #include <linux/types.h>% X/ C4 J$ C: X0 f4 U3 |
  29. #include <linux/interrupt.h>8 C$ i$ L, Y) S5 m. M7 [2 e7 `6 h
  30. #include <asm/io.h>/ F" K5 ]5 M2 a) C1 `5 X
  31. #include <linux/moduleparam.h>
    7 v8 _- j3 |1 G7 [; ?! X
  32. #include <linux/sysctl.h>
    3 y4 P- E- m1 ~: b) f4 ~
  33. #include <linux/mm.h>3 x  C1 l( E$ v9 d4 [
  34. #include <linux/dma-mapping.h>$ g% L0 n) A9 s( c" ?6 p
  35. 1 \" z5 w' u6 O; u, B) T/ t! C% s
  36. #include <mach/memory.h>/ Q7 S0 U) J, E/ E1 V( H; _$ b
  37. #include <mach/hardware.h>8 k' W7 B' f1 w$ ~' `% W
  38. #include <mach/irqs.h>
    , y$ C3 G5 m- ~2 d/ X. e/ S, P
  39. #include <asm/hardware/edma.h>2 r; T. @3 }4 Q9 p% n2 P
  40. * S$ H7 K* Z7 {$ n  A
  41. #undef EDMA3_DEBUG$ o' k) q3 R6 U$ [) g5 U
  42. /*#define EDMA3_DEBUG*/* ~3 _  N6 Q0 R3 i: z' p& I1 d+ u9 i

  43. , _9 ?+ u. k/ D. ~: O
  44. #ifdef EDMA3_DEBUG
    . I* \8 t+ j5 o6 a5 }& L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); N" }  S; S" z. q" e. l& |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " }! C0 P$ o6 }6 `$ B9 y% b, N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ T6 k0 t  o  V
  48. #else$ a$ V6 m. k. E1 f( o
  49. #define DMA_PRINTK( x... )3 \% e, @! S/ _, J- T* |
  50. #define DMA_FN_IN
    : }- z: z+ O  z+ f
  51. #define DMA_FN_OUT
    1 T' d5 q# h8 L, [  [8 _
  52. #endif/ u; b2 G, C6 F2 W# [

  53. % }& T. L" v0 y8 V# Q* n8 |; p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 y) {7 P" Q3 d6 g
  55. #define STATIC_SHIFT                3! ]: P0 T+ R. `, G; ?/ J( u
  56. #define TCINTEN_SHIFT               20( c1 {2 u9 H7 Q+ m0 f/ o
  57. #define ITCINTEN_SHIFT              21/ G. T9 c8 [" ]! z0 n" U# @
  58. #define TCCHEN_SHIFT                227 [0 A+ D7 `( c" r# ^
  59. #define ITCCHEN_SHIFT               23: k, n: ?; R3 w& e4 C' P

  60. 8 s4 }9 @  b' t5 D) ~" e% U' K
  61. static volatile int irqraised1 = 0;$ s3 ]9 ]1 D2 J/ ]1 }! G
  62. static volatile int irqraised2 = 0;
    2 ^0 F  t% [$ f3 Y! L5 P
  63. ! [2 N( @0 d# E: d+ K8 q$ H. p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ _3 A6 f  x7 E( `( d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 {' L- ~, J. M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) h8 ]/ [1 Y7 C4 Z, O" {
  67. 4 V+ G) F! K1 q+ j  R% p
  68. dma_addr_t dmaphyssrc1 = 0;2 |% l( d& B1 H' `+ p
  69. dma_addr_t dmaphyssrc2 = 0;
      C7 l" d3 I5 \1 V2 n. f
  70. dma_addr_t dmaphysdest1 = 0;" s( p# X, Q- Z/ |6 R+ w3 K
  71. dma_addr_t dmaphysdest2 = 0;
    " [! t1 A- D7 R7 D5 _7 T

  72. 5 L* l+ L  C5 W6 a) ~( h4 j
  73. char *dmabufsrc1 = NULL;
    7 d. l% i) G9 B4 N8 l
  74. char *dmabufsrc2 = NULL;
    6 `7 n8 F8 V8 }& a  x0 B
  75. char *dmabufdest1 = NULL;1 x: m$ a& d9 Y! U6 i
  76. char *dmabufdest2 = NULL;0 Q5 i. G+ f7 y7 |$ t$ g. \

  77. & j8 t8 M; j8 i+ O
  78. static int acnt = 512;7 ^# w+ Q: n. o& e9 l
  79. static int bcnt = 8;
    ( W! F7 F& s% ?1 y" z5 A
  80. static int ccnt = 8;/ d  }* a8 ]) G0 O/ K3 T5 A

  81. # S! W9 l. g$ y6 B$ q& y
  82. module_param(acnt, int, S_IRUGO);
    5 w; x- v3 c0 w8 q
  83. module_param(bcnt, int, S_IRUGO);4 T& K5 S6 r' U% @( w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: @. n3 S- P+ q( N
- ?8 H( S6 O- i3 O# A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 Y  X. s& W. b# e& J
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. c: W5 A5 i2 |* _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ V+ C4 C# p' F
# ?* }/ _0 D% q* u% i4 g' O9 ^2 E7 o0 g0 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 04:21 , Processed in 0.042105 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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