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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 k, V, K( w6 N, ^0 g
  1. [code]EDMA sample test application
    5 M7 N- ]3 U! g- m# N' m
  2. /*
    9 @" _, n6 ]. w. s! A7 y
  3. * edma_test.c: |9 A( B7 v$ g2 z! k+ h+ Q" u
  4. *6 K. s. H5 A8 K0 I+ t& F: K
  5. * brief  EDMA3 Test Application+ {" {* K: i9 k( J1 v0 [( ]3 i" a
  6. *" z( j4 u" q6 A. `
  7. *   This file contains EDMA3 Test code.
    : r% I3 Y( [  T! p. x$ a$ q9 X
  8. *
    5 U  j% x8 n$ g+ L8 v0 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. C- J( Z$ T, {& Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( w, b9 j; d9 y) r* r
  11. *         TO CHANGE.
    , Q; X1 ~: P6 E
  12. *
    4 m- |9 }5 J8 C. k0 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . u6 F. y$ y, {/ A/ r: \
  14. *
    ; t$ j% v7 _: U8 R! e& \
  15. * This program is free software; you can redistribute it and/or
    ; d6 U% J/ X8 P2 @7 ]
  16. * modify it under the terms of the GNU General Public License as
    6 d! E0 k1 b3 U2 y
  17. * published by the Free Software Foundation version 2.! X$ i% T6 x! Q, y8 }0 [2 i7 B
  18. *
    8 V& M. A0 B0 y% q5 _/ p5 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; o% W' i8 @1 |/ B
  20. * kind, whether express or implied; without even the implied warranty& B8 i9 Z' F8 ~. P1 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ @+ s. [3 [2 W
  22. * GNU General Public License for more details.
    0 ?4 S0 \  \9 z& B
  23. */
    # {& x- X8 j# Y
  24. / p+ z! y+ |0 G* z3 x- i2 Z- F
  25. #include <linux/module.h>
    # b  B2 ?3 q8 }$ n8 P
  26. #include <linux/init.h>7 l( h' S8 g$ k8 {0 q! B$ c6 W' [
  27. #include <linux/errno.h>
    / F5 j! n* g( E! C" ]+ C1 g; i
  28. #include <linux/types.h>
    - c2 O7 o" p3 t* R
  29. #include <linux/interrupt.h>: L; P! n, n' b* w( U: p# Y- z$ m
  30. #include <asm/io.h>
    . N! J2 U2 E9 r1 u" l
  31. #include <linux/moduleparam.h>% Z4 m; h9 {  ?
  32. #include <linux/sysctl.h>* Z+ m8 p/ D+ z
  33. #include <linux/mm.h>
    0 r+ W  N3 W$ e# |' c; b
  34. #include <linux/dma-mapping.h>
    # N. Q8 q: h- X: n" G0 ^+ D
  35. ) g2 ^' J4 e" S1 {' E9 ~; I
  36. #include <mach/memory.h>
    * |- A6 I5 e; \
  37. #include <mach/hardware.h>3 W; Z. B5 f3 `$ k
  38. #include <mach/irqs.h>
    # K$ b) `6 o/ z7 ~+ `
  39. #include <asm/hardware/edma.h>
    , [  f! c% v# Z! [4 u1 T
  40. 5 I$ Y- T- o8 z' j
  41. #undef EDMA3_DEBUG
    $ ^6 s+ p4 i5 M  g+ i; u; P7 \
  42. /*#define EDMA3_DEBUG*/% ~- \( v8 Z8 S# `" G4 h4 r

  43. ! F! E0 C% n; e6 O, G; K
  44. #ifdef EDMA3_DEBUG
    ( i+ I( X6 X  r: T5 e1 J& Q9 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" W) G7 {9 t# E4 I8 G. s0 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ V: K( T( Q6 k8 W) T! n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 x6 W: A) z3 V2 U- Z! y
  48. #else
    2 s; C9 O/ H8 t( e5 i
  49. #define DMA_PRINTK( x... )% l2 M2 A2 m2 _
  50. #define DMA_FN_IN
    * p, V6 k7 H2 G4 k: V( W1 i
  51. #define DMA_FN_OUT
    4 E1 R. F% f& w6 {/ c/ |6 g" `! Y
  52. #endif7 @  \5 b: A8 W
  53. 2 ~/ {- r8 }  |& \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 @' J2 k, g  f6 z& V2 E
  55. #define STATIC_SHIFT                3, ^: k, H- s5 X" v8 o1 t, @, Q: D
  56. #define TCINTEN_SHIFT               20( r& g) |* ]% h# K
  57. #define ITCINTEN_SHIFT              21! @+ M5 a' J4 V9 P! a; |' s
  58. #define TCCHEN_SHIFT                22: F2 O; X7 K- a6 K* S9 [& F2 P
  59. #define ITCCHEN_SHIFT               23
      [" B3 }# h) D# Z
  60. ! c* C, T6 c- `% q
  61. static volatile int irqraised1 = 0;8 w5 @8 _$ T: p8 l
  62. static volatile int irqraised2 = 0;
    + S) _! G* [. i. Y
  63. ) N" j  V) D3 n% J: h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* B" `$ j, V: i: I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& f9 m1 L) V6 `( }; K2 a$ B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - E" F6 H8 `$ L* I' F& B& L  n6 i+ b

  67. % \. N7 u& h, \$ |( J2 M% ^
  68. dma_addr_t dmaphyssrc1 = 0;5 Z3 S( i1 O0 |/ C1 O6 }0 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    " I( `" G5 [7 w  `7 u* w( s
  70. dma_addr_t dmaphysdest1 = 0;
    1 B. t9 H$ C! M6 x9 @* J
  71. dma_addr_t dmaphysdest2 = 0;
    ! L. p3 |6 h) B8 M, l" R- f8 d
  72. ' [4 D" B  u3 i- K) |
  73. char *dmabufsrc1 = NULL;* x, Z* p& D7 ^5 b  Z' V
  74. char *dmabufsrc2 = NULL;( j' ~5 V! H, `3 ^- P
  75. char *dmabufdest1 = NULL;/ o) X. o) Y; P' Z! U6 w* k
  76. char *dmabufdest2 = NULL;9 h2 u7 a& }7 [6 U

  77. + t* D& ^! F( `4 b( |
  78. static int acnt = 512;+ o4 C9 n4 W4 h: d! f
  79. static int bcnt = 8;
    5 {% {6 I2 Q8 t8 o
  80. static int ccnt = 8;2 A- o0 U4 i; t* R
  81. " L) f0 ^+ k8 {+ g
  82. module_param(acnt, int, S_IRUGO);
    $ k' t7 @# Q) W0 }5 H8 \2 M
  83. module_param(bcnt, int, S_IRUGO);
    - U: }& V7 _6 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& _; `! j& F4 r4 w; S0 H

% C5 H, m( `6 z2 s) r/ }# k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 q0 G/ y. v; s- t; U: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 s# L) ?- Y& L+ r* _5 e' c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 r" ]) n2 M1 \! S& d0 T7 y; J9 t/ Z0 J

- J  u. I5 n4 z+ d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-3 21:45 , Processed in 0.047462 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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