OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; a) _- a2 `% U9 l+ }$ A
  1. [code]EDMA sample test application
    . C  W. ?: c. V- w# s. z
  2. /*
    9 @# ]4 N+ E2 D* N
  3. * edma_test.c+ a: I& ^# |9 L. ]/ O/ D8 A* v
  4. *% U5 q4 V* e' T- n1 m) F
  5. * brief  EDMA3 Test Application6 e  X9 p" `! B
  6. *' Q/ K, Z! w' O% @5 i
  7. *   This file contains EDMA3 Test code./ U% j9 @# R0 A4 Y3 i# z
  8. *; p) A8 a2 D6 C# X4 ]) f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 g6 P0 D# t3 I4 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" T4 x- K  ~. ?8 y8 H! t2 D0 L: B
  11. *         TO CHANGE.
    / `8 p/ x) D  |: c7 `! Y
  12. *2 B4 U0 W0 X! q6 n) _) c+ Y' ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ~1 K, {2 L) p2 R3 b- A
  14. ** H3 r  _8 _+ {1 v: a; g4 E1 p+ G
  15. * This program is free software; you can redistribute it and/or
    2 G. {: P! L% A; R, c% @( ~
  16. * modify it under the terms of the GNU General Public License as2 n4 q8 C, u% A  \' X! g
  17. * published by the Free Software Foundation version 2.' C+ I$ d5 L) B* Y% u% S( Z
  18. *
    ) O! S+ {  Z3 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ~; O+ @7 A4 F9 @! }& I
  20. * kind, whether express or implied; without even the implied warranty3 P/ K% [1 C- S& J  A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 o3 o7 T; A# ?, l& e3 T3 [
  22. * GNU General Public License for more details.
    6 D# {3 ^! @9 Y$ V
  23. */3 J0 K3 {1 q3 |8 j) b7 D  z
  24. ; i0 v1 g7 k$ P5 `9 Q
  25. #include <linux/module.h>
    5 Y3 ^2 U# Q1 Y/ t
  26. #include <linux/init.h>+ D+ }" G, H- M! R5 K# x$ J
  27. #include <linux/errno.h>
    4 ?9 y" A1 @6 x/ G* F0 X  b, O0 @$ r7 P6 Y* f
  28. #include <linux/types.h>
    1 Y8 ^& [! F! T3 R3 M" n' [
  29. #include <linux/interrupt.h>
    6 A& a/ D$ R& u4 d& ?
  30. #include <asm/io.h>
    , W( F2 l2 K. ^! ]7 O9 ?1 B( F9 D
  31. #include <linux/moduleparam.h>
    , W; S" S' s3 ^4 g  a# f% |
  32. #include <linux/sysctl.h>6 M* I! B2 c1 Y, r! N* B: [+ W1 f3 v, _
  33. #include <linux/mm.h>" ~3 s4 o  i; g  {/ U
  34. #include <linux/dma-mapping.h>
    4 A5 k# g3 A9 u3 G
  35. + G# V+ D: |' \% i: N, Z2 f: Q
  36. #include <mach/memory.h>
    0 y, i# n. c: N7 y' m: ]2 w
  37. #include <mach/hardware.h>+ U  _: d. D/ @0 c
  38. #include <mach/irqs.h>
    $ D4 Z4 v7 x" g8 Y
  39. #include <asm/hardware/edma.h>
    " V5 r3 u" N3 ^$ t& Q. N
  40. 4 h7 a4 K. E( I0 e
  41. #undef EDMA3_DEBUG+ i9 S1 f; Y1 d5 d7 E3 p
  42. /*#define EDMA3_DEBUG*/; d3 n3 U) A; G9 s7 w4 @5 W7 E
  43. 1 j; T5 t. X- l, H  `3 w
  44. #ifdef EDMA3_DEBUG
    7 J" S2 t# x+ F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), a+ r8 |, G7 V+ Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 {$ Y, Y3 w) \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); {  Z8 {# i+ g0 s% M
  48. #else- Z" S, f3 S: N) f4 Y- Q8 v
  49. #define DMA_PRINTK( x... )6 V4 P% q2 l  l7 }/ N- L  F
  50. #define DMA_FN_IN
    $ q, b2 X+ r/ k* W
  51. #define DMA_FN_OUT0 P) B) S8 x) C( n) e! ?
  52. #endif, x% m0 d' Y$ _" W1 A; ~

  53. * _4 h: }+ q2 M$ x, q* w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 P# R. \5 o+ {" X/ Q; w/ E
  55. #define STATIC_SHIFT                3$ P% `. a2 [* M; p4 B$ h* o& p+ |
  56. #define TCINTEN_SHIFT               20/ T! x* Y- `7 d) }+ g
  57. #define ITCINTEN_SHIFT              21
    7 |( k9 M9 {: O, O) N
  58. #define TCCHEN_SHIFT                223 A( e- w" Y! @2 T
  59. #define ITCCHEN_SHIFT               23- i3 N! a! m( L8 Q- i
  60. 6 V: y& A' `! A/ @7 [
  61. static volatile int irqraised1 = 0;
    9 W0 l2 O$ x- F8 ~( a
  62. static volatile int irqraised2 = 0;
    2 d+ d, [  M9 i, a# e! b. N% F3 E* X

  63. 5 s" r. z  Y1 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 }2 x4 I* T% K! D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( F& O' x+ Q; ^* L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p8 m- s$ u1 K  w( v

  67. & l) @' ?& G; k" _4 P
  68. dma_addr_t dmaphyssrc1 = 0;
    ' M! [0 u$ F# u. |3 L( O; _& H) N% k
  69. dma_addr_t dmaphyssrc2 = 0;- S% A  `" n, M2 x; W8 y
  70. dma_addr_t dmaphysdest1 = 0;
    : c8 B- L1 }- \* U& j
  71. dma_addr_t dmaphysdest2 = 0;! K- \+ S. q' ^! i% f

  72. " B. V  K" ~. D# f2 l
  73. char *dmabufsrc1 = NULL;
    , c. \& e1 d% N" A5 d$ @2 `* U
  74. char *dmabufsrc2 = NULL;
    + W; O5 T- B& G* `; W, S' d
  75. char *dmabufdest1 = NULL;
    / s: m+ K: ^2 e
  76. char *dmabufdest2 = NULL;$ y' K0 g$ W1 n" f5 E2 W- \/ w

  77. 2 T( h5 K' P% V+ [
  78. static int acnt = 512;
    ! w' |4 ^& T& U# S
  79. static int bcnt = 8;
    : Y: t2 o! G2 W+ }
  80. static int ccnt = 8;' g" f" {6 M/ p9 e% `9 x0 [! M

  81. 1 _, Z) y. H' {
  82. module_param(acnt, int, S_IRUGO);
    / D5 Y; x; o0 {5 x' A# g6 v! W
  83. module_param(bcnt, int, S_IRUGO);( w3 J, j+ j# q) ^5 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 b! G/ c/ _( H/ o9 X) \
, S+ b$ c! |( _) C; Z; p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 N4 O7 L, h5 |+ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, M: ^/ T* W, ?- \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: N* Z9 d  x0 }5 I
# J( n; Q" c) ~* d& ~: W# ]1 }2 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 11:59 , Processed in 0.037450 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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