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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 _4 f; M$ {3 b  b
  1. [code]EDMA sample test application" O2 Z' U) j6 k- w2 V
  2. /*
    " |" \8 T+ m3 P$ P: c$ p# r4 S  f
  3. * edma_test.c$ z1 [: K4 ]- h' H: ?
  4. *" M. F$ X! Z0 q7 V' E; v
  5. * brief  EDMA3 Test Application
    6 D) G& t* }" _- e% f% y
  6. *
    2 ]8 m6 b3 n& z, c( R+ J7 S. @9 k
  7. *   This file contains EDMA3 Test code.
    2 A6 E; q. K' j, W! A
  8. *
    / S4 k6 O! t2 r' f+ X0 |+ _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & q4 D  y* X# m, V9 ?' L9 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Q/ x8 [& a: x" J; ~) j
  11. *         TO CHANGE.8 \/ ?! o' `2 H6 m) C. r$ v
  12. *
    5 a; B9 s' R- |1 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : u4 @$ R5 }: b# {- B
  14. *. r+ B' m9 r" }4 h0 F% \- J
  15. * This program is free software; you can redistribute it and/or
      S) U) ?$ \* \4 X4 \! z# R) M
  16. * modify it under the terms of the GNU General Public License as
    " U' r1 D4 s' V' C  T/ g) G
  17. * published by the Free Software Foundation version 2.
    : E; g' H4 u, _3 k& k. l) {
  18. *
    " K8 b% [( A- X, m& @' X$ g$ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 m9 W: R" L/ v" a' p4 h
  20. * kind, whether express or implied; without even the implied warranty( n  j7 k5 |1 _: Q# \+ ]: j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  W/ N' H+ n3 d$ O* B$ M! K
  22. * GNU General Public License for more details.+ p3 q$ M' k5 ~" h/ X
  23. */
    5 G# @) J+ F- y

  24. % k7 f" ^2 z9 f; Q$ i0 Z$ K8 [! F
  25. #include <linux/module.h>
    5 ^0 N1 l' [1 a. j0 _5 g
  26. #include <linux/init.h>6 F8 K: x! J: H! j" @5 F
  27. #include <linux/errno.h>
    * C  e( v% ^7 c9 m# H$ ^4 [
  28. #include <linux/types.h>* y3 y8 i  Z* I; c9 [- B4 Q
  29. #include <linux/interrupt.h>5 M6 @4 X! ]1 s5 O3 y( x
  30. #include <asm/io.h>  n2 }9 r% U) t* l; r
  31. #include <linux/moduleparam.h>
    0 e: a& I" f1 a/ G" }0 b
  32. #include <linux/sysctl.h>
    1 X2 m3 @* A/ l; G+ p& M
  33. #include <linux/mm.h>
    4 ?) x% A6 k  `. O4 S6 Q; I1 A
  34. #include <linux/dma-mapping.h>
    2 V4 v! f9 g4 I0 W/ x1 X6 ~
  35. + k$ @% v8 i4 i$ s: M! K
  36. #include <mach/memory.h>3 s4 n' f: p8 l
  37. #include <mach/hardware.h>
    - c% ^. N  ?# W
  38. #include <mach/irqs.h>
    " q' N0 Z! d3 D, T' u! Q
  39. #include <asm/hardware/edma.h>* p. R& U0 Y2 N  M, ^9 O1 J' V1 V) L1 ^
  40. 2 {! k7 B: F" S' N+ r7 [# h% K
  41. #undef EDMA3_DEBUG
    - Z) P0 b; J) l: U
  42. /*#define EDMA3_DEBUG*/
    ; i6 P+ Q5 g* h0 f  g
  43. & u& t( c0 ^/ j& r# x- \
  44. #ifdef EDMA3_DEBUG3 ?9 e+ P# e! b# E8 m$ }, ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % E& n3 A7 u/ q# R/ s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 D. o- f. o6 h/ z- v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : a0 A3 Y' [; j
  48. #else( b$ @/ D1 A/ O" Y" h
  49. #define DMA_PRINTK( x... )0 N/ n" ]6 K7 u+ t9 e2 {+ l
  50. #define DMA_FN_IN
    . x% h& F$ J5 N9 Z4 u# K9 Y/ `, F
  51. #define DMA_FN_OUT% e& \) [1 z3 p* S) s
  52. #endif8 i7 \6 j6 R- L+ y

  53. * {% j8 h3 {* `; u9 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 M" @6 F: x/ K* g. Z
  55. #define STATIC_SHIFT                3
    3 _3 L3 c% m7 a  S
  56. #define TCINTEN_SHIFT               20
    8 Q% M; L* j: {1 T" S
  57. #define ITCINTEN_SHIFT              21
    6 f. @/ G; l8 @
  58. #define TCCHEN_SHIFT                22
    . |8 a7 B1 r& B" N7 t/ F7 g9 a
  59. #define ITCCHEN_SHIFT               23
    8 p( y- x1 V8 |* U+ C! x
  60. 9 s  y- J2 K& j* h( k3 q; n& ~
  61. static volatile int irqraised1 = 0;
    - ]4 |4 E0 a- W- A/ T
  62. static volatile int irqraised2 = 0;
    9 C4 |, Q5 |/ I! _8 {6 P  s

  63. + |6 N1 c3 a2 d! C2 K3 M* d4 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: g7 T, x" ]( @3 _& v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . d0 I; h; ~7 k5 b$ m( \/ T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( k4 I$ Z( [* m+ z

  67. / I( v7 [9 F4 e% i4 U
  68. dma_addr_t dmaphyssrc1 = 0;
    ) ~5 |7 ^; f; ?
  69. dma_addr_t dmaphyssrc2 = 0;* ^4 K1 L) ]2 F' \9 n1 F
  70. dma_addr_t dmaphysdest1 = 0;: A$ m2 V# e; l9 C4 K+ C. F
  71. dma_addr_t dmaphysdest2 = 0;& M" V# ^0 T/ G; G2 W, j! N+ F

  72. 5 H% m5 d7 G% e( p1 _7 t. Q
  73. char *dmabufsrc1 = NULL;
    3 ]" Y6 P" e3 J  k7 I5 g7 o1 t9 k
  74. char *dmabufsrc2 = NULL;
    ! c" U& v5 s6 \/ f. w! Q% ~7 x7 n
  75. char *dmabufdest1 = NULL;4 v: T! J. f/ K$ f
  76. char *dmabufdest2 = NULL;
    / d: Z1 V1 ~4 m3 C: G8 E

  77. - J! b0 }* N' {) f0 p
  78. static int acnt = 512;
    & W) q( ^  b8 T( p
  79. static int bcnt = 8;
    . T+ k( t. A3 @& L3 `! L. W2 h
  80. static int ccnt = 8;
    / E) l& }& S1 H' s8 Y5 v/ s) G+ E

  81. / j0 d0 W1 S- ?; }
  82. module_param(acnt, int, S_IRUGO);# I( J' K0 q: z+ C! b
  83. module_param(bcnt, int, S_IRUGO);
    9 g/ k" _. O* c2 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" v" y! o& Y. u* c& [3 |

$ n5 ?7 V2 `  e7 t% s2 Z4 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' I+ _' `7 ]1 R0 @2 s
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 B% c1 H- w; {  @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 m) l; t# U6 V- I* Q
+ W# c; o' J2 q5 k2 U& K( `* K5 `6 I$ j  c4 {. V5 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 18:26 , Processed in 0.041341 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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