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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) [0 J8 y5 q3 `0 V$ X* {. o
  1. [code]EDMA sample test application
    ) l7 }0 B5 S# G. `. S
  2. /*
    7 U+ B# p! h" I+ u% V" ]
  3. * edma_test.c
    8 `- o9 v9 g9 p) R
  4. *, h. U, t. l% Y( w. e; r+ g
  5. * brief  EDMA3 Test Application/ z/ P; L) T# D5 c1 H- ?+ a
  6. *2 t3 R/ e, s  k0 Z2 U( M8 {. P3 H
  7. *   This file contains EDMA3 Test code.
    $ \8 u# Q+ t5 d& [
  8. *
    2 G) b- @# ^+ w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * s- W# X% S' A7 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; E) F0 e4 d% o3 M; c+ X1 F/ }( U, }
  11. *         TO CHANGE.! E2 I1 {9 N% w0 _
  12. *
    6 d/ J1 K$ U) O2 `) r$ X4 \; \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 e- I2 X& B8 b5 \9 u" B
  14. *# ?6 I: D  u7 U3 E% O' N
  15. * This program is free software; you can redistribute it and/or
    * ?- I. M- z  w: b  o) u. Y) P
  16. * modify it under the terms of the GNU General Public License as# H+ n9 s. i# a
  17. * published by the Free Software Foundation version 2.4 e6 k: {+ W0 f! l
  18. *+ ~9 O  p! t7 p) \1 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& W4 J2 M# e; z6 w$ {0 u& _3 Q0 m/ }
  20. * kind, whether express or implied; without even the implied warranty) W( y* z4 u1 L) P1 |4 E1 c4 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% i$ j) f$ I0 X' L/ T* W
  22. * GNU General Public License for more details.0 d3 q5 c& t; L9 L. _8 X  ^
  23. */' r9 |0 C! n. a0 _1 ]
  24. % V: }' t! x  V5 `5 l/ y
  25. #include <linux/module.h>
    5 t8 k% V  R/ r2 g
  26. #include <linux/init.h>
    6 q3 b1 E: S( `$ W
  27. #include <linux/errno.h>1 O1 q6 a( `) c- i3 y3 j
  28. #include <linux/types.h>3 t4 N  R- m& o8 w
  29. #include <linux/interrupt.h>8 F  m$ _# M9 h8 T+ v  K: @, X. |9 N1 W
  30. #include <asm/io.h># D# C* y6 j7 r3 V6 F; L
  31. #include <linux/moduleparam.h>
    7 _6 |3 v8 u9 {! R8 ?9 A
  32. #include <linux/sysctl.h>2 t' f' y# R- H
  33. #include <linux/mm.h>
    & P+ q5 J9 v; G6 C+ x9 ~3 L
  34. #include <linux/dma-mapping.h>$ ?7 l& V7 J) V$ P3 a2 T  r
  35. ' A" \: I  X: s0 {7 b3 j
  36. #include <mach/memory.h>
    5 Z2 X  F1 R' H6 Y# s; m. ?/ A
  37. #include <mach/hardware.h>
    1 V$ G  V* V) n3 L1 z' T
  38. #include <mach/irqs.h>4 Q' i+ f" Z8 X) E7 L' Z
  39. #include <asm/hardware/edma.h>
    ) P8 V- I( g0 {( u

  40. : C$ R, p2 N3 H+ `
  41. #undef EDMA3_DEBUG) j0 N+ T- k! E% z
  42. /*#define EDMA3_DEBUG*/
    2 Z+ D, B" k5 S: t" n
  43. 3 A2 P  v. G" {" T! m0 b' S
  44. #ifdef EDMA3_DEBUG# A* n  s0 d7 @1 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 V: _/ e& ?1 e- z1 y8 D, z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 A- }% u. F  y0 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 w4 d$ }1 u) y1 ~. ^
  48. #else5 T# e1 d7 R- N8 Q
  49. #define DMA_PRINTK( x... )
    6 d) M! ?6 y* n2 V4 \' q1 j
  50. #define DMA_FN_IN
    6 V) o6 s* R  l
  51. #define DMA_FN_OUT
    ' j' _/ n4 `8 V1 K! i
  52. #endif
    ( T) B* B7 X  w/ x) ^8 V& D# l
  53. ) K7 {* [9 y+ f, g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! g* `4 N' q8 V3 _
  55. #define STATIC_SHIFT                3
    . q9 c" ^3 O" B4 w2 R
  56. #define TCINTEN_SHIFT               206 f; `8 W/ V0 I
  57. #define ITCINTEN_SHIFT              21% q% f, K2 f2 Y4 u1 J4 n8 ]6 c/ y
  58. #define TCCHEN_SHIFT                22
    % E4 i5 ^, g0 d; U, |" I0 K6 a
  59. #define ITCCHEN_SHIFT               23
    2 O* l0 M/ z) H/ C5 x0 i+ A0 D9 i# ~

  60. . U1 Y; U& `: r% x+ e& ?0 N) L
  61. static volatile int irqraised1 = 0;
    " E& j% j) z1 z9 a; l4 _  K
  62. static volatile int irqraised2 = 0;! d" C, w0 b& s; P3 B& V

  63. 4 E0 c7 z& i4 f( g3 J9 ~- S2 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # l# w. m- w) b) Z5 g* }6 R  ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & \: F3 n  Q. Q( d7 f" W$ o$ X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c6 l" [1 c) x7 z+ \) Y

  67. 9 q% e6 n4 I; p9 o  }0 T
  68. dma_addr_t dmaphyssrc1 = 0;
    8 [! [- [4 D- M) `
  69. dma_addr_t dmaphyssrc2 = 0;2 V: t9 g  d9 _
  70. dma_addr_t dmaphysdest1 = 0;; ^- E& [1 L0 h# ?* d
  71. dma_addr_t dmaphysdest2 = 0;& O5 A* C! F& Q3 c- R
  72. ' b" S! r  ^0 v+ C/ p
  73. char *dmabufsrc1 = NULL;
    ! ]  r+ F/ P$ J4 \! p; U
  74. char *dmabufsrc2 = NULL;
    - b5 W! t! \# I# s
  75. char *dmabufdest1 = NULL;+ w! l8 K) F, }# E( M$ F3 n' [/ p+ f
  76. char *dmabufdest2 = NULL;
    ( J9 B% u7 N6 D- C3 O

  77. $ k  J$ }6 L4 z; G" e- j1 `/ c
  78. static int acnt = 512;5 b" w. E0 W; W7 T8 `
  79. static int bcnt = 8;
    / p+ d9 r- T: W$ L" y' A
  80. static int ccnt = 8;
    0 E6 J0 _! o- c7 {; H

  81. , ?5 |+ _4 ^% R1 k
  82. module_param(acnt, int, S_IRUGO);
    5 d* f9 U2 Z: l( u
  83. module_param(bcnt, int, S_IRUGO);! B8 u4 ?& c2 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- O5 i4 @& ?7 [/ d) H. H; l( M$ M2 Y" [: M) D1 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C: b2 g$ @' g* x8 x& ~& |2 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! c+ H5 {8 |, \7 ~- C/ R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. G+ O- r; F! \5 N) \5 Z- ?
$ ?, x; m( _& ^( w; p$ s5 y* C( R% B4 P3 Z/ G1 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 16:52 , Processed in 0.037376 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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