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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% W8 B5 r3 D8 P. }# V$ V0 [; u
  1. [code]EDMA sample test application
    9 H2 S; U1 W2 Y  d- {
  2. /*4 j" r  c7 _# s* c, _' `
  3. * edma_test.c
    / ~# W2 d* q+ B# J# R5 ~
  4. *' X7 R% a3 y/ a- Z, `/ a
  5. * brief  EDMA3 Test Application  K5 S/ u9 T+ ]4 e; _7 ^; _4 S
  6. *
    $ C) x2 d. h* s+ ]
  7. *   This file contains EDMA3 Test code.
    . p3 R! H  b% I# J0 o
  8. *
    / ~) E8 i3 D* T, ^* d* ~1 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ~& w$ g! G, S3 Q. }% Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; m* e2 s; c7 J1 m% W2 @) B# T1 W# h
  11. *         TO CHANGE.
    : B& ]) {/ A8 w7 p* l
  12. *; Q, r* r) C; }" j. w3 q; i1 u: A# J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) V( `+ R3 x" }3 W) ]& L( m
  14. *
    8 k0 M0 I: a, H6 d
  15. * This program is free software; you can redistribute it and/or) o& W4 Y2 _* }" R* s0 s
  16. * modify it under the terms of the GNU General Public License as
    " @$ r" a5 {5 c3 @4 \+ k
  17. * published by the Free Software Foundation version 2.5 I1 A: Q! W' C* |
  18. *
    4 v  o7 y$ W- Y( y: N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Y, I8 \4 F: Y, Y9 I  S
  20. * kind, whether express or implied; without even the implied warranty5 d1 \* {/ {4 x6 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 i* x! P7 O. M1 \. V: ]* |
  22. * GNU General Public License for more details.7 Q, H/ r* m8 i% m( b7 N
  23. */
    ) i5 l6 E3 v* V9 X% e6 a
  24. ( R, c( W1 V$ J8 |
  25. #include <linux/module.h>" n' C) P# C! Z5 ?3 X5 `
  26. #include <linux/init.h>" i. G6 M. d3 f4 V7 W
  27. #include <linux/errno.h>
      f2 x* J% `0 u. f" O1 \: |, x: X2 ~
  28. #include <linux/types.h>
    . r( t( i7 \. [6 v# [2 \- g
  29. #include <linux/interrupt.h>0 j$ c8 O8 \0 K1 y' J9 B& i7 g" g
  30. #include <asm/io.h>" a: v1 p  H: U# ~6 y
  31. #include <linux/moduleparam.h>
    + n. h+ w: L2 w$ y7 u
  32. #include <linux/sysctl.h>
    6 |9 F# S7 i, E+ |+ n7 f* m' f
  33. #include <linux/mm.h>6 l" d: j! M8 ~2 K+ R  A3 O
  34. #include <linux/dma-mapping.h>$ [8 _7 t0 ~1 w2 L! w! O- M* w, ^. j
  35. 7 i, S0 V. j& k" D( s( Y8 `+ J
  36. #include <mach/memory.h>* G; o7 t$ ]  Z) R
  37. #include <mach/hardware.h>
    ( x' w" b& V$ H- c8 e
  38. #include <mach/irqs.h>' J' `) [6 ~/ U3 K! g) r, T5 }
  39. #include <asm/hardware/edma.h>
    - {  @7 H& u* q) d  |0 f& q% \, e

  40. % L5 l! h- J2 ~7 J# Q# e. a
  41. #undef EDMA3_DEBUG5 t  I! A# y  c! F' J5 N
  42. /*#define EDMA3_DEBUG*/
    . X7 ^/ W8 V3 c2 D6 o8 y+ {
  43. 5 J. x: |- |' n' r* j2 P4 ?
  44. #ifdef EDMA3_DEBUG
    5 W( M$ i. g/ x+ B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ~% b) G/ D2 L9 |. _- b) W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): q. I8 k2 C9 Z! N" N! l" T5 `0 d6 A& S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ x# ]+ k, d" G  b1 |' E# R
  48. #else0 u+ c- h! q: X! V9 @
  49. #define DMA_PRINTK( x... )
    7 N- J' N* M# X, d
  50. #define DMA_FN_IN! i2 Y6 \4 o  s+ M! m& z  e, O" ^
  51. #define DMA_FN_OUT
    $ [% \3 }$ H6 Z+ r# [6 M
  52. #endif! G% Q6 y/ c- F# r2 `, {

  53. . `6 R3 j% l2 \$ n* L! o$ |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) W8 D2 u9 H+ T) {" z, ?- o! {
  55. #define STATIC_SHIFT                31 x  w. n+ y6 _3 s1 W2 G
  56. #define TCINTEN_SHIFT               20
    # y; a# y) @; M
  57. #define ITCINTEN_SHIFT              21
    7 T: {: o2 \1 l' ~- S# g
  58. #define TCCHEN_SHIFT                229 _) W- \8 V* a0 A" ?- {
  59. #define ITCCHEN_SHIFT               231 g: t+ u1 U, q! ^! D8 J$ q$ m+ H2 D
  60. 7 ~, I6 M+ f8 q/ _
  61. static volatile int irqraised1 = 0;! N2 t- D+ i% _8 R
  62. static volatile int irqraised2 = 0;
    7 z' q/ X0 B- E: x+ d
  63. 9 `2 o* P5 ^. J5 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 R( A/ ]7 C3 `* c5 R% ]7 j/ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . b* y* W. j" J7 i* @! W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & y8 M2 V7 @7 k: p4 ~* X. ?3 K
  67. % i( ^9 E; L" x
  68. dma_addr_t dmaphyssrc1 = 0;
    , d- T5 J  g' D8 x
  69. dma_addr_t dmaphyssrc2 = 0;
    $ Y# d  l! ?  `2 `1 [
  70. dma_addr_t dmaphysdest1 = 0;
    % B% v' a- T- P% _
  71. dma_addr_t dmaphysdest2 = 0;
    ! S. ~* S5 n5 j2 p: Y# c2 x, x
  72. 0 c# p: N- g, k  D2 i, i
  73. char *dmabufsrc1 = NULL;
    ' ?7 d( N+ |, _: E
  74. char *dmabufsrc2 = NULL;
    . Y$ Z2 i5 V7 L  _
  75. char *dmabufdest1 = NULL;8 H1 w2 |5 T8 S
  76. char *dmabufdest2 = NULL;9 O: |! X8 x( D' u  h1 S" S& f# N
  77. , E2 |; ?% D. w! G3 A
  78. static int acnt = 512;( L$ y* M  f/ B2 G
  79. static int bcnt = 8;
    - {/ K( I8 I; ^' q% ?* S
  80. static int ccnt = 8;7 b' x/ ], ]: V5 I+ P. {: F3 I

  81. 5 m3 A+ b# y( O# n/ i
  82. module_param(acnt, int, S_IRUGO);
    0 E$ L8 A3 B  ~- h4 R/ U( O3 P
  83. module_param(bcnt, int, S_IRUGO);/ M! X5 H* Z( e1 u7 U5 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) w! F/ d1 @! U. I1 N, F9 L
; Q5 K) Q/ f$ n! H. p4 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ]- H7 `9 R7 Z6 u6 e% q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 V+ j1 n! m8 O* I9 z! l" F$ t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) l* J+ E$ Q8 u) x. e% Z+ z
7 B1 i5 K: U. H
, }; _2 c, ]& o- K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-17 16:32 , Processed in 0.110102 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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