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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % B3 y7 i" v- w: |1 H
  1. [code]EDMA sample test application! F3 v! _2 s$ t) j
  2. /*3 b7 K+ Y1 B5 ~6 z
  3. * edma_test.c
    ' ?: L. `/ R, g
  4. *9 ?; N" d, b: i, ^8 q# m
  5. * brief  EDMA3 Test Application
    / X9 C% z% a0 E. L
  6. *- T* q+ b* n! ^8 ?: @% l- V/ }
  7. *   This file contains EDMA3 Test code.5 |, n% `1 n$ g3 M
  8. */ S/ Z, \1 Y; o7 A& _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # q$ @% Q8 [/ K' N  f& A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ o; L+ ]8 e0 N# P- ~9 g
  11. *         TO CHANGE.
    ; `, B: K  C9 q6 b
  12. *! Q: E- n7 f' p" x% M6 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 b% d$ \$ ]$ G/ [. V8 \4 P
  14. *
    ; L: u' |% ^' \: I6 J
  15. * This program is free software; you can redistribute it and/or; Q+ B3 J! n: v! A) n
  16. * modify it under the terms of the GNU General Public License as2 N0 s+ s4 n! Q9 V: I  J  ?# M
  17. * published by the Free Software Foundation version 2.
    ( z8 I& |+ k: L1 Z+ B
  18. *
    ' m) m( N4 g/ L3 B3 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 m: ]0 i* w) u, s
  20. * kind, whether express or implied; without even the implied warranty
    0 }5 U! |% q9 n( M' ]$ I) k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 q# u& G. B# b) y
  22. * GNU General Public License for more details.
    ; R. B6 j" v  g! O
  23. */* _0 @. x1 t* o! l4 o3 Q1 @

  24. ) G( f6 A6 x4 j3 T: |) _. T! P
  25. #include <linux/module.h>
    5 @" _5 V! d- d, N
  26. #include <linux/init.h>
    5 c% f7 o4 ?6 N. l4 b: _+ [5 f" E: m8 j
  27. #include <linux/errno.h>' k9 Z9 J. }3 ^% x6 o9 E
  28. #include <linux/types.h>$ v4 b; h1 A. v1 Y0 l5 V/ J
  29. #include <linux/interrupt.h>+ {: B0 [9 A/ y% g1 q
  30. #include <asm/io.h>
    0 d" b2 G/ l+ n" d) p) \, v
  31. #include <linux/moduleparam.h>. S: {# \4 g! I" e, P7 _# B9 s; e
  32. #include <linux/sysctl.h>) y. m+ x5 B) l0 y
  33. #include <linux/mm.h>
    ) c) d5 |; V' H" q) X
  34. #include <linux/dma-mapping.h>
    & _2 [( |# r% g$ R, k4 @

  35. ' `7 F1 `$ d( S9 ]/ B# E; Z! Z$ X
  36. #include <mach/memory.h>6 V" E! d5 ]) R# x
  37. #include <mach/hardware.h>
    ) r8 k/ D% h9 G6 W$ }
  38. #include <mach/irqs.h>3 k+ o" E( C5 ?- s" j
  39. #include <asm/hardware/edma.h>
      J/ L, e; P7 x2 D3 q1 }. P

  40. : P, [2 u$ S) Q* {3 T: N8 I
  41. #undef EDMA3_DEBUG* N8 h8 P; d4 E) K. l) f6 z
  42. /*#define EDMA3_DEBUG*/
    , [- v, W$ I9 ~4 w0 f
  43. 2 y- Q2 y7 d. R3 m. h9 G: n/ Q5 y* z0 f
  44. #ifdef EDMA3_DEBUG$ H6 k$ V. r$ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ~3 Q% V7 y( P6 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 a1 Q+ b* `! s$ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 e' i1 F) p& |; m; G" {) b( \
  48. #else
    * }8 M3 h' B, M* I
  49. #define DMA_PRINTK( x... )# L3 z- H8 w, `) U9 ]8 D# o
  50. #define DMA_FN_IN
    ! |2 n$ P* q* T. W, S! I
  51. #define DMA_FN_OUT
    8 k# c# \7 |, J
  52. #endif
    3 U: Y4 ]( x6 S4 O
  53. # U- v/ C6 Y/ G! R' S- P. _) g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 a& i5 X3 B) U& e8 m0 T
  55. #define STATIC_SHIFT                3; N+ h) h% n- Z
  56. #define TCINTEN_SHIFT               203 E& y( X8 p9 s! q. \7 K% P- I
  57. #define ITCINTEN_SHIFT              21# f0 i2 d4 E+ v. E5 L$ D
  58. #define TCCHEN_SHIFT                220 \- T' z5 }6 f" H6 k' r! m
  59. #define ITCCHEN_SHIFT               23
      o" G( d# r; ~: A7 D
  60. % P2 \. y) F/ n+ B' X
  61. static volatile int irqraised1 = 0;8 e# L- g' r' @2 ?
  62. static volatile int irqraised2 = 0;
    ' i( `; _0 U; O% `
  63. 0 C2 c% Y: Q4 M2 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K! d( i7 o" M- A" S* E+ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " G, f: F: R) b0 B8 ?) V8 f. L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 d& ^# h# u' \: @7 M) V% k; m

  67. , a- S  k5 r. G% h9 q( x0 C6 m
  68. dma_addr_t dmaphyssrc1 = 0;
    ) c; y' z7 o* O3 I: j1 r  N
  69. dma_addr_t dmaphyssrc2 = 0;
    4 u6 w" [6 j* r7 ~/ n5 w4 H
  70. dma_addr_t dmaphysdest1 = 0;
    5 J$ M2 l; |5 e! g7 G! F
  71. dma_addr_t dmaphysdest2 = 0;: E2 K2 E! @1 m9 v4 L

  72. 8 {# N4 E- D7 H7 `  v7 H
  73. char *dmabufsrc1 = NULL;$ P( L) x; H+ k6 j
  74. char *dmabufsrc2 = NULL;/ ~# t8 ]5 D9 V2 _
  75. char *dmabufdest1 = NULL;
    ' F; z. x: N* J
  76. char *dmabufdest2 = NULL;
    1 z1 A2 b5 E8 |! X- n) [
  77. * h# H9 v7 q) J( G' W
  78. static int acnt = 512;
    2 r7 K( a& V# Y* N' u4 ~
  79. static int bcnt = 8;
    # w' |1 |+ Q) B
  80. static int ccnt = 8;9 y; W8 F+ H. m5 B
  81. 0 l3 u0 k9 Q; m. A6 {  y
  82. module_param(acnt, int, S_IRUGO);& d9 z) m* q: h; c
  83. module_param(bcnt, int, S_IRUGO);8 K5 }# j6 {3 s7 D, X' z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 w2 S4 W, i4 q# j- L' g
9 D, v- T- f# L" S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) Z8 C5 P% V- y; _2 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ r3 C1 E3 Y3 d3 J- e9 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 C6 r5 a1 C7 o, Z- O0 G: b! b

& W) e* j% Y  i: p. H9 f& F/ s% x+ y% O& K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 00:27 , Processed in 0.037829 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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