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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   }  |# t$ B* s& ^% g; P
  1. [code]EDMA sample test application
    2 q! N" n) X7 b% B3 S2 c! X3 H
  2. /*
    6 D5 \8 M& p# B" _% i9 z8 h$ b
  3. * edma_test.c
    ( A; ~7 t  [/ r9 }' m7 M
  4. *
    4 s' e5 l8 R, L# Z+ t
  5. * brief  EDMA3 Test Application1 `: Q% R1 H, B3 r5 K
  6. *. ^* n' `* B, B4 |6 E# u
  7. *   This file contains EDMA3 Test code.0 z$ W- |1 [" F. k# [" e6 C% U' \
  8. *
    ! |/ {* g( _- y. q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - c: ?4 B0 R9 W8 q$ j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 g6 {: I: ?7 @+ j  g
  11. *         TO CHANGE.
    2 F( T. v0 Z3 B/ k# Z9 X2 G& y1 h
  12. *
    + h$ w, _0 {& q9 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 ^6 A  `+ c9 ]0 y: |! R7 R' x3 t
  14. *! V. y) Q8 B) S
  15. * This program is free software; you can redistribute it and/or! {( Q2 w% f" Z% M$ e
  16. * modify it under the terms of the GNU General Public License as
    ; O8 ?6 o( _, l" x7 j
  17. * published by the Free Software Foundation version 2.
    ! ?. v. u' C/ @& {9 z7 }
  18. *
    2 |0 z! s" t. Q% y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 w9 ]7 |3 j; u! P, b
  20. * kind, whether express or implied; without even the implied warranty
      O0 O9 u1 S& z9 Y; ^2 \% ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 n& d* x/ _( h% J) ?
  22. * GNU General Public License for more details.
    1 P( H; V# g1 K- O+ w  H% ?( c
  23. */, W0 |" t/ \: P# D
  24. 8 ]& l5 U: {5 `5 y
  25. #include <linux/module.h>+ ~5 y3 w; q" H2 r  Y1 _; K6 U
  26. #include <linux/init.h>* S& i; e5 h# X1 a
  27. #include <linux/errno.h>
    8 @# X5 f1 }. z5 L; _
  28. #include <linux/types.h>
    , u) _1 ?3 Q7 r1 }
  29. #include <linux/interrupt.h>+ X, r( ^8 {# Y& F! P
  30. #include <asm/io.h>. b) q) ~; K9 }4 N% j  A
  31. #include <linux/moduleparam.h>7 t( w& y7 A+ u4 n/ ?6 G
  32. #include <linux/sysctl.h>- n4 x/ M5 i8 n1 E' }% T3 [8 T
  33. #include <linux/mm.h>
    ; h  ~! ]# m, G6 Y8 W
  34. #include <linux/dma-mapping.h>( v3 H2 O. z( e$ s$ b2 \$ x- V
  35. 9 h" i! Q4 C( G7 _$ y. d% u
  36. #include <mach/memory.h>& Z. W3 |% ?9 Q2 H- Q& R* }8 V+ }
  37. #include <mach/hardware.h>4 i* Z7 |/ D/ e5 B. f* V5 m
  38. #include <mach/irqs.h>' y) j' C. C4 S/ K! O" Z
  39. #include <asm/hardware/edma.h>" z4 W4 F1 b  K  f/ I
  40. 3 t) O! ~. G8 f, l
  41. #undef EDMA3_DEBUG# u. M3 ^1 D$ @8 c
  42. /*#define EDMA3_DEBUG*/! m( ~- J) N8 m: _# B

  43. 2 g0 @# A# W7 I1 y8 G* T) m- K- p
  44. #ifdef EDMA3_DEBUG
    ! `% R1 n. i$ W  g- B3 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 e5 X+ e+ f0 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & O' `8 l/ x( c9 l  ]1 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( r% s$ ~/ S$ F" n8 f& E' h/ V
  48. #else" Z( I. C$ s$ e/ M4 J9 t: D9 y
  49. #define DMA_PRINTK( x... )
    , W3 Z0 \+ L' ~
  50. #define DMA_FN_IN
    4 ]: e, F% _0 B( }
  51. #define DMA_FN_OUT4 E/ S" K" Z: [' ~! l# K3 |
  52. #endif7 K5 T# a# }9 j3 p; Y

  53. 8 E) M$ O, R7 @8 i7 y) ~' c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  m7 g" N0 g+ o
  55. #define STATIC_SHIFT                3
    3 A* l6 a) Z. k- _& ~
  56. #define TCINTEN_SHIFT               20
    , O! u9 P. p4 B$ y& V
  57. #define ITCINTEN_SHIFT              21
    ' V$ o; _4 x9 ~- W: z% h7 C4 ?' p
  58. #define TCCHEN_SHIFT                22/ |& U, O2 H9 K
  59. #define ITCCHEN_SHIFT               23
    8 s3 P+ g- B8 x  M

  60. ) @: E$ O8 n1 m; X7 p
  61. static volatile int irqraised1 = 0;( m( N8 r; P6 L& V. [) f5 s% |
  62. static volatile int irqraised2 = 0;: H/ x* t6 a: z" k  w3 o. V+ S
  63. 5 s% M- g& w& B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . n3 Y; }4 C! x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F9 o, @( U2 h; ~' y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K4 P1 L9 `4 h8 g" m
  67. & m7 P0 |: W' C" z  u5 L5 T9 r' A& m* _
  68. dma_addr_t dmaphyssrc1 = 0;, N3 k. y* _; Y" T
  69. dma_addr_t dmaphyssrc2 = 0;
    & t6 H* h5 I0 N( \# N
  70. dma_addr_t dmaphysdest1 = 0;6 l. I  R! `# \  B+ Q" d5 V' P
  71. dma_addr_t dmaphysdest2 = 0;
      E) g8 t% V4 u' c  {  K
  72. . J2 S- Z$ O# H' x7 j# c7 |& K8 Y
  73. char *dmabufsrc1 = NULL;5 ]& U7 X- k9 L- L
  74. char *dmabufsrc2 = NULL;% u& g3 ?* R5 L: V: L$ c
  75. char *dmabufdest1 = NULL;. D2 C" f4 @8 v; a6 m. g, A4 ?- R
  76. char *dmabufdest2 = NULL;; g2 i0 |! p: _  i4 T+ [

  77. 4 o0 E) N5 P6 j5 E
  78. static int acnt = 512;+ m4 \) L4 M" R" b, y7 L
  79. static int bcnt = 8;6 d8 O7 }& e8 k' E" h
  80. static int ccnt = 8;
    + c) f+ x( {8 w! ^3 c: A

  81. & }0 ^9 n& c0 G& {1 H: T; G2 `1 H
  82. module_param(acnt, int, S_IRUGO);
      c# E3 e: c6 Z; o# A& n' \
  83. module_param(bcnt, int, S_IRUGO);! X6 Z. ]% D2 ^7 J6 u; x1 ^- z  U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; F! o, A" ], q% U4 N  I

; c* _3 V& ?8 }# a/ j- k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! y4 q0 ^# Y5 w* k6 D' Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 K* n1 s3 e! {5 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; C9 a! ]- P4 P) [) Z( l9 ^1 Y
7 [9 r2 g' Y) n7 i7 M4 R% f/ v$ U7 {( ]  q
5 Q5 G; i) h3 _; q  }, \+ A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 08:29 , Processed in 0.041163 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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