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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 F+ v+ u, S" y. m6 R# f, R# t. r
  1. [code]EDMA sample test application0 o* D! g/ A/ M- i! t
  2. /*
    5 S' \' M- ~1 d2 _- u
  3. * edma_test.c* Y7 s2 p4 @. W* d7 T6 L( y9 F
  4. *- V+ ~, n; h. Q( K
  5. * brief  EDMA3 Test Application" v- {) H5 m. c- j, t7 _' e
  6. *8 Y. j& F- X1 |9 D) s1 z- T
  7. *   This file contains EDMA3 Test code.8 l9 l" {% |5 V: O
  8. *% @- K- |, S& w% O0 _8 f  e5 r6 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; p) |/ x& W; M; v4 B  N0 ~3 K$ m: v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S& D  s- q. v# Q% E
  11. *         TO CHANGE.+ F( T, j, D0 `' E) o0 P: H
  12. *
    4 q2 x( h; O" ]( ]. _" s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; h! y7 J& |8 l
  14. *2 r2 m: l& l  ^' f
  15. * This program is free software; you can redistribute it and/or
    * y: \- Q4 c- h. G5 ^5 L
  16. * modify it under the terms of the GNU General Public License as3 F4 {( j" z; f' T- \$ f" R; ?
  17. * published by the Free Software Foundation version 2.. K$ Q6 k8 e; C/ i  J4 v# ^
  18. *
    ( p6 r2 l5 C* a) e6 ]+ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 V2 z& V6 d  Q% f' d8 p; P
  20. * kind, whether express or implied; without even the implied warranty4 Z; S1 m7 C- _; n/ p+ M5 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 c( z/ w0 b, K- A) j
  22. * GNU General Public License for more details., R' G* ~; f% p
  23. */+ Z- u8 |2 v8 p8 h6 b8 T
  24. 8 X% m/ ~2 d/ e+ @& u* w
  25. #include <linux/module.h>
    % o0 x" r/ C. {: `% S5 X) y2 @
  26. #include <linux/init.h>
    & `5 M( u4 C) ]! M0 l  G7 U2 i
  27. #include <linux/errno.h>9 j. B1 ?" @1 ^  ]& b% P3 ]
  28. #include <linux/types.h>1 f2 h/ M9 a& j: G9 v
  29. #include <linux/interrupt.h>: K0 `) Q5 P  W
  30. #include <asm/io.h>
    2 p% |; P3 \2 C* |
  31. #include <linux/moduleparam.h>: _. U* }+ r% v1 T
  32. #include <linux/sysctl.h>
      T8 d! |9 S7 c2 S
  33. #include <linux/mm.h>
    3 u; U  B+ n1 s! Q
  34. #include <linux/dma-mapping.h>
    0 Q& I1 |' \! q2 X4 v# p, ?

  35. 9 l9 D1 w4 c  I( M: e  |3 i
  36. #include <mach/memory.h>
    5 _- {' o# H8 t" U5 ~( Z
  37. #include <mach/hardware.h>
    * J1 v( R  V% Z$ e5 p: o- C! q* j* {
  38. #include <mach/irqs.h>
    9 W" l) @/ M( Y, H
  39. #include <asm/hardware/edma.h>) }/ b- n* a, N* ^: U3 w$ j7 a! Z: }
  40. 3 K& k5 }5 j" C
  41. #undef EDMA3_DEBUG/ R' t( G6 l9 S3 N, ?- q  Q+ j
  42. /*#define EDMA3_DEBUG*/( v  o  f( S: t* f/ h' k6 {
  43. 1 K, T8 J# g. m6 H; s
  44. #ifdef EDMA3_DEBUG
    8 e1 ?8 t& v/ s  A7 i! y4 y" F" m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! e! H+ d) r; M9 _# n" l4 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 g% K' t* v+ U8 @4 }) g: q$ O" l& F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ~7 F  e7 I7 f9 N( V0 L" f
  48. #else( ?6 @& Y, O" S+ ?
  49. #define DMA_PRINTK( x... )
    9 n$ K' f( k- U' m; `; x
  50. #define DMA_FN_IN0 I; S" Z' T, a" m0 _# Q0 h" T
  51. #define DMA_FN_OUT5 d* o5 E/ D1 L
  52. #endif2 y' ?; r0 L+ I. t( C1 p- U9 C
  53. ; c) }2 ]7 I3 e) c5 V. U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 |$ B. k0 k; P$ H, b
  55. #define STATIC_SHIFT                3
    # Z. {) p. Q* n& T
  56. #define TCINTEN_SHIFT               20
    , H3 `7 X9 w$ I3 b0 r* @3 n7 _
  57. #define ITCINTEN_SHIFT              21
    ; d& r# J+ _1 T2 z
  58. #define TCCHEN_SHIFT                22  i; U0 T% h2 T! h. B- ^
  59. #define ITCCHEN_SHIFT               23
    7 C/ Y; }% y# @0 d$ O. i; b
  60. 3 A) V3 L* D! o
  61. static volatile int irqraised1 = 0;: o. h) L; Z# D" x& O+ n5 F- M
  62. static volatile int irqraised2 = 0;
    * S4 G/ Z+ E4 }' `5 |
  63. - }+ Z. z- w, ~/ v: l* v4 d. H- c, h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F' z6 J2 k. A+ t. ^, e) T) d2 ]( u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Q- L9 E+ C3 ~, x/ P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ d0 d! d/ K8 r; w. j  Y
  67. + N' g; D3 a6 V0 d. O: Q
  68. dma_addr_t dmaphyssrc1 = 0;
    6 w( s; T4 F3 |# q. T- ]
  69. dma_addr_t dmaphyssrc2 = 0;
    ) l2 r+ N0 W* @5 H1 S
  70. dma_addr_t dmaphysdest1 = 0;7 @$ H5 o8 L9 N  r2 h0 b
  71. dma_addr_t dmaphysdest2 = 0;
    / s' X( k! X: b8 M. d
  72.   @1 y7 w- T" i1 d, t+ M' e  Q" l' D
  73. char *dmabufsrc1 = NULL;
      \- ~2 [7 {( D2 {  V! E
  74. char *dmabufsrc2 = NULL;) B7 t: D5 ]  O3 I
  75. char *dmabufdest1 = NULL;2 `) Y( G* \6 |
  76. char *dmabufdest2 = NULL;9 P& i7 O9 R9 V- k
  77. ; f, S0 q- p6 l0 @% o6 f& q
  78. static int acnt = 512;
    . D$ l- R7 g! L* Z- r, j
  79. static int bcnt = 8;/ S. y3 L3 {; w. e: V; B* G
  80. static int ccnt = 8;* j- R$ S( s! M+ y8 Y: W3 a4 E

  81. * q- e" F* n5 o
  82. module_param(acnt, int, S_IRUGO);, {  n& E& C2 `- O5 m/ a
  83. module_param(bcnt, int, S_IRUGO);( A7 ~' S+ `% b- i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% i2 e5 C0 z/ r& ^
/ [' s" X! j1 D! V: i2 }6 |  n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* F* h) C! E- Q3 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; y7 {- @' E1 c( _# Y* ]- P- f5 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- x. w4 U, U( I! p) z5 W* c
7 o" O7 X8 w' B/ Y& G
) i0 u) n* [. K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 10:55 , Processed in 0.041159 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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