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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % m5 k3 c5 v  s- G; N) S0 U
  1. [code]EDMA sample test application( E4 Q( x4 |& r1 S
  2. /*
    + A: Q! a' C) G
  3. * edma_test.c
      G1 ?8 b: m' |( _) r
  4. *# A2 }9 B3 Q+ t1 \1 I0 A
  5. * brief  EDMA3 Test Application
    2 Z4 D6 W, q* |9 M, V
  6. *
    & R! K1 ]3 _* y
  7. *   This file contains EDMA3 Test code.
    7 y. p4 e6 V, Z' J+ m; M
  8. *
    8 v$ N' G6 q  U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; E8 c' l5 b; H5 }5 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * v- h9 u' Q! Q! G8 G2 M: P
  11. *         TO CHANGE.8 n, U0 f) ~6 u/ @
  12. *
    7 h9 r  v  |; f, {; s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ g. @! ^7 E! C, Z
  14. *
    / l) l+ m. n9 `: y* \& z
  15. * This program is free software; you can redistribute it and/or' t6 r$ Q  R, J5 ?% Z2 ~$ c
  16. * modify it under the terms of the GNU General Public License as6 p6 b, J2 |8 x
  17. * published by the Free Software Foundation version 2.
    2 O7 m! S8 c6 N- q- r8 V% X3 ]
  18. *
    + Y" O! M2 e" w, s* D' n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / z9 Z6 c( t$ ]/ y
  20. * kind, whether express or implied; without even the implied warranty$ P, a$ D' k$ b! d5 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: r. M; b: ?* f
  22. * GNU General Public License for more details.' I4 V! ^+ H# r9 j6 P8 s8 G( S3 a
  23. */1 E( w" r* \' }4 q) {4 R# N2 M
  24. # X4 }, [( O: f, o
  25. #include <linux/module.h>
    5 g3 S' {( D% `' G8 t: U$ L. a
  26. #include <linux/init.h>/ q/ F! G% B6 d% k3 E9 X& S, O/ g
  27. #include <linux/errno.h>; @& T6 ]5 V5 x
  28. #include <linux/types.h># l8 h. r: E+ C7 k1 Z
  29. #include <linux/interrupt.h>
    8 O1 v% s; b: s6 y* u) Z7 L$ c6 i  X
  30. #include <asm/io.h>0 ]- z$ z& X3 n
  31. #include <linux/moduleparam.h>
    , m. _% @0 ~0 y5 U; M
  32. #include <linux/sysctl.h># A9 s( v! S1 Y" {4 }0 X
  33. #include <linux/mm.h>1 S8 A$ P4 o$ j% H
  34. #include <linux/dma-mapping.h>* w% }* a1 w# E8 m& N9 J6 I
  35. 1 S, C1 ~" d4 E% m1 |, @9 i; G! `
  36. #include <mach/memory.h>
    3 Q; D8 k3 A( M+ t  T9 _
  37. #include <mach/hardware.h>, m1 {! x3 W; w. g+ j% m
  38. #include <mach/irqs.h>! m0 T+ x6 a( E9 `) ~
  39. #include <asm/hardware/edma.h>  [4 `; o3 Q9 U/ N$ s
  40. 9 @2 K/ O4 P+ k3 l  s/ n
  41. #undef EDMA3_DEBUG
    % w! x# m+ [8 ^8 ]3 }0 w) N9 O( z4 b
  42. /*#define EDMA3_DEBUG*/1 ^  N# u' u3 r7 b0 O) H' H. I
  43. 1 p! R' h/ v) J) W0 u8 r& y
  44. #ifdef EDMA3_DEBUG7 K% m' z3 _( H2 D+ E( @" s  b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( l! B) O- f" N+ ], v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Z* o: z( u! [5 G$ T) s! y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' L% k; b& l+ K) H, M8 _+ T5 N
  48. #else
    : |' Z2 `" T5 }
  49. #define DMA_PRINTK( x... )
    : U- W& r) d! Q
  50. #define DMA_FN_IN
    ' O2 V2 J4 U5 i2 k; Q
  51. #define DMA_FN_OUT
    $ [. ^2 q, t2 t5 P7 g% t
  52. #endif; [% G1 A6 M- A( w! u4 u

  53. 7 [5 s; Z0 _% u% I+ r- h- M7 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# E+ r# }" s: p5 J- t! f1 S) N% a' i
  55. #define STATIC_SHIFT                3
    9 p4 B2 x" T4 d2 T1 _
  56. #define TCINTEN_SHIFT               20
    $ W# J% v/ }7 l, X
  57. #define ITCINTEN_SHIFT              21
    / _: W* }/ b: i% @
  58. #define TCCHEN_SHIFT                22" a6 _$ Y  p6 _' h7 x4 ^
  59. #define ITCCHEN_SHIFT               23% V+ O  o5 }! f1 k; _" G$ E
  60. ) j0 Q2 O/ m( ?( [( M: g7 ~7 i
  61. static volatile int irqraised1 = 0;
      i# w4 W5 U7 S8 v+ a
  62. static volatile int irqraised2 = 0;
    & u2 E  I7 a) d4 R: ^1 S& q
  63. ( |- o! k- v: k7 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 E! D# G, {) Q7 n. S9 i; }- Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& e" J8 Z& P: z4 d, S' [3 {3 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ p4 P2 a  ]8 ?8 v$ C5 j# I
  67. ( X& _) E2 O: @- Z2 `+ D& X
  68. dma_addr_t dmaphyssrc1 = 0;
    ) `3 e# F1 \7 k, z& J7 P
  69. dma_addr_t dmaphyssrc2 = 0;
    + L9 E$ l. x$ g5 _) l
  70. dma_addr_t dmaphysdest1 = 0;
    . W' }1 A0 R+ f2 ~8 [! @5 X
  71. dma_addr_t dmaphysdest2 = 0;
    2 a$ \4 N* q# G" S( R
  72. - ?0 r4 q: e# C1 v% h5 ]" [
  73. char *dmabufsrc1 = NULL;
    2 y! h4 q9 i* P& k) B
  74. char *dmabufsrc2 = NULL;# I# X( J( `, C; G4 ]6 a2 P
  75. char *dmabufdest1 = NULL;
    % f  G; D, ?. S( T( @) h
  76. char *dmabufdest2 = NULL;! ^) W% j) z) U- \- ~7 o
  77. : G3 C0 R: c' Q9 l
  78. static int acnt = 512;
    5 ~4 P! R+ S) P7 n7 i  g; x
  79. static int bcnt = 8;! j8 x  ^5 R/ ~% k- Z
  80. static int ccnt = 8;
    5 A. q/ X9 R4 g! c: N8 Z
  81. ! k4 t6 O* k% `& ]2 s
  82. module_param(acnt, int, S_IRUGO);( I, G9 G0 ~$ O
  83. module_param(bcnt, int, S_IRUGO);4 x4 i4 z7 q, N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 @  o; e; x7 A( e, F* F
, |- I3 g6 n" ^* ?' J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ Z/ z: q0 X. \' K1 f' E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ M6 m. m: p- P  `& d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 v, M# Y# Q  Y  ?

' k+ F0 {4 w( w3 V% e& K* i5 S
: a  ?# y* h, Z7 P# D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 11:51 , Processed in 0.039794 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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