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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& {4 N" T# s; D- E% {' G0 y
  1. [code]EDMA sample test application
    2 R; \* Q( }" S* I- q
  2. /*
    7 E) j! v: p( H, w
  3. * edma_test.c
    / l/ _4 h: D2 X9 [& q) ]6 H6 {
  4. *
    6 }; ?8 k4 \; S
  5. * brief  EDMA3 Test Application. h4 R; B3 k# z, C
  6. *9 j, d: {$ ]3 [0 [
  7. *   This file contains EDMA3 Test code.
    ( |5 \2 o. |/ m" d& x
  8. *5 ^# _7 f2 v4 X; Z  N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Q* f+ c; C: {5 k# F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 w! C1 h/ K- e0 _# F9 l" j
  11. *         TO CHANGE.
    ) G. R6 L& S3 b# Y
  12. *, U* a5 t4 u. i, ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- J8 H: U' M. z* d$ P7 \& T
  14. *$ ]+ g# x5 j& ?
  15. * This program is free software; you can redistribute it and/or$ {$ V5 p- l+ o1 [7 L" q* e
  16. * modify it under the terms of the GNU General Public License as% H' e# n: b0 q. N, E
  17. * published by the Free Software Foundation version 2.9 Q5 z; ~. q% K# g/ o
  18. *4 ^+ q' Z2 ^5 w* h, f1 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. _) C) t* d0 c( x, a) ]' @
  20. * kind, whether express or implied; without even the implied warranty
    0 |. Y3 l6 x+ V. f2 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . Y0 p) y, S' J& C
  22. * GNU General Public License for more details.
    # J" t! k! S+ x9 R
  23. */
    ; k& ?/ S& a  \; S+ V) o6 i
  24. $ _' O# v8 o5 i+ ~1 A6 n9 H( g
  25. #include <linux/module.h>( _2 P0 `+ V9 E2 Q" U
  26. #include <linux/init.h>5 t: \: |8 P& q5 S; n- G) R' d
  27. #include <linux/errno.h>
    7 P7 W" Q. Y4 S
  28. #include <linux/types.h># A5 w, }5 s2 c1 Z
  29. #include <linux/interrupt.h>* `5 o- X$ Y1 G% I, f& l
  30. #include <asm/io.h>& t  W& {7 p! ^  a
  31. #include <linux/moduleparam.h>1 E; v% J: p! {2 j- \7 l
  32. #include <linux/sysctl.h>% o7 x+ a& R$ W
  33. #include <linux/mm.h>
      ^7 @* ^2 u- G' O& j
  34. #include <linux/dma-mapping.h>
    ( C6 N' Y- z( u0 U( I4 `" n# y
  35. 5 K4 y, C1 A" w
  36. #include <mach/memory.h>  h1 G) j$ J- ~* X
  37. #include <mach/hardware.h>0 N4 l" G* ]1 D% ]. V
  38. #include <mach/irqs.h>
    : N5 S' @, v+ Q0 Z+ ~( g" o
  39. #include <asm/hardware/edma.h>1 V- D: W% n8 V# e( X9 m

  40. : G) E4 R+ v% F6 L+ A
  41. #undef EDMA3_DEBUG
    / b( ]4 H  t7 L( j; }+ G
  42. /*#define EDMA3_DEBUG*/
    $ W8 K$ z/ p: Y$ \8 _0 f

  43. ) Y% s- V6 V% K8 p. T
  44. #ifdef EDMA3_DEBUG
    7 K/ n: Y0 E' ?1 q( ?/ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- B4 O) `" {& ]5 r- C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % M0 M' m  \! c( s+ n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ~0 a" B5 f) R9 i8 P  T
  48. #else# k; [) I! M* m; g" I/ D
  49. #define DMA_PRINTK( x... )
    4 |6 a1 \4 U7 F% d& v
  50. #define DMA_FN_IN7 X! u! k4 d1 Y
  51. #define DMA_FN_OUT/ k: @) w8 M+ p+ D( y) L
  52. #endif9 W+ _0 B" y1 J  U+ f# m' ?2 w
  53. ' f( l5 }! @& l8 B4 v6 B+ n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# l+ O7 E& B, i8 v0 H' x
  55. #define STATIC_SHIFT                3
    * }. Z7 m9 E- v8 o# H
  56. #define TCINTEN_SHIFT               20) H$ J$ b# C' T4 j" u9 T
  57. #define ITCINTEN_SHIFT              21
    # G* m: m9 i7 N9 [( d
  58. #define TCCHEN_SHIFT                224 v1 N  f. l! _0 a8 V% a1 j9 p
  59. #define ITCCHEN_SHIFT               23* ]. M: D6 |! f5 O4 f* I  f
  60. 1 I1 f; W; V  |  L
  61. static volatile int irqraised1 = 0;
    % l! R0 N1 G& @" j3 R
  62. static volatile int irqraised2 = 0;) }" x  C4 z5 W8 a
  63. # q/ x$ F8 _# d; C2 X' N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & p( X& [5 _  h! Y. H* k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      O  l" `- }/ T$ |& u8 _+ F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ M5 j9 J9 z/ o( g4 Z. g
  67. + k5 S% U9 [( Q: Y' a4 O
  68. dma_addr_t dmaphyssrc1 = 0;% q# b' y0 ]  @5 H4 c
  69. dma_addr_t dmaphyssrc2 = 0;+ V- I& D: b6 G
  70. dma_addr_t dmaphysdest1 = 0;" j$ X. I- L' m5 \
  71. dma_addr_t dmaphysdest2 = 0;; \. `" |# s' h, u; E$ J( T
  72. ) a0 b4 n& i6 B/ u
  73. char *dmabufsrc1 = NULL;
    2 Z6 f. \3 f- ~' m+ ^
  74. char *dmabufsrc2 = NULL;1 ^9 ]6 S/ f; ~- S
  75. char *dmabufdest1 = NULL;/ t" N7 I" C& d' U' ?
  76. char *dmabufdest2 = NULL;
    9 ^- T# a3 `/ T, d% K

  77. 4 G) P6 K1 T5 b5 l
  78. static int acnt = 512;5 m% I7 ^: a9 c
  79. static int bcnt = 8;: s) d$ S. M6 a5 l" M
  80. static int ccnt = 8;
    % o9 k. ~" ^% d7 ~" Q9 @/ `

  81. , G1 U# K2 w' T
  82. module_param(acnt, int, S_IRUGO);
    ) [" [# G3 t1 F* w' |9 h* P
  83. module_param(bcnt, int, S_IRUGO);; k, \5 f' i& O. y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  v' ^( V+ [* }" F
8 s# U+ r' S4 U. }0 U" N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 E9 O# a2 w. _( P5 `# y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 B* R2 L* y+ f* i) ^/ @) f( e8 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# y+ N8 C! L7 ~; P& `. G. S0 {; `1 ~/ x$ F

/ @4 r5 g: P, Y$ a6 E) Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 12:06 , Processed in 0.040296 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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