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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 d  m7 M& G5 j* a( a8 K& e: R
  1. [code]EDMA sample test application
    / E. S$ m7 Q* q
  2. /*. x3 E7 E6 B% b3 B5 n" Y2 g
  3. * edma_test.c
    ( y$ Z9 z2 [/ S$ k5 r* U  a4 \
  4. *) _' C9 _5 t5 N4 p% {
  5. * brief  EDMA3 Test Application& m% S' I3 k4 a5 G0 w" Z
  6. *
    6 c# Z4 _, o7 S! z+ i
  7. *   This file contains EDMA3 Test code.
    3 U: f1 P  ~; d2 o8 a6 D4 ^
  8. *
    5 Z+ T, i1 O# M/ [& S3 \4 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 H: V7 m+ U' V" T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + f& f; F* I+ }5 p& u
  11. *         TO CHANGE.
    ) P4 r- B$ y" t+ s+ q7 \
  12. *% w/ J: {7 Z" e- h( r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + }% [; O! ^1 U2 K8 @! X! h* P
  14. *! M7 x9 m4 l2 r" `( _- }/ p2 a
  15. * This program is free software; you can redistribute it and/or
    ' o; F" x1 `9 w* o
  16. * modify it under the terms of the GNU General Public License as( K# k5 I+ d$ P9 R' H( m
  17. * published by the Free Software Foundation version 2.
    + v! l6 t8 e6 F
  18. *
    + b& s  f* ^- u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' Q5 T3 y0 g, r/ [* @' z9 b
  20. * kind, whether express or implied; without even the implied warranty6 g+ ]6 v" B" z9 N, o4 y6 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  ]$ {. b: L# [& Y8 J5 |
  22. * GNU General Public License for more details.2 x2 d: V& i# h/ }0 R% Q( a
  23. */: G; W: S: s1 ]5 `

  24. # ]$ K  }! B% ?6 K. P
  25. #include <linux/module.h>; w) B! B2 l, q" F) c! u
  26. #include <linux/init.h>% C0 D5 p1 ^: g6 b
  27. #include <linux/errno.h>
    2 _8 v* e* J) I- `0 Y4 w$ O( ~
  28. #include <linux/types.h>+ p  Q" q- L  ^8 d  \: f& I& A0 P
  29. #include <linux/interrupt.h>
    0 `6 Y! f2 e) ]& R
  30. #include <asm/io.h>
    5 s; a% X/ X, o5 f9 f9 ?- |$ i
  31. #include <linux/moduleparam.h>
    $ L% o' l- S9 K! m
  32. #include <linux/sysctl.h>* e/ p0 T+ v) l, @
  33. #include <linux/mm.h>
    6 U5 P4 n- M0 N8 l, N- u+ W
  34. #include <linux/dma-mapping.h>
    . B* r; Q8 B8 x6 J. ?

  35. + G( C& Y8 ^, T. A& q; R
  36. #include <mach/memory.h>
    5 a  T. N4 i! l3 ]  H  q  @: w! J: {
  37. #include <mach/hardware.h>. g- W5 h& x/ c. W+ V
  38. #include <mach/irqs.h>
    * u- I7 D( O* A; k$ a3 E
  39. #include <asm/hardware/edma.h>4 T% S9 z, f+ T/ h$ F5 t
  40. ! l8 Z8 u: X2 w0 C; A, _, ^
  41. #undef EDMA3_DEBUG
    6 y. Z$ ]% T3 r
  42. /*#define EDMA3_DEBUG*/1 U% H/ o% |( }& S3 U

  43. : z& k! J; k4 k$ u1 F$ {  @
  44. #ifdef EDMA3_DEBUG) D# `' i% _' a; B. p- V  y7 O1 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' N/ ^+ ^$ b% ~9 T: E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 q- c' T) ?5 Y" r' B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 z% q. t3 Z+ ?. g( T2 @+ E
  48. #else
    + j1 w9 n! ?  L- }7 S7 {
  49. #define DMA_PRINTK( x... )
    3 ~; F4 ]1 H7 l2 T$ E# [. W
  50. #define DMA_FN_IN5 l) n& H7 x" h) Q) f) {% ~) H5 i
  51. #define DMA_FN_OUT* N7 b  r3 a4 e
  52. #endif
      J+ w. r6 x3 `* S0 e' R" ?( M

  53. " B0 ^) E, _. ^$ Y9 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 S( G# j. r. V7 @4 l8 W9 I" A
  55. #define STATIC_SHIFT                3
    1 p6 H4 K; C3 O* d2 p2 q5 l
  56. #define TCINTEN_SHIFT               20/ y4 B% K# O$ E
  57. #define ITCINTEN_SHIFT              21
    ( A/ r; @6 J" `* z
  58. #define TCCHEN_SHIFT                22
    ; f4 _  _2 {5 V9 ?: V
  59. #define ITCCHEN_SHIFT               23
    & {1 _# @8 p+ m. m' `5 o

  60. ' A8 ?8 I* J; F0 M8 Z- ^9 J
  61. static volatile int irqraised1 = 0;
    - ]) @" y0 l: i/ {- L
  62. static volatile int irqraised2 = 0;% X8 j7 z+ o/ h3 c* Z

  63. # d* K4 q9 O/ x0 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 S& Z- a1 E/ k. x2 ?% a! g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [) j* f4 {! x" V# c7 f; N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " O2 D& y) i) Y5 B

  67. $ c4 B; p6 u0 r% G  }  E: I
  68. dma_addr_t dmaphyssrc1 = 0;
    " `5 ^) Z6 \9 K/ D
  69. dma_addr_t dmaphyssrc2 = 0;
    1 B! d& R5 G; Y0 C: d8 T
  70. dma_addr_t dmaphysdest1 = 0;
    3 ^  h9 P8 {7 y4 A1 ~. Y* T
  71. dma_addr_t dmaphysdest2 = 0;* P+ i' ~3 j" |, ~& |) O8 A) X

  72. * H# m% h6 O: X0 k  _1 t5 G
  73. char *dmabufsrc1 = NULL;
    + z5 t" N* c, N3 l4 h( `
  74. char *dmabufsrc2 = NULL;
    ; o3 g% ]% o$ t& |& b7 b
  75. char *dmabufdest1 = NULL;
    8 z6 Y# w3 m2 l% A2 v
  76. char *dmabufdest2 = NULL;! K$ h7 p# Q# P. q( w* `  d

  77. 4 U, F* [  Z. w. C+ A1 J
  78. static int acnt = 512;
    $ P2 n  \' Z6 g& V
  79. static int bcnt = 8;
    1 Q0 N% m" s- I1 F- \% o
  80. static int ccnt = 8;
      Z8 r& C# O7 |. K- F8 u
  81.   z! N* g. y5 K# B( a2 m% ~
  82. module_param(acnt, int, S_IRUGO);: p* q. J+ D6 n6 A
  83. module_param(bcnt, int, S_IRUGO);
    * ?( j3 M9 ^* J2 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ O. s' g1 K7 i( U
4 p) }2 @6 T& b/ V& I3 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 p. q  g  `4 |  H$ H" _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) `9 ?4 T& U% c" B8 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* f% U1 Q; L7 w

! ^& Y! ~5 y0 C. w- v$ {, \
* i% t2 t( A* J; k( q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 20:28 , Processed in 0.038281 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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