OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( `$ m6 v" _- R8 D( b7 M
  1. [code]EDMA sample test application/ A* K* h5 ^: v# W5 X
  2. /*, J$ P, [8 Y3 s4 ^! U2 @
  3. * edma_test.c' ?8 _5 p% q3 G7 y' N; R
  4. *, m0 ^. H8 n8 |: U" V0 I. Q3 ]: @
  5. * brief  EDMA3 Test Application! w  h) c. _6 G3 p$ O  q: k& s& I
  6. *' ~% H& G% h/ F8 a, h2 I
  7. *   This file contains EDMA3 Test code.
    * g  \1 G+ B- I; n
  8. *0 x2 f2 z# W: m1 `& k# _; |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" X) w3 S) s* D8 e8 x6 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & K8 K8 J& W3 H! j4 Y/ D" x. `
  11. *         TO CHANGE.  n) I+ g# P  v7 D
  12. *
    7 M9 U) V% o" p  l* F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 y9 {" Q( Z% w( i, P
  14. *
    8 C) ?( T: u7 ~! Y" Y
  15. * This program is free software; you can redistribute it and/or
    2 b7 D8 `  E: D2 k. y  T7 i" J
  16. * modify it under the terms of the GNU General Public License as
      z3 p# r' O1 }4 y+ [, P; F% Q
  17. * published by the Free Software Foundation version 2.
    2 ~, ^7 F- H" J4 m
  18. *3 t; J2 ~& Y$ _8 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 [: Q7 g9 n; q- y. j0 s- F
  20. * kind, whether express or implied; without even the implied warranty
    $ f, F5 R1 s8 B8 m2 u, w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 g% J- X$ U3 @% \- K% J5 J6 y( S
  22. * GNU General Public License for more details.
    & L+ l0 G4 i! t0 s% z, d0 S. A
  23. */4 `* R4 k, b. y: E) V# x/ b

  24. 8 _2 n( J( K1 R
  25. #include <linux/module.h>
    7 z" a# [- C  j3 Y7 W
  26. #include <linux/init.h>2 r9 t; I6 R* @8 \# t
  27. #include <linux/errno.h>* B% E' e6 n7 j( O
  28. #include <linux/types.h>
    4 l- U9 T- N9 A  z  T& x
  29. #include <linux/interrupt.h>
    ( V9 B, l% |; p/ ?4 X
  30. #include <asm/io.h>
    ' A- @6 b& g2 Y
  31. #include <linux/moduleparam.h>- t. n8 [2 w8 L6 U# s  J
  32. #include <linux/sysctl.h>7 C" q0 y, O, e! M: R. Y
  33. #include <linux/mm.h>* _- P/ U0 t# i$ ^; [$ X% N
  34. #include <linux/dma-mapping.h>
    ; Z. V- a$ [3 P$ J
  35. 2 J& X4 j0 m2 f' L
  36. #include <mach/memory.h>
    & R* |3 A* ]7 W
  37. #include <mach/hardware.h>* w. m7 V6 ?! p* J
  38. #include <mach/irqs.h>
    & p; d& }; m5 b1 u6 z( _) V
  39. #include <asm/hardware/edma.h>
    3 i0 \, T/ H# @
  40. ; y  P6 z4 s0 P" g
  41. #undef EDMA3_DEBUG
    ; k& I! u" S6 D& J2 A& c- e: `
  42. /*#define EDMA3_DEBUG*/
    9 _! x, S4 W& G- v. x0 a
  43. 6 F' w" c9 B8 O1 E/ a7 p5 b  A
  44. #ifdef EDMA3_DEBUG
    * x& B" Z% {( i- B& R$ r5 P$ v4 G% T% G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 H3 E' O' w* p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 p8 {! x% I4 Q  M0 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 d9 p! p/ a+ H+ }; N
  48. #else4 g* p, a9 F" p, R; \
  49. #define DMA_PRINTK( x... )
    * e3 W% D+ {$ J: V( o* ]
  50. #define DMA_FN_IN
    5 W- Y5 k# b4 ?2 O5 X" h) q
  51. #define DMA_FN_OUT
    8 n5 P. R0 m5 k/ A: _% H7 l  `  [
  52. #endif
    0 M/ H! b( d0 L- j
  53. 4 R, y  V* j0 ~5 h# J; U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , ^* a3 Y+ Q9 \7 o% ^
  55. #define STATIC_SHIFT                31 l0 I9 S6 d& K$ S/ N
  56. #define TCINTEN_SHIFT               20
    * }, T, e4 e5 k) ~$ K9 Z2 M6 u' V' g
  57. #define ITCINTEN_SHIFT              21
    " C0 a5 r/ ~" n2 j) i0 Q2 }1 X1 [
  58. #define TCCHEN_SHIFT                22+ ~' ]! v" T8 C
  59. #define ITCCHEN_SHIFT               230 Z* Q/ g+ E# N/ o( @1 m* d
  60. 4 n" |7 B7 Z: _& P5 E+ \) k
  61. static volatile int irqraised1 = 0;
    1 P1 _0 e' n  j
  62. static volatile int irqraised2 = 0;
    & \) L* \; S/ P

  63. 2 N6 T6 J. c0 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 C/ x: R: B; |' @) H/ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Y& |# f4 J( i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! |) ]8 k! p2 k& c$ M
  67. ( K( \. f  w. u: c5 x! y7 q
  68. dma_addr_t dmaphyssrc1 = 0;& y4 P* i5 j! }; w# [( ]1 W8 C, Q, P5 e
  69. dma_addr_t dmaphyssrc2 = 0;
    . @2 o% f, ?6 u
  70. dma_addr_t dmaphysdest1 = 0;) P4 r1 Z( z* Z* x: |0 s
  71. dma_addr_t dmaphysdest2 = 0;! C/ n1 q% x: L0 q" m6 L. C

  72. / P- ~4 |! P6 h2 ]1 ^$ M
  73. char *dmabufsrc1 = NULL;
    2 n* M5 _5 ~# v% J
  74. char *dmabufsrc2 = NULL;% B& ^6 q& L  `3 [# M7 i
  75. char *dmabufdest1 = NULL;
    $ H. N: A7 H, D+ ~) W
  76. char *dmabufdest2 = NULL;3 {5 P$ k' w9 m6 @  ]/ B
  77. 5 M; J' }6 m& g/ D7 n
  78. static int acnt = 512;: s$ u+ W  \  U- Z# b6 t
  79. static int bcnt = 8;! H+ i) O6 T8 O: w! W' O0 g
  80. static int ccnt = 8;
    ( _: E" ~& U5 ]& `* M

  81. + s8 p' a# i/ m( r1 V, Z8 k! d
  82. module_param(acnt, int, S_IRUGO);% M# P3 V8 y7 ~6 U4 X- g- O
  83. module_param(bcnt, int, S_IRUGO);
    . o" T. u9 f5 m' [: O( i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 H, q! [$ z$ {0 U9 ?( E
/ @7 V8 d2 y  V; v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 @! u' K% D, K- y6 _5 z/ x6 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" q  d2 @! q" U1 ^0 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: T' D5 T1 o; E+ l& |+ Q
" K! Y9 K( x' Z1 \: Y

6 @7 Z4 p9 F  i# b& n% Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-30 02:30 , Processed in 0.042635 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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