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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 N; R8 U" b4 S4 y; G* g# Z1 x
  1. [code]EDMA sample test application
    ( L, R& T+ B. c; Z4 b
  2. /*( }, I. f0 K6 @8 y9 m
  3. * edma_test.c( J% ]7 I  F" {* X. b
  4. *. A. y+ d+ }+ ~& c( }9 b  {
  5. * brief  EDMA3 Test Application
    ' x+ O( h& O  J" o% S
  6. *# C- p/ X% r- u1 K
  7. *   This file contains EDMA3 Test code.
    ; ]% Y) V  P8 p
  8. *4 R0 b1 u0 t9 ]# y' d+ \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, x' W: Z$ \: A1 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ l0 a* Q+ I$ p6 N' R  H
  11. *         TO CHANGE.  Z8 \4 @+ N2 Q+ P* `
  12. *
    ( ?; v2 f  N9 d+ E& {2 ?3 h  ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  M* R0 _) J" Z: c* o
  14. */ \5 M7 ?# l0 J4 ^* d' L; P
  15. * This program is free software; you can redistribute it and/or
    . y3 n& x. ~6 p0 m: X5 \" `+ ^( |
  16. * modify it under the terms of the GNU General Public License as
    7 m2 N% \4 H' p1 J
  17. * published by the Free Software Foundation version 2.4 ?  U% H% o! S7 s8 L6 g
  18. *
    $ ^! g* v# }* h: S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 j2 s' F, |" e! c7 o
  20. * kind, whether express or implied; without even the implied warranty
    ( `0 W: d  x8 N. M$ J6 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " D7 A1 L/ d, C% w
  22. * GNU General Public License for more details.
    ! W$ D( A" J2 v& l1 E1 k6 F; v
  23. */( t, ]) h4 ~, v" P* p' _

  24. 4 j' o* i5 |6 p7 X. g
  25. #include <linux/module.h>6 M! t, N9 @2 [
  26. #include <linux/init.h>
    3 d, K; }1 [5 c0 E* m/ W
  27. #include <linux/errno.h>
    ( x! x: K/ G4 q
  28. #include <linux/types.h># G+ @1 U7 ]$ i; @  K
  29. #include <linux/interrupt.h>
    9 X3 m, u$ l) m8 s7 T$ o8 D6 C: u
  30. #include <asm/io.h>
    ! s% I8 w& @& \. O; T
  31. #include <linux/moduleparam.h>3 y$ j0 U& {# [5 i- D  K7 L
  32. #include <linux/sysctl.h>$ U5 B4 D( q* g: I
  33. #include <linux/mm.h>5 J- i7 C1 D& ^6 X- X5 T
  34. #include <linux/dma-mapping.h>
    9 M. _; e; s6 \0 O) p

  35. " B# J, P# w* e! d" i
  36. #include <mach/memory.h>
    5 z- P5 Q. K9 u2 r1 I
  37. #include <mach/hardware.h>
    3 w! f9 @  n* y: c8 X
  38. #include <mach/irqs.h>
    ) S0 T' r. R6 t: x) \' E
  39. #include <asm/hardware/edma.h>
    , M+ p  @) A# m+ |5 M

  40. 3 B  ^( u0 `7 \% x7 T
  41. #undef EDMA3_DEBUG
    - j: J( ^% A0 S& _  F
  42. /*#define EDMA3_DEBUG*/
    ) s; ^8 J% }& F: H! O4 |

  43. ' N, T9 q% K( d8 b( \3 G
  44. #ifdef EDMA3_DEBUG. j, j: [7 w: U( X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ m! y6 K4 s! q, J. N- V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( P2 W/ I9 X3 Y( T( V5 e" U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; M* e: e# l$ m9 S9 O
  48. #else
    , z. N& y7 z6 e, |4 n( u; L! S' A
  49. #define DMA_PRINTK( x... )
    & T' l. s5 I/ \. `
  50. #define DMA_FN_IN. z" [+ Y3 e3 ~+ x" }0 n
  51. #define DMA_FN_OUT; R5 \/ R) l" D7 f7 P/ J: O4 |
  52. #endif" Q: U! Y1 t8 {4 h9 l* b& ^3 G0 A
  53. 3 {- g: F6 @- b) R$ [; ^6 ~5 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 t9 e* c3 D. [5 j$ F1 \
  55. #define STATIC_SHIFT                37 U. R! z; }5 T, p( ]2 F/ K" X% ?
  56. #define TCINTEN_SHIFT               20
    2 B) Z+ w, f. m% G1 K7 g: W  P1 w
  57. #define ITCINTEN_SHIFT              212 f' e1 _: P: [+ J- _: X
  58. #define TCCHEN_SHIFT                22
    3 b" y0 J9 x1 K( A# b
  59. #define ITCCHEN_SHIFT               23! M1 ~. h* X$ }/ s# x: A+ t
  60. 8 b* \. F  p( j7 T
  61. static volatile int irqraised1 = 0;
    1 {1 R0 w. `3 f7 |$ z
  62. static volatile int irqraised2 = 0;- i5 C% p: a; G2 a

  63. 7 q; I3 U/ K2 C' T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' v* k; g6 v' p- G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ?9 N% A5 K. K; F; h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n+ z8 r% r4 a

  67. 5 |+ J5 S  f! j3 m# m
  68. dma_addr_t dmaphyssrc1 = 0;
    1 f# ]3 @8 T6 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ; z+ C3 u7 q! ^' l; k5 I* t
  70. dma_addr_t dmaphysdest1 = 0;3 l& a5 E# Z. q/ K$ G; ?$ S; A
  71. dma_addr_t dmaphysdest2 = 0;' k: f+ n: \* r) I; [
  72. / _. L; i8 R$ F+ n4 H" N* `' K
  73. char *dmabufsrc1 = NULL;
    & X( L! {( N* L% q( _- s
  74. char *dmabufsrc2 = NULL;6 O( g# g3 \7 y, n
  75. char *dmabufdest1 = NULL;
    7 G4 ^" D6 ?" R/ K% I# n
  76. char *dmabufdest2 = NULL;4 L' e3 b& D1 A; f; h* I/ y. A1 `
  77. ' m/ n; ]$ p1 q8 B! y  h
  78. static int acnt = 512;
    , F1 l7 A7 \+ p
  79. static int bcnt = 8;
    + A* W7 G! ^4 C- F$ N2 u/ J
  80. static int ccnt = 8;: [6 L" k$ [1 ~

  81. $ C5 _, w3 B+ H2 Z9 l
  82. module_param(acnt, int, S_IRUGO);
    . O& U% Q4 Y3 f. R  E, L3 B
  83. module_param(bcnt, int, S_IRUGO);
    $ A+ ^; H& x: @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) I$ e5 e0 s. \  j
6 }8 G( P- p% }5 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: I' j( I0 l5 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Q; f! {- m- o, ?0 J! o" s- E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. e7 ?  n6 }4 M% `
+ A+ j; q" Q+ ]- t

, m: }7 \6 N3 |: U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 05:38 , Processed in 0.040687 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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