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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( B: e( G5 b; i1 N5 N0 f+ C& `; p
  1. [code]EDMA sample test application
    ; l4 f, S& H0 ?4 v) ~7 A& H
  2. /*
    # R9 G. \4 {% ]* T0 ?1 e! O# E
  3. * edma_test.c
    . H9 v+ W8 R. u1 _/ l% s
  4. *& L2 X- U/ D( H: A* @$ y! T3 ^" e
  5. * brief  EDMA3 Test Application
    $ Q# s$ b- \4 y& A
  6. *
    2 K$ a, f% W& o6 [
  7. *   This file contains EDMA3 Test code." K2 Y: d+ P3 O& _$ m2 H2 s# T
  8. *
    2 d/ L0 W( J. N! n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 f6 `- O  i  L3 a/ M, B1 y& D4 _; s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 {4 C! _0 V* _- b( i( l+ G$ E
  11. *         TO CHANGE.  |! W+ Y/ x* {/ p4 b0 |
  12. ** r# x9 N) l$ i- k+ P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- F3 @+ X8 a9 F$ `( }' M+ P8 V
  14. *6 R) q0 ]+ Z  T, [8 m
  15. * This program is free software; you can redistribute it and/or; W, R! T& P" m+ Y# c6 W* W2 L* H
  16. * modify it under the terms of the GNU General Public License as9 ~& ?2 Z  p  M
  17. * published by the Free Software Foundation version 2.
    1 ~% l. [% F( [" k$ G$ V. o
  18. *
    5 Z: a$ Q# S" J8 x0 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 f. a: h$ S" L, o: v
  20. * kind, whether express or implied; without even the implied warranty( g" A' |& E3 x5 T% B+ F* T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ B; D# w' |! c
  22. * GNU General Public License for more details.) G9 a( a3 u2 T: ^3 m$ P( q
  23. */3 _  |8 w% I& n* R/ y9 L* p2 y6 L
  24. * F# w9 i* p( R
  25. #include <linux/module.h>0 X0 j: C) e5 b8 e
  26. #include <linux/init.h>
      V+ ?0 j$ T2 Q  J' u0 A
  27. #include <linux/errno.h>6 X9 n7 R" d: i* f) T
  28. #include <linux/types.h>
    ' |7 P" ~; t4 P* y
  29. #include <linux/interrupt.h>( r/ g$ s" G& v0 p
  30. #include <asm/io.h>
    # V6 `% h7 ~0 E7 g* z
  31. #include <linux/moduleparam.h>
    8 _7 E# b, n* ~  F' K; R; [: n
  32. #include <linux/sysctl.h>! Z8 E2 J* J! I6 g/ I
  33. #include <linux/mm.h>
    * h) K: e- u( H2 o0 v" c
  34. #include <linux/dma-mapping.h>
    ) k8 E1 j( }! H0 z! a  z% V- `

  35. 8 _, w& S: r/ w5 d: j# E- Q" _/ `
  36. #include <mach/memory.h>
    7 q- y- v1 x1 @# A2 O
  37. #include <mach/hardware.h>
    ) T5 B; y3 D' R/ Y5 z
  38. #include <mach/irqs.h>
    + P, g. E4 d4 U8 w: D% q+ e
  39. #include <asm/hardware/edma.h>
    * D+ {% i% R) T# X& `7 s+ K' N

  40. . @( l1 i1 R/ |# s
  41. #undef EDMA3_DEBUG4 e8 ]9 q& L2 a2 w
  42. /*#define EDMA3_DEBUG*/( m( a% E$ b+ A! y
  43.   X' ~: f- v  U; j
  44. #ifdef EDMA3_DEBUG  V  a$ i. f& J' W" b( t* k+ {) d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ `/ E& Q. k1 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ e) ]  Z3 o& O/ T9 U" J( ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 _. K* t- G3 [1 o% Q4 h$ r6 x
  48. #else
    $ p$ i8 }& {" R, |/ q. y( f
  49. #define DMA_PRINTK( x... )1 P* |* G+ @3 i
  50. #define DMA_FN_IN; o2 D/ |' o: }- I6 g/ C4 g4 q
  51. #define DMA_FN_OUT
    # A4 [4 T( Q+ o1 z- t4 Z3 }$ s
  52. #endif
    $ i0 E: D- U  T& v/ p
  53. ' s/ [4 U- ^2 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% {; M: z: ?2 h  x) g; w
  55. #define STATIC_SHIFT                3, `, g; g0 Z( d
  56. #define TCINTEN_SHIFT               20
    + g; j" S5 T0 N: Z
  57. #define ITCINTEN_SHIFT              21
    ( i2 ]3 u# A% @+ G
  58. #define TCCHEN_SHIFT                224 t* n( H2 p. r- S
  59. #define ITCCHEN_SHIFT               23
    ( u3 T4 h2 C7 T
  60. 3 ?$ w  ?) U0 V7 h; b4 [) S
  61. static volatile int irqraised1 = 0;
    ! J  Z0 ]2 l" u, g  E
  62. static volatile int irqraised2 = 0;
    % X$ x5 C* m7 T" S
  63. ; q# Q; S( b! l& A' p& _. `1 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 k! V! @" y  o% Y4 S( Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 }# W( }- E7 n& D& {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. J7 w* k2 U; H1 X! ?

  67. + H9 u+ Y) a3 x. k8 Q  B
  68. dma_addr_t dmaphyssrc1 = 0;
    4 W* _% Q/ H3 @# ~# j" N6 I
  69. dma_addr_t dmaphyssrc2 = 0;" i/ p# d5 W. n* T
  70. dma_addr_t dmaphysdest1 = 0;
    6 U3 b0 S- E: N0 y, U
  71. dma_addr_t dmaphysdest2 = 0;
    ! q+ N# c7 J. k, O9 z& ]

  72. 7 ~+ Z$ s( w& _2 v. C
  73. char *dmabufsrc1 = NULL;# \' k7 ?5 C1 H, e  L4 W; p
  74. char *dmabufsrc2 = NULL;! f& a. H# ?) L# z+ ^# F9 M5 q; o3 }
  75. char *dmabufdest1 = NULL;
    : P$ ?1 x! u8 e$ T# }. m
  76. char *dmabufdest2 = NULL;
    ! Q# C+ ~- F- ]* l7 P
  77. # r1 P+ B% o" d$ b! j
  78. static int acnt = 512;$ r$ b4 a$ A% c6 |
  79. static int bcnt = 8;
    2 L; z  q/ b, @% @
  80. static int ccnt = 8;! |' o" B$ j, X* V/ ~% X

  81. " a; c4 P9 M6 ^: V: L4 A! }
  82. module_param(acnt, int, S_IRUGO);
    0 S  Q8 c* f  ~' B, T( X" W* N: \
  83. module_param(bcnt, int, S_IRUGO);
    2 Z' T, u: L/ A0 h" h  j: j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% ?* Z. |5 h" J
+ R* l, @. m$ W8 `* }3 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 S3 @/ A! A3 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  F+ ?+ p& r+ ~: R2 I8 ^9 O7 x; h. r& Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& [# N- a4 {  U; Y  I
  \% U8 R- t8 m! x. c( C$ v4 q8 _( ]8 b* r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 09:26 , Processed in 0.037477 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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