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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  a3 m3 B4 ~+ T- a% q7 e* m
  1. [code]EDMA sample test application
    7 J7 P. k- m2 x& _! P. j  i
  2. /*' w" B$ r$ \4 F- K+ j
  3. * edma_test.c
    + f) M! S- k2 I
  4. *
    $ S6 T9 R! C. B# B0 j1 F
  5. * brief  EDMA3 Test Application+ o# A7 [& O) b, c  X( B" p9 ?
  6. *6 s3 O! |! t8 J
  7. *   This file contains EDMA3 Test code.0 M; x- G$ n. V$ `
  8. *
    8 o: x) W( M+ r5 v# t6 m8 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; ]1 \4 [' d& N, l5 v$ ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + F# |- b: |2 h  b+ Z% x+ V" O
  11. *         TO CHANGE.
    . Q% |; t) l1 g6 G4 k/ j& S: @
  12. *" i* @" s* J: r. D) y0 f# N$ z- `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 u- E4 L5 o. L+ A2 @
  14. *
    & V2 \0 o) I3 Z! k5 \& N
  15. * This program is free software; you can redistribute it and/or
    / V1 A# K% x- ?3 X2 \
  16. * modify it under the terms of the GNU General Public License as
    $ h; F8 N3 C- q" G, f
  17. * published by the Free Software Foundation version 2.8 j! r( I! l7 G1 m
  18. *
    . a0 _1 K; n% `& z1 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Z) _8 i' n& o
  20. * kind, whether express or implied; without even the implied warranty9 B9 i4 z; w* ~- X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 s& W' c4 B9 j& [  G  V
  22. * GNU General Public License for more details.
    * o5 z+ W; G5 V0 }/ v# d4 |
  23. */
    9 f* t8 H9 |+ U  M+ v& r) E
  24. / F9 N& \# K6 I& `- q0 V) r' G5 K
  25. #include <linux/module.h>! J( N, x# h+ p5 s
  26. #include <linux/init.h>6 Y% b9 W8 J/ m, E
  27. #include <linux/errno.h>+ y8 M& s) M( t2 F9 ?" f$ D
  28. #include <linux/types.h>
    " w7 M$ m2 P% P! O, o% _6 E
  29. #include <linux/interrupt.h>7 H) K6 c3 x4 L% z
  30. #include <asm/io.h>
    . i! ]" ~# C7 _$ J4 X- }, `7 ?( Q
  31. #include <linux/moduleparam.h>
    0 o6 B& D1 [4 z5 V4 v+ U
  32. #include <linux/sysctl.h>" U4 U! [+ h: k
  33. #include <linux/mm.h>
    # s+ }' d9 U8 s+ t1 e" X2 n, o& ?' }
  34. #include <linux/dma-mapping.h>& ?9 u) b1 l" W1 ~+ L$ _/ B7 p

  35. : e1 w" j+ D& ~  M! S: q( d
  36. #include <mach/memory.h>6 d$ v8 L* X8 {9 E( J
  37. #include <mach/hardware.h>
    1 i4 ^: l3 Q1 M4 ^9 Z
  38. #include <mach/irqs.h>- m+ v4 |6 Y/ Y, X+ _
  39. #include <asm/hardware/edma.h>
    0 S. l, {, ^3 k& T# D( R
  40. : a& Z7 B. z! E4 V( p- C
  41. #undef EDMA3_DEBUG! {) y: c5 B. f6 p) o3 l
  42. /*#define EDMA3_DEBUG*/
    , ?5 B- H2 b1 z4 B* `: E. u
  43. 9 O1 X  a' D# z
  44. #ifdef EDMA3_DEBUG
    ' V& ?% }# n8 @) U. r: v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 W/ w, C+ P1 w) g2 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 b* q7 V+ [4 `0 Z1 P% l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      P+ `6 O' c# _
  48. #else
    ; D' m+ }! `  B6 w
  49. #define DMA_PRINTK( x... )
      X% i  [8 [# A  ]
  50. #define DMA_FN_IN$ k) ^* \+ Q" \- o% w* Y; f
  51. #define DMA_FN_OUT( U! b% |+ p4 A$ _# D! F* [; v& }
  52. #endif4 r# x* Y. {, n& g( S6 U

  53. - B& d: x8 `) \% {) ^  _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 h) s  Z" _2 k% O$ R
  55. #define STATIC_SHIFT                3$ u  B1 P& r$ Z, x5 y" g# u
  56. #define TCINTEN_SHIFT               20  ^( o2 p; V3 L
  57. #define ITCINTEN_SHIFT              21
    5 V: L, v1 k$ b# C5 x5 J( y
  58. #define TCCHEN_SHIFT                22
      T; M8 A+ f( ]5 b
  59. #define ITCCHEN_SHIFT               234 p5 W2 O3 c% o! y' D
  60. ! h* J4 `8 t6 c  Q& }
  61. static volatile int irqraised1 = 0;
    " |; R! P% s  s  ~
  62. static volatile int irqraised2 = 0;! s6 I) G" _( n, O' A% d3 ~
  63.   Q& s& ~0 _; u. C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( m3 [& C% K+ D3 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + j& \8 {; Z7 L9 g* F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 o) X6 p  Y6 W* H& O6 G6 D5 |

  67. / {+ Z. D: g1 G, O
  68. dma_addr_t dmaphyssrc1 = 0;8 @* w! h$ {! L5 \% L
  69. dma_addr_t dmaphyssrc2 = 0;
    ' Y+ e5 S: l" r$ y4 i- i
  70. dma_addr_t dmaphysdest1 = 0;
    8 ^: O7 Q+ h1 M3 D# P/ C6 [
  71. dma_addr_t dmaphysdest2 = 0;2 f; G3 d' E+ c0 Y

  72. 9 r4 f' N7 _& X9 ]7 l: n
  73. char *dmabufsrc1 = NULL;
    & H8 W1 F' K* h/ o* v8 U  z' [
  74. char *dmabufsrc2 = NULL;
    ) ~+ L1 J2 c5 a# a) R
  75. char *dmabufdest1 = NULL;
    4 U3 [: J7 \% Q$ v. ~1 w
  76. char *dmabufdest2 = NULL;
    / |7 [$ ?, B9 @
  77. 6 U9 H* G$ T: N
  78. static int acnt = 512;
    2 h. p% w7 a/ B, G0 d
  79. static int bcnt = 8;
    6 k6 q, y6 b, ^' x6 ^" Z0 f( U
  80. static int ccnt = 8;
    & }7 U: o2 ?( _; W
  81. 1 Q, ^6 x: f# p, b- U8 N/ E
  82. module_param(acnt, int, S_IRUGO);0 S5 t6 u4 d# R4 b# w7 l, k- g
  83. module_param(bcnt, int, S_IRUGO);
    / v" X1 ?* c# `; r: V; |: p/ C" |+ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 r2 X- H9 q5 S4 |( C! O; Q- N1 X
* D4 C. y# D$ I) Z6 i& e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M+ A/ D6 }0 y6 G% garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: s  a$ F. {3 v& a2 b2 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& r1 K1 y3 S, a1 b
) N- p) p" G9 Q1 S. C' Y) {
7 i5 v6 T; Q& w( e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 02:15 , Processed in 0.045447 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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