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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 f" m( B& p) `+ p+ W" _
  1. [code]EDMA sample test application
    5 u" N7 U& j5 M/ x" W
  2. /*
    : X% H2 u- R* h% h( q0 t7 l
  3. * edma_test.c4 K6 l# @8 _  z* P. Y2 c' B$ F
  4. *, V% N& G, v; o* a% e
  5. * brief  EDMA3 Test Application& ]" v6 G* w+ K% {8 T' @: c! [
  6. *; B$ x; B4 n# E
  7. *   This file contains EDMA3 Test code.) C; \; z1 Y! L) M
  8. *
    * Z8 `( w$ v5 n1 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # V# G/ d( a) D+ q5 c/ `) C0 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( |3 N, ?( X: h- f3 p5 J  n* F( O
  11. *         TO CHANGE.# K+ j! A# }$ q) v" j$ L
  12. *! E8 z2 n& g! z% s( D$ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 e4 M' W& R% J3 j+ c2 G/ [6 S
  14. *
    4 p8 R7 v! W" @5 h
  15. * This program is free software; you can redistribute it and/or% I8 S/ U0 g$ T: D, n" ~
  16. * modify it under the terms of the GNU General Public License as
    : Q9 z9 h5 t0 q' e1 m
  17. * published by the Free Software Foundation version 2.
    ) l+ v8 v/ f! w+ _6 ^- K* c5 q6 D
  18. *8 i  o5 \. @* ?% U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      F4 T8 U' R# D
  20. * kind, whether express or implied; without even the implied warranty
    9 i% D" j. ?+ h) N, d7 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; Z! }9 u6 g# L0 t$ n7 S( S
  22. * GNU General Public License for more details.9 x: ]' N5 l2 w* L. Y* U
  23. */4 O& U+ G: ?2 J
  24. ! j5 `' I2 f" {( [1 G7 a- m, L: n7 a/ B. H
  25. #include <linux/module.h>
    % P' N1 A3 Q6 @* d
  26. #include <linux/init.h>
    , z& f  s7 {0 L+ C; P
  27. #include <linux/errno.h>
    3 B3 d9 ]2 f0 y! T
  28. #include <linux/types.h>' g) n4 Z  \8 O6 a* s
  29. #include <linux/interrupt.h>
    5 @3 p: W# k' A& n, @
  30. #include <asm/io.h>
    5 E4 ^: [- `, f; I
  31. #include <linux/moduleparam.h>
    : G1 F: I1 O8 {
  32. #include <linux/sysctl.h>
    9 U$ C6 S0 D8 S- ]5 l0 q
  33. #include <linux/mm.h>, X9 Z3 P6 g. ^% l& }) Y8 I
  34. #include <linux/dma-mapping.h>0 p# t: J6 g# @" o! V  w
  35. & J' N3 C" e" J" x# {$ ^
  36. #include <mach/memory.h>
    4 ?7 a) f: M- y0 R1 S/ `, w) i
  37. #include <mach/hardware.h>
    # L1 y  U% `" L& Y
  38. #include <mach/irqs.h>
    - e) l% }. \( f- t- g9 R8 a9 a5 D+ w1 b5 G) i
  39. #include <asm/hardware/edma.h>1 U7 d; M: m( A: b; d

  40. ; L+ |: |/ g6 b; b$ Y* t5 y6 ^* v9 X
  41. #undef EDMA3_DEBUG" p7 W  m) [( _- s; w5 w
  42. /*#define EDMA3_DEBUG*/
    ! Z+ q0 J9 C3 ?' [) r- z
  43.   I6 y7 z3 J* J
  44. #ifdef EDMA3_DEBUG
    ( k" \. x' I1 Y- L' ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! `* [" Y' P# ~+ @) l( l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 d9 c8 F0 W4 I1 U; E- P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 c2 Y  \1 b9 H9 t- {; ?5 k
  48. #else
    ! V/ `  F( W0 s5 _) E1 i
  49. #define DMA_PRINTK( x... )% F0 i, G( C, O7 j+ y
  50. #define DMA_FN_IN6 _: l" |& p/ ]& U- j$ E
  51. #define DMA_FN_OUT
    # q5 d: G  K* ^0 S: F
  52. #endif  g# K. z4 K/ d" ]* U
  53. " u% Q% V7 K* D; A9 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + b% }/ H: j' W7 [- }7 p$ w
  55. #define STATIC_SHIFT                3
    9 u" x" C9 v$ H  Q+ N; d
  56. #define TCINTEN_SHIFT               209 z2 u! f) R7 U$ b3 H
  57. #define ITCINTEN_SHIFT              21: q, t& m6 O4 S/ i! G. U
  58. #define TCCHEN_SHIFT                22
    + z5 M8 J" `0 z* M
  59. #define ITCCHEN_SHIFT               23
    : N( a  Y4 P; P. h3 V

  60. 8 T2 f& Y- H" ~9 X% z% Y; P
  61. static volatile int irqraised1 = 0;# h- a( K# Z( D& f/ r- E$ B
  62. static volatile int irqraised2 = 0;; Q1 o+ P1 j& S

  63. 6 @' h( r8 [+ ^5 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 \' U* F7 c1 y& I0 s5 H  |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 t; t: {( A( o5 @1 u: S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' U! o; s3 v6 J% j

  67. 4 p% T1 v/ k0 P$ ~3 u
  68. dma_addr_t dmaphyssrc1 = 0;
    / V; ?, ?  Y0 \; U) k4 x8 e7 F
  69. dma_addr_t dmaphyssrc2 = 0;& F8 V; i0 g  {6 A8 i
  70. dma_addr_t dmaphysdest1 = 0;
    5 J5 j2 D; z  U. ]* ~
  71. dma_addr_t dmaphysdest2 = 0;
    , Y5 H$ I$ K. m# K

  72. 7 ]; v; k- X& b
  73. char *dmabufsrc1 = NULL;
    # O. e% Q, ?7 a0 b$ ?6 O( P
  74. char *dmabufsrc2 = NULL;2 x3 N( F1 _; N' ^+ i' U  U
  75. char *dmabufdest1 = NULL;
    6 g. e$ l( `7 F7 Q
  76. char *dmabufdest2 = NULL;! w: X; ^) q  h; A' I7 T9 l

  77.   e% h; ^" Z$ @3 |
  78. static int acnt = 512;
    ( W! o: k+ f/ \0 i9 y) R' a# K
  79. static int bcnt = 8;& l' z- K4 s! `0 N
  80. static int ccnt = 8;
    9 i, u8 Q9 k2 p1 M# z9 M/ W
  81. ! R8 v$ e* ^) u
  82. module_param(acnt, int, S_IRUGO);! S$ f5 G$ g9 X% z  C
  83. module_param(bcnt, int, S_IRUGO);
    ' e- K. B4 W& p- k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 j0 P8 B) ?. k8 a, ^7 v
1 J1 ~% |, f$ a. V) l+ {$ F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ B) l2 Y4 {8 ?# v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 J& _' R3 Y' u& z6 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  H5 }: R6 F) [3 A" l- S) I/ G/ R; b. v5 L2 K( V
, [) [( ~% g& {/ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 21:13 , Processed in 0.037800 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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