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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 D' i; A6 }0 z. B. u
  1. [code]EDMA sample test application
    4 e* P) S* Z% L8 K
  2. /*
    / L* o9 Z  b/ V5 b: N
  3. * edma_test.c
    8 g& ^  `, Z1 x% E
  4. *
    $ C3 I6 a6 r) c5 V' Q
  5. * brief  EDMA3 Test Application
    * a7 u) u" {8 o. a- X1 B
  6. *
    2 x7 v1 v" o' g) P7 Q2 I
  7. *   This file contains EDMA3 Test code.
    ) o9 Z( ?* f9 ]- q) G
  8. *
    $ ^0 l  w' r( ~0 s3 M/ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- L$ e# F& h4 [. h+ f$ c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 Q; g; e' V. C# q# A
  11. *         TO CHANGE.9 N1 A2 k3 x" J- Q- j7 `( d
  12. *. K, N4 j7 e6 d6 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" v2 E" L$ T0 X6 [
  14. *; t, O9 ^4 W+ s0 P" v5 z
  15. * This program is free software; you can redistribute it and/or
    & ^- s0 U* K, [
  16. * modify it under the terms of the GNU General Public License as
    / @1 D% E5 \. m9 M7 X! N# Z+ N. m5 C
  17. * published by the Free Software Foundation version 2.0 n8 V0 o3 h+ x) M
  18. *
    2 N- P; u2 Y. M$ ^( E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" x: w7 |1 B% B  \+ a: @
  20. * kind, whether express or implied; without even the implied warranty1 @; ?/ W6 p5 r2 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - T: J. _( ~! j  c! o- e' k
  22. * GNU General Public License for more details.
    7 R; O# Q1 F+ D& n6 E6 a( X$ U4 H
  23. */+ w3 U" L3 f; |; p6 O# r
  24. 4 }7 V( `5 O  h0 f4 i, _0 T. l( i2 U
  25. #include <linux/module.h>
    - \% B! f% d+ A& J0 Z) Z
  26. #include <linux/init.h>) a/ R) R0 h; r6 I
  27. #include <linux/errno.h>; }. c0 _* j: R; A" \! D, l, x$ D
  28. #include <linux/types.h>
    , c0 I5 D# A. u# ]- @; g/ B4 F
  29. #include <linux/interrupt.h>+ T- ~! U0 G' Z. y$ G8 U
  30. #include <asm/io.h>
    ( s9 I; r0 Q1 h5 z
  31. #include <linux/moduleparam.h>
    9 ]1 D; y1 ?& y& o- w, G7 c
  32. #include <linux/sysctl.h>0 \) r( J/ }& ^- G
  33. #include <linux/mm.h>5 o  Z& T$ X, B& G
  34. #include <linux/dma-mapping.h>
    ( E1 @% m- r, k5 P6 D$ r

  35. + C5 I7 d) c" i# v  q3 h0 @) s. n
  36. #include <mach/memory.h>. {1 z) a; ?4 ?! H$ Q9 ~
  37. #include <mach/hardware.h>; p- C; K8 R& G% g. o( p% t! \
  38. #include <mach/irqs.h>6 v6 z1 e$ \  q; m
  39. #include <asm/hardware/edma.h>1 X; ?4 o1 t! T, H: {! T. B

  40.   ^, B5 h) q5 t( k% z, W
  41. #undef EDMA3_DEBUG, N! y4 U& n3 i( C2 B
  42. /*#define EDMA3_DEBUG*/
    7 S+ Z( A, k" m- t! ]0 j; R

  43. 2 C, U' [( T  v& ^8 \7 F
  44. #ifdef EDMA3_DEBUG
    9 j' {/ q: S8 L. D6 y8 C/ \; }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): u( H* H0 z% p+ q, N# O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 G3 ^9 |5 E2 ^; D8 f3 p  v6 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! a4 u4 f! X) b7 G0 H: c0 u
  48. #else3 J/ K4 a& u4 L6 h9 p- H) ?
  49. #define DMA_PRINTK( x... )
    6 J. a4 v7 x% R3 h* R& K7 R
  50. #define DMA_FN_IN
    2 q- `( j. i+ U
  51. #define DMA_FN_OUT4 y# P0 U+ |9 \
  52. #endif
    / s5 y( }# B8 q3 f) ~2 Y. G

  53. : R) K9 |+ H% b# N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- h' h: t* v* \, P
  55. #define STATIC_SHIFT                3
    , z( e+ N2 }$ y9 _
  56. #define TCINTEN_SHIFT               20
    % X% Y% q; m7 a8 {" j/ K1 w
  57. #define ITCINTEN_SHIFT              21
    " ?% d! X, F* a( S8 M
  58. #define TCCHEN_SHIFT                227 _- s: @, t2 ]0 }  \
  59. #define ITCCHEN_SHIFT               231 n- G: p$ K; f2 d2 X

  60. 1 |- C5 d- J! F$ L
  61. static volatile int irqraised1 = 0;1 q0 Z. s8 a9 s$ q1 f* P8 i: O
  62. static volatile int irqraised2 = 0;
    0 G+ P0 w9 I( ^! x6 j. g
  63. 6 p. X: O: }- h, l8 S9 L, m" A0 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 l! i) G4 s2 w( t2 W1 e" u* w( ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 {! A! l: ^1 X, K0 P! o. \( ?, A, a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      M$ I$ g( @6 I$ l4 t7 ^

  67. ; k$ }  k0 A& E4 {7 l
  68. dma_addr_t dmaphyssrc1 = 0;
    + C4 O3 N+ |) t* M
  69. dma_addr_t dmaphyssrc2 = 0;
    8 t" G+ h# s5 Q
  70. dma_addr_t dmaphysdest1 = 0;9 }1 W2 P4 O0 M) T/ e
  71. dma_addr_t dmaphysdest2 = 0;
    + q4 w+ d7 P# j5 g' g
  72. $ R* b4 S6 w9 z6 N4 ?
  73. char *dmabufsrc1 = NULL;7 |  v! x: ^1 K
  74. char *dmabufsrc2 = NULL;
    8 l6 R4 M4 g( l- [5 i$ R7 l
  75. char *dmabufdest1 = NULL;
    6 R8 N. \7 ?2 ~
  76. char *dmabufdest2 = NULL;
    ) M) M4 H) s$ U3 \3 d' N

  77. ; U) T4 I+ T# n$ N- N7 E4 y7 @8 K1 c
  78. static int acnt = 512;/ z4 `; G" E  P4 j, P  Z
  79. static int bcnt = 8;+ V! O3 G9 M- A+ w6 D) K
  80. static int ccnt = 8;
    % f% H& T  Z* \9 Q. `

  81. ; Y2 w) T: z! r' d
  82. module_param(acnt, int, S_IRUGO);2 p& Q/ d: ]0 m" p
  83. module_param(bcnt, int, S_IRUGO);% c; H# y8 h& R/ b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  |. V0 ?/ }4 ?! `3 @+ i2 o! z8 U* {. W5 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 _9 B0 }) O2 {
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 r4 Q5 P3 S  h. Z7 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: ]9 p4 f- K9 d
5 N* a+ E6 O/ \' u

) {" U5 M* |- l# f( |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 04:59 , Processed in 0.036946 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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