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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- U3 L1 }# o: W3 v8 v
  1. [code]EDMA sample test application
    5 x$ O% _/ U9 a1 a$ K
  2. /** g! V2 h+ R9 {* Z$ i
  3. * edma_test.c4 Z$ V5 \/ g% I. j; P# S" c
  4. *
    4 a$ |6 h" B  G, G" q
  5. * brief  EDMA3 Test Application3 t# Z" o1 k7 q) E* D& u
  6. *, j% U) T. A+ ]9 R) x( j
  7. *   This file contains EDMA3 Test code.0 C: V2 h$ l0 p7 _( D
  8. *
    . v) @1 }* W4 t8 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # |. d. I9 o3 Q, |( q  t/ u# Z8 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S' m9 `0 ^4 R
  11. *         TO CHANGE.5 Q4 ^! m/ q4 R" j8 s0 c2 n. P6 O
  12. *8 U" Q- B/ I; v# b) G) R" W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ]( _0 G& K& k# A) F% N! m) m
  14. *' U1 q. T3 C( D
  15. * This program is free software; you can redistribute it and/or8 k  T' o, E; ^+ z; q; ~5 H
  16. * modify it under the terms of the GNU General Public License as
      ?: z% A9 Q; b& i# d+ H# ~) C: r
  17. * published by the Free Software Foundation version 2.
    & ~! y" B. k, F; q
  18. *
    ' B3 S# s# i8 t  X2 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # E- |3 K# Z  P/ Q7 n0 L
  20. * kind, whether express or implied; without even the implied warranty
    * l8 `& V) f# s, _3 s+ h4 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 V' y# N9 L5 H6 E0 H
  22. * GNU General Public License for more details.
    . _, n/ S/ x( V6 }6 N& k
  23. */
    / ?; Y2 E! }0 F6 o9 {2 c- N' V

  24. 0 g6 J( l8 b' d% E3 c! z* ^
  25. #include <linux/module.h>
    ( A* G5 S  \" _. V
  26. #include <linux/init.h>$ _7 a8 M* }+ T2 W
  27. #include <linux/errno.h>
    . d3 n; n9 C9 t& J. M2 x9 y
  28. #include <linux/types.h>6 [( @# {) n  k+ }
  29. #include <linux/interrupt.h>
    0 M+ h; }9 j) @. Q( ^9 @
  30. #include <asm/io.h>
    7 i6 L1 q# Q6 l& f3 N  ^5 T
  31. #include <linux/moduleparam.h>$ m$ L2 X/ K: w+ m/ X
  32. #include <linux/sysctl.h>
    ' H# n( y) M  v! ?+ f$ b
  33. #include <linux/mm.h>" y9 f. ~& ~3 P4 ]/ S
  34. #include <linux/dma-mapping.h>; l# j) C; O. E7 I3 v$ T' [' V

  35. 0 p5 @- V/ O5 e
  36. #include <mach/memory.h>  ?0 D+ ]& t% n2 F
  37. #include <mach/hardware.h>
    ) E* U: x- O9 `2 {1 q- @2 i. r* N
  38. #include <mach/irqs.h>' j) i$ g* _  w5 S# ^% ~
  39. #include <asm/hardware/edma.h>
    ; \5 a$ ]# D' g6 r; ]# k  ]* Q

  40. 8 I9 k7 v) J* o% w5 B# R8 f
  41. #undef EDMA3_DEBUG8 f5 t6 w4 O2 w' X
  42. /*#define EDMA3_DEBUG*/
    8 X' @1 y: B9 K! ]" Z
  43. 5 _0 E3 e* E' S" F& X! n
  44. #ifdef EDMA3_DEBUG+ a8 k- I3 [! B" D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * c0 e' ~$ ^+ M+ b9 z. g$ Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 {. [7 {; g9 i7 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 o7 ]: \6 u3 z( b5 n- @( O" b
  48. #else
    ; H7 ]* N" g, }. j( O
  49. #define DMA_PRINTK( x... )
    8 r& o0 J8 M' k3 ^  Y- {/ t
  50. #define DMA_FN_IN/ u9 l* z: v: d7 y1 @0 L4 k
  51. #define DMA_FN_OUT7 L- ]7 n' U: [+ D. Y# U1 k
  52. #endif
    9 f6 |0 f. m/ w9 A2 s) n
  53. : O' \, p8 H/ R" e0 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      J- B2 h. t9 p
  55. #define STATIC_SHIFT                3! H2 O( T, [+ Y# o! _
  56. #define TCINTEN_SHIFT               205 ~9 `, R+ I. L3 W
  57. #define ITCINTEN_SHIFT              21
    ! R1 Z: d! {- L2 V( A9 y
  58. #define TCCHEN_SHIFT                22$ ]# x$ I9 I+ Z# `  W3 [( I4 _. I2 a
  59. #define ITCCHEN_SHIFT               235 N; v9 \% h2 \( M  N
  60. * v9 E9 r# s$ M, Q1 g
  61. static volatile int irqraised1 = 0;" V, q7 O8 ^6 D
  62. static volatile int irqraised2 = 0;: w" h' l" q- ?) W

  63. " R  v) @' D9 J, W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , b: M0 c9 x( l3 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      u5 f+ z. o& i4 L( m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z2 W$ q; a5 r
  67. ; }) p: v* @' |3 }
  68. dma_addr_t dmaphyssrc1 = 0;
    ! Z3 V2 K# w9 g0 I4 T1 M- N
  69. dma_addr_t dmaphyssrc2 = 0;! N$ R0 i/ x4 {( x6 y# Z
  70. dma_addr_t dmaphysdest1 = 0;
    5 v; M/ e& }' I( i) \2 Q
  71. dma_addr_t dmaphysdest2 = 0;
    3 N1 v# v1 c6 f

  72. 6 T* ]" A) t6 q+ x4 r
  73. char *dmabufsrc1 = NULL;
    ! y% M& H% L2 U. s, n& ~" a
  74. char *dmabufsrc2 = NULL;# c' P' H) d& e3 d1 s
  75. char *dmabufdest1 = NULL;* X) e: W) S, }8 t4 O2 M$ j/ f
  76. char *dmabufdest2 = NULL;6 L3 {$ y6 D( D+ y2 M
  77. 9 y$ e8 j! `5 `9 ?- I2 t- M" n
  78. static int acnt = 512;
    1 \; b% ~% J" c8 h8 S+ N/ b
  79. static int bcnt = 8;" b1 r, r# `3 x" j* ?
  80. static int ccnt = 8;
    " S4 p4 _+ a3 |, q5 V

  81. : Z/ Q1 U' q! w5 b$ A1 m
  82. module_param(acnt, int, S_IRUGO);( \  l2 C/ u' j6 k
  83. module_param(bcnt, int, S_IRUGO);' _! V( J. T6 Q- B, \( K- Z+ t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' J  Z( V* u$ t3 v& y
9 y, ?5 y! N; e3 m* P+ g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 h; E* U4 o) |( |7 ~* A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) {: Y9 K, T3 k4 K* e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# T8 {: u2 G& O1 ]" x) _0 u2 J/ E  P6 d
# q3 s# g/ o' O/ l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 22:50 , Processed in 0.035935 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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