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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ o: @+ S& S$ R, p- R
  1. [code]EDMA sample test application3 G' g" }9 a1 D/ R' g: Y
  2. /*
    8 q- `+ |* e" D* S% b
  3. * edma_test.c; N; b1 {9 g  C+ m( A# T
  4. *  M$ C( c5 ?2 _* x9 d: J
  5. * brief  EDMA3 Test Application
    % B1 u' F% T, n) l0 u; S
  6. *% [6 F- c1 X9 M3 [
  7. *   This file contains EDMA3 Test code., C  H5 w  ]( L+ k0 D7 R- A* v' X+ ]
  8. *
    8 H, q2 f$ y! Z) c/ s6 P4 ^5 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! n; `( Z- B5 u7 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # ^" v& U' c; L2 D2 x% Q
  11. *         TO CHANGE.
    * F- g, r$ G; x1 M( V$ [4 @' b
  12. *
    ' y' \5 V( _. ~9 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; q6 S7 E+ m/ ?! _/ c( j
  14. *, E9 f) Q' i' z/ [/ n; Z% B* ~, Z
  15. * This program is free software; you can redistribute it and/or/ h( X7 l/ r# X6 ~8 l
  16. * modify it under the terms of the GNU General Public License as
    3 U7 ~& X4 I% A( S
  17. * published by the Free Software Foundation version 2.
    & C4 a) d$ g1 ?5 E
  18. *9 V3 ]/ `8 J8 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" e, N$ u3 X2 O# u: q/ _9 {0 N! ?  M
  20. * kind, whether express or implied; without even the implied warranty/ u- J/ H7 t( F" ^: t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! g& o  S4 @9 z
  22. * GNU General Public License for more details.) I% m2 i& h! s; _
  23. */) J& I( M  D  B+ F; L* }/ p6 ]/ \
  24. & X4 G! m! ?+ q# t9 M$ T4 l
  25. #include <linux/module.h>
    4 o1 N( A9 C7 h9 X
  26. #include <linux/init.h>/ ~3 d* F+ T4 ^1 I
  27. #include <linux/errno.h>* |! E, T) K" h. p, A- E6 h& j# q
  28. #include <linux/types.h>
    + o6 J& U9 G+ Z4 o8 {, N
  29. #include <linux/interrupt.h>: R# s/ f, T0 ~! U6 f
  30. #include <asm/io.h>
    3 j0 k. {) R6 k* |# _. k  ?
  31. #include <linux/moduleparam.h>& L7 b' B7 Y, `9 ]3 l
  32. #include <linux/sysctl.h>
    4 P! v4 V) N1 D8 a3 t# K
  33. #include <linux/mm.h>
    - W9 J/ Z$ b( F: K+ H4 H
  34. #include <linux/dma-mapping.h>
    # W+ |8 M4 Q1 `: r2 n( ?" V! O

  35. - f6 _4 o- x$ T. x
  36. #include <mach/memory.h>
    ) H$ g; h0 Q- g" H5 e
  37. #include <mach/hardware.h>
    : h, N" x8 X# S0 @$ |8 Q
  38. #include <mach/irqs.h>! b5 h& s, Z# H
  39. #include <asm/hardware/edma.h>
    * D* H" U6 ]4 a9 Y' P! ~! c

  40.   q& |# r% Y. T) U- M6 Z
  41. #undef EDMA3_DEBUG/ w' o9 @* }0 K' P# t2 q8 ~" g+ r
  42. /*#define EDMA3_DEBUG*/
    " J# S( `) C& l$ M/ W

  43. ; a% p. N. K# x* Q+ A8 ]9 F
  44. #ifdef EDMA3_DEBUG
    ( P+ a% J  d8 T. S3 E, P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 r- |  }7 k3 X! g' z, b5 d! H9 _- U! s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 P4 h+ H2 t+ x0 |8 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" t; ?2 Q( P  |& R7 f  V: o# M) F) c
  48. #else
    5 q9 ?6 Y9 o- o' |: S7 H5 M
  49. #define DMA_PRINTK( x... )
    * k+ B5 G, j4 S( d) W# Q$ W/ ?
  50. #define DMA_FN_IN
    7 f. c9 K2 F; |; \# ~5 d+ O' Y* G
  51. #define DMA_FN_OUT0 b1 L, r0 X( |& s8 R6 \: W6 @
  52. #endif
    , ?/ X# S5 @7 @. a6 }, G% h: {

  53. % b' D1 y- f( C  X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ O$ V  A8 }0 q9 a1 M
  55. #define STATIC_SHIFT                3
    9 t2 ?: X4 R) A
  56. #define TCINTEN_SHIFT               20
    ( ~" u6 s0 M+ ~5 N
  57. #define ITCINTEN_SHIFT              21  F; _8 C7 }* J) _
  58. #define TCCHEN_SHIFT                22& b# e! d, R5 T! n2 g# ^
  59. #define ITCCHEN_SHIFT               23* X4 @+ p0 v1 |3 q5 Q- a
  60. 7 l6 @5 X2 P* z4 e7 z& {: [
  61. static volatile int irqraised1 = 0;/ v8 G6 n; R# O1 `  g, |: b0 M
  62. static volatile int irqraised2 = 0;
    8 ^" M$ r. G; p, i0 S- G% J

  63. ( T7 t0 _5 M/ I' E) n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ?3 o5 n0 u1 `8 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# n4 B+ h+ d0 B4 q+ @$ e5 _0 O8 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& C3 `5 `0 C6 l1 Y6 x; y

  67. & f* k- K7 z+ p  z# p
  68. dma_addr_t dmaphyssrc1 = 0;) d( W5 b9 L5 ?# F3 e( i5 E" Q
  69. dma_addr_t dmaphyssrc2 = 0;
    4 G) B  q7 n0 [- g& I
  70. dma_addr_t dmaphysdest1 = 0;
    3 h$ H. m* s( w- h! M
  71. dma_addr_t dmaphysdest2 = 0;
    1 P0 q2 O- `4 H. E& C
  72. : ]7 B2 L1 U- J' f
  73. char *dmabufsrc1 = NULL;: k' j* q5 K1 u7 u3 H
  74. char *dmabufsrc2 = NULL;/ Q* e. _+ {; e* V1 ?
  75. char *dmabufdest1 = NULL;
    3 A/ U! n6 u7 D$ d( F1 [5 |" }
  76. char *dmabufdest2 = NULL;
    - x9 J' d& W' w( h9 x! {5 j. I; I
  77. + ~$ ^# y+ `. x, A/ V7 ^! g4 F
  78. static int acnt = 512;
    - g$ m$ l; F6 c& C, C
  79. static int bcnt = 8;
    $ f" H2 M- i2 ], T  A2 P
  80. static int ccnt = 8;
    - N9 j9 Y) e6 ~, k
  81. . ~  _! S1 ]1 e
  82. module_param(acnt, int, S_IRUGO);2 j  |2 Z+ _( z
  83. module_param(bcnt, int, S_IRUGO);4 L" ^+ Z/ w* S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ d; i) x* O6 Q) d8 D* C$ R* X- R- z, |/ y: d! Z7 k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  \- u- G3 `, D) \& C, d- rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N/ y( {  E: ]% R4 b* g+ ]5 p  g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' u" C* B5 ]2 @# F; s  G5 R
2 X& c$ T$ ~# X4 ?8 P3 k' R: c: h- @: U- o1 K1 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 12:36 , Processed in 0.057109 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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