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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 W- R1 B4 N# Q1 {
  1. [code]EDMA sample test application. B2 W7 |3 u& D$ k' S
  2. /*
    7 {7 X! d. ]- O, @8 D
  3. * edma_test.c
    4 c4 x1 @) h( t$ j; e
  4. *
    ) g$ P; [" O( {% j  P3 s
  5. * brief  EDMA3 Test Application4 ?# G: T- y- h% [* T' S9 x3 q
  6. *
    , s- P# i9 T+ b/ m: D2 C) Z
  7. *   This file contains EDMA3 Test code.0 {0 O* _& @, K. y+ U$ B
  8. *8 a. e6 x" c- N! L$ W! F+ K; A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 ]- Q. T8 G8 ?) n& A' D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , w  \# K. E: W$ e4 [1 E
  11. *         TO CHANGE.
    8 M5 ~+ V+ Z1 {- S6 Q
  12. *- z/ O) O1 m" q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : r  t% y2 D. t, h8 g6 K5 g+ F
  14. *
    / ~. V6 F' T+ b; x6 ^$ C- ]
  15. * This program is free software; you can redistribute it and/or
    ! u4 A6 z. P" T* _: p& q
  16. * modify it under the terms of the GNU General Public License as: e- Q, G7 D3 E4 m& L9 k$ v
  17. * published by the Free Software Foundation version 2.( d3 \$ i& I4 b7 M2 t, ~! B" Y: u* `  h
  18. *
    ; f& I; [6 B7 A+ R3 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 v$ z# q2 N2 l7 c+ t
  20. * kind, whether express or implied; without even the implied warranty8 _- g. G) ^* Y1 w: \0 ?. Z- @; Q7 z2 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 j4 {, t6 `9 V  g8 c
  22. * GNU General Public License for more details.
    $ d" X- T4 @' ]) k0 y& f$ t
  23. */+ ~% v% s6 X$ `2 r6 e) R3 R* t
  24. 6 g6 g9 o' w. W( R5 |
  25. #include <linux/module.h>) o! r" j# |4 L3 H. N4 v3 R7 _( X
  26. #include <linux/init.h>
    ( l$ q( q: c5 x" e$ L
  27. #include <linux/errno.h>5 ~, v% I6 t3 E% I  u9 [) r5 @2 K
  28. #include <linux/types.h>$ Y6 }, r3 J3 Z1 \7 n
  29. #include <linux/interrupt.h>4 _: t  C4 W3 h" ?( O: k4 g
  30. #include <asm/io.h>
    8 {" l9 c. H$ v$ a5 D3 z( [
  31. #include <linux/moduleparam.h>. Y+ {- b9 w& ?! J/ b. i
  32. #include <linux/sysctl.h>* ]: `5 a7 E* d( S4 U
  33. #include <linux/mm.h>2 K0 w+ ~) J. l: G# g
  34. #include <linux/dma-mapping.h>9 d5 _. p$ B  z1 o0 j9 h
  35. / ~- o- V. v1 f" q
  36. #include <mach/memory.h>
    * x4 U" g) y9 {) M% {; u
  37. #include <mach/hardware.h>6 o& y. i; k* @( G
  38. #include <mach/irqs.h>
    / D, ]: h( T7 M* _
  39. #include <asm/hardware/edma.h>; V) l0 ]9 y1 y# L
  40.   b! b# t; W! s& ?: ]3 r/ o, f" A
  41. #undef EDMA3_DEBUG
    ' _9 B* V& }% s6 G9 a
  42. /*#define EDMA3_DEBUG*/. V7 h- _( Q% r1 Z9 o" J, ~. ~0 ?8 k: ^
  43. . w% `& s1 W8 Y/ g" Y& |! U9 e
  44. #ifdef EDMA3_DEBUG
    8 [9 H, i; \% W6 q, c& d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 t8 m, C; e/ j# L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ~' m! I' Q& r0 q  o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 _. b3 d( P% ?
  48. #else
    , R3 b" U1 ^+ D' g+ N! n/ A
  49. #define DMA_PRINTK( x... )& O+ r* V5 m: T: u9 i
  50. #define DMA_FN_IN
    3 r7 [1 D. W) Q( y! [
  51. #define DMA_FN_OUT
    % g6 D, W6 ?  K* Q7 V: m6 x8 w
  52. #endif& ]; y. ~, c6 Y9 @& o
  53. 7 V; u  A6 b: x; K0 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , e, @4 z. H3 k9 X6 T
  55. #define STATIC_SHIFT                3
    0 e3 L% {- T; z+ l. \% b+ Y3 }
  56. #define TCINTEN_SHIFT               20$ b9 a; P5 |5 L% v5 z6 Z8 p/ O
  57. #define ITCINTEN_SHIFT              21) v4 s. X5 [( f" k# v  d
  58. #define TCCHEN_SHIFT                22
    ! W1 N! l* c4 `' |1 D
  59. #define ITCCHEN_SHIFT               23
    $ s, e: r/ l3 K
  60. , k) M& l% f6 v
  61. static volatile int irqraised1 = 0;" q  H9 w( ^! |; q" O/ k' `' L
  62. static volatile int irqraised2 = 0;) b3 E1 N& ^% \, R( q7 X

  63. ) ?0 `( [( ~0 y! C. X( c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 @" m. B: O% t! j% s' Y. t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 {- u% ], s3 z9 F* P: Q) f/ ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 R5 y8 W2 A* y3 B  R  o5 G% C4 d' Y

  67. ! S4 s3 A. B3 j. w! ^! G
  68. dma_addr_t dmaphyssrc1 = 0;- f% z) |9 `4 l9 `5 p$ D! c4 p
  69. dma_addr_t dmaphyssrc2 = 0;* @! S: {% s/ I9 P* z, g8 \1 ]
  70. dma_addr_t dmaphysdest1 = 0;
    4 j% Z+ ]) C3 p9 \; F5 l9 C  @
  71. dma_addr_t dmaphysdest2 = 0;
    + u% \* V0 `5 g0 A1 y

  72. ( e* X, j  Q* Y' y3 F4 T3 l8 V
  73. char *dmabufsrc1 = NULL;
    . j0 f7 z2 e: f, x( ?2 ?
  74. char *dmabufsrc2 = NULL;
    1 O& E- M! Q- c- [8 E2 @: X
  75. char *dmabufdest1 = NULL;
    - w/ r: W1 g( h* G9 y4 A
  76. char *dmabufdest2 = NULL;' t5 J: k3 q, ^# X6 v2 G

  77. / E$ b) A# \7 N; L' }6 b$ J
  78. static int acnt = 512;
    ! A: E: r' F7 p' p: r
  79. static int bcnt = 8;* u5 [+ j# X9 c' E6 E9 ^; K8 b  N
  80. static int ccnt = 8;
    . _- m4 s+ r, |, R( D% R

  81. 0 y9 Q; A- c3 ]' p5 R" _/ Y
  82. module_param(acnt, int, S_IRUGO);
    ) p0 A0 D, B! E& w' Q% F- D/ E# x
  83. module_param(bcnt, int, S_IRUGO);
    6 L+ J! {$ B4 g' v- h1 \. r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 o# u4 D& Q; b! G- g, j5 |0 g  g0 N) D7 m) O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% Q, ^9 ^- c+ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 K/ Z7 f; G: l3 M9 k6 {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& l( l2 d1 \) M9 [" d, k# [& s) l) R' X4 l- n; S4 {# V5 g

3 r/ t+ h- w) F0 r( r" W/ u- a- t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 15:33 , Processed in 0.038169 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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