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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / t; J. S8 n- x
  1. [code]EDMA sample test application
    - W1 `: H$ \1 [, Z
  2. /*
    * m3 }. c. u  h, T6 b
  3. * edma_test.c# c! w; K: Y3 f' b9 u4 S* i9 K" W
  4. *6 F3 C. Z, f2 K& I/ o" M9 a
  5. * brief  EDMA3 Test Application
    & w  h) J0 g$ O# y
  6. *
    2 ^! G0 @" Z: [+ l! H7 j3 I
  7. *   This file contains EDMA3 Test code.1 x" [) W) k+ R
  8. *
    0 H) [- N! o5 A5 U: b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% X+ r6 ]1 k% W" l& d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; p- Q( r' a5 _# D
  11. *         TO CHANGE.
    " X  o# }$ K( m5 [
  12. *
    / y" D/ m" x" e: N1 t: V7 [% b3 {" c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// |; p0 y- K& }: q9 c: o  ?
  14. *) A, A1 c  J- z
  15. * This program is free software; you can redistribute it and/or  W4 Y9 ~$ h$ ?4 t7 z5 i3 p
  16. * modify it under the terms of the GNU General Public License as% D+ m- ^! a' f% W# e. ~
  17. * published by the Free Software Foundation version 2.6 V" Z( i7 `% A, q7 t8 _
  18. *1 H6 r# B2 _9 D. z9 H9 @2 {* G. V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 g. F) O# S' z" O: {. T8 T+ A" J) b
  20. * kind, whether express or implied; without even the implied warranty
    : d+ ]5 o, q% c5 P% M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 w$ ~7 x' Z' |  v/ P  }3 X
  22. * GNU General Public License for more details.8 A* q* _) ]$ l/ ^
  23. */
    * b, x. n% c. V( W9 H) W: b3 Y
  24. + V- C4 z* A6 k% j1 @0 u
  25. #include <linux/module.h>
    3 X. U1 z/ O, N" j3 x6 K4 [
  26. #include <linux/init.h>
    . t& U( F  k  l, Q8 i; a4 o
  27. #include <linux/errno.h>9 E6 i' D3 c: C9 {4 E! d
  28. #include <linux/types.h>
    6 i4 t8 }8 p1 b; h
  29. #include <linux/interrupt.h>
    : m! A! ~$ y/ f* q9 s' M8 |
  30. #include <asm/io.h>
    6 H+ n) }% k3 a- e8 t
  31. #include <linux/moduleparam.h>* r+ \  `* t$ D& N% d, X; A
  32. #include <linux/sysctl.h>, T4 [8 X" a4 N' L, {
  33. #include <linux/mm.h>
    ; f/ _. q$ P. \/ W1 }3 F
  34. #include <linux/dma-mapping.h>
    8 S8 V4 k- G! w. V
  35. & W) E& A  ?! K
  36. #include <mach/memory.h>  p1 R" H4 f7 `! K
  37. #include <mach/hardware.h>
    2 ^$ C' l3 u: ?  _0 F2 v5 w0 `
  38. #include <mach/irqs.h>0 O: J# @4 h4 }7 y
  39. #include <asm/hardware/edma.h>
    ) k8 t2 q8 b$ E! Y1 {- R! D! K2 T) T

  40. 7 |+ M$ h" H3 Y
  41. #undef EDMA3_DEBUG8 ?" m5 P( Q0 p7 N) l% S
  42. /*#define EDMA3_DEBUG*/
    ! b. [7 u9 l! |) q; U5 R
  43.   F5 u# x- l% K* Q5 d% B
  44. #ifdef EDMA3_DEBUG% U, }  S0 i9 B) V3 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* k4 l" r" y, n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ ^6 e% S1 Y! V2 \0 A3 G3 q4 U; }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 F4 f4 x) g6 ?5 L- j7 g6 b  Z
  48. #else" t5 K6 ]/ q6 ]. o- }: v% S  l/ p
  49. #define DMA_PRINTK( x... )& o0 N4 t5 I* }% |
  50. #define DMA_FN_IN/ `: Z( y2 S0 |! z, b( p: i& V
  51. #define DMA_FN_OUT
    # F4 Z. V( n* E- W/ J# b
  52. #endif8 p1 n% }; l. F% E3 p4 J1 F/ ]

  53. / r( n: e7 b! ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 }5 p! ^) ~' h) a" E. ]
  55. #define STATIC_SHIFT                3# p1 y8 }) v8 b- ]) E8 Q$ r; X3 s
  56. #define TCINTEN_SHIFT               20: K; g$ A: |) V7 X
  57. #define ITCINTEN_SHIFT              21
    ) F9 G0 u2 |0 W: E
  58. #define TCCHEN_SHIFT                223 o! U, ], p& E; z" A# W
  59. #define ITCCHEN_SHIFT               23& |. I! }/ F8 @+ n

  60. " t; w- J; }" P5 q2 ]$ `$ s5 }
  61. static volatile int irqraised1 = 0;
    ( K' h: ~2 R7 D/ E& d
  62. static volatile int irqraised2 = 0;% c2 `+ X0 g" m" P, L( P1 I

  63. 0 d% ]2 W' n$ b! L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 X! ^( b4 U, [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + e6 E7 \$ M! Y) l4 v! D, a$ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 P1 m$ A7 ?+ n) J! x# J
  67. 0 \2 m* B4 Q/ n( I5 ?- Q) c3 l
  68. dma_addr_t dmaphyssrc1 = 0;5 p$ x: v% u, B2 K, x/ b) G" E
  69. dma_addr_t dmaphyssrc2 = 0;
    $ K4 u! l4 O6 J, f4 T3 K  T2 t
  70. dma_addr_t dmaphysdest1 = 0;
    ) o: [' l* Y) m) u3 G* ?- ?7 k2 j6 D
  71. dma_addr_t dmaphysdest2 = 0;
    $ m/ u" M0 n: U
  72. . L5 I2 o& k9 o- B1 |* \
  73. char *dmabufsrc1 = NULL;
    $ N- H8 [: @7 }/ V5 \  {: i
  74. char *dmabufsrc2 = NULL;+ X! D% E: F8 W! B' T
  75. char *dmabufdest1 = NULL;5 g: |, Y: x/ y/ z) v+ }  |
  76. char *dmabufdest2 = NULL;4 j% N  z. ^# Z
  77. # p. w* ]7 ]$ C/ b) m+ G. U/ t! p" _
  78. static int acnt = 512;
    $ i: c# |# {9 l" c, M4 b+ Y! ^) P
  79. static int bcnt = 8;9 m7 N' w2 Q5 l3 ^4 h, S: L( l8 Q# t
  80. static int ccnt = 8;5 Z" D! K! d8 C" o1 C" Z, p3 M
  81. 3 z  p. m. ^, t. C5 U4 ?2 K
  82. module_param(acnt, int, S_IRUGO);: \! H" q: X% r" @' z) X
  83. module_param(bcnt, int, S_IRUGO);  [; X" |8 t- s% n3 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 ~$ o+ t1 w' p. Z- M
$ q6 a: {: P2 W2 g+ N" T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% S' P; t4 i1 o$ H3 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" P0 d4 o( W% }0 r; j/ j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% D. u) o% R; k) m3 a1 T
2 V! J# i0 b8 f

! j6 n0 |7 s+ M# k7 W2 R5 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 18:52 , Processed in 0.039239 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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