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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " p- C9 ?7 v3 K8 w  n
  1. [code]EDMA sample test application
    5 a& p; a& x8 m; i: p
  2. /*+ e5 T' j; F( P: d4 ^/ b
  3. * edma_test.c
    + Y1 X0 }: ]/ _8 k- T# l
  4. *; q5 M% A6 t' S' U+ h5 I0 {
  5. * brief  EDMA3 Test Application" L1 d8 v, }! F2 _+ v3 Y
  6. *# V2 z8 A/ W( Q
  7. *   This file contains EDMA3 Test code.- s9 l- B; z+ x* d% e  c
  8. *
    1 T) \/ Q, O3 P3 ~4 I3 q" a5 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& d) A' Q2 e/ _* b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % K% P6 Y; E0 x  c! V
  11. *         TO CHANGE.# N" O2 O$ r1 w8 A4 k
  12. *
    6 P. k: o! ^  p* W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / d0 ?1 o6 j0 \  W" W# X' }9 I4 H
  14. *5 [# w0 y% _9 i% ^, R2 \" l
  15. * This program is free software; you can redistribute it and/or* [3 q$ |8 ^8 G! s8 l
  16. * modify it under the terms of the GNU General Public License as
    6 Y  Q( }- a8 W+ F4 r3 a8 {
  17. * published by the Free Software Foundation version 2.0 B. E2 K7 ^: v( N; |7 z. a
  18. *  a% v- t/ d! t) x/ m; D" e+ e% S2 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) |9 i9 ?3 `3 }  g& m  U  `
  20. * kind, whether express or implied; without even the implied warranty5 ]$ k0 o# j: k3 |  p# T. l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + E4 }4 P2 b5 ]# o+ I+ H$ M9 K
  22. * GNU General Public License for more details.( M! L$ x& m8 o& i
  23. */- a5 x# A1 y( e7 M* o% n
  24. 4 u& f6 j& _/ s
  25. #include <linux/module.h>. ^# @/ ?* Q- J) b
  26. #include <linux/init.h>0 ~7 e- Q5 f( ]; j
  27. #include <linux/errno.h>2 T2 K7 S/ \& c2 R, j
  28. #include <linux/types.h>4 E  I) O( p; I. Z% g- I. X; h0 m+ z# |
  29. #include <linux/interrupt.h>3 N4 F# q; j' K' Z9 g) Q
  30. #include <asm/io.h>
    / Z2 X6 ]2 l% A) d9 B+ H" w' ^
  31. #include <linux/moduleparam.h>6 ?& y; ^# l2 l
  32. #include <linux/sysctl.h>
    ; K$ a" _$ ?  T# v
  33. #include <linux/mm.h>
      t: R9 [2 e" D8 Y: g1 ]
  34. #include <linux/dma-mapping.h>$ O4 N2 W: e4 d9 J* z

  35. 1 L4 P" R7 r# H
  36. #include <mach/memory.h>2 i! E7 ?9 ~) X' ~% J5 t
  37. #include <mach/hardware.h>
    " [  E) k& ], j* u- k' [1 m( W/ w
  38. #include <mach/irqs.h>
    1 J9 j! M/ `. q: J6 y6 {! l; l
  39. #include <asm/hardware/edma.h>8 t- w) f& ~) i5 e) M$ o
  40. ( O. n9 ^4 ~6 |$ _& |5 q
  41. #undef EDMA3_DEBUG6 U. M) Y7 H) I) B8 C5 Z! s+ n
  42. /*#define EDMA3_DEBUG*/  e1 C; K0 f/ _. [4 f8 k* M" J$ l

  43. 1 h& B& \, w' Q& l
  44. #ifdef EDMA3_DEBUG( Q+ U* O* c7 ^3 Z' ~3 w- ~# n3 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! b  A8 w" A2 c* Q! p$ @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 |7 b+ ~* l8 L$ f: b+ w  c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 E8 E) \) n5 O
  48. #else1 w1 [2 c  g8 ~7 e
  49. #define DMA_PRINTK( x... )& e8 L( a/ E5 A; T4 [' f0 R9 D* F
  50. #define DMA_FN_IN
    1 e6 K. L  F2 J( D
  51. #define DMA_FN_OUT
    $ v( p, l: O9 I; a
  52. #endif/ Q8 c- q5 _8 Z, K5 O5 h2 e) T
  53. + d, {2 u4 T& T) T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # w7 U2 ^9 |& r0 B: t
  55. #define STATIC_SHIFT                36 n6 q2 R% g( c* x% L& T8 N+ Z
  56. #define TCINTEN_SHIFT               20
    2 O* c- [" U# w5 f1 @- }
  57. #define ITCINTEN_SHIFT              21
    9 ?2 k+ n( j6 |* t
  58. #define TCCHEN_SHIFT                22
    : O* w* w- ?2 D6 B1 {- f% s& V
  59. #define ITCCHEN_SHIFT               23
    6 t; z, F$ Z. A) ?, ]

  60. . _% |( [2 Y: i7 _
  61. static volatile int irqraised1 = 0;
    * G+ N+ M4 s% f$ H
  62. static volatile int irqraised2 = 0;
    # }, Y0 v9 O7 z+ d) F! P$ c

  63. ; I, Z+ m! }% R/ I: h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 E, G% m* C: c7 U8 o  {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z1 x. d- b) n1 z2 C1 C3 |! t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u! {, [! L$ i) D5 j

  67. 2 E8 F8 _% g& {6 K% W
  68. dma_addr_t dmaphyssrc1 = 0;
    , `% }4 Q4 l' f- ]. i# i
  69. dma_addr_t dmaphyssrc2 = 0;
    & m0 e& j; P5 \/ I  |  U! d
  70. dma_addr_t dmaphysdest1 = 0;3 h' u' s( u) E6 x
  71. dma_addr_t dmaphysdest2 = 0;
    ( p' h9 K1 ]5 g

  72. ' I! ~+ [6 P# E" B( r2 K( ^& w* ~
  73. char *dmabufsrc1 = NULL;" h) x& F$ u8 x, ?9 q
  74. char *dmabufsrc2 = NULL;/ ~0 X2 O8 X# `* j5 C0 g/ B
  75. char *dmabufdest1 = NULL;2 ]7 Z2 d  v5 I- J  N$ a6 k3 C2 U
  76. char *dmabufdest2 = NULL;- V3 d; q1 H: @/ M) ?. o9 x% e
  77. ( w# G' {  v: g$ q7 r! x' C
  78. static int acnt = 512;- r) c6 h$ m& ~' u2 o& F0 b
  79. static int bcnt = 8;
    9 P( {" c* V3 Y! k. u. o8 X
  80. static int ccnt = 8;# G9 d& G, L8 a* P+ H# ?
  81. 0 e! L# C$ G, o+ K& A: e
  82. module_param(acnt, int, S_IRUGO);
      Y# w+ m* G2 I" l
  83. module_param(bcnt, int, S_IRUGO);. p/ \: T2 i5 x! R7 h5 F# b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( j0 Y1 m7 d1 R  f  W  J

. B: d5 @$ @) b7 W0 D  K( r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 f. b; K5 b, i9 _$ q' Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: S3 j+ u1 d  B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ p6 P+ ]! S8 D! x$ A- t; R* @
( D0 @/ b* H" {+ C' S  A; I9 t, r2 J! c/ }6 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 20:52 , Processed in 0.037080 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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