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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 J* E2 ~3 _- U% {" J$ F" y2 T
  1. [code]EDMA sample test application" j* L% m9 U, h4 R! `
  2. /*1 Y$ K& t. z" @* f* v
  3. * edma_test.c
    3 I" e2 {' f6 [+ z
  4. *2 p5 n% G# L9 f: _" w# _5 J
  5. * brief  EDMA3 Test Application
    - U# e& ?! \: U0 ?+ E
  6. *; A' |/ A: y, J: n
  7. *   This file contains EDMA3 Test code.
    ; K- Q4 l1 _# c6 E  J
  8. *
    6 q  w4 e  r: c: q2 |0 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ n" O; V0 ~" P$ Z' c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  s9 n6 N$ j8 L9 g, }
  11. *         TO CHANGE.1 S6 U: q# h7 w1 d" m. x
  12. *
    : U, x+ |3 o1 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - R  w* j  D( R8 X3 b0 i
  14. *
    5 p9 r9 L/ F5 y+ l- c4 M! h
  15. * This program is free software; you can redistribute it and/or
    - F- E  J# s6 W, R; \
  16. * modify it under the terms of the GNU General Public License as- k3 h: Z7 ^7 V$ `9 ~& K# A
  17. * published by the Free Software Foundation version 2.
    / S. v& d" t3 [( d: `" G8 X8 v# ?
  18. *! X& ^4 G" j* q+ i) r4 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % a& @, [, ^9 j6 [# K3 O; T2 X' E
  20. * kind, whether express or implied; without even the implied warranty3 M, [; n, W2 p# W; @, V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( H! y. y, e6 b5 r) c- z
  22. * GNU General Public License for more details.
    5 K0 K- I* R& H/ z" W
  23. */6 L0 i  d- y/ c3 ^+ a4 J

  24. 3 A1 R  U% `* b% m8 x9 `4 F
  25. #include <linux/module.h>3 u) p, F" \+ \6 E7 E! W
  26. #include <linux/init.h>
    ' P5 v2 J; C  K! m5 N/ ]( W  ?
  27. #include <linux/errno.h># E0 H& ~9 x2 \
  28. #include <linux/types.h>
    9 ?! y; S' @8 m, ^% T
  29. #include <linux/interrupt.h>& t. d2 h, ~# ~6 k' ]7 g2 Z
  30. #include <asm/io.h>8 ~# m$ C$ h( F* I) M  v8 O
  31. #include <linux/moduleparam.h>! D% u8 H% |5 @$ r
  32. #include <linux/sysctl.h>- {2 A* L" R- n3 L  @$ ]1 h2 C
  33. #include <linux/mm.h>% M0 T# T0 R$ s- I. @; w: f' ?
  34. #include <linux/dma-mapping.h>, Z0 y1 g* f; k7 e4 Z% A, L4 p

  35. * ]/ v/ V9 t+ x- Z: V' I' M
  36. #include <mach/memory.h>
    1 B! D  @0 Q( h5 N$ x: f( `0 i
  37. #include <mach/hardware.h>
    4 C7 o1 J9 n8 n/ g" p/ O
  38. #include <mach/irqs.h>4 O% J1 @) F2 O& I1 T
  39. #include <asm/hardware/edma.h>* g" ?7 h' F6 \, j

  40. ( U1 g5 N' B' D# u' t+ p! Q$ Q
  41. #undef EDMA3_DEBUG
    5 q/ \6 y1 ~, ^8 S' H) s7 U5 ~
  42. /*#define EDMA3_DEBUG*/
    $ X8 ^, V5 j& @

  43. ' v, q5 `) v% a6 U* w
  44. #ifdef EDMA3_DEBUG
    6 u1 b% l$ z/ [0 G7 k  \: J3 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( r" s6 [' o1 O8 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      X9 }, n. D' r* r0 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % V8 H% x' L& [1 A+ n2 B, x  X
  48. #else6 j$ I- e; |7 W: ~5 j. E
  49. #define DMA_PRINTK( x... )( ^. Y1 w- P1 o5 m0 Z9 {
  50. #define DMA_FN_IN
    7 H7 `0 \) Q4 X6 `* r9 @
  51. #define DMA_FN_OUT' b$ I6 }  n& t. g0 D
  52. #endif. H5 N2 O4 p  h  ?+ F
  53. 4 B6 l$ ~- S  D% f4 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 t- J; o9 d1 }' Z
  55. #define STATIC_SHIFT                3
    ! ]2 q& N: N% Y3 z" o
  56. #define TCINTEN_SHIFT               20
    ! c+ _6 A3 r2 X! Z" J) f7 H1 g
  57. #define ITCINTEN_SHIFT              21. S2 L0 i2 k' L# w
  58. #define TCCHEN_SHIFT                22' k/ \1 c2 ]! ?% K( K% j
  59. #define ITCCHEN_SHIFT               23
    - U1 ~% F1 \% y) B! u. Q

  60. # n' ]! b8 G8 U7 l/ w% h4 j! S1 _" E3 c
  61. static volatile int irqraised1 = 0;5 z8 m2 Z. R( M$ w+ ]' E! U) T
  62. static volatile int irqraised2 = 0;; ?. M5 _: r, U/ I8 f7 p  Y. x
  63. 2 j5 Q. k  p5 F! [! o) {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }/ M( {5 `* i0 B  M1 D3 c3 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: i! a) O' j5 D1 h, R* M' i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L1 [0 y8 [; H9 z1 t
  67. # k# _/ t7 i4 h; u1 I
  68. dma_addr_t dmaphyssrc1 = 0;+ m2 H# X) F9 S1 M. W+ V
  69. dma_addr_t dmaphyssrc2 = 0;$ f; Q8 N3 g9 q% _) T% w
  70. dma_addr_t dmaphysdest1 = 0;9 {9 L6 ^& u8 c; d
  71. dma_addr_t dmaphysdest2 = 0;
    . L1 a5 Y/ K3 }# f! e( u

  72. : P6 u& l. K2 ?0 h
  73. char *dmabufsrc1 = NULL;
    ' s, `: ^* ?  @+ J' S# j- z
  74. char *dmabufsrc2 = NULL;1 ]+ |' A2 k% E4 x  }) `
  75. char *dmabufdest1 = NULL;: [3 f! I! A2 Z/ ?. p
  76. char *dmabufdest2 = NULL;% ?/ G- h) p% k
  77. / C5 B+ \: s5 [; f
  78. static int acnt = 512;6 U( p% j  h# r% o* T
  79. static int bcnt = 8;5 R$ c2 f2 w0 w5 ^9 T- x' e! p
  80. static int ccnt = 8;! Y) l, c  {8 ?. ^; k
  81. # q1 o. \, L9 d/ I5 F
  82. module_param(acnt, int, S_IRUGO);( l9 G8 A5 c/ g; i3 H6 B5 X
  83. module_param(bcnt, int, S_IRUGO);2 L8 ^. z# l. ?# I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Y- Y1 S# ^8 P3 f" @, y- j$ G3 D9 {4 g8 d2 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 b4 f/ ?; A% S' q" I( F1 _) \% aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ V4 I7 r7 G$ T4 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- t0 B0 l4 ^/ j% |' X. H2 G! V8 U3 d) a

3 G3 M' l3 h& m( d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 13:42 , Processed in 0.040282 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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