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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : }5 Q- O0 g2 n1 w- s
  1. [code]EDMA sample test application
    6 ?, q! `5 U: @
  2. /*
    ; d5 b4 W6 X% O  k8 x' O5 N" A
  3. * edma_test.c
    2 b' s, m8 }+ f
  4. *) F+ S1 T$ q% M, }
  5. * brief  EDMA3 Test Application0 u$ J, `1 c- d' ]. _
  6. *
    7 z" X! ]+ c$ f4 v2 c* E/ _
  7. *   This file contains EDMA3 Test code.
    ) }7 m) p$ @. l& W& t
  8. *& d3 |8 ?; f* n: q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 \/ q: K; }& s7 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 s" P* ]& J. y8 t0 i9 E1 j" Y
  11. *         TO CHANGE.
    8 C8 ]1 k: s! @$ Q# P1 s
  12. *9 y+ I( q# J9 O# v6 ^5 {4 T/ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # q. q; v* q% X: ]# G+ _
  14. *
    ( F# a9 j" {9 W" q, V1 A
  15. * This program is free software; you can redistribute it and/or& b" b$ o- `" @
  16. * modify it under the terms of the GNU General Public License as9 I" g7 s/ a( x1 K( P) n9 G
  17. * published by the Free Software Foundation version 2.. w% @1 Q1 e' w5 t4 T
  18. *6 X' }: y  r  [& |: a( F, Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % C( c( z: d' s  p3 Y. Y% |
  20. * kind, whether express or implied; without even the implied warranty6 T  L4 j. a; h+ d7 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' Y* e2 V  ]4 V$ |
  22. * GNU General Public License for more details.
    ! p* D( Q% ?6 N% I$ ^: a
  23. */! u! {) E! C3 V+ R
  24. : z" {2 U/ y' p
  25. #include <linux/module.h>0 G5 i. k& X. ^1 A+ b1 z/ J
  26. #include <linux/init.h>6 h) }; \: U0 U
  27. #include <linux/errno.h>- _9 }3 |+ B! [: S3 @+ c
  28. #include <linux/types.h>
    4 G4 F  G  i, P* L* F
  29. #include <linux/interrupt.h>
    # E1 P9 z4 F2 ^; P# d6 s% o5 a
  30. #include <asm/io.h>
    5 J0 c" y, j2 Y( N4 H
  31. #include <linux/moduleparam.h>
    4 V8 g" h' E. y! q$ p; w
  32. #include <linux/sysctl.h>3 R. E# v9 Z- g9 r1 }
  33. #include <linux/mm.h>1 i, j; w/ |" w1 S
  34. #include <linux/dma-mapping.h>, |3 [3 f2 e7 C& B

  35. ( z# I& @! u$ n3 Q0 H. A
  36. #include <mach/memory.h>* T: A3 ?, }, W* I/ k8 h
  37. #include <mach/hardware.h>- f1 j; E: {9 R
  38. #include <mach/irqs.h>2 O8 ]: Z4 f8 @4 g" C, n' u! V3 ~+ V
  39. #include <asm/hardware/edma.h>: `2 l: k4 H4 A( W- f% Y
  40. 6 l9 p1 M* {! I9 t$ ]
  41. #undef EDMA3_DEBUG
    . L5 f$ z8 Y; S  U4 o
  42. /*#define EDMA3_DEBUG*/1 }4 ~- z/ n3 Z+ g# I: j% W
  43. & K- @  j7 l8 t- i/ s' r. l
  44. #ifdef EDMA3_DEBUG8 A* Q3 I5 {0 W- L7 ]7 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 C6 |# f2 {+ c6 N- ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( X% C& i( k) c' h) b; ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 B, t$ D2 J: _& \6 K
  48. #else, j+ ^4 c! [6 b
  49. #define DMA_PRINTK( x... )
    . l/ |7 q! |& q
  50. #define DMA_FN_IN8 h' V# k; @+ n/ ~
  51. #define DMA_FN_OUT  V0 I5 U4 o: L# |: G
  52. #endif% o& ~+ U8 ]: ]% T/ ?

  53. - k7 `3 t& U: q8 R' W+ {) b" f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      H' f# E" T; B
  55. #define STATIC_SHIFT                3
    7 ~  x6 g5 \3 p
  56. #define TCINTEN_SHIFT               20
    2 y% _% y8 Y  r1 m/ q; o8 h) N
  57. #define ITCINTEN_SHIFT              21
    + K) T* J9 ^8 d7 V
  58. #define TCCHEN_SHIFT                22* V% z- X+ S$ A* u1 \; y' l( \
  59. #define ITCCHEN_SHIFT               237 n4 I* o, Z; w

  60. ) _; W/ m1 L. `, [8 [
  61. static volatile int irqraised1 = 0;$ H! N2 D( X2 w0 i  ^# j& T3 N9 i
  62. static volatile int irqraised2 = 0;( _! O) [# I4 \; K$ _

  63. 7 U, a& M! W4 ?( X' y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l: B; t* G& w0 f7 ~. y: G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I& w& b# [$ F, [4 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; d, H- P8 `  [- w

  67. 8 h& ?" r0 v6 m! Q8 ^! \3 Z; |+ A4 W
  68. dma_addr_t dmaphyssrc1 = 0;+ Z# R8 V4 ?; `" a2 l* z$ j& B
  69. dma_addr_t dmaphyssrc2 = 0;
    ) f: r0 ~9 X7 h
  70. dma_addr_t dmaphysdest1 = 0;
    $ H5 `1 M( \2 Q" ?1 Y; x& m' j- R
  71. dma_addr_t dmaphysdest2 = 0;
    1 @1 Z2 G: `; z. A- x/ \# w1 K
  72. 7 k, E. q1 M5 E0 J3 A/ a
  73. char *dmabufsrc1 = NULL;# C. e( v1 ^9 p! R( U8 {3 q
  74. char *dmabufsrc2 = NULL;: @! P/ p2 ~/ n
  75. char *dmabufdest1 = NULL;( a! |. O7 h/ x/ `# h5 U4 H5 l- Y" ]1 V
  76. char *dmabufdest2 = NULL;
    ( ^# H$ H2 v& Z- A( t6 _/ E# {

  77. 0 o1 J: D, @* [  R$ g
  78. static int acnt = 512;
    ' @1 A5 L- V* @: E
  79. static int bcnt = 8;
    & C9 y# d: g4 N7 j; D4 {2 I
  80. static int ccnt = 8;
    8 B, b/ c0 J1 }+ O3 k% ]

  81. ) X( J& }$ G5 D" C( w
  82. module_param(acnt, int, S_IRUGO);5 A" a2 V; G- A' H- j" u
  83. module_param(bcnt, int, S_IRUGO);% ~/ ?1 U+ t- Q* Z; b1 h# H8 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ b( d6 u9 c9 T
: x0 A( E2 g' _, _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 w7 |( Z9 p; p# @- N3 r) ~" Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- `* Z1 |6 k! C) G7 _1 T8 ^. W3 |) H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# b% J8 L' \& K# T: p* ]1 D- d; }: `% {/ u

/ P' r- [6 U) _: b3 P" e, ~/ `& v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-27 17:57 , Processed in 0.040646 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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