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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( S: L, `0 p0 }7 y' k. @+ u/ k- v
  1. [code]EDMA sample test application
    : K, ~: |8 I* h% G+ L
  2. /*
    + S% S2 j- s1 e
  3. * edma_test.c4 y% F  h; n/ x" C# c4 c8 B6 p
  4. *
    ! R1 G8 U1 `7 Y0 d8 _, Y
  5. * brief  EDMA3 Test Application% m5 v3 W' m' H, e* _- n
  6. *
    ! |7 [+ @( I( p, k9 {: H# j/ ~/ ]
  7. *   This file contains EDMA3 Test code.) ?5 n7 n8 u: M( Y1 U* p
  8. *
    # U" A1 W* ^, f1 h  d; s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ], C+ o; i5 _5 V* N, N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; n& p2 x5 p4 Q" p
  11. *         TO CHANGE.
    / e* [- F8 V" v' m
  12. *
    : [3 X- t6 g5 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / Q5 D. h5 x5 M; h
  14. *
    0 o$ C  z' \! K9 B* s; |
  15. * This program is free software; you can redistribute it and/or
    , o* H6 \: S9 k* E/ A+ d
  16. * modify it under the terms of the GNU General Public License as
    9 B' V! S- |! H! `, n
  17. * published by the Free Software Foundation version 2.
    8 k' [5 r3 h$ i/ H- N- o
  18. *4 D1 D  z8 ~: |% H" X. P, y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 u, x% b' X/ t1 T3 _7 G2 W! Q( ^, L
  20. * kind, whether express or implied; without even the implied warranty1 V: Q" S/ e0 ?/ }: O: z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! o/ W8 k2 k: J9 B
  22. * GNU General Public License for more details.
      S8 ?: @6 S9 a
  23. *// z6 C5 u- N) t: k

  24. $ S5 R' t& I. Q9 H5 X3 d  M
  25. #include <linux/module.h>" N0 {2 q5 k# I. M0 N! E1 N
  26. #include <linux/init.h>2 W3 K+ d. I3 c9 w& q* t) A& o
  27. #include <linux/errno.h>; j  s) v3 D. t$ m/ x: g6 g1 `. E
  28. #include <linux/types.h>
    8 i/ o% x  q1 `) J) t* u: \
  29. #include <linux/interrupt.h>, |+ i4 I8 {3 Z3 o' R# ~5 L
  30. #include <asm/io.h>- S; m' x- y& {2 M6 H) }
  31. #include <linux/moduleparam.h>! Q) I- Q& H7 m8 S% p
  32. #include <linux/sysctl.h>
    1 \# a- g) h% X& N) ?5 @% q  x, ]
  33. #include <linux/mm.h>6 q% n# I, s7 Y, b
  34. #include <linux/dma-mapping.h>
    . b9 o2 s$ E7 k" o4 N: T% }7 _  W1 V

  35. 4 ?& w& `9 H3 ~2 C+ w9 A9 x
  36. #include <mach/memory.h>% A4 l4 K9 Y+ Q1 t' z# L
  37. #include <mach/hardware.h>
    ( m5 R) O/ F" H
  38. #include <mach/irqs.h>
    $ ]3 x# ^1 N& J  J) a  v
  39. #include <asm/hardware/edma.h>
    ( N$ F1 p+ E% M1 ]0 a6 F. ?

  40. % C, ?* m% H4 s  W
  41. #undef EDMA3_DEBUG" `: ?0 n3 `4 k5 L2 V
  42. /*#define EDMA3_DEBUG*/
      x0 \% ^% E+ u  {( _) R

  43. ) X! [, w! w' t, L1 L5 y; |
  44. #ifdef EDMA3_DEBUG2 j$ ?1 l% N7 i7 M% b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 ]: T4 h! ?" ?/ v8 S9 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 C& m- l* x4 M2 \9 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& g0 ~, L( d3 j
  48. #else
    ( g7 e! E$ c7 o
  49. #define DMA_PRINTK( x... )
    ' G9 u- Q8 A5 \! S6 |
  50. #define DMA_FN_IN
    + a/ a* z, Z( Y; k8 \
  51. #define DMA_FN_OUT
    # X+ o* {/ B# J# f% C/ h
  52. #endif; P6 {; g8 |4 D$ r3 ]

  53. ; h0 k) L, L5 b* J, c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 \1 B% }. j% O7 R
  55. #define STATIC_SHIFT                3! j* Z- U) B  h/ s- c# p& u1 G
  56. #define TCINTEN_SHIFT               20" G9 C6 R7 J* f' `& x* I0 A
  57. #define ITCINTEN_SHIFT              21
    5 u9 {5 N1 o: Z6 t+ j
  58. #define TCCHEN_SHIFT                224 Y3 f* U0 \' t7 f3 y7 a
  59. #define ITCCHEN_SHIFT               239 u0 Q3 j# h- D7 p' a
  60. ! k7 P5 J5 x! I2 ~% M( A6 }0 c- }3 V
  61. static volatile int irqraised1 = 0;, I' J( V# c; \, N  C. L
  62. static volatile int irqraised2 = 0;
    # L& P+ i# I1 w
  63. " k. }  H( |* P% [$ J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z# o/ d8 C* L  I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H+ Y! w8 V( k0 E4 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O* n( I" {6 e  [2 |

  67. / G# u8 z, Z  C  N" j
  68. dma_addr_t dmaphyssrc1 = 0;2 U9 _0 a$ h. Z& B
  69. dma_addr_t dmaphyssrc2 = 0;' C2 |  l4 P* D: J) n$ S; [8 X- j
  70. dma_addr_t dmaphysdest1 = 0;
    ' N- @4 L$ c# b. ?5 r" `
  71. dma_addr_t dmaphysdest2 = 0;
    7 `3 C2 l! w5 G" J5 C, k4 ~0 }

  72. ! F* ^$ n/ v3 a; a, k
  73. char *dmabufsrc1 = NULL;3 M4 G$ z; w! r  O
  74. char *dmabufsrc2 = NULL;# ]7 X' Y5 M8 N3 \" r
  75. char *dmabufdest1 = NULL;
      a$ F! a/ S9 r) {5 ]2 U  u
  76. char *dmabufdest2 = NULL;
    ( B" j& h9 b3 Q& ]3 x
  77. 2 o: R5 H0 q. C. j9 t
  78. static int acnt = 512;1 W* {6 y. E- M6 R8 O3 R- k: k/ Y# D  d
  79. static int bcnt = 8;+ w8 N8 r( C5 q7 J, [/ Q5 T
  80. static int ccnt = 8;
      N2 g/ z/ M7 v' d  A
  81. + Q& y% p) B$ v# [) L% M
  82. module_param(acnt, int, S_IRUGO);
    + O9 w4 [3 t, t* t: g
  83. module_param(bcnt, int, S_IRUGO);. P4 Z& O/ }' ?* _- d, g" x. O! s6 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. `* M- M: P6 N4 K

1 N/ n5 Q$ `$ [+ T) l/ |' A/ l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! J6 q7 o% Y$ Q  U" Y. H
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 [) \* l0 q* R& N% V3 p7 }+ E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! g) y* M3 h& G" S- \
0 F* g: a- Q# Z+ [7 ^4 g9 [. f7 [2 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 18:34 , Processed in 0.041076 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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