OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& t. k) v1 |' s, q" t
  1. [code]EDMA sample test application
    4 R: u3 P  e. M7 p& z
  2. /*+ f5 @/ G1 g; o1 m" b! g
  3. * edma_test.c
    $ \' c/ o) ~8 x- O0 G- }9 Q: `
  4. *; ~0 v: m9 _" E* s6 \
  5. * brief  EDMA3 Test Application
    ) L- d7 d! K9 C$ V
  6. *8 g2 e! `& S/ H% a6 Q: ]
  7. *   This file contains EDMA3 Test code.
    : N! w" j" E9 X) G' ~' a
  8. *
    0 R: T4 T6 C8 M9 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 E; b  b7 n- O4 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! e9 o6 \. C# Q
  11. *         TO CHANGE.
    , v1 N* e' p( Z* O" C  H! t; s. [
  12. ** c2 B/ \, ^1 y/ A( u8 `. S4 g6 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' W( H; l% E  x) G+ i) u
  14. *) k6 _$ [1 c( E" P: H
  15. * This program is free software; you can redistribute it and/or1 m# e/ i9 s; L& C
  16. * modify it under the terms of the GNU General Public License as
    9 a. A, }( C' M# J/ P, F1 {: T" k0 \
  17. * published by the Free Software Foundation version 2.
    1 v( ?1 H8 L0 v& v  B+ K% r* M
  18. *8 ~3 G; E# s; p' s* r) I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) \9 M9 Y' k$ f# S' f) u: F
  20. * kind, whether express or implied; without even the implied warranty
    2 w. o8 J% z! m; |* e) p5 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 `' S% k- G) |# \+ {0 a% z6 l7 X
  22. * GNU General Public License for more details.
    + Q8 |/ u: p* D1 x7 ~6 s
  23. */
    2 D5 i4 T1 X% _/ N
  24. ( P" h4 E; j, L- l1 a4 m5 ~5 z
  25. #include <linux/module.h>' ~* d; o* w( R. u
  26. #include <linux/init.h>$ Y" I' p4 j2 }! I( V1 o6 z
  27. #include <linux/errno.h>
      B# q5 [2 J0 {+ G- o8 Q
  28. #include <linux/types.h>
    ( A* @% E) U! B1 J
  29. #include <linux/interrupt.h>
    ( ?: s( I2 m& X4 _3 S( U9 T
  30. #include <asm/io.h>
    6 f2 m6 U- ]8 c& d  x# \0 i5 t
  31. #include <linux/moduleparam.h>
    5 v7 b+ v$ V! K! g2 _, O6 r) R' H
  32. #include <linux/sysctl.h>& z6 z: u& F' W; i& N) c
  33. #include <linux/mm.h>4 H+ B( i0 @& s
  34. #include <linux/dma-mapping.h>. t$ g: ~, @! I: w+ q/ z
  35. 6 l% i4 U/ W3 q: t- T
  36. #include <mach/memory.h>
    $ d  \. O) l1 v; z9 G: Q6 O- Z
  37. #include <mach/hardware.h>
    3 E) S3 j9 M6 U
  38. #include <mach/irqs.h>
    ; [& B2 ^1 H7 o: s/ E# f
  39. #include <asm/hardware/edma.h># n) b& s& ?3 S0 `/ P, m+ k
  40. 0 \* h* V0 V) v6 e6 G; T
  41. #undef EDMA3_DEBUG9 f# ~4 H' N: \% P
  42. /*#define EDMA3_DEBUG*/3 q# I+ {$ b0 ^7 S) q3 E' I

  43. 1 @+ U5 u+ y$ L7 q
  44. #ifdef EDMA3_DEBUG* r* ~) G4 ?4 g! V; ]! }: I0 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 I/ _% }% a& v* f6 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + P' y! R4 C3 B: F4 K2 x) K5 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x3 w. Y! e2 G* A/ e" Y4 {
  48. #else
    ; k8 i) o) L/ ~' b
  49. #define DMA_PRINTK( x... )
    2 ^* M- N6 [) }6 u0 z1 ?0 M
  50. #define DMA_FN_IN! ~8 `7 t" C: a2 s0 h
  51. #define DMA_FN_OUT9 D  D+ P" F1 I  T8 S# D$ _
  52. #endif* l. v" @* v7 q8 L- g  E

  53. ) p2 n6 J3 F! I) X; z  h: U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' t$ v0 E% m0 G% t  j
  55. #define STATIC_SHIFT                3- D2 @$ P6 i$ w. i8 Z) _
  56. #define TCINTEN_SHIFT               202 g3 T9 V3 L, T  b0 {+ {
  57. #define ITCINTEN_SHIFT              21
    & s9 B, D  X! F8 h4 O% Y
  58. #define TCCHEN_SHIFT                22
    * ^# Z* F$ u8 U  i- Q
  59. #define ITCCHEN_SHIFT               23
    9 O* V9 g6 d. m; U* o

  60. $ d7 U. D7 C/ b+ W7 i* C
  61. static volatile int irqraised1 = 0;
    3 I* ~; e$ ~$ r; c
  62. static volatile int irqraised2 = 0;
    8 K0 d# l4 x+ S( U
  63. 0 w% X5 k, f( s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V# [% ~9 V4 E/ H2 w- o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, }! d4 N' ?  R2 Z% U4 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" p1 M/ z4 y2 k# z# m2 X
  67. & \$ y& m+ Y: {6 |3 T; c
  68. dma_addr_t dmaphyssrc1 = 0;
    5 ^- j  t5 H! X3 h* }  F
  69. dma_addr_t dmaphyssrc2 = 0;
    5 t: c( e0 ]- [9 i4 M$ d
  70. dma_addr_t dmaphysdest1 = 0;( x6 [2 H; q/ z5 @1 L) q
  71. dma_addr_t dmaphysdest2 = 0;
    7 B5 }$ z( w& o9 D7 b7 z9 X

  72. ' {8 b. J* y" E4 z- M3 y
  73. char *dmabufsrc1 = NULL;
    * z" T& D; M' ]7 `2 A
  74. char *dmabufsrc2 = NULL;
    + p% [3 z8 P3 I+ b& ]
  75. char *dmabufdest1 = NULL;
    $ q! i( t3 v& m; N  A3 g- r5 K
  76. char *dmabufdest2 = NULL;; A7 O! ?* Q; ~5 s' C

  77. ; F5 Y* S$ N5 J- |+ s
  78. static int acnt = 512;
    3 a0 {6 W2 b! W3 B) X& P/ C
  79. static int bcnt = 8;5 S2 K1 j) i0 i& C
  80. static int ccnt = 8;
    ! J8 R# }  f. t1 Q% T. o# X

  81. 3 C/ e0 F; t/ O9 ?. y6 @' ?9 V5 {, B
  82. module_param(acnt, int, S_IRUGO);
    / C4 }' ^; G0 D. h8 K% l
  83. module_param(bcnt, int, S_IRUGO);: }9 r$ d! I! ^' t5 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, e$ B. `3 C8 u" i% r4 X

8 n% Y7 P! ~/ p4 {. k5 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" q# A4 _! Q* I0 @, V, @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V: t+ m1 m1 q* L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ r5 e  T- ?# b2 C2 P/ ]7 e2 k. b- j4 k/ a1 e; ]
. h8 L/ u% w$ w" N; H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 02:13 , Processed in 0.069828 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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