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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ]. r! v! a+ j# ^8 c' f; O
  1. [code]EDMA sample test application
    + h8 A. p# K7 e$ `
  2. /*
    - b! `- d* B, R$ e/ c
  3. * edma_test.c
    ' G2 Q4 I0 I4 D* y4 ~2 w
  4. *
    6 l$ m$ ^. }8 x1 q
  5. * brief  EDMA3 Test Application  \9 A5 z& _* z8 S) K
  6. *5 z7 j  z0 G# g1 V4 P" N! |. V! E
  7. *   This file contains EDMA3 Test code.
    0 m8 c5 O# ~$ U5 T6 D
  8. *' x! R# o. F! C/ o' Z! E0 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' r1 t; b$ R6 o+ W5 Y7 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& H4 b1 R( j! M; s* l
  11. *         TO CHANGE.% `1 `, q6 H8 v* U! N9 w$ X/ h
  12. *
    4 t1 ^2 s; A2 K* f/ I$ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// Y( \! C2 v* W4 |) g0 L7 q
  14. *5 N0 ?4 y& E2 H. X3 E; |, q
  15. * This program is free software; you can redistribute it and/or
    3 a+ _  ~7 o6 P9 J( s1 _
  16. * modify it under the terms of the GNU General Public License as
    5 h7 W$ F0 Z8 w& g' p" M( t6 Z& p
  17. * published by the Free Software Foundation version 2.4 _) M: {* y' P9 @& z& X! y
  18. *' F* H, q$ _  d: v5 j4 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ `/ G, f% G' @3 C
  20. * kind, whether express or implied; without even the implied warranty) t; a+ O# ^4 D7 }/ [& N5 V; c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' q, Q- d+ P6 u: e1 Y, }
  22. * GNU General Public License for more details.
    ( ?, d/ A/ ], ~8 |1 ~7 p4 j
  23. */
    $ ]5 S+ q" n* A& c5 ?! g
  24. : B5 x) [9 \" s: o  n
  25. #include <linux/module.h>9 w, a5 h/ r; s" g1 m- p9 D8 d
  26. #include <linux/init.h>
    % V% w$ X4 n$ l! d2 p5 Q
  27. #include <linux/errno.h>3 ]- h! p" m0 H) z, k. W/ }
  28. #include <linux/types.h>
    $ ~- |. Z  W) T5 E. Z; Y, R, |( [
  29. #include <linux/interrupt.h>
    6 {! r( U- m6 Y- N4 T( k% r
  30. #include <asm/io.h>+ ^1 n+ \% K; N
  31. #include <linux/moduleparam.h>
    ! {/ z8 U' c- z( y8 u
  32. #include <linux/sysctl.h>$ b: ?: P6 I) g; _4 y
  33. #include <linux/mm.h>- _# f5 E& M& W
  34. #include <linux/dma-mapping.h>
    7 K+ g" I. g8 e3 |- `
  35. % v' e: P. |/ K3 a) i
  36. #include <mach/memory.h>
    , y# Z  \1 T# z& ]& k
  37. #include <mach/hardware.h>0 A8 e1 k! y" A6 o, Q
  38. #include <mach/irqs.h>
    * I8 P, j# N. K. |
  39. #include <asm/hardware/edma.h>
    8 l4 y% L! y, `! R$ B  E

  40. 0 }$ D* ~) T% P  h& }+ |( N, y
  41. #undef EDMA3_DEBUG
    $ U& w! v( X4 B4 E  b/ w
  42. /*#define EDMA3_DEBUG*/. h4 H0 f7 P5 n$ `+ L* i7 {  r

  43. & Z% w  ?. c- i: x! G1 R0 ]
  44. #ifdef EDMA3_DEBUG
    4 g- R: @. w! `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 R. P- J; V4 o/ T. E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 E+ G+ c( M& m3 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ ?. U: h+ v- z1 v
  48. #else
    1 T7 _- g. {; Z: n6 L
  49. #define DMA_PRINTK( x... )3 A8 W. q! W+ F3 \' c
  50. #define DMA_FN_IN
    ( {* ?; y" b3 G5 c; v5 b( s
  51. #define DMA_FN_OUT! [/ M7 S" C" s& P
  52. #endif
    * L( K! L$ x' @# }
  53. / C! z5 I5 f/ [5 s! n4 ~% T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; G# O3 _% Q* O# z7 d4 R$ p& ]
  55. #define STATIC_SHIFT                3
    + g$ b8 G  H1 t- [: R% t
  56. #define TCINTEN_SHIFT               205 b! x  H# Y& Y: K
  57. #define ITCINTEN_SHIFT              21
    5 m7 j/ D/ k7 U2 n! f
  58. #define TCCHEN_SHIFT                221 P. {, [! E2 u; }8 q* z1 b  r
  59. #define ITCCHEN_SHIFT               23
    + G8 o" q7 ?, B# d0 u

  60. ! ~' x; W1 f7 v5 E5 S
  61. static volatile int irqraised1 = 0;: \) V; m( z3 x& I
  62. static volatile int irqraised2 = 0;
    4 p! _) r; Y5 A$ {  U- u

  63. 2 P+ a* ~! ^# P5 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n. e  a. K  w9 \5 b+ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' I5 t4 }: J9 z8 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  d8 D6 O; q! Q1 ]

  67. ; O+ q7 p) c( b  F' ^
  68. dma_addr_t dmaphyssrc1 = 0;
    . E8 E2 j0 G( i! Z% i6 A) l( _, m( v
  69. dma_addr_t dmaphyssrc2 = 0;
    ; R7 \% _( p$ t# D
  70. dma_addr_t dmaphysdest1 = 0;& W5 s' I8 J5 H  @) V: a
  71. dma_addr_t dmaphysdest2 = 0;
      p9 r( x- {. }/ m8 d* ~7 Q8 c- n

  72. $ B: @2 Y; U7 B, |. R
  73. char *dmabufsrc1 = NULL;$ {: v, Q) z. T3 ^. O9 u
  74. char *dmabufsrc2 = NULL;5 Y2 S2 E: B7 t0 a6 ]
  75. char *dmabufdest1 = NULL;
    0 T6 Q4 {- f! v8 C! T! a
  76. char *dmabufdest2 = NULL;
    8 w$ d+ Y- H$ B( Q  }0 `
  77. 4 [) q8 K. P6 a
  78. static int acnt = 512;
    9 r" }8 L8 l& ~! ?9 e/ C  u
  79. static int bcnt = 8;
    " K. O) \& q  N! y, J( t
  80. static int ccnt = 8;% w3 }7 E9 T, A# o
  81. 8 d. g6 k. x- I
  82. module_param(acnt, int, S_IRUGO);# B0 r" ^6 n" j
  83. module_param(bcnt, int, S_IRUGO);* f" D. J3 I+ x, P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ h+ W+ r! U; }0 L  P, L. W# ]5 s% J/ R( @# r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 U9 `  G1 ^0 s9 y$ n3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" q7 p, }, i3 r! v: S) j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) P: I; {# E* X; o
: `" l: g* r" g# R: f+ p+ t0 A0 I4 l/ Z5 V/ g, V0 C  S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 17:38 , Processed in 0.040990 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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