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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! z" M$ z0 h$ q, y; D0 @
  1. [code]EDMA sample test application
    % H% Z" X- e7 \) |1 L
  2. /*7 l, E' T) V* \2 w/ [) Q1 n: v
  3. * edma_test.c( I4 ~7 M6 C1 \' N3 q9 y$ W
  4. *
      T9 _6 p$ H! R& \/ v
  5. * brief  EDMA3 Test Application
    2 D1 F& z+ l& Y' a* \0 P9 H
  6. *% J- V* I; x2 i
  7. *   This file contains EDMA3 Test code.
    7 Q1 w; U- f# z8 O+ f. m
  8. *
    " Y7 {0 J* t/ d. w0 N: i- x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Y2 U; B/ e5 j, x6 B; x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & g+ s$ O- b3 n
  11. *         TO CHANGE./ y# d+ V) ?! ~+ H. Y8 \0 j$ C- C
  12. *6 E) w9 T5 H2 M( G& A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# U, D6 ]9 C3 i/ f) i0 d5 e( p
  14. *# z4 r4 P' a( u8 ?, v
  15. * This program is free software; you can redistribute it and/or. z& r- z) d" E4 @2 U
  16. * modify it under the terms of the GNU General Public License as
    " t! }; x, x, o8 l3 L
  17. * published by the Free Software Foundation version 2.
    ; B5 r4 E. P% ^! U1 ]& Q  U$ [% G+ v5 b
  18. *
    ; d+ Y6 ^. H! w8 c5 U5 k* [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) l2 _1 F" l9 Y( L
  20. * kind, whether express or implied; without even the implied warranty
    % J/ E9 W3 u" w8 R% ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, q! F, k$ J: @- I) ]
  22. * GNU General Public License for more details.
    ! V! z' E/ x7 ^
  23. */
    1 v3 }- P; k9 o4 a+ ]$ K
  24.   N$ B6 B/ _/ @6 l& e  K, B
  25. #include <linux/module.h>' e  `  ?" d. |
  26. #include <linux/init.h>
    4 o% E8 A3 J7 X3 S
  27. #include <linux/errno.h>
    2 C, t  j. j5 q7 T( W
  28. #include <linux/types.h>0 ?5 o& A# o' o- c# L2 y& }$ \
  29. #include <linux/interrupt.h>
    ; z4 K6 j- W2 L& d
  30. #include <asm/io.h>
    3 Z% I+ x" Z8 M; w1 D9 H
  31. #include <linux/moduleparam.h>
    & O- p; X6 j# n: f. @# I
  32. #include <linux/sysctl.h>, J  F& ?$ I# g: j
  33. #include <linux/mm.h>
    + q1 y/ _/ ~2 A2 Q( D  g* z, V
  34. #include <linux/dma-mapping.h>) ~$ l  h  n2 `

  35. 2 B5 O' E% Y: b* S% b; I
  36. #include <mach/memory.h>
    ' P( ?4 r: J- k2 ]/ {& ?( X
  37. #include <mach/hardware.h>( U9 G7 ^2 h, Z! q  ^. f
  38. #include <mach/irqs.h>+ [1 B2 F$ `" _1 v1 z% k- n& [
  39. #include <asm/hardware/edma.h>
    6 f9 g2 j0 }- W- H, m6 L9 U! y
  40. . z$ H6 O6 T- g2 y
  41. #undef EDMA3_DEBUG
    / j& E2 c4 Q- C$ ?0 Z" ?0 e
  42. /*#define EDMA3_DEBUG*/
    6 T$ f4 p9 h% ], D! A& O$ n' P
  43. ) V5 M& d  |2 Y
  44. #ifdef EDMA3_DEBUG
    ! a0 O( U0 i5 k/ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & W% }3 K* Q% W7 Q& |( T! L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 a: V9 f7 V, m0 v. s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 T. a( b$ ~# q5 c
  48. #else# h! r; w/ \& H5 U* x( L2 d; T& i6 m
  49. #define DMA_PRINTK( x... )
    8 M' N+ r7 K# L- h- }& c
  50. #define DMA_FN_IN
    * L0 T" K, v& Z3 p, G! x- r7 i
  51. #define DMA_FN_OUT1 l# D5 _) e1 P) Z) k
  52. #endif6 q" b! I! ^1 h. ~

  53. ( K) _8 i) m/ I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 d$ V4 |9 m& U& H3 z
  55. #define STATIC_SHIFT                3- N6 G- `2 T. D$ ~) e) W
  56. #define TCINTEN_SHIFT               20, F: d# }, U) a5 w
  57. #define ITCINTEN_SHIFT              21
    6 D& h5 J( J0 i! R, Q; N! d
  58. #define TCCHEN_SHIFT                220 C' l5 C- N2 Q- M8 [+ d
  59. #define ITCCHEN_SHIFT               232 [7 |4 z8 _  `3 C' s& v4 M% S

  60. - U9 u4 D" @) J! J4 e$ W
  61. static volatile int irqraised1 = 0;
    . |9 N. l- f- I
  62. static volatile int irqraised2 = 0;0 U) @' D! y# a4 w/ d9 [
  63. ( B2 P% i( {  `% A. k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H. w7 [: _4 ]' g: V* @5 f9 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 z# Z! N' A; W1 i& F2 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 F  [0 N  }0 X9 f
  67. 8 d1 D1 v6 ]9 O5 B4 D2 O
  68. dma_addr_t dmaphyssrc1 = 0;
    + w- E; \- C" X
  69. dma_addr_t dmaphyssrc2 = 0;
    7 M  }$ o% f) U- w6 v. c: M* n( Y
  70. dma_addr_t dmaphysdest1 = 0;
    & C: r5 H7 r6 @8 N
  71. dma_addr_t dmaphysdest2 = 0;
    / O) X) b6 S8 O& n

  72. : ], u* c" b) P8 t6 m" ]3 z/ [7 F
  73. char *dmabufsrc1 = NULL;' l5 [2 X2 i1 e5 g8 K- {. g
  74. char *dmabufsrc2 = NULL;
    ' s- x8 ]( Y# r: c
  75. char *dmabufdest1 = NULL;3 k  S2 L: ~- ]9 [+ @
  76. char *dmabufdest2 = NULL;
    ( K7 ~8 T4 |$ u6 a+ B/ v
  77. 2 |0 A" \+ F4 O' w# }& p
  78. static int acnt = 512;# g: F8 _8 m6 F/ @. g* g
  79. static int bcnt = 8;
    - ]( O+ k$ v. ~, e
  80. static int ccnt = 8;- K/ R5 H- A2 ]0 T! D
  81. 9 ?* _" B2 }0 m
  82. module_param(acnt, int, S_IRUGO);. P" g- ^' u) A' |$ v2 p. ?  l% T5 F& H
  83. module_param(bcnt, int, S_IRUGO);! U/ _, b; J" A: D1 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 x" C: I1 e. C: _9 y6 Z; N% Y6 r# B* a) y; |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 \: e" F& b# [% `0 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ {4 S( s( W' R' D  q+ x1 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 M. U' O$ y6 X# k; C& P9 ]6 @
% ?, m4 W5 y. [" p# J' ?4 a9 ?. |, k

  I/ \8 ^8 g! X4 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-25 19:00 , Processed in 0.048083 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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