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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 [0 F* W( _: o) f; R; q0 t
  1. [code]EDMA sample test application
    8 d8 z% n) @' l( o
  2. /*
    3 Z1 F; T5 h) \. ~
  3. * edma_test.c/ T. G, o( U# f9 E6 Z( V" r
  4. *
    9 J; U/ c: R4 M) }# [: i& P2 c
  5. * brief  EDMA3 Test Application$ }, ?' r& }& I/ l1 e, d: f9 B5 w" _
  6. *9 v; k2 c5 V! ]. E$ O7 g" H1 X
  7. *   This file contains EDMA3 Test code.
    ' Q" g9 V+ _: d' ~* _& |
  8. *9 K% h, i* I/ `# _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 `0 f; n0 i( l, |2 W/ W. h# q1 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 i3 P' |9 p0 Q
  11. *         TO CHANGE.
    " ]6 C# }. t' A- i. g5 a
  12. *
    1 i5 h# r8 h" O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! v; u8 i# ]8 o+ C. N- `9 G
  14. *
    % A: ~9 L% [8 T8 b
  15. * This program is free software; you can redistribute it and/or! H( E9 D/ \! T; Z" w
  16. * modify it under the terms of the GNU General Public License as' T3 @* T4 a6 F% F% c
  17. * published by the Free Software Foundation version 2.
    8 v6 L- r; o& C0 P- o. X
  18. *
    7 g' U( [. m. b! q6 i5 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 L6 l: X- \+ Y+ e& E' F  d- M
  20. * kind, whether express or implied; without even the implied warranty
    : p8 }6 f/ h4 |5 |4 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: ?+ a& g: ^0 H3 A) D& d
  22. * GNU General Public License for more details.
    / \% Y2 t% Y4 s
  23. */
    % Y0 J* Z0 z' ?8 D1 V( u& O

  24. 6 D, F4 E5 D3 M9 C" L+ _  s
  25. #include <linux/module.h>% k# _; b. @7 }+ k" _% L* q
  26. #include <linux/init.h>
    - F& p1 b. S1 y* Q$ E/ \  o; \
  27. #include <linux/errno.h>
    ; s5 N8 z. t' v+ U
  28. #include <linux/types.h>
    3 p% U! Y2 D3 }
  29. #include <linux/interrupt.h>+ t( U' ^9 Z( v) I0 H8 o4 A( H6 k
  30. #include <asm/io.h>" Y- M' `1 F4 c9 ?- k# H# @8 k+ v
  31. #include <linux/moduleparam.h>; @* H% K' Z1 {! p9 A3 M
  32. #include <linux/sysctl.h>8 z. h5 Z2 n, P+ w' v& J8 q6 o
  33. #include <linux/mm.h>8 I* T' q! `+ B7 a+ l! {7 P- H% ~: r4 p
  34. #include <linux/dma-mapping.h>
    0 ]; `7 B! L  P5 i

  35.   u0 w; k; Y" v' N* i, v
  36. #include <mach/memory.h>
    & b0 `8 A6 k" d0 L( |: ]
  37. #include <mach/hardware.h>
    $ \7 r$ O) n3 h# O9 c2 G5 Q2 a, f8 o
  38. #include <mach/irqs.h>
    - I) e1 }' u& R, }* U1 M( z' N
  39. #include <asm/hardware/edma.h>" D! d) B3 w9 {, F4 q
  40. 1 v; s# c5 X7 Q% j- W4 A
  41. #undef EDMA3_DEBUG+ f- R, _8 E) o( N
  42. /*#define EDMA3_DEBUG*/7 o4 s6 l; L4 R( x% t
  43. 9 Y% ^8 A0 l# K, O
  44. #ifdef EDMA3_DEBUG0 I$ f& Q. j# W# ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; s3 E. S: n1 W8 ^- }" X3 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), ^) d; \0 L5 `4 _) e/ w' E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 L. |! b4 x+ d, D: O+ X. r9 A
  48. #else1 P# X5 B4 `! v4 A- i8 P9 L+ I! d+ [
  49. #define DMA_PRINTK( x... ), }7 B& d( t- M- O* n+ S. |) U* l
  50. #define DMA_FN_IN- A2 E' s" D: G- q4 I# q
  51. #define DMA_FN_OUT7 w; ^9 x* H/ G! ]4 ~& \) [. g6 L
  52. #endif7 Y# q% T6 t# f' h+ [. ~
  53. + y! N% t. ^. @. ?' e' N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 q9 e+ q) J7 l: }
  55. #define STATIC_SHIFT                3! q6 s& Z( u$ o) F8 z4 L
  56. #define TCINTEN_SHIFT               200 F' `5 }7 M. ~& |8 g8 k
  57. #define ITCINTEN_SHIFT              218 ^5 H+ }. Y' M$ G5 q
  58. #define TCCHEN_SHIFT                22& W4 d3 c3 P0 D. _0 A. S
  59. #define ITCCHEN_SHIFT               238 x9 Q: W6 X4 ?0 z5 a9 @. ^
  60. ! |1 E1 h* x% D+ z' t; E' B# {
  61. static volatile int irqraised1 = 0;
    ' }( j- @0 r% g1 o6 c
  62. static volatile int irqraised2 = 0;
    9 Z9 m" A7 j& c% q0 I& s

  63. 4 a) J) ^6 |' p2 X4 P$ |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L: [9 U9 ~/ o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 k$ c  r8 f; U2 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ~( I/ v4 s7 l! {* J- W
  67. " r8 Q) e4 Z: ?: O: z0 A8 l+ A
  68. dma_addr_t dmaphyssrc1 = 0;
    : C- o" q, b; r6 q& v
  69. dma_addr_t dmaphyssrc2 = 0;, H; ?7 k5 A- n2 j' ^2 O
  70. dma_addr_t dmaphysdest1 = 0;0 d2 L" D; f- N1 O) @. y
  71. dma_addr_t dmaphysdest2 = 0;
    0 h9 S1 D( _* l5 {, F  {  {2 r

  72. ) @' {: N" D" D$ f
  73. char *dmabufsrc1 = NULL;8 ]5 L0 \& ]0 [; T# S' |5 w
  74. char *dmabufsrc2 = NULL;
    2 G. B; e% _0 q
  75. char *dmabufdest1 = NULL;' R& X. p9 l' \- d0 K% o9 E
  76. char *dmabufdest2 = NULL;  z2 ~) M' D: L0 }" I+ a, B
  77. & Q0 M9 ^0 h: f( h0 p" r
  78. static int acnt = 512;
    2 m; `, ^" K2 s6 z- @7 ]8 V
  79. static int bcnt = 8;5 _9 g9 E9 G% k$ N, I. j
  80. static int ccnt = 8;9 T& Q: D+ ]3 z( v# M0 M

  81. 2 L) F: H& [3 _' a
  82. module_param(acnt, int, S_IRUGO);
    0 D  |# c% b4 G
  83. module_param(bcnt, int, S_IRUGO);6 A8 a' f8 G; |0 h0 C( C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, h- O+ Z0 W0 ^8 S& H7 M
1 J; z# p( W2 x2 \6 K5 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 O. M4 T, O5 M+ ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 v& i  ]- ?6 ^& ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( O- e9 y$ V& O5 u& `" S( y7 N

/ n4 S2 P4 `) D6 ~8 M6 I3 D5 {1 R8 _6 A: M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 21:25 , Processed in 0.039225 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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