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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 s) w! R* M8 y- _' c- P) I
  1. [code]EDMA sample test application5 e$ w/ t, K$ v  N7 I+ C6 a% B7 |& |
  2. /*
    3 ^- h6 J: I3 l# M
  3. * edma_test.c% M) J: ]! h" _# H
  4. *9 X( r+ \6 i( H1 R' F! W
  5. * brief  EDMA3 Test Application9 h+ g8 S  p5 t
  6. *
    ! T, E) l& A" F* g% `
  7. *   This file contains EDMA3 Test code.
    ' t+ q- _  q& t. U
  8. *1 W# z* I: u/ w6 F$ q& _4 z& ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 m$ x( _& e: o8 k/ ]" i3 V  L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ q- l" W1 @9 C
  11. *         TO CHANGE.: q% u1 X4 w' F  e5 ~( F$ M
  12. *  d  q" f8 A2 @% ]- ]' Y8 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; @, c% L" B: J5 g
  14. *
    ; g! D4 s* v1 J/ s. O
  15. * This program is free software; you can redistribute it and/or, n, J* q0 Z* F# V) S
  16. * modify it under the terms of the GNU General Public License as6 A! S$ Z# _4 p. T! X
  17. * published by the Free Software Foundation version 2.
    : T: |% Z5 u. ^+ u" K2 W
  18. *; c. T. u, K1 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( h( c% j+ T. s2 a" [
  20. * kind, whether express or implied; without even the implied warranty
    / X; O" Y5 h; Q/ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) f' t& q# D8 L/ \# p9 t
  22. * GNU General Public License for more details.5 o+ s1 c# t) {: D0 Q( @
  23. */7 Y: e$ e4 ]$ i; m6 ~

  24. % @  w4 h4 H8 M5 u
  25. #include <linux/module.h>8 b  b2 _* n6 \: Q$ Y+ T# u
  26. #include <linux/init.h>: d$ d6 D) S0 E& H6 b
  27. #include <linux/errno.h>8 E; ~5 v4 M. {# v6 a
  28. #include <linux/types.h>
    1 W7 L% J; n0 Z! V: O
  29. #include <linux/interrupt.h>
    ! v+ t3 A! w+ P( U
  30. #include <asm/io.h>9 |- |$ f6 x. w  @
  31. #include <linux/moduleparam.h>
    & o. p. U4 t3 |. U
  32. #include <linux/sysctl.h>) T  k( H/ D" A9 y, A' M
  33. #include <linux/mm.h>( M/ ~, ^8 S+ [- B
  34. #include <linux/dma-mapping.h>
    1 {5 n0 a( N' @! i- {, Z+ |

  35. $ u" v& z0 _+ S! ~
  36. #include <mach/memory.h>
    4 A& g# h/ E3 o: {& k/ U, t
  37. #include <mach/hardware.h>/ x0 F7 G  ^8 d$ T! r
  38. #include <mach/irqs.h>
    # N& K3 @. o8 }; l
  39. #include <asm/hardware/edma.h>
    + f' N; L6 d! G* Z& b9 h7 ?

  40. / \& e% {/ p  l$ v  d
  41. #undef EDMA3_DEBUG
    $ y- M) L0 \: B
  42. /*#define EDMA3_DEBUG*/, l$ C. D& q+ I- ?( L; q/ m

  43. ; U7 K) N7 X  |* z
  44. #ifdef EDMA3_DEBUG2 o' U4 [- E$ V7 _- o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  i1 z8 w2 i9 S. ^9 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- j2 I$ _& u7 U, R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" x7 H/ ?; u7 Q) v* V1 [0 F# O
  48. #else0 m6 S# D' ~8 p3 V3 A# J+ D
  49. #define DMA_PRINTK( x... )4 i( ^1 _( z& ^; [3 X. b4 {
  50. #define DMA_FN_IN$ P! A  F2 \4 m9 k
  51. #define DMA_FN_OUT
    5 y; K  f" u$ {7 k
  52. #endif4 h# w6 `" L6 T4 V# i' s. M
  53. # b; F. J6 ]! y; C# X) p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # w: F8 l2 }8 ]1 a
  55. #define STATIC_SHIFT                3
    + g, J1 {: l. f2 I6 Z+ k3 a5 U
  56. #define TCINTEN_SHIFT               20
    4 _3 \0 e1 B& `1 S0 [3 H! _3 H
  57. #define ITCINTEN_SHIFT              218 o! G: e8 b2 F$ I2 p
  58. #define TCCHEN_SHIFT                22
    : k7 R9 N: q+ M+ A
  59. #define ITCCHEN_SHIFT               23
    ; m4 Z( }6 W5 m# E9 N+ G9 ^- f
  60. ) y( r, O( _3 W# O& Q6 a& R3 c; f$ n
  61. static volatile int irqraised1 = 0;
    2 K3 A' H. f% L9 V! l2 y- l% {
  62. static volatile int irqraised2 = 0;
    8 h- i7 K* S! [
  63. 2 d( d4 K+ W2 e) i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Z; _& ^0 {  B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- H9 o# x' t$ B" J9 G% o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; h) ?( l" Z; D. n3 l) C' H% i/ x
  67. 5 J' Q+ p7 r. {
  68. dma_addr_t dmaphyssrc1 = 0;% D2 e  P+ N4 ~
  69. dma_addr_t dmaphyssrc2 = 0;2 v# O- I1 G/ _5 q+ P
  70. dma_addr_t dmaphysdest1 = 0;+ c* a: ?+ ^4 @! M& c
  71. dma_addr_t dmaphysdest2 = 0;
    ! ?5 _% R, G# n, `/ @- d) j

  72.   v8 q6 p3 e. E' n+ p/ V* |0 n
  73. char *dmabufsrc1 = NULL;
    4 T3 O8 _5 |+ v. U1 i7 ]
  74. char *dmabufsrc2 = NULL;7 P; A3 t# Q1 N9 N" P
  75. char *dmabufdest1 = NULL;% x5 [+ X) F+ E1 R" i
  76. char *dmabufdest2 = NULL;
    ! O9 I2 s1 Z7 Q2 ]
  77. ! m2 B! {, o" K
  78. static int acnt = 512;  E: B: w4 J( M3 t
  79. static int bcnt = 8;
    ) [. X7 Z' o) T5 R, ^6 m! d
  80. static int ccnt = 8;
    4 V3 n, b+ ^6 d( S9 k
  81. " }/ Z9 {) f& I; l! r, y
  82. module_param(acnt, int, S_IRUGO);  ^8 x( Q6 s) G
  83. module_param(bcnt, int, S_IRUGO);
    6 V, l$ K* ~6 U' b9 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 v1 R; [* J- M+ G9 Z+ n; M4 b, V; ^. S- B# ]% b# t9 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 R% U/ Y0 S# [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 P$ L( d1 n8 t; l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 a& o0 x& M+ z; J# B0 S$ _0 u8 R. k1 ~' }

2 N+ L8 O5 ^6 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 21:19 , Processed in 0.036111 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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