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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, s& S; j2 T1 ]! T: [7 |/ ?+ z
  1. [code]EDMA sample test application
    % }3 {- ^7 ~5 t: _8 [0 ~+ v. Y
  2. /*
    % D5 \4 Y' \% D, x3 q7 ~
  3. * edma_test.c
    ! ?8 Y( S* s$ s) g
  4. *
    $ q! v7 o, U) `1 i! r
  5. * brief  EDMA3 Test Application
    3 `3 S/ ~8 F% g( e8 u8 ]# z
  6. */ n- e6 j9 x& n- f0 h' h8 P+ a1 n
  7. *   This file contains EDMA3 Test code.6 o' h! I# `$ m6 X
  8. *
    % M* R7 K8 Y  e8 c7 `1 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! [  [7 L9 Y4 i# o! P2 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 |% F4 q  r1 y
  11. *         TO CHANGE.! ~. g/ f" W' |3 B% X4 J) B% c
  12. *: n( C* m4 x8 F7 q- O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 s' |7 e7 f( u* r* |
  14. *8 e" N! d4 P+ z" Z
  15. * This program is free software; you can redistribute it and/or5 E. f* V) O+ u  [1 F, l0 \
  16. * modify it under the terms of the GNU General Public License as) U# R3 u, c% b- }
  17. * published by the Free Software Foundation version 2.
    & @% b9 {5 T, B8 O8 v9 x7 a( \. n
  18. *' E5 e4 s: V- I: ?: V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " S1 P0 v6 |$ @9 ?
  20. * kind, whether express or implied; without even the implied warranty
    . O; w5 V, o% T5 \/ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, q# p) e( j6 Y; W3 u3 Z4 |
  22. * GNU General Public License for more details.
    $ G& `2 ]* x3 |' o, m  [. L
  23. */
    * R2 m6 A6 {. p; B% c

  24. 9 a9 V# |: D& ^
  25. #include <linux/module.h>9 z% A% w' a8 o
  26. #include <linux/init.h>
    9 ~, q$ N& P& U4 c
  27. #include <linux/errno.h>
    $ m/ e+ q( D. \% t
  28. #include <linux/types.h># Q* B  F, k- C1 t" C2 U2 ]$ K! z! x
  29. #include <linux/interrupt.h>5 `: A. @2 s) I% {9 X0 C# A
  30. #include <asm/io.h>
    $ z7 H5 m; v6 e- e) V
  31. #include <linux/moduleparam.h>  y0 w2 z# J* Z6 p5 w  [
  32. #include <linux/sysctl.h>/ K' l3 f& X! [( y3 {
  33. #include <linux/mm.h>
    8 Q/ U7 S- P! }$ ?, p
  34. #include <linux/dma-mapping.h>; Z/ E; m% G  l3 I/ Y
  35. 9 {0 X  ^/ r- ?0 D' X
  36. #include <mach/memory.h>  i9 d# \5 [- S$ o
  37. #include <mach/hardware.h>
    " X$ w! }5 `( \! Q& y# r7 T% t
  38. #include <mach/irqs.h>- R& ]+ }9 R: a4 \/ {. S
  39. #include <asm/hardware/edma.h>
    6 I! j- M6 D3 a9 V, F/ C: w6 f9 M

  40. , {+ R( Y: K7 a& [
  41. #undef EDMA3_DEBUG0 |7 }+ h: W8 K, l2 {. [
  42. /*#define EDMA3_DEBUG*/
    . T2 d0 H3 u' B5 J
  43.   F( ]& ?5 L4 A( x0 M& R
  44. #ifdef EDMA3_DEBUG
    " g5 O3 o& i9 @7 v- A# l3 s& W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ @3 V2 R% C/ S, m4 b+ x/ N5 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & X& h- C/ @! ]5 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! l3 y% l& _* S* C9 x
  48. #else2 i6 \% g5 W7 T' J  F& s9 a; a! r
  49. #define DMA_PRINTK( x... )0 o% G( H9 Y7 M& e
  50. #define DMA_FN_IN1 N; v; ?: M* U4 z
  51. #define DMA_FN_OUT
    , c; _% l6 w; j6 p" g  ^7 ^0 v
  52. #endif
    9 A9 W) S4 c" G
  53. 6 W: ]# {  U: S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      y' g( `* S. p
  55. #define STATIC_SHIFT                3/ Z' P" A9 z% [5 a
  56. #define TCINTEN_SHIFT               20) `7 ^, s& h* C
  57. #define ITCINTEN_SHIFT              21! A9 T1 `9 |. F1 f' y
  58. #define TCCHEN_SHIFT                221 f  P. U% V5 o- a: K6 d
  59. #define ITCCHEN_SHIFT               23
    ! \1 S% H: j0 g7 q& u% M& b

  60. 1 l, Q7 j3 X% k/ \5 A- q
  61. static volatile int irqraised1 = 0;6 s& O8 y0 }( d# o
  62. static volatile int irqraised2 = 0;
    , _- s& z( ^" q5 W- @

  63. 3 w1 R# G. G" m. v' f8 k4 k0 ~# c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Y. i: x+ I2 ]0 i: X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . L  r* m, A: j2 |# C' t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # u& h: p/ w$ {- q# _/ @

  67. * l7 b0 x5 z" S& M* l8 l
  68. dma_addr_t dmaphyssrc1 = 0;$ `$ D6 D' [! |) o7 V" U2 f1 q8 c! I
  69. dma_addr_t dmaphyssrc2 = 0;
    : m. y& x! M! |( A  Q+ p
  70. dma_addr_t dmaphysdest1 = 0;
    - ~' _* ~- }4 J3 X$ d
  71. dma_addr_t dmaphysdest2 = 0;
    & d  Y! K* {8 t1 S! _1 t

  72. 9 {4 s  g8 Q# O3 A; H/ y' E
  73. char *dmabufsrc1 = NULL;# O; z- j" N7 ~, e) A3 f
  74. char *dmabufsrc2 = NULL;
    " ~6 ]: {. x; h) j
  75. char *dmabufdest1 = NULL;# y' H; G' h3 {( t! {! H+ u9 F
  76. char *dmabufdest2 = NULL;1 e2 y6 N/ Z" f% q- a. {4 f

  77. ! d  N3 Q& q& d  |  I$ }8 z% N& e
  78. static int acnt = 512;( o0 t: ?8 Y& Q8 Z
  79. static int bcnt = 8;6 @1 i2 J+ F* k6 S: `! Q# `8 s$ V
  80. static int ccnt = 8;  {, |( U, E9 h- N6 y% ?

  81. . ~0 p" H, d( w/ k8 n
  82. module_param(acnt, int, S_IRUGO);
    3 F" @2 E) z4 c$ M7 h+ Z% R
  83. module_param(bcnt, int, S_IRUGO);% o, [% z1 d' H+ x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! X* O9 Y8 o* V8 ?/ l

2 y, Q& p6 {' Z9 j! C* E5 q4 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) {- s2 y  B- W! C+ Z/ n2 [# darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ U7 M) B/ g7 [/ ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 ]2 S; m% @3 D) o$ F1 A3 P9 e3 k
) Q  Y! r9 k! r/ w2 H) P- g: a9 ?$ u! g% a6 l  b4 v# `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 04:52 , Processed in 0.048682 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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