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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; f+ J7 w) z' z3 b# X) x  E
  1. [code]EDMA sample test application
    1 K' X6 u, i# {) e1 I% m: p$ ~
  2. /*2 g3 l9 p; B# _/ \& j7 M
  3. * edma_test.c- _' C7 h; w1 a1 C/ b
  4. *  f% N8 }2 p) W- w. g
  5. * brief  EDMA3 Test Application+ S/ P; m" `4 p; R+ X  V
  6. *+ ]1 C% B) _+ E  [; j
  7. *   This file contains EDMA3 Test code.
    ' m2 C" L- b( T1 @+ S7 i7 u$ R
  8. *
    ; [3 ~( [" p5 h2 u8 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' x( ]! A# t. D/ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , \4 ?! D2 j6 v% `
  11. *         TO CHANGE.5 o7 ?, V5 y$ V; u
  12. *; h7 \1 N4 M+ d$ N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / K& k9 s0 m5 Q( v/ v
  14. *
    0 ^* T6 `5 s/ |; d; v2 L) F
  15. * This program is free software; you can redistribute it and/or
    ; ]6 \2 H% @. O% U( U
  16. * modify it under the terms of the GNU General Public License as
    3 b& M8 \8 [  G0 S2 ?/ e! a( y
  17. * published by the Free Software Foundation version 2.
    * c. X6 a" a5 ]6 t
  18. *
    + R8 J$ E. M* K6 z. e3 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 }: G1 S2 Z& F+ n# c% l) K
  20. * kind, whether express or implied; without even the implied warranty. D/ B- T. i. k+ B& o, }. U: C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 i, }+ z3 T% o. _  N, Q: |
  22. * GNU General Public License for more details.7 c1 k5 e2 l4 [* k; M
  23. */
    1 ^% {0 b2 {4 u

  24. ; \' q- g  k- x7 P: o
  25. #include <linux/module.h>
    8 j( K+ `, S5 c- P
  26. #include <linux/init.h>- y& Q. E0 m7 K7 r0 T
  27. #include <linux/errno.h>3 x' P/ K& Y3 n9 h! B
  28. #include <linux/types.h>1 O1 U3 z  B" P0 q' X/ g- j$ V
  29. #include <linux/interrupt.h>
    3 [: H: U, W/ U' c
  30. #include <asm/io.h>
    . }, R! x' b$ S4 u( y! v
  31. #include <linux/moduleparam.h>
    1 v6 a' P; `6 S8 F, |/ I# K
  32. #include <linux/sysctl.h>
    4 r% x+ v. L9 t6 ~3 S$ p
  33. #include <linux/mm.h>
    3 g% X2 E  S( ^, l
  34. #include <linux/dma-mapping.h>
    / o" f& Y7 D3 |8 O4 J* K4 y% p

  35. & c' A% l. s' ^" {& T" A
  36. #include <mach/memory.h>, b  W, i' m! m3 k- c0 K& l
  37. #include <mach/hardware.h>! B3 T) T8 y: x% ^9 _5 ?
  38. #include <mach/irqs.h>8 y) {! y& h! C
  39. #include <asm/hardware/edma.h>
    8 R; Y! u2 i% D: G, S, g2 Q+ q
  40. - m& @2 k. [. d, B* }* i  O7 L
  41. #undef EDMA3_DEBUG
    " _/ d7 ]8 _( L5 |! ~( \/ E' S  ~
  42. /*#define EDMA3_DEBUG*/
    & t. L* X; [3 x: _2 P* R
  43. ' L6 H5 b5 |+ \4 Q. k
  44. #ifdef EDMA3_DEBUG
    ' |! t5 o. n; {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( k* G; f  C+ N# N9 ?6 d: g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- J# @1 b; s# _% t- i% L/ v2 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 d, t/ Y; l9 D- a9 a3 |. U
  48. #else
    1 E, q: m/ o3 `- b
  49. #define DMA_PRINTK( x... )
    # h9 G6 H% r9 k) |7 t  X
  50. #define DMA_FN_IN' @9 f, F6 d) W+ b8 E
  51. #define DMA_FN_OUT5 G+ y7 c2 C6 C
  52. #endif
    # R. B7 i$ J6 h. u# V
  53. / I8 b0 e9 d+ a4 z3 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 q: B2 ?9 O+ U9 u3 N7 u
  55. #define STATIC_SHIFT                3
    . f. g" j+ v' P0 J, U3 J" V% d
  56. #define TCINTEN_SHIFT               20
    " w; _# \2 F6 J, Y. }% r8 w
  57. #define ITCINTEN_SHIFT              21
    0 c' `8 R+ o+ ~: t* W
  58. #define TCCHEN_SHIFT                22  `6 a) ]. d9 w; D+ }9 z
  59. #define ITCCHEN_SHIFT               23
    ( ^: B5 Y# O8 o5 P* b2 M
  60. , P3 u# U  d: r* @: f" X# J
  61. static volatile int irqraised1 = 0;. \. o2 v; ^: c1 d6 f. [, c/ q
  62. static volatile int irqraised2 = 0;3 O( w# ^6 y" e4 p

  63. 6 H  d& H- N2 F  e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 z, p+ A, O! X. n8 V+ x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 [& ]) O/ e! x; P. n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 \/ U6 _# u6 b. c3 c
  67. 8 ?  n" }& `" d# u& z, w
  68. dma_addr_t dmaphyssrc1 = 0;
    ' ^5 c# C8 K9 V! J8 v4 @
  69. dma_addr_t dmaphyssrc2 = 0;# `2 r. v, C4 \2 }) k8 y2 j3 V6 r5 {
  70. dma_addr_t dmaphysdest1 = 0;
    2 V& n; {- T7 p
  71. dma_addr_t dmaphysdest2 = 0;
    0 g2 r  ^9 H/ c1 o
  72. # y3 t7 ~% V& M4 I8 Y3 W
  73. char *dmabufsrc1 = NULL;
    ) H* ~% L( {! N- D/ Z; N
  74. char *dmabufsrc2 = NULL;  E; s" q& q, F' M) }/ |
  75. char *dmabufdest1 = NULL;2 R3 }( o9 l( s+ m7 B+ k2 R
  76. char *dmabufdest2 = NULL;
    ; v4 l; T! ^' g2 X- Z

  77. ) |% [6 i9 t) U+ _
  78. static int acnt = 512;
    $ Q% P( p( Q6 F
  79. static int bcnt = 8;! x8 s8 F. [9 L3 [" ]8 `9 {; l
  80. static int ccnt = 8;
    9 u  ~3 q% J8 t) L: w- A$ R
  81. * j0 @; s* c- a1 p% I7 l( @* T
  82. module_param(acnt, int, S_IRUGO);
    / ~( i6 k$ R! O. w% k
  83. module_param(bcnt, int, S_IRUGO);
    6 u9 A: f+ g" N" a% ?$ C2 h6 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" ]) b1 W6 l0 }2 B: i2 w
. {4 G. G2 j9 u; q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 b9 o" M, d  s  tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 I- Y  M, K$ q- X5 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. L: p: y& ^* f2 ?+ ?4 P
' C9 \6 |! a6 J7 a' a# X
" P6 k& s0 d1 e% k  j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 00:01 , Processed in 0.047622 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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