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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- e* I) s3 l4 G/ R# a4 X
  1. [code]EDMA sample test application
    . \2 {& Y0 }, _$ ?  K
  2. /*2 X& }5 O6 `- |1 C7 R( P  o
  3. * edma_test.c
    5 F$ y2 W# K2 @7 ]2 M
  4. *
    # s9 o% Z. c' k4 d' P2 H! P
  5. * brief  EDMA3 Test Application7 @6 \' v2 p5 c4 ~0 u- d
  6. *" s) I1 r' u4 E* L& K
  7. *   This file contains EDMA3 Test code.4 h5 \5 S( e& H1 A" j6 o* h
  8. ** R( V) M! F0 H* p/ f1 x, W1 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 u) Z' M: \) N. X& q; Y  h/ X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : |) ^7 ~; T# r2 ^' X* n, L; _
  11. *         TO CHANGE.9 J. b! D8 j/ Q5 n4 V  l6 X
  12. *
      G1 A6 x+ e  C+ q1 o$ E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : o! @$ k- Q# c: x! C
  14. *5 t) n9 G: M; o0 m+ S- A
  15. * This program is free software; you can redistribute it and/or4 Q+ `# w5 }% s6 {. I% K
  16. * modify it under the terms of the GNU General Public License as3 p7 \- j* Z+ |) Q( V
  17. * published by the Free Software Foundation version 2.
    6 E5 l+ N5 B' e! s
  18. *- |! D: p2 p% A/ l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- X; W& ^2 j% l- g' R, H
  20. * kind, whether express or implied; without even the implied warranty
    * e. D6 G+ y, V/ X* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 T- t2 Y8 U+ C) U7 K* K: g& l/ O
  22. * GNU General Public License for more details.! I" S2 \* r# G) W" Q
  23. */
    6 }4 A" \' j+ j; {, T/ M: b2 W& n

  24. , y3 N. Z! m6 W& i: N! `  _
  25. #include <linux/module.h>
    2 T# L- y+ i! r/ P6 ?% K
  26. #include <linux/init.h>
    6 t  R1 A2 y/ e6 E- Q9 B/ {+ ~( W
  27. #include <linux/errno.h>
    6 c) v/ A2 D2 V: f; k! h
  28. #include <linux/types.h>3 J1 l( u: i" v* n6 ~
  29. #include <linux/interrupt.h>
    " v9 M6 I. @% l6 E' T" x( s
  30. #include <asm/io.h>+ {$ g0 S7 [, o  o* D  L! q/ \6 \2 ]
  31. #include <linux/moduleparam.h>
    , W1 M; {' w" D- a% n# n2 s: m
  32. #include <linux/sysctl.h>5 ]- J# Q/ U: G: b5 `) Q+ _0 X
  33. #include <linux/mm.h>( [) V& ~! r" Z7 l) W( v( K. Y6 N
  34. #include <linux/dma-mapping.h>- ^; o6 r# E. _: \
  35. ' O0 y+ |" r& l" j# C; @, i
  36. #include <mach/memory.h>
    * ^. V+ w' _- J+ q. j
  37. #include <mach/hardware.h>1 i7 G1 \' M$ @8 i$ h
  38. #include <mach/irqs.h>
    1 `( p5 A' \9 I
  39. #include <asm/hardware/edma.h>3 L# J& P7 B0 c" j

  40. % ]& \. q- B. J, `
  41. #undef EDMA3_DEBUG. r. h' g# C- R, V, N* I
  42. /*#define EDMA3_DEBUG*/4 A# s5 K; \* C: A( I
  43. * k+ O8 p/ q* W$ [+ c, c( o9 d
  44. #ifdef EDMA3_DEBUG* x. d9 n8 j2 b* |9 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * c. l% R5 P$ z) [# T8 t5 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 D" z& R# N! e! I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : R" \+ J9 W: W( j
  48. #else
      D5 O& W# U, Q0 R- U! B
  49. #define DMA_PRINTK( x... )
    9 t8 q  a) y; ], u
  50. #define DMA_FN_IN9 k4 W7 Q1 \* g% C4 r
  51. #define DMA_FN_OUT
    # h# D6 T5 Z% B! @
  52. #endif
    # F# t. u/ P" B4 S) R

  53. ) Y" @* p$ W6 M' u' p/ b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * N# W; z* w  o2 b, x
  55. #define STATIC_SHIFT                30 r- Y+ @; b8 B1 p2 B/ X5 m
  56. #define TCINTEN_SHIFT               20
    1 f, i$ c0 w7 _* s2 x  ?2 P- ~
  57. #define ITCINTEN_SHIFT              21
    & k. i: R1 ^) B5 A% q8 t9 F
  58. #define TCCHEN_SHIFT                22( D: P# w* n/ _# X# u$ L
  59. #define ITCCHEN_SHIFT               23
    " R0 x1 c# ^6 i' R4 C" {
  60. * v2 G) _  X" w* i
  61. static volatile int irqraised1 = 0;* r0 t" |" o% m' A. Z0 I4 `; I( e
  62. static volatile int irqraised2 = 0;* z0 C; Q0 n, D% x

  63. / B  ]2 [, f% Y7 a/ r+ C& u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % {- h# A1 E9 f: m9 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; q/ ?+ m& S9 N, ?1 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 v4 G; u6 k% B7 o

  67. # j8 C+ c( G# s# ~
  68. dma_addr_t dmaphyssrc1 = 0;# A& a. `" E3 F( r" R
  69. dma_addr_t dmaphyssrc2 = 0;
    * W# n9 F. L% t7 S. H2 `; @; d
  70. dma_addr_t dmaphysdest1 = 0;
    + K* |. q) _: b. ?7 S
  71. dma_addr_t dmaphysdest2 = 0;
    % ], [; S& K" q' n* B
  72. % I3 V& E+ K' e
  73. char *dmabufsrc1 = NULL;6 v/ w- t; q7 O% E
  74. char *dmabufsrc2 = NULL;; j: f3 V& r0 a0 L) {. y8 C7 b
  75. char *dmabufdest1 = NULL;
      |  j' \0 O, ~) r: x
  76. char *dmabufdest2 = NULL;' }1 Y1 U# x# u7 I1 J) z
  77. # D2 X/ L6 E) }% l
  78. static int acnt = 512;4 a& V. }( X* o* M9 O* }
  79. static int bcnt = 8;) O' l; F2 O% ]+ M9 M
  80. static int ccnt = 8;
    ! A3 G4 q5 _" [- c" f

  81. # Z! P. n" g" k- q
  82. module_param(acnt, int, S_IRUGO);) A  `1 s/ ]2 b& o1 \; N! F$ V, b1 Y
  83. module_param(bcnt, int, S_IRUGO);' Y& H5 [- M. P8 r( s2 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ T% v' J* N) {  _* U% L' t/ p# T  U% C' C8 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 b$ J; K- p: u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 V! A5 M& v/ n! J+ N2 G$ g6 r' D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# o# _5 q$ n2 v" P+ v) \4 @9 N

7 u+ o/ O4 g/ \
  |, A0 K0 Q4 Q, t0 H. p. \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 07:57 , Processed in 0.040562 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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