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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 D" @9 u( p% C% S4 f
  1. [code]EDMA sample test application
    " ]% E3 u2 p: t2 H
  2. /*9 d3 k) {8 t% x3 V
  3. * edma_test.c
    + K! H: i* x5 Y9 p5 F5 x& R
  4. *: _! G; _, l3 w9 L) b* b! ~
  5. * brief  EDMA3 Test Application) @3 ~+ {0 Q. x/ d- C: f
  6. *) c( V& U2 I( F- I$ s# F$ L
  7. *   This file contains EDMA3 Test code.# j4 K* o% B/ J# B) N" p) J
  8. *
    ' M4 G  O1 c$ R/ ?# N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! o7 U4 {3 u7 u9 U* k1 _' t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 s6 p. t6 c" b2 m- N3 z4 f
  11. *         TO CHANGE.
    6 O5 p* m7 s  |; @  z2 J% H+ N
  12. *( R1 t8 D/ R. T* w8 X) q1 p2 p' k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: @- K; Q& c, {* X3 }
  14. *
    3 x1 l9 Z* t" d( C# P  e$ V
  15. * This program is free software; you can redistribute it and/or9 m1 g! y, d( r5 q
  16. * modify it under the terms of the GNU General Public License as' v' a2 [' ?& V  |
  17. * published by the Free Software Foundation version 2.4 a7 Z9 I9 e* U9 U1 B. G9 g- Z- ^
  18. *
      U: i) G+ `9 U) X7 `9 I: \" C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 T- ]/ Y6 w6 g( ^7 t& t0 r
  20. * kind, whether express or implied; without even the implied warranty8 @3 l# f  U/ [3 ]9 }% Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 h& ^8 o* i& U( w, ~
  22. * GNU General Public License for more details./ b4 D3 V; [$ u3 ^
  23. */! ]+ P/ d. J; V, L  I/ L( c

  24.   I* [9 J) q7 |2 q
  25. #include <linux/module.h>
    & h  o5 N% G4 L) l/ m% h
  26. #include <linux/init.h>) D- s# H7 O( F/ l
  27. #include <linux/errno.h>- M3 m7 q, V3 H. B
  28. #include <linux/types.h>1 `  w1 }8 K. J" b6 b
  29. #include <linux/interrupt.h>7 z+ m0 o- r0 Y6 _% D2 v* L& K
  30. #include <asm/io.h>9 }8 ?' b  c" L% h& h5 y( W& e7 d
  31. #include <linux/moduleparam.h>' s" `/ H" E, z" h
  32. #include <linux/sysctl.h>
    ' [# R- X+ `% G+ _! ]
  33. #include <linux/mm.h>
    ; W9 L7 V  b8 r0 ?7 ~  i4 {
  34. #include <linux/dma-mapping.h>& C) S) ]+ q2 o6 N
  35. : }/ U/ ^8 A8 f1 Y  n& \2 ]
  36. #include <mach/memory.h>1 ?$ F! ^  c9 J, c
  37. #include <mach/hardware.h>: A3 m+ [/ m+ s" J* C/ ^2 B, l
  38. #include <mach/irqs.h>6 f' X4 R5 k$ F) _. i
  39. #include <asm/hardware/edma.h>
    1 y5 I" `) u  S5 Q0 P

  40. ( O7 W# |/ w. m* R  K
  41. #undef EDMA3_DEBUG/ w6 Y/ G# ~" c1 n3 u! d. q5 l
  42. /*#define EDMA3_DEBUG*/
    & D6 j" C2 p& N  `, {% w

  43. . K# S7 R8 Z+ S- Q4 `  b
  44. #ifdef EDMA3_DEBUG
    4 `$ |, K$ \) A4 U; J# X8 z/ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " ?. @) ?1 E, t  a. m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( y. z* `; u3 f/ R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; U- s, I# K, {' q5 d
  48. #else
    1 b" b  k0 a7 T( G
  49. #define DMA_PRINTK( x... )4 l! I. J2 n' z$ l% X, P
  50. #define DMA_FN_IN
    ! `) z2 G$ a3 N& z: R, I$ ]- I
  51. #define DMA_FN_OUT) O+ b  ^; Y' V% _
  52. #endif$ Z! L" G# u/ Y' o" l
  53. . G5 ~' s) S  z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! |# F) a0 y. y6 n/ U1 r
  55. #define STATIC_SHIFT                3; q5 w2 y; l8 B
  56. #define TCINTEN_SHIFT               207 z4 Q$ x# G( l" ~6 c; J
  57. #define ITCINTEN_SHIFT              210 V( _' P: Z2 z; z- `
  58. #define TCCHEN_SHIFT                22
    0 G& V' K: s7 ^. e
  59. #define ITCCHEN_SHIFT               23
    # {+ h6 k) h) v# Z6 y0 g: |
  60. * O% s$ U& }  D
  61. static volatile int irqraised1 = 0;+ G  i2 {2 I8 h' p; g" |  z
  62. static volatile int irqraised2 = 0;' V/ I; _! |9 C* A9 m
  63. " h4 j: h1 B! \1 T) u. {/ G  F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 H4 L6 M1 `! [8 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 {+ N7 `+ B* P& r) l# v7 }! S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z# D. |6 t7 X; u# K
  67. 8 G1 |, ?7 f, l: L& t7 Q8 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    ' b, @+ D9 C/ O7 \) q! q$ s
  69. dma_addr_t dmaphyssrc2 = 0;
    / I7 m& q4 M# ?& F$ L& R# [
  70. dma_addr_t dmaphysdest1 = 0;" N9 X9 ]2 W- k* c6 h
  71. dma_addr_t dmaphysdest2 = 0;8 _' D& p8 i: a: E. o% t
  72. - }- g* Z* d" |: H
  73. char *dmabufsrc1 = NULL;  _3 x3 }; q4 e: U
  74. char *dmabufsrc2 = NULL;
    , C2 I9 p' L6 f6 ^4 {1 K
  75. char *dmabufdest1 = NULL;
    9 I* }9 p% Y0 F+ b( @
  76. char *dmabufdest2 = NULL;
    2 r0 T( f- |! a1 Y5 n

  77. / ?6 b& {  G, o. \+ f
  78. static int acnt = 512;
    2 _; H* x4 [9 z: Q: O6 a
  79. static int bcnt = 8;  P' o& D2 r7 q& [  w. \7 T8 I7 ^
  80. static int ccnt = 8;; Q+ u! r% Z% p; g7 ^2 q8 Z2 R0 m5 g
  81. ' M" p' Y7 A5 H% l3 F& P
  82. module_param(acnt, int, S_IRUGO);* d) {5 J0 C) p. n* _( y$ t- E3 k
  83. module_param(bcnt, int, S_IRUGO);. U" F, _7 f5 A7 m) z7 I' O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 B3 W5 H  k3 j5 E5 m

( B8 F. g6 a6 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) B/ ^; M  n( N+ y: z# J/ G
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 s/ D: t5 s! M6 \9 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 M7 T# x0 [. D4 P' l4 ~6 \6 h

; X. e. y/ c& J5 K4 ]3 d) T; n; ~1 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 18:19 , Processed in 0.036783 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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