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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 r' {/ Z- R5 d" L6 e
  1. [code]EDMA sample test application
    . N% B# v  b9 ?6 I1 D5 c
  2. /*
    & z- m+ p# T4 t9 r
  3. * edma_test.c
    6 h4 ]' k0 \: Q. K0 E7 F4 J2 k
  4. *: p- C" h) i  \( K, x
  5. * brief  EDMA3 Test Application
    8 `7 G' A6 e" B# D; ^
  6. *+ h( K: R, t' E7 I$ w8 J
  7. *   This file contains EDMA3 Test code.& D( H& e# d( @2 X* |; Y
  8. *1 R1 o# g3 F/ }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Y6 w5 h! o) ?- h- V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Q+ `. b6 b' A- {$ U( `' b
  11. *         TO CHANGE.
    : T! Q7 G& K" I; F9 w
  12. *" Q  M1 [; ^' A4 I4 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 x' x5 a8 a3 U9 o: n/ p
  14. *
    : [6 T* \) p: r- Y- O. n
  15. * This program is free software; you can redistribute it and/or) Y* Q1 b2 s+ F$ m& D  F& {5 F" Y
  16. * modify it under the terms of the GNU General Public License as
    * U$ u1 {4 A$ o  `/ _, M8 J
  17. * published by the Free Software Foundation version 2.
    0 ~) Q; w/ ^5 o! T3 |. B4 F% U7 S
  18. *) ]7 X) C& U& |2 u- ~' f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ b7 p1 Q- L# q  X$ ~3 R
  20. * kind, whether express or implied; without even the implied warranty2 T, V4 M* v7 d! ^  y, y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 @1 j7 s3 E  L0 C; ^) }* f: D. Q
  22. * GNU General Public License for more details.
      R3 A. }( M% {
  23. */
    1 W/ o% [4 P& `6 q# H$ s
  24. ; ~8 p' {' l# Q( f- i  s
  25. #include <linux/module.h>- q4 x9 j: o( x' J: k8 y6 T
  26. #include <linux/init.h>/ r( E) _; d& j+ C
  27. #include <linux/errno.h>
    ! V7 ?& ]8 T4 N; ]" P4 ]
  28. #include <linux/types.h>2 c& V7 [' m: \; U* `* V4 v7 x  o2 A
  29. #include <linux/interrupt.h>
    + L5 `+ X9 Y: Y! C6 e
  30. #include <asm/io.h>
    1 Y3 Y3 V9 _8 P7 o6 m
  31. #include <linux/moduleparam.h>1 W6 K) P8 \  Q" b' z
  32. #include <linux/sysctl.h>
    * p4 e( t' F% E
  33. #include <linux/mm.h>' V2 B" s% r, |7 e" l; n' a2 @$ \+ u. L
  34. #include <linux/dma-mapping.h>- b) D3 M8 H( T# o( O

  35. 5 i1 t9 a* B  p0 Z0 M1 y
  36. #include <mach/memory.h>7 ?$ [& y4 W; V  q6 L
  37. #include <mach/hardware.h>
    1 e, }8 f: c# \5 h1 A
  38. #include <mach/irqs.h>7 p* {7 }# o2 t' N: \, h1 w
  39. #include <asm/hardware/edma.h>0 l% d, g% ~1 i. J1 r: `0 V0 D
  40. 7 t# C1 w$ [1 f3 j# B
  41. #undef EDMA3_DEBUG
    1 }/ U$ L1 P, G7 X/ H0 M( E9 _9 t7 A
  42. /*#define EDMA3_DEBUG*/
    , Z) m& D$ o- ]/ l0 l; l& G
  43. ) [9 z) J) A$ G4 {% [
  44. #ifdef EDMA3_DEBUG: T% Q  j- a( @" z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( n8 U$ ~" Z6 C( B% X7 y% K% f. X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 F! a$ m& y; ^0 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 D/ |2 l# b5 V% t
  48. #else
    3 ?& |: k  {/ [5 Q" u, l' k
  49. #define DMA_PRINTK( x... )
    + G2 f0 V) T& V  o
  50. #define DMA_FN_IN5 {+ _; q: N' Y1 Z
  51. #define DMA_FN_OUT6 V. s% Y3 z( ^3 C4 _3 x8 ^
  52. #endif
    $ M. p+ K9 F; {0 I

  53. ! `" y# Z- K/ F' A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , E. [. `& t" z* b) q* s
  55. #define STATIC_SHIFT                31 U: _# t/ D7 B7 }# W; O7 L0 C
  56. #define TCINTEN_SHIFT               20+ S/ G" [0 p7 U3 h3 s0 U
  57. #define ITCINTEN_SHIFT              21" Y1 ^5 h! |0 ~8 z6 O9 ]; ]
  58. #define TCCHEN_SHIFT                22
    , u1 c' j/ U8 w# A. ]) {. w! O
  59. #define ITCCHEN_SHIFT               23
    ) z" J4 M' Y' l
  60. # [" l% O5 J* o3 F$ s3 z& V
  61. static volatile int irqraised1 = 0;
    7 q/ D3 u, u$ u7 h0 |9 s
  62. static volatile int irqraised2 = 0;. h- s& K+ J6 {( _  a/ j8 C/ i2 q
  63. : `9 O  y4 z: a0 \* {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 I9 h! p6 t9 {8 x1 l. }  x# V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o4 M$ _# w. E9 }( A+ M, j* m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( b; r; q7 Q; u! M/ c
  67. 5 u* w, S& v7 m* t
  68. dma_addr_t dmaphyssrc1 = 0;
    6 ~7 x& s0 o' m* V2 j
  69. dma_addr_t dmaphyssrc2 = 0;
    * G' }. d2 S8 S2 @- h% h
  70. dma_addr_t dmaphysdest1 = 0;
    . S' E1 k( y4 w/ U0 H( N1 M
  71. dma_addr_t dmaphysdest2 = 0;
      c0 w9 W1 Y( ?: @, A
  72. % a! `8 L: S5 S; R3 Z$ v
  73. char *dmabufsrc1 = NULL;
    $ N/ ]  Z; ], Z1 m
  74. char *dmabufsrc2 = NULL;1 j' M$ `9 c  C
  75. char *dmabufdest1 = NULL;4 P% O7 Z3 Q# T( `
  76. char *dmabufdest2 = NULL;
    ! D2 P3 U- Y3 t9 {# H8 e. T* \

  77. & ]4 Z2 l! j8 j; E, P  e
  78. static int acnt = 512;( ]7 @1 o) K0 J. g  u8 L
  79. static int bcnt = 8;6 Q% ]6 T; E* x6 [
  80. static int ccnt = 8;" ]% }4 W) o8 V: f3 `1 Z9 I
  81. : S% h. s% t; a3 }
  82. module_param(acnt, int, S_IRUGO);. ^$ {# _- m; v- ]6 t/ J
  83. module_param(bcnt, int, S_IRUGO);
      P/ j+ y  e" n3 B% N  F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- v5 }1 H7 F9 W+ G5 {1 c1 e# z2 W8 J* y5 R

6 [  J! C' J- `  `: N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% k5 u6 F+ z' _! I9 ?5 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- W" J3 o/ T5 b6 e8 m1 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ z3 _2 T5 B* |) F
7 D- N" t. B& T( }$ I3 }
3 p; E0 b( W/ ^! Z. |7 `4 n1 O  ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 02:29 , Processed in 0.042362 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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