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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" z8 t; p+ V  j, @
  1. [code]EDMA sample test application' n# Q3 F4 z2 f3 n& o) X+ U
  2. /*
    0 k& Q$ m- X/ `" U9 O- K; a5 N: ~6 \
  3. * edma_test.c9 t! @! l8 N" |% h, X; f' u
  4. *, z* }( @% z! H! Q0 @( X1 w
  5. * brief  EDMA3 Test Application. B8 D& W9 N5 D
  6. *& f% d- W4 r5 l/ k0 h- O& \1 Q7 \
  7. *   This file contains EDMA3 Test code.
    , f( R7 g0 [4 B& ]! f+ T
  8. *
    ) S5 }8 |6 N9 Z- S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : K( ?2 U8 u0 L: t  a0 T  e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " ^& ^+ M( O& ?  j. v
  11. *         TO CHANGE.
    - c, S- b9 ^9 n& T* W
  12. *! K! f0 X7 b9 Z" Q$ }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' l" e) o- o2 D  N
  14. *
    ( {- b1 ^' P6 y2 Y
  15. * This program is free software; you can redistribute it and/or/ n7 T* d' }4 {# f' d& E8 w
  16. * modify it under the terms of the GNU General Public License as9 T' S! K4 R# B  B* X" S
  17. * published by the Free Software Foundation version 2.7 {* y3 \; U# H. V
  18. *9 k7 @+ m& D- M) U7 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 v# e3 Y* p. _, j, D
  20. * kind, whether express or implied; without even the implied warranty
    * V  n3 q' s1 d! _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ }: q, |; V4 L0 E  G9 H
  22. * GNU General Public License for more details.
    4 C& e  ~5 l5 g+ o6 Z: a
  23. */
    & B. `' \  H1 u4 r9 E" I

  24. 2 D. o6 Y+ q- p, z8 n, O
  25. #include <linux/module.h>
    $ |: K/ V4 |& c
  26. #include <linux/init.h># D6 b5 P0 v. Y; g5 M1 u
  27. #include <linux/errno.h>
    4 {1 Q4 ]7 ?7 `1 f* h% V
  28. #include <linux/types.h>: p! G5 T) o- w/ ^, T- b
  29. #include <linux/interrupt.h>
    9 Z0 \, a) e6 r
  30. #include <asm/io.h>- w5 ]1 `- w" Q# R7 z3 H
  31. #include <linux/moduleparam.h>
    + V% e( w) x9 S  i. T
  32. #include <linux/sysctl.h># i5 _5 @( g( s" o1 H9 g
  33. #include <linux/mm.h>
    + g6 h# [" y9 c3 G8 y
  34. #include <linux/dma-mapping.h>
    9 J  j( }' n& M9 ]' ^6 [

  35. 1 f4 S, l: e8 q
  36. #include <mach/memory.h>
    $ Y4 _' w& G$ i, T2 o  Q7 j( @/ B
  37. #include <mach/hardware.h># ]  I+ d8 W' [; O! e. e
  38. #include <mach/irqs.h>+ j: @5 h9 j# [4 Y" P
  39. #include <asm/hardware/edma.h>
    ; K; b. B, j; N7 ]" U" _

  40. 7 \* k# [: O# ~8 O9 [
  41. #undef EDMA3_DEBUG' \& |3 V, P$ l0 p( I
  42. /*#define EDMA3_DEBUG*/
    ( G2 }; i7 A6 S: D, D* l6 F
  43. 2 p+ X  \/ ?2 E% i, L9 y
  44. #ifdef EDMA3_DEBUG5 V+ L8 \0 [1 R- c2 i/ O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 D3 W1 z- U3 Z" R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 R3 }# H1 p. I1 W& r& k9 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + U7 T8 a, ?6 o# v+ }
  48. #else+ q0 L# j5 C5 n1 U0 \+ l' |
  49. #define DMA_PRINTK( x... )
    - ~* ?8 ~2 c7 \- j! c( ]- X, u
  50. #define DMA_FN_IN
    $ \/ p& u" `! f2 a$ O. B4 N) ?( f; a$ S
  51. #define DMA_FN_OUT
    & v8 B* {9 n2 _9 r" W9 _  l, _
  52. #endif5 b! Y' j  K0 Y# q
  53.   \& [4 s& h) ^2 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& I9 I# D: S' N4 D; @) z% j& q+ {7 u
  55. #define STATIC_SHIFT                3
    8 {. U7 t9 T' `9 |& J
  56. #define TCINTEN_SHIFT               20. j! t6 g- W! \, t
  57. #define ITCINTEN_SHIFT              21, z( n; {7 N9 _4 x3 V. i& J
  58. #define TCCHEN_SHIFT                22
    ; M0 g9 l* P+ c. e$ Y
  59. #define ITCCHEN_SHIFT               23* {' G: E1 k' l+ W% S$ C
  60. 6 l* g6 d' Q; d' L$ |: P, y) }0 X" m
  61. static volatile int irqraised1 = 0;
    / K1 W& S2 d" @' ?) m
  62. static volatile int irqraised2 = 0;
    4 E1 z2 `0 [. t2 H1 b  n2 P
  63. 5 y- c3 L4 @" `/ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & t1 i, v0 J+ q7 ^( W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, k" H4 d. Q! h0 p7 X9 G) Q& I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ]4 C0 V8 a& K4 s% J

  67. , P# N  L% X9 n
  68. dma_addr_t dmaphyssrc1 = 0;8 s4 m! b, M% E/ Z9 V
  69. dma_addr_t dmaphyssrc2 = 0;6 U+ S# k6 U+ I( n
  70. dma_addr_t dmaphysdest1 = 0;
    : u) C% J& ]! `. d- e
  71. dma_addr_t dmaphysdest2 = 0;6 ?) `# F8 V# r7 F: U% M

  72. 6 z( H+ d4 H. W7 [. K
  73. char *dmabufsrc1 = NULL;  T( {1 P9 N' _" Q  x+ A: N
  74. char *dmabufsrc2 = NULL;
    , M1 v; [& ~) S
  75. char *dmabufdest1 = NULL;8 o- g9 S" b2 t) }! b
  76. char *dmabufdest2 = NULL;9 S( {2 l% b  i

  77. " Z2 f" k% n2 k
  78. static int acnt = 512;
    1 s$ b+ g  W* a0 H  W* W  k/ c
  79. static int bcnt = 8;
    4 ?5 U. K6 B) c" _7 W/ z
  80. static int ccnt = 8;
    - }" E9 r' d2 ^! z
  81. ; s9 D  j. v+ X$ V4 q( e/ P: t
  82. module_param(acnt, int, S_IRUGO);
    # r* i/ e; l- U. m  m
  83. module_param(bcnt, int, S_IRUGO);
    # a# ^& ]  J3 s% a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: H+ G5 t9 L! l( u3 G* ^. A% O- d# o* \/ S3 t, @2 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, H4 L! K+ _) `4 t* A3 C$ I
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 L/ E3 N( q# }8 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* D: x7 b% |9 m5 r" r

1 i) j- U% w+ f  S0 c7 n  N, W
( ~% a8 ~9 {) B3 k. @8 q' B. ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 13:56 , Processed in 0.038668 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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