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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 q+ S0 @  [( M7 n1 y
  1. [code]EDMA sample test application
    ) J$ b4 W5 s0 E0 [
  2. /*$ h1 B) D2 w! P' o
  3. * edma_test.c
    ; G. A0 |; ?5 D
  4. *! O: b/ @+ q5 K' Y6 j0 O
  5. * brief  EDMA3 Test Application
    ! u/ D& l5 x0 q" G& r# K; n
  6. *
    ) _3 `  a9 @4 [% ?1 a1 E
  7. *   This file contains EDMA3 Test code.% S: `( E2 L/ f6 \' y# R- X
  8. *
    7 L" N" s7 H6 l% z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 i3 f( c( F- H) A1 m; W& B5 ?* s6 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ W4 v! B4 z' ]/ `
  11. *         TO CHANGE.
    0 M8 E/ u! h  z2 w: u
  12. *& j- f1 W  x( D9 |! [* L; ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! h! x1 Q; g6 q/ c8 Q
  14. *7 H! C* l2 O' j8 V: k0 G
  15. * This program is free software; you can redistribute it and/or
    $ i% s: E  u" f; g* E) H
  16. * modify it under the terms of the GNU General Public License as
    " p2 E( R& v2 l3 {' ]: T
  17. * published by the Free Software Foundation version 2.
    . x' Z6 I1 b: D) _
  18. *
    ) }& V% \6 z; A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 h6 c! e+ }5 E- m) I9 B
  20. * kind, whether express or implied; without even the implied warranty2 A1 [- ?$ L" p+ m  R: I3 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' @) k, \, U" A! O; |/ u2 B# p, x- L, Q
  22. * GNU General Public License for more details.$ U# A( O7 r4 O' U# M/ ?- |
  23. */
    9 u+ @, E4 x# A/ Z4 p4 ^: W/ r

  24. ; T8 |& R7 r8 I7 \" t7 C
  25. #include <linux/module.h>
    # Y, v9 C5 x' M* ]2 x
  26. #include <linux/init.h>
    ( D7 y# q( [- \; b, N$ z$ Q
  27. #include <linux/errno.h>
    " d2 I3 Z1 P7 L! J
  28. #include <linux/types.h>2 z+ c+ v2 x! ]/ V- {
  29. #include <linux/interrupt.h>. H/ E8 l' r; G6 e  I
  30. #include <asm/io.h>2 w- Q6 h; y7 p; h
  31. #include <linux/moduleparam.h>6 c1 E' S  u; v: W" n( k
  32. #include <linux/sysctl.h>
    $ q0 _/ q! F8 }* d
  33. #include <linux/mm.h>$ U" b9 E5 a$ A; g' W
  34. #include <linux/dma-mapping.h>' x; R- P8 |1 P3 ~4 l1 n; g& C

  35. ' `* O% j- v; S- q6 S
  36. #include <mach/memory.h>
    & X  S) J9 W5 R" n& Y3 q* w9 G
  37. #include <mach/hardware.h>
    9 Q* e# v; S3 P& Q& A
  38. #include <mach/irqs.h>
    7 Z( p; {( D- [- ^6 T8 X
  39. #include <asm/hardware/edma.h>4 w* }7 b5 ~" s9 Q

  40. ( b" ?- b, r, }* S3 A2 o$ Q
  41. #undef EDMA3_DEBUG9 l- X$ _+ K6 Z  W5 i* m
  42. /*#define EDMA3_DEBUG*/
    + n8 p* [/ A# X

  43. 5 y( a* Z4 n3 K$ K
  44. #ifdef EDMA3_DEBUG
    6 r6 T7 Z, }" d7 @+ H: d8 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& y5 p0 ^9 {8 z- y9 G% x  U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). M" {2 b3 Z" H& X5 G, \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 H+ L9 P, |! k6 \7 H
  48. #else2 W2 R! v9 P4 C& e0 A
  49. #define DMA_PRINTK( x... )4 U6 Z7 q/ M, P% N. s8 o* v5 V. \# B
  50. #define DMA_FN_IN
    ( t7 ~# Z' L, q8 Q" l* o7 I! [# l
  51. #define DMA_FN_OUT, a9 F$ z) ^, X# z/ m' C* Z
  52. #endif0 D& k! K5 l% Y- y3 b+ N2 ?
  53. 2 M# Y: o. @% A. d. W/ a7 k5 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% ?/ B) q, H7 A/ _6 e; ^
  55. #define STATIC_SHIFT                3
    6 {' ~3 |: {' K. F8 D/ {& v% T
  56. #define TCINTEN_SHIFT               20
    3 G% c5 D) g3 O8 X7 }, w  P
  57. #define ITCINTEN_SHIFT              21
    5 `! T- T$ Q8 H8 s9 Y4 f
  58. #define TCCHEN_SHIFT                22) {3 C( c( B  x& T8 z
  59. #define ITCCHEN_SHIFT               23
      T  h, p1 n8 g7 M
  60. 9 E2 S+ b* R% W; y4 p: @
  61. static volatile int irqraised1 = 0;
    6 v5 u9 o5 h. Q) y4 u
  62. static volatile int irqraised2 = 0;$ E# H: {% M0 L' Q7 X9 b1 y9 T

  63. + i; q: o4 ]. t, E6 H1 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 H1 I/ T* t* v% t2 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 o& _5 D0 y) e& R* ]5 E7 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ \5 \/ C  g' Q% b3 ~
  67. $ Q+ w% D5 U# O! b/ t
  68. dma_addr_t dmaphyssrc1 = 0;# `' W' E0 Z6 b9 z
  69. dma_addr_t dmaphyssrc2 = 0;
    6 b( g. o0 `# p) p+ r0 q
  70. dma_addr_t dmaphysdest1 = 0;# e+ b3 d6 j) N% i- T: Q  ]
  71. dma_addr_t dmaphysdest2 = 0;# M3 J! d3 \: C( h4 `# R/ X

  72. ( K5 B( T7 v; D# I& l
  73. char *dmabufsrc1 = NULL;2 b6 L/ a) h& l3 o2 I: j- [
  74. char *dmabufsrc2 = NULL;+ [9 ]; Z! C# K; N1 Q! J! A# S
  75. char *dmabufdest1 = NULL;
    * u7 L- R2 ^- C3 {6 p) q9 @# d
  76. char *dmabufdest2 = NULL;' q8 s; _2 K, [! g5 q4 l7 }
  77. 2 M' \7 M/ ~  j' s
  78. static int acnt = 512;
    0 }. c: _* \6 ]
  79. static int bcnt = 8;3 e/ p3 t; B5 Y+ Q
  80. static int ccnt = 8;4 Y6 q) h+ a! n8 Q5 a7 ~% g
  81. . ]$ v+ D: ^6 F
  82. module_param(acnt, int, S_IRUGO);
    2 K' s, o& r  O+ K8 ^; \2 i
  83. module_param(bcnt, int, S_IRUGO);3 j; }) C  w6 ]2 s1 F6 d0 P  Y! h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# J: J5 P- g- r- Y

1 v% ]: t0 [7 ?/ p* D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 j1 H: F. I6 g4 x- u4 |+ ]% c8 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% o0 |% F4 l% G, x+ d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* `3 b) F8 L6 G8 }, u( B  W5 V

2 N8 A0 I2 ?7 U! G$ m9 W* Z% Y  N8 b
+ b6 P. ?3 K8 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 14:53 , Processed in 0.044558 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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