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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# t2 S3 o. k; p6 |5 |
  1. [code]EDMA sample test application6 W* c' W  ~; Y5 c" R7 V
  2. /*
    , I7 }' |8 Q6 B  V3 U9 w2 o/ d
  3. * edma_test.c
    # R) s! p& C2 R1 n8 i: k; p% I7 }2 x
  4. *
    8 ]2 ^" T2 E/ l% ~, p
  5. * brief  EDMA3 Test Application
    3 V5 X9 a: k8 f( k1 U) W
  6. *5 q9 _; O( n4 G/ X
  7. *   This file contains EDMA3 Test code./ n" _+ z+ H, b7 F9 [  V, a
  8. *
    1 M0 I& F; M' N! h& E2 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 X6 x6 i  J* q& i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 S. g. Q  g1 B0 J6 i' @
  11. *         TO CHANGE.3 t7 [9 I8 x9 |# l4 y4 p
  12. *
    ( M9 K3 U5 w5 V" E! z1 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - S5 x7 [: b& L% C% R- w
  14. *
    9 j+ c! ?* {( V# ]
  15. * This program is free software; you can redistribute it and/or
    0 F9 ~3 a7 l# M5 E( x
  16. * modify it under the terms of the GNU General Public License as
    ( J2 q4 S7 J( }% l+ |7 P6 {: u
  17. * published by the Free Software Foundation version 2.
    % g% b0 Y3 K1 b$ y) M( k
  18. *
    9 F9 k) q) N: ^+ }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 F' a0 G6 I# }# D. e6 Z/ \+ I
  20. * kind, whether express or implied; without even the implied warranty
    ! |, l6 J7 L/ i; h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" Q! L$ n( {: b6 h$ }
  22. * GNU General Public License for more details.; \3 C8 ]; h% N7 ?3 [9 w- {1 l
  23. */7 F  T% Z5 M- m. A9 d
  24. 1 q- Z% ]- e! M
  25. #include <linux/module.h>$ D4 [1 u7 d% J
  26. #include <linux/init.h>7 C. V- t5 K& F0 Y
  27. #include <linux/errno.h>( v  }: n& s# p0 Y! e4 |# d( p* ~
  28. #include <linux/types.h>
    - h9 d9 M& w1 b( `+ h! z
  29. #include <linux/interrupt.h>* R& I2 K; F& ]  x: X) C
  30. #include <asm/io.h>9 v9 T% m, C3 Z: c4 f4 B
  31. #include <linux/moduleparam.h>
    * n9 a5 w; F- c2 E3 O, L
  32. #include <linux/sysctl.h>1 R( B6 n# _6 y0 p
  33. #include <linux/mm.h>4 M0 U/ T. y) w1 G
  34. #include <linux/dma-mapping.h>
    3 A5 L" h) v& W) z8 Y! i' v

  35.   F) H# n/ J9 u3 r/ V# a5 s3 s
  36. #include <mach/memory.h>. Y, v% P; [& U) k- b1 X
  37. #include <mach/hardware.h>
    + |5 T' P% Q( ]% H
  38. #include <mach/irqs.h>+ j# G; A( P- a8 E
  39. #include <asm/hardware/edma.h>* G# K9 O' G0 v& H/ v
  40. ) P5 z! z2 n) F% z* t- U9 x
  41. #undef EDMA3_DEBUG5 r8 [* B; t9 ]! P
  42. /*#define EDMA3_DEBUG*/6 K* f' z9 _3 n0 f- l4 r+ G) w5 {

  43.   ~) |, {0 N1 y3 _  @9 M+ X. w6 _
  44. #ifdef EDMA3_DEBUG
    / ?* \% q" S" b$ Y! V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( e9 i0 U  N- W& O* n! S% j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 A/ x; q0 X' l: m% b! s, c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - {! g! S4 K7 i* h1 t' T3 b
  48. #else4 Z: N2 ]/ b2 t3 T7 j" K% }
  49. #define DMA_PRINTK( x... )
    3 V* `7 s2 y8 W# K! Z1 K
  50. #define DMA_FN_IN
    ! y( l7 |9 M4 E  ?
  51. #define DMA_FN_OUT) K! W. ^. \' g9 M/ O$ f
  52. #endif
    : y& _+ G1 j! P$ w" @$ M) G
  53. ! P$ Z) N- |* c* [' f& e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) b, f1 h4 t# _+ J. ]' I8 U2 M: K
  55. #define STATIC_SHIFT                3; H+ R6 T, t4 X, j1 q
  56. #define TCINTEN_SHIFT               201 e; b: G" J0 F5 }1 N4 [+ z3 E
  57. #define ITCINTEN_SHIFT              216 ~) w( d( r0 t
  58. #define TCCHEN_SHIFT                22
    ; a& x) m5 s7 l; m$ F& h' V! Y
  59. #define ITCCHEN_SHIFT               23) y1 \* u& i! O. c5 r/ P" z

  60.   \) D9 m: W/ T
  61. static volatile int irqraised1 = 0;
    5 U% p5 M$ ?1 V
  62. static volatile int irqraised2 = 0;
    ! a0 n+ P  i% t7 h% v
  63. # P9 v9 H/ ]+ _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* t( J' ?( K  u5 P& A4 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! c  \5 N3 m8 F3 C" v' A* G% ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `/ t. Z7 {5 K
  67. # n5 s. P$ @6 \( [/ h1 I" v8 O
  68. dma_addr_t dmaphyssrc1 = 0;
    % q6 p1 y$ [! U* r( X  j
  69. dma_addr_t dmaphyssrc2 = 0;# @" M% Q/ u( y& @- e/ Z
  70. dma_addr_t dmaphysdest1 = 0;' l0 `. j) T# \/ p0 w$ ]( N
  71. dma_addr_t dmaphysdest2 = 0;+ B, N2 j3 L  _  a

  72. 3 a! q1 d5 S* v% P
  73. char *dmabufsrc1 = NULL;
    7 m: s# |/ U' T. C5 R9 \
  74. char *dmabufsrc2 = NULL;
    ( b4 W& M8 V% c9 o3 i# {+ L
  75. char *dmabufdest1 = NULL;
    ( T; j7 O6 p( F! U! r
  76. char *dmabufdest2 = NULL;
    " M; A$ q9 N2 k! }3 \

  77. 0 T8 \/ W- K1 U% s6 \
  78. static int acnt = 512;
    % w7 Q: s6 R$ q  H
  79. static int bcnt = 8;
    4 z5 K- J1 ^! r) A- Q
  80. static int ccnt = 8;4 j" c, y& Q& P: C$ V7 i

  81. * K; l0 C. t: W/ u+ Z% j
  82. module_param(acnt, int, S_IRUGO);( L# a3 {" m4 P4 t4 T6 \
  83. module_param(bcnt, int, S_IRUGO);9 _8 T/ ]# w3 A9 w" D' l3 v1 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- o, s9 B! R' c/ Y: f8 v. B, S

4 x5 |* `" V7 f4 U$ L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& t: g4 q4 L* j( Z) P% M/ ~1 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 O- Q8 D3 c% v4 v; d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* `9 p1 b. t! P) ~* H
* `/ Z; w" m3 M3 W. K6 T
$ q/ _- w; }( n# T1 |2 }( h3 v3 ?) R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 06:30 , Processed in 0.039588 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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