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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Q+ h( w- _" j9 C& s  k
  1. [code]EDMA sample test application
    0 v! B; {5 ^5 R0 s$ O
  2. /*
    2 I# j) j% X1 Z4 [0 ^- @
  3. * edma_test.c
    . A2 d! t; d9 {# R' z2 y
  4. *
    & s2 a/ P0 W9 ~- B, \
  5. * brief  EDMA3 Test Application
    8 o" v- q: h/ Z) ^- Y5 _
  6. *
    2 z, z5 x8 j8 R% h  }1 d" q
  7. *   This file contains EDMA3 Test code.
    0 W: `0 z0 z& ?
  8. *
    1 I/ S. w6 D: f. f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % V6 e/ B3 p! G6 C' s- i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * [" X( J2 r' U! K# c8 U$ v. }
  11. *         TO CHANGE.
    9 c/ ]3 J3 ^0 v
  12. *# y3 d& I, H% c) C! U3 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 S. E3 {6 m" d" h* O0 W" J
  14. *' n7 [; l: K& ?3 ]! L
  15. * This program is free software; you can redistribute it and/or
    2 K7 n% P- q/ a0 \' L2 f. u
  16. * modify it under the terms of the GNU General Public License as
    ! Q: _6 V3 _4 }- s2 L: e( F
  17. * published by the Free Software Foundation version 2.
    # z5 f0 l5 x5 K3 B( G& z% A
  18. *
    . P* `- l4 N2 D& |5 L& _: }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' G  M2 E# b7 x* E" N9 V4 t# c
  20. * kind, whether express or implied; without even the implied warranty. ~$ [% z( F" ~; v* t9 p: G$ n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 ^  |( y5 ?4 J. \4 z
  22. * GNU General Public License for more details.4 J# q1 x4 i+ p5 U
  23. */8 T! N2 i/ ]3 {! ^0 F+ O! b

  24. ! F" w+ Y3 \( a9 x: j0 Y
  25. #include <linux/module.h>! B: b! s; z/ |$ `
  26. #include <linux/init.h>
    ( _$ H- B( i/ t
  27. #include <linux/errno.h>! }+ \; m; x8 Z2 d4 {& u
  28. #include <linux/types.h>- Z, ^+ o+ c/ H8 {) K1 _: T
  29. #include <linux/interrupt.h>+ V- f' h$ X! j& b9 Z, t) W
  30. #include <asm/io.h>
    # j& v. @1 m% F) [- t
  31. #include <linux/moduleparam.h>- h' b- _3 j; K
  32. #include <linux/sysctl.h>4 R. n' T3 }! }6 G0 e' u2 \
  33. #include <linux/mm.h>; b) m: e( g, R( A: {6 F# V
  34. #include <linux/dma-mapping.h># E- k0 T$ p3 L- B6 {! h* T

  35. 6 Z9 B9 [3 y( _; D) Z
  36. #include <mach/memory.h>2 B! z/ |$ @. a! A" c
  37. #include <mach/hardware.h>' p% P: u$ ], [
  38. #include <mach/irqs.h>
    " [/ }2 R. Q2 b. z* O- i, L
  39. #include <asm/hardware/edma.h>
    2 p; @* j( K0 u' g

  40. 0 [& m) R0 z: k4 E6 \3 ~$ _" o
  41. #undef EDMA3_DEBUG
    9 g( W+ @* G! f" p' i
  42. /*#define EDMA3_DEBUG*/$ N" o) l! p# }: g
  43. 2 X+ k) y* [  z0 W4 c: X. X1 T6 V
  44. #ifdef EDMA3_DEBUG# Z* u, s+ {0 S, D8 u; x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! g6 S( S" F# r" W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ h* @$ E  v/ E6 ~6 T, G( }* D+ \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 D7 \5 [& Y7 K: N4 b
  48. #else! a9 B& D* d1 L
  49. #define DMA_PRINTK( x... )
    1 d) Q/ P( Q: K5 ~1 c
  50. #define DMA_FN_IN
    - C: c$ m+ i1 N' V' R, u
  51. #define DMA_FN_OUT$ f2 W3 r, q  N6 w5 m' E" A; V) z
  52. #endif" k, q" o  ]* l) l  C  G: ^
  53. 5 n4 ?0 W( c+ O# Z" {: `; u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" Q. |$ t9 Z- H. P; q7 u. y
  55. #define STATIC_SHIFT                3
    0 i; V8 v8 E9 R" e* ?9 S
  56. #define TCINTEN_SHIFT               20
    - x  V) B; I6 ?, l- |
  57. #define ITCINTEN_SHIFT              21# s1 s  k9 C" _. X1 B/ R
  58. #define TCCHEN_SHIFT                22
    6 A$ p5 i& V5 r- V% M+ j/ h# P
  59. #define ITCCHEN_SHIFT               23
    & }2 ~9 e5 c# v
  60. ' m1 n. n7 B* \/ _' Q
  61. static volatile int irqraised1 = 0;: ~  a( T$ ~" a7 i4 v5 t2 a
  62. static volatile int irqraised2 = 0;: a8 N" {( s, J) b9 y) I  L% u
  63. 9 z% f1 H. P6 b& T/ g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m& D* U/ @% y- D# f5 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, \- X1 y, n  G; j. V: ~# {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 h! [5 b) l' |* d6 |( `  U+ N

  67.   m0 m" ]0 L. x& v% }
  68. dma_addr_t dmaphyssrc1 = 0;
    + d* W. Y/ v; _3 s
  69. dma_addr_t dmaphyssrc2 = 0;
    5 k0 o3 J7 g- F
  70. dma_addr_t dmaphysdest1 = 0;
    % M7 e. y  ?8 ?. ]2 H
  71. dma_addr_t dmaphysdest2 = 0;& e; R% k1 Z$ g- g; ~
  72. . Y) |3 E- J/ e% `3 t) @( }
  73. char *dmabufsrc1 = NULL;
    & H( ]" b% K( b2 Y+ G
  74. char *dmabufsrc2 = NULL;6 J& {$ Q) |6 U! w4 ]7 c8 s+ {2 N
  75. char *dmabufdest1 = NULL;
    / |2 M3 ?4 i/ S1 y7 T1 f7 n
  76. char *dmabufdest2 = NULL;
    2 B3 y" d9 g/ }4 v0 i  A
  77. * X7 k* c9 f& i) j, T! T" z0 C
  78. static int acnt = 512;
    ' J6 {( [' x" ?: N# e
  79. static int bcnt = 8;2 I% }( v& j/ k/ p% S% C
  80. static int ccnt = 8;. ~2 }) \8 `" v
  81. 9 ]+ _- q6 O0 e, @7 P3 ^9 B
  82. module_param(acnt, int, S_IRUGO);5 H" h* F2 h, r: n0 ~+ z  ?
  83. module_param(bcnt, int, S_IRUGO);
    . P0 s# r9 e2 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 A3 B, R1 J" T& L
" h0 j" |7 q$ D) g* b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: {) {* \5 {+ Q  t& Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- L/ Y% j# Z1 v$ R) {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ O: {8 B  Y- K$ v* U
- ?) t3 U+ ]2 k
& u8 P$ I+ d9 M0 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 03:12 , Processed in 0.041023 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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