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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! d1 b9 v, f7 z1 G, U
  1. [code]EDMA sample test application% d- E9 f8 y3 o* D
  2. /*. {( O$ d% }+ w/ U9 Y& U2 Y5 N
  3. * edma_test.c7 ^0 V. y$ h, \
  4. *
    * r0 ?* W3 c0 L
  5. * brief  EDMA3 Test Application5 v' @' w$ d+ x8 `, e! T
  6. *! l! o- z/ f* ?  V
  7. *   This file contains EDMA3 Test code.$ S: R$ G; K! }0 r# _: \2 ?
  8. *5 f% r. v" j% x" s% y. f' z: E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( F& V4 P' T- y7 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 U- J# |6 e% z; u' s
  11. *         TO CHANGE.
    9 H, b4 Y( `1 @& m
  12. *
    9 S8 X" q2 U$ f3 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; y. i, x% T. f& Q5 U7 s' d
  14. *
    & L  f+ }9 D4 E0 w7 r
  15. * This program is free software; you can redistribute it and/or7 J: y) c; G* I0 O. H
  16. * modify it under the terms of the GNU General Public License as
    ( |! \1 o: ^1 k$ }% w. ~/ I5 n
  17. * published by the Free Software Foundation version 2.* u+ d+ v6 X& B- _; Y1 a% h
  18. ** C6 Z1 V# R5 ?* r/ |8 [7 Z& _8 O" m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - j2 z' Q8 k& H8 k) a: V, F1 c
  20. * kind, whether express or implied; without even the implied warranty7 ~- H, I) j0 d. d% O/ K1 p7 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 p6 {* r" p! i6 k
  22. * GNU General Public License for more details.5 R& [$ F1 d: I" F) b# p
  23. */; \7 _' u, n, s" P8 P  D

  24. - o# C5 a7 H/ G; _6 k3 c4 h3 R% s4 k% E
  25. #include <linux/module.h>) K0 x" c% }' r% q
  26. #include <linux/init.h>: y  w' @5 }- r* Q; M4 c
  27. #include <linux/errno.h>1 i2 b1 y! V. x6 a4 o: c
  28. #include <linux/types.h>
    3 K$ K1 d7 f" B
  29. #include <linux/interrupt.h>
    / b% Y' T# u+ g
  30. #include <asm/io.h>
    6 o1 t. ]$ x' f( W( C& n4 E
  31. #include <linux/moduleparam.h>
    8 d8 y( c7 t+ e" o% J: k
  32. #include <linux/sysctl.h>, D; c5 i& L% Y; h# s8 f* v- x
  33. #include <linux/mm.h>
    " j1 g/ N' T$ d* k! `7 R+ ?
  34. #include <linux/dma-mapping.h>1 F! M% R1 N! @2 Y' n7 r

  35. ; {% k$ f4 }' B
  36. #include <mach/memory.h>$ n) l2 p! B' x: H) r9 w
  37. #include <mach/hardware.h>$ d0 t7 p2 p; S7 q9 B# A' X( d
  38. #include <mach/irqs.h>
      i) K$ m' g) e7 H1 g9 t
  39. #include <asm/hardware/edma.h>2 l# X, E3 m+ S

  40. 3 s, s. K- ?; j" \( K" S& B* N
  41. #undef EDMA3_DEBUG" x3 A1 K( c7 g( N% Z. N- B
  42. /*#define EDMA3_DEBUG*/
    , f9 v  r3 c  z& t7 a3 s
  43. 0 L6 Y; Z( G% G$ d. c% j
  44. #ifdef EDMA3_DEBUG
    0 g5 J, [/ X" M/ Y/ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 K0 ~. o0 u8 n5 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 Y4 M  Y* Y8 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 J7 @+ o  v' S0 D; _' R) b# f
  48. #else
    : L2 N' f- `- @
  49. #define DMA_PRINTK( x... )# m! O5 ]" T7 ]2 |* |- f0 t1 r" g
  50. #define DMA_FN_IN
    ; P3 X& `& c  z8 V
  51. #define DMA_FN_OUT
    0 @4 g5 z2 C) a
  52. #endif1 I4 Q% p: d9 `: s2 _/ D! c
  53. ) E$ r# \2 {! `9 u( k$ q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 o+ d" L/ R# X9 S4 m% U' y
  55. #define STATIC_SHIFT                3, J6 n. M- t1 J+ C
  56. #define TCINTEN_SHIFT               20
    ; q2 Q# j$ s( K0 t4 h  N
  57. #define ITCINTEN_SHIFT              21
    " b4 y% z  n- f( A$ S- i& U/ r
  58. #define TCCHEN_SHIFT                22( _' L' S! H- \5 m
  59. #define ITCCHEN_SHIFT               23
    8 }; ]3 u1 k' K, O+ o/ C
  60. 4 r' X: F  c) k$ h/ T
  61. static volatile int irqraised1 = 0;# |3 _+ D! `( @# r1 C
  62. static volatile int irqraised2 = 0;
    0 g8 J! I4 |' l( R- c: g  O

  63. 6 W4 B  Q; t' x9 s5 {/ B: v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 {  L* w7 Z$ E. P0 ]- Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! o. ]6 x) m% S" o. W" U* Y- k4 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a0 A' W; o: ?; {8 B
  67. $ t6 E: R! j+ G
  68. dma_addr_t dmaphyssrc1 = 0;) q' O4 K. [; r9 [- x2 M/ @
  69. dma_addr_t dmaphyssrc2 = 0;5 N1 P0 `. h0 w" Z
  70. dma_addr_t dmaphysdest1 = 0;
    - H! }" {0 E2 U, ]
  71. dma_addr_t dmaphysdest2 = 0;
    1 |8 J! T4 Q  Q6 i- T

  72.   V( V4 o9 o# _! }
  73. char *dmabufsrc1 = NULL;
    ) w2 V3 n. M, g" F" ?
  74. char *dmabufsrc2 = NULL;/ u. f3 n! \8 Y* a& c; P1 {
  75. char *dmabufdest1 = NULL;
    * ], L1 V, z- M1 f  P
  76. char *dmabufdest2 = NULL;7 F, v- [; m3 n6 x, U" n/ V
  77. . _6 p+ g' @+ Z4 T3 I6 c
  78. static int acnt = 512;
    8 d! V  x. @, S2 q
  79. static int bcnt = 8;
    " z1 t  y: \1 y$ l! o0 L/ W
  80. static int ccnt = 8;$ m) d, e# {1 L  ~* D

  81. - c: r" I' H% P) x: ^, \% ?
  82. module_param(acnt, int, S_IRUGO);
    / y4 P) x' a# O3 S
  83. module_param(bcnt, int, S_IRUGO);
    $ S. L4 q% \" t# A, i" ?1 G" Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  G2 h8 D1 q# c
0 R3 U% O& _8 m; x3 ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ _6 w7 ]& @. J8 Z9 m. G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( S8 ]  S- d6 C9 q" e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. U1 G. h7 h& h0 c! _$ N* J9 [, r$ x
  ?& d, k2 \4 a: S
- l; f6 P4 s& L2 _) R3 t% h6 J: @3 [/ O  Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 13:59 , Processed in 0.048178 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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