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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * \- S1 N# t& T  T5 @
  1. [code]EDMA sample test application
    ) R0 g  Q2 M( {0 ]  w1 J) Q
  2. /*3 g2 ~2 w5 f6 T3 R% i/ P
  3. * edma_test.c
    - d7 P9 ^* q7 O# _
  4. *& b' l3 g, H( w3 Q9 S; \
  5. * brief  EDMA3 Test Application
    ' I) j1 C9 Y2 c& L
  6. *" A' q" m( s5 \3 M6 @: H% D8 g
  7. *   This file contains EDMA3 Test code.& c2 u* x- _, D) P" v/ c
  8. *
    5 k5 ~+ P: o6 w- F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 C( d0 s- d6 S% L  g3 t: N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" {: F5 Z$ [6 {# |* X
  11. *         TO CHANGE.
    0 u8 z* j/ G& c2 [$ h# ]
  12. *
    8 m! A7 p3 v: _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% n9 E- q/ W! f( \& |8 ~
  14. *
    " E8 e  V* h1 A8 T5 m, I$ `: j$ l& {
  15. * This program is free software; you can redistribute it and/or
    7 i* K3 P/ \- U% w% [0 E  t( [8 ?
  16. * modify it under the terms of the GNU General Public License as
    , q% e! P) [  P2 c0 o1 w4 T
  17. * published by the Free Software Foundation version 2.4 a- T6 n) F6 g( c# y+ z1 u# ^  R
  18. *
    ( q2 [' G+ p  U) o! l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" r, O* j! i: Q
  20. * kind, whether express or implied; without even the implied warranty
    3 u- E/ C% E- G6 }! J$ \1 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& d' P8 u  y! Q$ |- E
  22. * GNU General Public License for more details.
    4 i* M( }# Y7 L3 W1 z5 G
  23. *// h: `& E$ t  Q+ J, \

  24. + N  W% K/ Q& `) N
  25. #include <linux/module.h>
    & H9 p) A. h: O/ g
  26. #include <linux/init.h>* j$ i8 L- g/ r) w1 m
  27. #include <linux/errno.h>4 D: `8 {- D4 R" E# ?* \
  28. #include <linux/types.h>8 D" D; L( D2 j  B# t' P
  29. #include <linux/interrupt.h>3 g, ?3 ]$ G" b+ M! B1 l6 W7 l
  30. #include <asm/io.h>
    ! s! R6 C) @; R* ^' {. ?* K4 B; W
  31. #include <linux/moduleparam.h>3 L1 }' c5 [" R3 F; |" @, |
  32. #include <linux/sysctl.h>$ B/ e- A) D4 e' ]( p) Y/ ]: J
  33. #include <linux/mm.h>/ A6 Z' O8 ], N6 Y& z  s! h/ _
  34. #include <linux/dma-mapping.h>/ y: G. e) I( G4 ?

  35. - D0 ^) Z7 P# f8 q
  36. #include <mach/memory.h>! m4 m' H1 L# l1 H2 F
  37. #include <mach/hardware.h>/ y% ~! M8 z; A3 K) e
  38. #include <mach/irqs.h>0 F; _& V/ x; ~- n
  39. #include <asm/hardware/edma.h>
    0 f5 U! |$ n0 Q6 ~$ F4 ?

  40. 4 r) X( U7 O+ h7 F9 `
  41. #undef EDMA3_DEBUG! T/ |2 r% C3 P4 R+ j3 @% y
  42. /*#define EDMA3_DEBUG*/
    ( Z  \: A9 v% f' S' O2 R; r
  43. 2 [" _" z6 }5 }* ]3 h8 ^
  44. #ifdef EDMA3_DEBUG7 V: y' m- C9 z4 G" Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , B* m# v$ G4 b; J4 N1 u7 c! \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! {, {, C7 W) H) r. O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 W/ l% P9 s3 s- z
  48. #else9 H) ^8 {  C4 A% F+ \/ e+ l
  49. #define DMA_PRINTK( x... )) X, @, J7 J  [: Q
  50. #define DMA_FN_IN: q( u) U8 L$ V2 G& @/ N" h
  51. #define DMA_FN_OUT
    5 f$ ?8 Q$ `7 Y. F6 ^: x
  52. #endif
    " h) ~' h1 E' t5 u% }1 y. a7 w

  53. + x8 f; s- b( W6 U3 n" b+ ?2 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % n" j* S! s7 s. P4 A$ y
  55. #define STATIC_SHIFT                3
    ! C; R/ a' g; ^7 H0 a  m4 T( T4 ^, G
  56. #define TCINTEN_SHIFT               20
    + V6 a, u. q0 d1 u5 X& L4 ~9 f
  57. #define ITCINTEN_SHIFT              21: W* `7 I+ H8 N" p" `  O1 L- u
  58. #define TCCHEN_SHIFT                22: A0 B, o8 [8 B* B/ a
  59. #define ITCCHEN_SHIFT               23
    ) R3 e1 z! Z" k, _& d& Y. j

  60. 9 t7 N8 C$ P0 l% I$ \5 {
  61. static volatile int irqraised1 = 0;
    # q. S6 Q) x# |5 l$ b- E
  62. static volatile int irqraised2 = 0;
    ' c! e& X; o! u7 r
  63. 1 {. S0 q0 p6 f1 j' Z% m7 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~0 i4 W) ]: y" P0 m* ~, u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' d0 Q3 ]$ T( n% J+ I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / N" ~* o8 O6 r& x6 Z% x5 Q
  67. ) B7 q9 v* ^, r- ~4 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    5 c: ]' D" P: I+ N: y" c' `! ~
  69. dma_addr_t dmaphyssrc2 = 0;
    8 `# u" v2 ^  K. t; ?+ X
  70. dma_addr_t dmaphysdest1 = 0;
    ! ^2 ~. s7 M1 ^* L
  71. dma_addr_t dmaphysdest2 = 0;4 X5 X- v2 U9 h7 }
  72. ( P. Z: r. g+ b' b; E
  73. char *dmabufsrc1 = NULL;9 E7 o/ T9 E9 K) r
  74. char *dmabufsrc2 = NULL;
    $ Y4 d' {) W$ B, U# R  M9 ?, Z! F
  75. char *dmabufdest1 = NULL;" F/ e3 B5 D3 E  e( t, {, {
  76. char *dmabufdest2 = NULL;
    / e0 Q- F4 ?9 I

  77. & S6 W. c- }& c" y( Z
  78. static int acnt = 512;" j: c% x5 p; f  b6 E1 N
  79. static int bcnt = 8;  h; ~! \, G: ]) d9 v
  80. static int ccnt = 8;7 U  Z! f. R6 C% M. |( i
  81. ) q" `, \  Q) U% _4 H# e" `: H
  82. module_param(acnt, int, S_IRUGO);
    * J9 j9 @8 T8 _
  83. module_param(bcnt, int, S_IRUGO);( M. o% T; J& s1 ]( A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 V5 l5 ], K1 M2 q
3 |$ y& W# s$ F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) c& I7 b9 o2 l: s8 t$ f* ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) f# I5 a+ \7 u  ?' Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. w( @# e- p4 e- ?+ [
' }% @- Y( u- o9 r7 C0 ^
  S* L4 w- H9 F% H' Q( s. ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-20 23:11 , Processed in 0.037604 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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