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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 b  u9 H" Z! X2 f% O
  1. [code]EDMA sample test application; g+ z0 F" X. A6 ?7 E
  2. /*
    5 }/ s9 s! P* G) u
  3. * edma_test.c
    1 l; C7 r. g* y; R9 U
  4. *
    6 @" E! Z5 q0 i/ j- L$ y
  5. * brief  EDMA3 Test Application
    ! `8 c! T5 A$ ^+ Y
  6. *) ^- m% J# S% k1 A% X4 Z
  7. *   This file contains EDMA3 Test code.
    , n8 O, r  R7 R4 @" A9 B
  8. *# f, b& ^8 U1 w( E6 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; s8 m" J) [  a# ?& T0 i) J# M0 q) P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ L) X* y2 s# j6 V/ l$ i' ^, |, t
  11. *         TO CHANGE.
    4 @0 T7 O4 j8 X5 P) m  Q8 c# g
  12. *( u, M8 l+ }; E' a9 D1 ?: L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ Q7 K( @( l' ~4 ~
  14. *
      i# D9 k$ Z' A# y) M( f
  15. * This program is free software; you can redistribute it and/or: |! R# u2 `6 x- v
  16. * modify it under the terms of the GNU General Public License as, W% O$ S. U  q6 T9 J7 h
  17. * published by the Free Software Foundation version 2.
    6 i% B2 e. L: ]1 t9 p
  18. *& N: n- V$ F. f! L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 E  |: F( R! |7 f* ^, w9 [
  20. * kind, whether express or implied; without even the implied warranty: R* I9 V- m. J2 R9 R  \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ?# P8 _* c( |' `$ c# f3 |, n
  22. * GNU General Public License for more details.
    ) h  Y7 j8 ?3 a* t. d
  23. */
    & Y" l- a3 F9 X
  24. $ M# k8 T7 ?+ v
  25. #include <linux/module.h>
    , p) b, H  }' W9 O5 `
  26. #include <linux/init.h>2 D% ], w) V+ _5 d) x
  27. #include <linux/errno.h>
    3 \, D$ c' E9 ^$ w: j% a
  28. #include <linux/types.h>
    - n! W& I, N* e1 x7 O
  29. #include <linux/interrupt.h>
    ) w1 }, V$ i0 k. S6 ~% h" Z: p
  30. #include <asm/io.h>0 j, d  r! M+ c" F7 [( ~
  31. #include <linux/moduleparam.h>. K( F9 @3 i, K
  32. #include <linux/sysctl.h>' G1 C3 s9 k" Q0 X+ S
  33. #include <linux/mm.h>
    3 j! u6 |- f- A6 p: v9 G
  34. #include <linux/dma-mapping.h>% \. t" P: s: m
  35. ) ~0 m* j2 W7 F2 n" C* z
  36. #include <mach/memory.h>" W4 z$ V; s$ Y/ L6 l6 g. u
  37. #include <mach/hardware.h>
    : V' `- c# u  H  [  W4 `
  38. #include <mach/irqs.h>( V. {; H; s% y& u! X/ u, `
  39. #include <asm/hardware/edma.h>2 h: H2 u  @2 ?) Y) `- L) `

  40. * ~% F* q/ J+ @. G
  41. #undef EDMA3_DEBUG
    : @- t0 M+ K/ ]6 }
  42. /*#define EDMA3_DEBUG*/' @* ?0 Y4 q" ^6 v, D9 b( E" x; ]

  43. 3 ~9 Z: U( {: X( ]. D
  44. #ifdef EDMA3_DEBUG
    & E( C  s; Z1 W# G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 V* N2 `5 Y/ [9 B% ~4 g$ @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) A4 m- Y8 n: E) K* V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i# ^  Y- H/ D& r
  48. #else
    3 y! X4 c$ c; N( B; ^
  49. #define DMA_PRINTK( x... )
    ( O1 b& Z& j5 q# k, J
  50. #define DMA_FN_IN) N3 ~3 f6 e" f3 ]8 f7 d8 Q; a
  51. #define DMA_FN_OUT
    , z5 f7 a& A7 \9 N8 c$ I/ v: q) A
  52. #endif' m- `3 M; v. H8 p6 _' z( a9 f2 K5 K
  53. : `: O6 I0 I4 B; n* U+ @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 b3 F- O/ ^& b4 o
  55. #define STATIC_SHIFT                36 N0 b5 c5 w! |) s: a
  56. #define TCINTEN_SHIFT               204 D: J4 f0 K5 D& w
  57. #define ITCINTEN_SHIFT              21
    ' v( `# {' X7 ^8 j7 _% [
  58. #define TCCHEN_SHIFT                22
    ( l/ B# M6 j3 g, C+ Z$ t0 n$ c
  59. #define ITCCHEN_SHIFT               23
    0 q5 v6 {: A( |9 b2 {6 Z

  60. 5 u  B! X; |, R7 M
  61. static volatile int irqraised1 = 0;
    1 c0 r' O  O$ W; q+ I+ J% p( r
  62. static volatile int irqraised2 = 0;! b+ Y5 p" ?5 L! U5 L7 ^
  63. & a/ Q) a3 `. Q& {7 ~4 o3 i& B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  O# p- v9 m7 z& p) [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 J* K3 H6 b# j  J* J" `# \# L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( u& b- p! F! ^' j! a

  67. ; m& j0 F4 C* r9 |& Z
  68. dma_addr_t dmaphyssrc1 = 0;2 [& `- P$ U4 E2 D7 X
  69. dma_addr_t dmaphyssrc2 = 0;
    4 f4 B, p, z( V% Q" a3 u
  70. dma_addr_t dmaphysdest1 = 0;
    0 V* U- S' o/ H' q9 y# o0 B
  71. dma_addr_t dmaphysdest2 = 0;
    1 H' _+ D3 E( w+ q4 c: n8 f
  72. . B2 s4 X$ k. R# t' f
  73. char *dmabufsrc1 = NULL;1 e: C; G6 S& o" k# r
  74. char *dmabufsrc2 = NULL;
    # A4 b# M& w, |' q
  75. char *dmabufdest1 = NULL;! L$ I0 j" \) b% ]. H4 Z
  76. char *dmabufdest2 = NULL;$ M3 ~2 P. c/ X

  77. 2 P5 u4 s$ a7 c5 I! Z
  78. static int acnt = 512;) J9 R/ w% K3 L
  79. static int bcnt = 8;9 h# F; \& B) O0 n
  80. static int ccnt = 8;
    7 [4 w: o/ e# c0 G2 p

  81. ) E/ C% Q0 N* x7 I( p
  82. module_param(acnt, int, S_IRUGO);% S1 g( B% q6 m" I' \
  83. module_param(bcnt, int, S_IRUGO);
    1 n, L6 H0 ]7 X5 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ t3 A% \6 ]+ x6 ^+ `
, I# C% F+ U1 N6 O  r' F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, R3 `, ]: O9 y0 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ^) \" ~4 T9 s  e0 ?+ R  {, I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B" ^1 x: Z" v; Q8 \9 k9 z! _( I8 z6 x. c$ e4 P  K) O
( s" N' V/ u) e2 z, W. \* a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 12:43 , Processed in 0.039903 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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