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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ k/ c: u, o" P8 v
  1. [code]EDMA sample test application  o7 |+ H  u# R5 ~. u7 G: `
  2. /*
    ) l! @; G* U# F0 T% r
  3. * edma_test.c, h, N: \4 m7 {" V% m) q; j
  4. *
    ; \: x0 _/ G( a: }" c
  5. * brief  EDMA3 Test Application
    ; k( M1 k$ d: |) \
  6. *2 Q/ t* C7 C4 R& W/ c+ k3 k
  7. *   This file contains EDMA3 Test code.
    7 I2 ]# X; x9 l- f* X6 s
  8. *
    1 x0 y" r/ Y( P' j) E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 I% y8 R! U/ e/ m9 z& c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ g. k+ z! ^* @0 i
  11. *         TO CHANGE.+ O, {0 q# v7 f+ ]  _
  12. *" C/ U. }8 n; x1 W/ W& R; `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 k+ ]" e3 J8 ~1 r, [: P5 S: @
  14. *) p+ f1 D; T+ N  a' J4 y
  15. * This program is free software; you can redistribute it and/or
    4 C: T  `* S/ c* ~6 Z7 {' Z  l" g% u
  16. * modify it under the terms of the GNU General Public License as
    2 A4 N4 I7 G$ k3 P
  17. * published by the Free Software Foundation version 2.( |; i. b# B1 z. s
  18. *" R7 b% m  T, O# F0 t2 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 D6 C* R' m  o! @! v
  20. * kind, whether express or implied; without even the implied warranty+ A4 l) T/ {& m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ O' W6 p  y' h
  22. * GNU General Public License for more details.6 a6 N. b+ z7 n4 f- j! l
  23. */
    : I% q; Q) f/ \( G) I

  24. 4 s1 X- h3 p+ |1 a. D: u1 x9 N4 A/ m
  25. #include <linux/module.h>: W0 O* ?* g0 J( r1 r
  26. #include <linux/init.h>
    3 q4 b: i* `& t/ b7 n  \
  27. #include <linux/errno.h>' S8 f! i& h8 x- ]) o. u
  28. #include <linux/types.h>
    + B0 ]0 j7 R: D3 s: e8 z
  29. #include <linux/interrupt.h>
    # o! H/ p9 b8 T# U
  30. #include <asm/io.h>; S* A* J! _* {$ L) h0 J
  31. #include <linux/moduleparam.h>
    ( j: N; v5 e0 y, {# K8 c/ o# ]9 a
  32. #include <linux/sysctl.h>1 r; x7 f$ f* }- L
  33. #include <linux/mm.h>
    5 j) b4 Y  h5 @3 h5 a
  34. #include <linux/dma-mapping.h>
    6 o* D. W5 G, q1 K" M
  35. - z' r6 U% r) A" ?, A0 D' }' P
  36. #include <mach/memory.h>/ ?& U, I) h  t$ I7 S8 y
  37. #include <mach/hardware.h>
    ' R9 t$ b* W9 E" M
  38. #include <mach/irqs.h>
    2 c% u! V" V* I! x
  39. #include <asm/hardware/edma.h>, L' B- C/ n0 N2 F4 Y9 l

  40. , I4 V% p$ ^/ ~- w
  41. #undef EDMA3_DEBUG
    , V1 H# m, y/ I4 \9 g2 K+ H
  42. /*#define EDMA3_DEBUG*/6 w6 ^$ w8 o. ]# q2 E
  43. ) E3 v/ W1 k% t
  44. #ifdef EDMA3_DEBUG( I- v4 K; P2 x3 a* p% M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      p; W. k9 w4 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  p& F5 m- b, D+ g. Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; @; G0 {3 K) V6 M+ H1 C! }
  48. #else
    / L. S# `7 b% M, o; S
  49. #define DMA_PRINTK( x... ): ]' Y" {( h+ M2 P/ [
  50. #define DMA_FN_IN
    ! ]3 K" W; J* }) \' ?6 K
  51. #define DMA_FN_OUT+ u. v2 M+ F) H, g" |* J
  52. #endif' l9 k! U; r8 W" b) Z7 f. x6 h  p' M, L
  53. ! Y) i  V8 r8 g- y  Y- z1 O2 L6 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 E* v7 K+ ?; _% B+ g2 c
  55. #define STATIC_SHIFT                3/ ?+ b1 [/ @6 D0 b4 a" B3 i7 r
  56. #define TCINTEN_SHIFT               207 ^/ S: F( Q) h. k# e- t
  57. #define ITCINTEN_SHIFT              21, c9 W5 }' i. G8 i' t! a3 L
  58. #define TCCHEN_SHIFT                22
    / a2 d$ K8 T) S
  59. #define ITCCHEN_SHIFT               23* ^8 g9 L4 B% l1 E( P: F

  60. - _) H% d! T% b0 g) a2 x
  61. static volatile int irqraised1 = 0;
    8 o' |; U% ?4 K& h8 A
  62. static volatile int irqraised2 = 0;
    : k3 }& U1 O' @+ p

  63. & C+ q$ n6 |) z  d  x% z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E+ ]& x% P5 A+ K9 S- A- E: z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% L) G' Q. K) B  f/ r/ [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( b6 ^6 u! Y4 ^* n+ S* R$ H9 ?" c2 \
  67. 2 U; s5 L3 R" o
  68. dma_addr_t dmaphyssrc1 = 0;% D) j* t, I; O  B" p" p9 g5 S
  69. dma_addr_t dmaphyssrc2 = 0;7 m% j& I3 s/ X
  70. dma_addr_t dmaphysdest1 = 0;+ `. l2 Q# ~( A, X6 r0 T
  71. dma_addr_t dmaphysdest2 = 0;
    + f  }4 d. p4 Y9 q5 h% M- f
  72.   `3 _3 e$ Z9 N5 }/ ~. b$ C) R. \
  73. char *dmabufsrc1 = NULL;7 R9 B* H; c# S
  74. char *dmabufsrc2 = NULL;& I9 a2 y# K& d+ u6 S! n
  75. char *dmabufdest1 = NULL;
    - Y5 V. o& z& t/ k2 W' }' U
  76. char *dmabufdest2 = NULL;
    8 Q: [0 O/ ^+ B# n
  77. 2 \# d# i( k! [; J
  78. static int acnt = 512;3 h: C# {: N4 D9 d2 f; L
  79. static int bcnt = 8;
    - \8 a& Y' q- q+ T" O0 W- l
  80. static int ccnt = 8;3 r: G. U$ I- P4 @; v+ r
  81. + d+ i0 K9 w: B5 ?0 F4 r, x
  82. module_param(acnt, int, S_IRUGO);5 l0 v) Y* m3 Y% D% \. t8 e
  83. module_param(bcnt, int, S_IRUGO);
    7 ]" ~8 o- U" N9 C1 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ Z( X  ?. t0 {6 f' @. J8 |; L0 J4 r( ^0 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) T: f/ C( ]0 E$ V; qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 G3 i; C; x) \+ ?$ u# g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- b  F: j( d7 p: G: ^
  s# X# k7 r# ^5 G$ c4 ~  D6 m% \
9 o' \/ D2 v4 ?- c% C' [2 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-23 05:12 , Processed in 0.045697 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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