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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 O2 A; D* Q2 z' ^  B
  1. [code]EDMA sample test application7 _% P. ]- i! }. O5 \5 F6 m9 u
  2. /*7 V0 F/ {" @# A& h7 a
  3. * edma_test.c/ I0 C' b5 R3 C' ]
  4. *
    : `; b7 p9 b% I8 i0 p
  5. * brief  EDMA3 Test Application* Y$ X! ?2 M( e! ^/ P5 k* C5 W
  6. *
    . C- o0 ~/ b8 \; E9 `
  7. *   This file contains EDMA3 Test code.: Q) `; d& h$ Z# G5 }+ Q# D) z
  8. *
    ' r- O9 N7 P6 b( }& p  \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, s( r5 p8 C$ {" n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; F7 j: g3 \8 T2 n
  11. *         TO CHANGE.
    ( ]% Z# Q1 T0 D  [$ P4 M
  12. *6 ?3 k4 y- V8 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 \, V# H) J2 v( @" U
  14. *: g$ o: M9 [* _# ~' k  n" W" X
  15. * This program is free software; you can redistribute it and/or
    ' u5 K2 J8 K5 z0 J- X1 A3 s
  16. * modify it under the terms of the GNU General Public License as
    % ]1 o$ x( c* D5 e6 g2 O% o
  17. * published by the Free Software Foundation version 2.
    8 E/ ~3 @  C7 h, \  E* s" x
  18. *
    9 j8 \0 }+ y% n8 D& x0 _; j% ~- Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ p7 g) L, T" T1 [/ R7 v5 e
  20. * kind, whether express or implied; without even the implied warranty+ g  M& B( X. O6 v: D% g# I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- o: O% V6 Y8 N, @* V, }
  22. * GNU General Public License for more details.4 i8 G! e% @3 l( d$ V: @' j3 k
  23. */
    2 C$ Q$ x3 y" K9 W2 l: {

  24. ( x& J6 I$ J; E% G7 s+ {: j  ?
  25. #include <linux/module.h>
    0 J: K% I0 P3 o
  26. #include <linux/init.h>
    0 ?; w. Z3 t( `6 j9 y
  27. #include <linux/errno.h>; U' K! T6 v! J% C" b; q
  28. #include <linux/types.h>
    ( t' ]8 f$ ?1 Q  ?9 }, X3 m, d+ w- ?
  29. #include <linux/interrupt.h>$ b9 S* B: L7 N( I
  30. #include <asm/io.h>; D( P0 y. z: Q8 o4 Y8 k
  31. #include <linux/moduleparam.h>) f- ^& l8 k9 _/ j/ e/ H# B9 h+ S5 H  c
  32. #include <linux/sysctl.h>
    1 n# r' ^" M& J
  33. #include <linux/mm.h>0 Z. v" c, I; ?) D
  34. #include <linux/dma-mapping.h>+ [2 J$ ]6 F# e- D* J
  35. . E" ]7 t7 U1 Q+ H8 q6 C4 [
  36. #include <mach/memory.h>
    ! X& l! J! q" u" A0 O
  37. #include <mach/hardware.h>" n7 ~9 W! a8 O1 W8 T0 A, l
  38. #include <mach/irqs.h>2 ?: g# Q$ G# [5 g6 ~6 _# O
  39. #include <asm/hardware/edma.h>: f" S# p; Z) a* v0 p& S; D
  40. ! P: s; A) U$ @2 Q" }" M5 ~4 }
  41. #undef EDMA3_DEBUG( j! r% T3 b9 k: w4 {/ @/ u
  42. /*#define EDMA3_DEBUG*/. L+ D7 o  y: x* [" u( D" e5 Z
  43. 9 D' l" q6 L# n& H8 V
  44. #ifdef EDMA3_DEBUG0 r8 L# D- n% C  R& J, ?% J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 U+ t( j8 c8 n0 O: s# p( a% ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): N* H: l8 I3 {" g: W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 A( K5 n  D* U7 Y" h5 O
  48. #else0 B* b$ M: Q& S$ D
  49. #define DMA_PRINTK( x... )
    $ a; ~" C* n) i5 s3 {3 d
  50. #define DMA_FN_IN# l( J! Q) z) `# }( s( B
  51. #define DMA_FN_OUT
    3 _  v- I/ U9 }' o
  52. #endif4 h( ]3 c& M$ @, B' \( ^* x/ F
  53. - g5 y: b# ?4 ]5 M0 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): A% {% M, K, k, W+ K2 E& u
  55. #define STATIC_SHIFT                3
    : }  X9 g1 Y+ \3 I+ z7 ~
  56. #define TCINTEN_SHIFT               20
    : x2 T0 _% ]; M- X
  57. #define ITCINTEN_SHIFT              212 G6 e4 j1 {5 X4 u3 p
  58. #define TCCHEN_SHIFT                224 |* i+ U' Q9 B2 S
  59. #define ITCCHEN_SHIFT               23
    ' d( Z6 Q6 A! w* Q
  60. % h4 c& o% p- T0 W
  61. static volatile int irqraised1 = 0;
    - h0 w3 G9 d, `
  62. static volatile int irqraised2 = 0;. }" H! l0 n. f# T& u0 m1 b- M1 c

  63. % z( J$ ?0 R! t4 b) L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & U7 P7 I5 K8 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% D+ K; H- G$ z# Q9 f# Y0 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - E  Q/ @9 N$ A* @- m% `# d2 P4 v

  67. 9 Z. F2 t' m' [8 d
  68. dma_addr_t dmaphyssrc1 = 0;
    4 Z" f8 o2 A! _* R
  69. dma_addr_t dmaphyssrc2 = 0;$ W: O" g! h& r: Q- U
  70. dma_addr_t dmaphysdest1 = 0;. p/ D* p/ A7 o2 P9 `6 _
  71. dma_addr_t dmaphysdest2 = 0;
    - g$ T& b/ R! m
  72. 5 R' j* N, a% o4 M" E! N* i
  73. char *dmabufsrc1 = NULL;3 k7 E. I1 {# K8 R, G& v; Y* b! d
  74. char *dmabufsrc2 = NULL;( N8 g/ n3 S$ I6 f4 R
  75. char *dmabufdest1 = NULL;
    5 Z4 ]  K& x1 k5 H" z, s
  76. char *dmabufdest2 = NULL;
    " Z. H% S6 \8 g* _5 S+ h- b' H- j
  77. 1 {1 |' F2 A) \9 v' ~. G
  78. static int acnt = 512;
    ; E4 o3 G4 @2 J# n$ c; W8 }" C" x
  79. static int bcnt = 8;
    % A; G/ l& B! v% k
  80. static int ccnt = 8;* U$ Y+ o8 r# p% r* r" A
  81. , E! {$ O% k  u" r! S
  82. module_param(acnt, int, S_IRUGO);
      F: q# S& q, x" ?7 j; k
  83. module_param(bcnt, int, S_IRUGO);
    ' \  Q( N- R- u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: K. O" l6 O4 n( g* f

4 U/ O% |3 K. o* H$ b3 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* X: \& _6 i& t" \3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, ?* I9 i7 T% e  X. M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- h4 }  _- G6 {7 ~; C! \
* G* U- H, y' ?+ ]# b: J
$ l+ O/ O! ^8 o3 M1 k, B+ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 20:26 , Processed in 0.040197 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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