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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 \' D3 e' U% C" W/ E
  1. [code]EDMA sample test application: f$ w. m; c0 v! D' Z, ^
  2. /*
    " K* u$ q$ s5 [4 ]
  3. * edma_test.c  ~& f8 v, J6 d' u- c
  4. *
    - L3 Z* f, L( i6 `
  5. * brief  EDMA3 Test Application. h' |4 v% p8 h* B4 L0 h
  6. *: |) n9 m2 ^9 K5 ?( H1 n9 k. R
  7. *   This file contains EDMA3 Test code.
    & o% P& G* P6 y& \! n2 Q: m
  8. *: @  z' A( g: j& S% S" e1 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 ]! U4 i: k4 ?- S7 ]. |" _+ c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) N" E7 y. r: l& H: i( H' q
  11. *         TO CHANGE.
    + H3 A& T: c$ n; [2 I0 ]0 j
  12. *1 `* s. G. n! t8 n3 h4 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; }4 H4 Y; d% U$ X
  14. *- |2 w+ b' Q# ^% m
  15. * This program is free software; you can redistribute it and/or+ O+ t# H% Z# ]
  16. * modify it under the terms of the GNU General Public License as0 B; @" V! L( g2 T2 n9 J# J7 d
  17. * published by the Free Software Foundation version 2.
    * W+ ?. I" {. {% ?1 [( Y
  18. *
    1 h8 |8 W# j3 I  U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ v& n5 W& q2 C8 Z" ~" y! h% D
  20. * kind, whether express or implied; without even the implied warranty
    ; ~2 \: q0 U% E& w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# s' W0 U3 K0 A$ d9 O  S* i
  22. * GNU General Public License for more details.! n3 |0 t+ }  f/ Z9 k2 ?. h  C5 U! r9 n
  23. */
    , \8 u: V; c1 {  L) S4 y
  24. ! e( x  a; J; i3 d) G9 E" O' m
  25. #include <linux/module.h>
    ' X& Y9 e. I7 z6 g, g9 m% s
  26. #include <linux/init.h>
    ; a5 P7 Y6 G' ?) K
  27. #include <linux/errno.h>
    $ j, f9 P$ N1 i9 E
  28. #include <linux/types.h>; P6 Z7 }. ~6 ~9 c" f
  29. #include <linux/interrupt.h>5 m9 }& ]% E+ z' `7 O/ A. V( J
  30. #include <asm/io.h>
    ' u, v! `% ?8 |% Z' d2 z. \
  31. #include <linux/moduleparam.h>
    - H* Z" }$ {0 i' n" P
  32. #include <linux/sysctl.h>8 }8 X, Q' U6 t( [
  33. #include <linux/mm.h>
    0 j8 e& g/ c3 @; E& B4 g
  34. #include <linux/dma-mapping.h>% v' ?$ ?/ H( ~* F  N; R7 Q
  35. 3 ?* G! q0 E7 G
  36. #include <mach/memory.h>
    " J* q" i( H) R: @7 H" M- v, E
  37. #include <mach/hardware.h>- u; C' B- |' j5 Z5 \
  38. #include <mach/irqs.h>' H0 S# r$ y) g
  39. #include <asm/hardware/edma.h>3 @3 U! q- @2 p8 w+ w  d" w

  40. 1 H; a: T7 Q7 @: C
  41. #undef EDMA3_DEBUG3 R  [) Z4 b+ H0 c, W1 I2 l/ j
  42. /*#define EDMA3_DEBUG*/
    ' |% F6 ^' {+ b8 P& L+ _& F8 }
  43. . c1 ^7 l* u; I2 p9 s* O5 H
  44. #ifdef EDMA3_DEBUG, m# d8 k6 m2 x7 M) T) ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) ^" l1 ?) O+ F1 \6 b$ t5 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - D/ O; \% O+ z2 P( h  b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- }3 X( K# _8 k
  48. #else
    5 h- x8 Q5 a2 O" j6 R
  49. #define DMA_PRINTK( x... )& T) o8 L* P" M& W) f
  50. #define DMA_FN_IN1 e' e1 H. I0 M' E  J* z* L
  51. #define DMA_FN_OUT$ Q# O9 O) x! t; T: q& p
  52. #endif
    9 {; j9 X( \" r' H7 ~0 N* a) m

  53. ) l% ]3 l! n: w6 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( v" o7 _6 }( H6 {
  55. #define STATIC_SHIFT                35 |# y. l0 J6 u8 o; ]' }4 y8 P
  56. #define TCINTEN_SHIFT               201 U5 W+ [) _( [5 s6 D
  57. #define ITCINTEN_SHIFT              21/ H) j% R# H+ Q8 t  B1 }
  58. #define TCCHEN_SHIFT                22
    * `) K% g2 }9 D  w
  59. #define ITCCHEN_SHIFT               231 U5 m/ k3 y! I0 [. ^3 `
  60. 3 j1 b, S) U" y4 @' t! D& q
  61. static volatile int irqraised1 = 0;* ^+ ?) [  o  j2 E! z
  62. static volatile int irqraised2 = 0;2 b1 |7 E8 ]) }* o( n
  63.   V1 H+ P" Y6 m* {+ S/ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 D) t# Z" e) d) O- `9 J; }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + `7 h$ f: l6 e. Y/ {4 ~$ D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ~7 r0 s! _/ o+ Q; L

  67. : P8 r# z) _; o3 X
  68. dma_addr_t dmaphyssrc1 = 0;5 R( r! b/ k7 n
  69. dma_addr_t dmaphyssrc2 = 0;
    ) u9 j  E3 \  a% `. [( z' i* C
  70. dma_addr_t dmaphysdest1 = 0;
    - P/ @* u# Y. u2 y5 G% S( S
  71. dma_addr_t dmaphysdest2 = 0;7 C/ @! l- y0 z4 x

  72. 8 o4 U  x: c$ o
  73. char *dmabufsrc1 = NULL;
    $ c4 v, H! a/ Y
  74. char *dmabufsrc2 = NULL;6 Q8 O7 l" \1 K* S2 a" f
  75. char *dmabufdest1 = NULL;) T- N( p$ K) R" g( X. f
  76. char *dmabufdest2 = NULL;8 c, `3 z9 j2 u) a% \" X0 I0 g

  77. 2 r( d1 n' A3 l) M
  78. static int acnt = 512;
    * j8 O% a8 R( y( i* Z& \
  79. static int bcnt = 8;
    9 h; X- [5 Z9 W* r$ ~
  80. static int ccnt = 8;
    , |  c& c  X9 O# e( k
  81. ! _0 _4 ~7 C" [1 I% a4 `
  82. module_param(acnt, int, S_IRUGO);
    1 X- v3 C7 D" T
  83. module_param(bcnt, int, S_IRUGO);8 Y' z0 P# l5 c" B& c8 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ g- d' l& ^3 X1 @# Y$ b; O
; Y2 `0 g0 L' o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 }+ E# A% y% j& karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) r" R/ h3 z% f+ s  U; A* L. Q0 L* A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 B, z# F) l* I* }1 I& g0 V4 y5 M8 I6 Q4 H& I( L: P
" d7 A8 H2 z/ O9 K( P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 17:09 , Processed in 0.036261 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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