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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Z' t/ ~9 x. w! y# }( x( \! B
  1. [code]EDMA sample test application9 k# \( h0 ^" h8 b
  2. /*/ p& D( L  H; V* x
  3. * edma_test.c
    / ]6 l5 r4 W' y& q" [3 K
  4. *0 n1 Y& b# ], B# k
  5. * brief  EDMA3 Test Application
    ; ]( u3 U. |# E. ~! q
  6. *$ B$ ]4 y8 q) ]) d7 t" a* A
  7. *   This file contains EDMA3 Test code.
    3 S; Z& W6 D' [
  8. *  U; r( K' \7 [; m3 v: k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Y) s. N  ~; x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 s' s' h% q7 \$ D# F5 G4 L
  11. *         TO CHANGE.2 y0 \# g4 [3 U4 H  m
  12. *. h! t- b: v' k' }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 L  t" ?8 V- ]; M: p) d
  14. *
    - G8 O8 ]7 f+ q6 e4 R' p' y$ T' X
  15. * This program is free software; you can redistribute it and/or
    * s: v; j+ q6 w6 f0 T
  16. * modify it under the terms of the GNU General Public License as: k/ |4 l6 o2 Z! ~; L/ A/ w
  17. * published by the Free Software Foundation version 2.
    : J# c; E( h" e; b* j" m
  18. *8 l- i) X" P  O! p* t  E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- W' T2 J% F, X" G
  20. * kind, whether express or implied; without even the implied warranty
    , u6 L& z, p7 C' N6 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & t3 S0 g3 t  Y0 c0 s
  22. * GNU General Public License for more details.' I9 D% s/ f9 T, k3 q' W
  23. */! ~, d' G- I5 i, W+ F! ^& H

  24. ' c: j6 l8 G  A4 F6 |, W! b5 S5 g2 [
  25. #include <linux/module.h>
    ' W6 {. |3 {0 \1 g" M
  26. #include <linux/init.h>' K7 F; X1 j* `& E0 ?3 W4 h& H
  27. #include <linux/errno.h>3 h7 C7 ^2 N+ m  ]) e
  28. #include <linux/types.h>1 E/ [7 _6 M' H; R9 k$ u9 ^
  29. #include <linux/interrupt.h>
    + _& b) @& p; w0 W8 t
  30. #include <asm/io.h>
    ) {7 B/ o7 I) b1 d, A  S  z' J
  31. #include <linux/moduleparam.h>
      d) D8 U& W' v& w: m. f
  32. #include <linux/sysctl.h>
    ) l7 {4 w! H) E+ F& }4 V& W) n
  33. #include <linux/mm.h>
    % n. d5 Z! c' t+ p9 A7 O$ e
  34. #include <linux/dma-mapping.h>
      f+ q- A5 e7 d! m5 I6 a- r
  35. ; ?0 Q$ d  n' C9 {- b% l
  36. #include <mach/memory.h>
    2 V% w. y, B0 h6 `
  37. #include <mach/hardware.h>8 {  E9 E) l8 J, `, }' `+ G
  38. #include <mach/irqs.h>5 U2 C8 c' T9 U8 T$ L3 M
  39. #include <asm/hardware/edma.h>; L* l/ V. d3 v0 G9 e9 H1 ^

  40. , U6 T: p: T$ p
  41. #undef EDMA3_DEBUG
    2 _- [3 e* z  y9 |
  42. /*#define EDMA3_DEBUG*/) e* F- Q, q; _# L3 M( W5 t

  43. / {. {4 T- G, `
  44. #ifdef EDMA3_DEBUG
    ) s% A# n& _9 y4 L/ ~6 b7 w2 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      N6 t/ M( Q5 y5 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 {5 L; Z4 E" a& [) Z  c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; R9 S2 l( b) z# w  Z4 j
  48. #else
    ' f$ O- P8 x2 V/ ~% [1 [! g  H# |
  49. #define DMA_PRINTK( x... )
    $ [5 t) ?$ z: ?7 d0 U3 ?6 i
  50. #define DMA_FN_IN
    3 Q7 ?. ?$ w8 r
  51. #define DMA_FN_OUT
    5 P' g8 j# D/ h3 k' }: ^
  52. #endif* y5 Z3 a3 @. }$ p! `. x

  53. " z9 K3 m( W$ ^$ q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 A) O- f7 K" J) \* ^& Z
  55. #define STATIC_SHIFT                30 c" x/ R$ V. s2 ]
  56. #define TCINTEN_SHIFT               20
    & n1 J7 ?  ]6 V, K3 ?9 C' o/ o
  57. #define ITCINTEN_SHIFT              212 f0 v1 x3 ?1 {! x
  58. #define TCCHEN_SHIFT                22( E( ^" G$ C6 j. z3 B6 {6 B
  59. #define ITCCHEN_SHIFT               234 S$ C! T9 e' D- q& T1 i) e% ~& M7 {
  60. , j8 J; z; u6 h6 [
  61. static volatile int irqraised1 = 0;
    0 E( r# n" `7 w
  62. static volatile int irqraised2 = 0;* @. `% K5 {, F1 V& [' ]( h' r
  63. ) }; B: I& D) R* Q5 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) I/ M1 s# c/ t! d: E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # y% c6 Y# m* w" J8 C* x; I/ g, X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ?( I- b  `7 ]1 h

  67. 7 R2 R+ ~, U  F  i% m1 P
  68. dma_addr_t dmaphyssrc1 = 0;1 I6 J/ v4 k$ ~) J  N, w& I
  69. dma_addr_t dmaphyssrc2 = 0;; s% S! G. p) {4 V; _0 h
  70. dma_addr_t dmaphysdest1 = 0;
    ; t+ @0 s6 _$ k! M3 a) I
  71. dma_addr_t dmaphysdest2 = 0;
    . ~  q  n* i" ]9 u

  72. # c. R5 b# m8 O8 ]4 u
  73. char *dmabufsrc1 = NULL;& ~6 G1 k7 P1 \1 F+ Z" l
  74. char *dmabufsrc2 = NULL;
    1 y1 a) Q, J; w, x: C1 ?
  75. char *dmabufdest1 = NULL;
    " I: E. L+ l0 y4 {$ W  H+ _
  76. char *dmabufdest2 = NULL;
    ; |. T# C# H7 i* A! V; x

  77. 3 {! I( D, C2 F
  78. static int acnt = 512;
    # ~' E4 @: {1 p1 E
  79. static int bcnt = 8;$ S% u1 Z  t7 t2 ^1 S3 t7 ]( w& M
  80. static int ccnt = 8;
    2 s3 F  q) ^- M  W: N

  81. 4 N# T, [7 o0 u+ E; ~1 z3 |% z
  82. module_param(acnt, int, S_IRUGO);
    * g' p. `7 N% J: ^
  83. module_param(bcnt, int, S_IRUGO);
    $ D0 }3 V/ j1 ~/ ?) z( s& p; p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! U# |6 `: [1 x6 f, a1 U7 [

  ?. s2 ?1 I% {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 T, g/ P6 o7 m8 K1 `  _3 d7 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 e# ~4 ?% v2 c! c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" Y( t0 b' \4 S' j
6 v" X0 S% }! w) ]! y: D1 z. T; T; {, K: H/ I( I. ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 05:04 , Processed in 0.036836 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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