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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 F3 E6 Q& Z, ~2 `' }% x. Q
  1. [code]EDMA sample test application
    & K4 c6 x- l: F* \6 @; L+ M' I" I# }
  2. /*7 |' ~9 [2 q0 a! o3 \
  3. * edma_test.c. D5 {  p$ m3 D9 _' f
  4. *$ F0 r9 ]/ g8 m+ _* Y& ?6 L
  5. * brief  EDMA3 Test Application' p7 G# T  F, x" L4 `6 ?
  6. *
    * V& b; O+ U, g2 p7 y0 i7 R
  7. *   This file contains EDMA3 Test code.7 r3 U2 u! G. ]2 r$ _
  8. *
    ) x+ l) ~0 V) u& z- P6 B' a  f% s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # ~5 ~6 e+ \2 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& f( p; M# T7 T. y3 z
  11. *         TO CHANGE.
    / B* t/ ^+ y) @" `2 O  F' O( C5 u
  12. *
    $ w) s( K6 e; v, S6 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( q& i# O7 Z9 R1 n
  14. *
    5 S% b& ]7 ~) N/ \! M1 a
  15. * This program is free software; you can redistribute it and/or- y6 e: |. d! `) j, C( H7 ^: `
  16. * modify it under the terms of the GNU General Public License as; ]* E2 b) h) L  M8 z+ Y7 o
  17. * published by the Free Software Foundation version 2.. k3 M$ j( j* f% W2 ^2 w& C
  18. *
    . L0 Z2 ?! e) y: H, \% r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 p& Q$ A( \6 e/ u& x! R
  20. * kind, whether express or implied; without even the implied warranty1 |( B" o: b+ W% S% A4 S3 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& `( O5 O4 J! `. X
  22. * GNU General Public License for more details.
    . G- C; u# f1 u, V
  23. */
    & d' f/ R& E7 M9 x. D* i

  24. . d3 u; ^; y7 s9 I  W
  25. #include <linux/module.h>  |3 n  x0 W; @- x8 I9 B
  26. #include <linux/init.h>/ u! G& y/ w" Y& A/ n) x
  27. #include <linux/errno.h>! j& E+ |9 N" v% \& U" R
  28. #include <linux/types.h>
    + {/ w! _/ t  E* q# Y) L
  29. #include <linux/interrupt.h>' P: ?% N) C( v, G9 Y7 o9 t
  30. #include <asm/io.h>" S( g1 _  ^, v- y9 Z6 @
  31. #include <linux/moduleparam.h>
    $ D! I1 J# h5 a: m7 U$ J7 B) m/ \( ?+ U
  32. #include <linux/sysctl.h>3 B* W8 @/ q2 N0 W
  33. #include <linux/mm.h>/ q! Z6 k5 o0 n' y) v
  34. #include <linux/dma-mapping.h>' a* |$ C6 O$ v$ |. P& Z, Q3 f' [4 j
  35. 3 n8 Z- x1 o3 n/ a
  36. #include <mach/memory.h>
    1 `7 j7 f: o3 o
  37. #include <mach/hardware.h>* |, T# V. i( d, b5 m
  38. #include <mach/irqs.h>
    1 M$ x6 j- N' H* l2 Q
  39. #include <asm/hardware/edma.h>  |8 w$ g, X; ^. T6 k7 I7 D
  40. 4 N) D1 }. }! s* S/ I6 \/ x! d, a
  41. #undef EDMA3_DEBUG+ t3 ^5 z9 k' M. s
  42. /*#define EDMA3_DEBUG*/
    * d7 L, q+ V' l. Q2 ]# _  V
  43. 6 Z% \' R; f; X/ H8 b0 ~6 W
  44. #ifdef EDMA3_DEBUG
    3 y% b& ~( u1 Z" i& ]* d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- e, i" o8 \1 R0 e6 U: T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* |6 D$ v1 }# M  B0 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - O( h7 }  F1 D6 V# ^! g
  48. #else! K9 K8 I/ S) t9 A/ ?8 `
  49. #define DMA_PRINTK( x... )- }9 s; Q; M1 V7 R& g: I
  50. #define DMA_FN_IN
    . N7 S0 F% a/ b2 S: P9 n7 S
  51. #define DMA_FN_OUT3 V/ `& u+ F1 Q& i6 X
  52. #endif
      S! U8 q. p( |& c0 P- Z2 f
  53. & Q$ @1 u+ Q7 x) J$ f2 x5 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 ?3 a( e0 o- G. S  W
  55. #define STATIC_SHIFT                3' d$ z; S6 f% D0 P. A
  56. #define TCINTEN_SHIFT               20
    8 c' [9 B( [5 d2 W7 [. f
  57. #define ITCINTEN_SHIFT              218 X8 y8 t6 |4 i. \
  58. #define TCCHEN_SHIFT                22
    * c) i8 r: Z/ q* \
  59. #define ITCCHEN_SHIFT               23
    8 ^5 {& N% p! A

  60. + Z$ i. s0 n3 t7 ^! [
  61. static volatile int irqraised1 = 0;2 Q6 E- j; l8 X1 \! ^# `) A: {
  62. static volatile int irqraised2 = 0;
    ! k- J2 l, F+ O6 ^

  63. 3 r% n3 l9 v. U4 L+ W( C4 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X0 V/ M" h& _0 X2 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  M2 D8 {  L. `( h* {. \! }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . {2 l9 d, `" G; `# O+ U

  67. - r" \& d1 x' o4 A6 ~: T* t
  68. dma_addr_t dmaphyssrc1 = 0;
    , E- X9 n: |2 o& P/ x" \# ^: _, m
  69. dma_addr_t dmaphyssrc2 = 0;
    0 \1 t! G- G7 \5 Z
  70. dma_addr_t dmaphysdest1 = 0;3 |9 v1 S" ~( H
  71. dma_addr_t dmaphysdest2 = 0;
    3 p0 D- D# X- c4 T0 e. z# K  H! V

  72. ' q+ g) e. r, l; j; o- s4 ]
  73. char *dmabufsrc1 = NULL;
    2 M2 ?3 y+ ~8 O( ]+ [( V
  74. char *dmabufsrc2 = NULL;2 J. K3 @3 o& Y2 W+ \. R0 u( `+ B
  75. char *dmabufdest1 = NULL;
    $ `$ @. E# N! y6 v# X6 s- H
  76. char *dmabufdest2 = NULL;; f; i" A, H& S4 h! T. T3 x

  77. 0 f# O) F7 Z4 S  ?, B2 E7 S9 \
  78. static int acnt = 512;
    7 I! f% z7 i- w# P
  79. static int bcnt = 8;
    2 y7 _  A- z( V0 J' W$ Q
  80. static int ccnt = 8;
    ) z- u# ]- L" x9 Q5 ^# s

  81. . w) D% R& b( Q8 V2 N
  82. module_param(acnt, int, S_IRUGO);/ W+ p/ e, x" L% i: i8 u8 @
  83. module_param(bcnt, int, S_IRUGO);1 K1 s! i2 T3 P2 c% ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 q9 |) Y( t3 q9 ~& y
0 t7 q' @# i" ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* J- R( ~4 z6 Z! Z: p$ r/ u0 l2 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; O" L: \+ q  f5 j" |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* }0 B, B! ]+ A0 C5 Q: ~% D0 J% \7 }% V  b6 F7 [+ g
4 O/ E: z9 n  H# M% v/ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-27 13:00 , Processed in 0.053942 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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