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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 \6 c7 n5 V) d
  1. [code]EDMA sample test application
    " S7 V) V  R. W) \. `
  2. /*
    7 A2 G% F  A5 f& A9 ^3 r- F! y
  3. * edma_test.c- f* ?! K! [/ q9 k, m. x$ L- F0 ^
  4. *
    # V* f$ W  }5 l2 Y4 L! i
  5. * brief  EDMA3 Test Application
    : c' ~2 q, f) ?; Z4 I9 h
  6. *
    0 O1 Z: s4 r* @8 J" y) Q! Q
  7. *   This file contains EDMA3 Test code.6 O  g. \7 h+ Z$ Z7 _
  8. *
    9 c* B" Z& s" x$ c8 @( R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 |9 v/ |5 G" i/ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 E& U# D  d0 s& a
  11. *         TO CHANGE.
    5 s8 W3 P5 A: V. g9 D, n. N/ ]/ ?
  12. *
    ; V. c9 _8 C( [9 n, H/ y- Z  X+ T) [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' b0 ~7 ~+ R- o. u0 J$ e& I
  14. *5 a$ b. B/ s! o) S# E* k9 X$ u
  15. * This program is free software; you can redistribute it and/or
    + w0 A2 A& r4 K6 o
  16. * modify it under the terms of the GNU General Public License as
    " j, S) h- z! Z3 s  h7 B7 G
  17. * published by the Free Software Foundation version 2.6 T, U: {, P6 Q2 @
  18. *( C$ g4 C% [' ]8 }1 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - S: F7 {, x/ ?7 g, @4 h: C
  20. * kind, whether express or implied; without even the implied warranty+ m/ H4 S" ]  X5 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) O! {3 R9 B& K# j) V
  22. * GNU General Public License for more details.
    3 h8 A7 n  i4 u
  23. */( L3 Z9 r$ z" U6 x

  24. $ H" a/ P0 m$ S6 a
  25. #include <linux/module.h>0 O4 V5 m+ m8 v: r! z7 `- }- S
  26. #include <linux/init.h>
    1 \9 @5 f% s0 z& X/ \( i% O& x
  27. #include <linux/errno.h>
    7 Z1 d2 \& w/ ?& e' O8 Z
  28. #include <linux/types.h>
    4 Z1 I. y5 h8 G# X6 f
  29. #include <linux/interrupt.h>" L5 [. Q5 B8 N0 z0 n2 {8 p2 G
  30. #include <asm/io.h>
    # |8 h# y' ^* {& |) d
  31. #include <linux/moduleparam.h>, f- c. d3 [  M1 N+ q; s
  32. #include <linux/sysctl.h>
      B, T7 N7 |/ ^% L( z0 ^
  33. #include <linux/mm.h>
    4 f8 [9 f2 o! e9 H& R/ m; n
  34. #include <linux/dma-mapping.h>9 q) W3 X) J" k9 z: l$ H
  35. ' N& f7 f, v2 w7 a
  36. #include <mach/memory.h>
    5 D8 d  {8 p  l; G  F$ E
  37. #include <mach/hardware.h>
    " k. m- `5 K: H. e/ ]$ D  H
  38. #include <mach/irqs.h># n, C7 {3 E2 I- s( {
  39. #include <asm/hardware/edma.h>* |- E- A6 }/ r( q" F
  40. % W7 K4 a+ s& J* Q2 L
  41. #undef EDMA3_DEBUG; Y: h; H% _! Y& r- X
  42. /*#define EDMA3_DEBUG*/
      j* q+ q8 l2 ?7 V  r

  43. , ^; T! E% L1 j
  44. #ifdef EDMA3_DEBUG' n, I" j3 Q9 h0 I3 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 f; f9 C& W8 U- [8 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); u. [" L( u2 s( m4 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( Q1 x* ^3 k: _+ a6 L# {, j' O
  48. #else' ]$ e  i1 r. e
  49. #define DMA_PRINTK( x... )2 }5 `0 |" K* J
  50. #define DMA_FN_IN, |( N  P" z- e6 ~* G$ F5 E/ I
  51. #define DMA_FN_OUT7 w1 w* b8 p/ X/ e
  52. #endif
    7 V- C' k" D7 ]; s) M) a; n

  53. + M' D  y. M, I4 `0 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  Q) Y8 e/ h& P: \% c
  55. #define STATIC_SHIFT                3
    % _9 i$ a& X8 I( z0 d. n% [8 _
  56. #define TCINTEN_SHIFT               20
    1 [6 M5 a( I2 q
  57. #define ITCINTEN_SHIFT              21  x! {( q7 l+ z7 k9 E9 ^) c6 {
  58. #define TCCHEN_SHIFT                220 |6 h- _% ]; j; l4 M  o
  59. #define ITCCHEN_SHIFT               235 ]9 h/ d, L$ E- x9 M2 l- p0 U% c/ W" p
  60. / J6 i  b4 c  Y# H' d
  61. static volatile int irqraised1 = 0;; c6 e+ s* Z) m3 v- @8 c3 ~! g
  62. static volatile int irqraised2 = 0;
    5 [/ G3 g: a1 F7 V' @
  63. 9 l2 b. [- }( O& S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 j3 e  k* h: O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% P" a; W! q9 c, ~' V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 A( g7 ?" g! i6 C

  67. $ f. n% W- Q8 s$ t* v0 M
  68. dma_addr_t dmaphyssrc1 = 0;
    $ ?# S; C+ w. O
  69. dma_addr_t dmaphyssrc2 = 0;
    8 _+ V9 p' i: S8 R* g4 K  p2 p7 t
  70. dma_addr_t dmaphysdest1 = 0;
    1 h; ]/ V* u2 F: x
  71. dma_addr_t dmaphysdest2 = 0;  u  e2 A+ M6 n% [& B1 u/ O4 r0 S
  72. " F  p) l; ^) J5 `) l: ?; [
  73. char *dmabufsrc1 = NULL;# R9 u( R8 O, w0 y7 [; F
  74. char *dmabufsrc2 = NULL;
    - T2 `- k: i( I
  75. char *dmabufdest1 = NULL;  k( D; p" V% e2 n6 `' K" s, [
  76. char *dmabufdest2 = NULL;
    7 V4 J/ q4 G- X/ K$ G: [
  77. - j7 ^  m& _  v" V7 c
  78. static int acnt = 512;% H2 E  x% |/ ~3 t
  79. static int bcnt = 8;& z6 B- o! X* n4 R6 J# |: V: F
  80. static int ccnt = 8;
    - c/ v' s1 d. Z* r7 d$ B! D. K
  81. * |6 ~( K, H- V6 a; J
  82. module_param(acnt, int, S_IRUGO);
    . N. B- N* i& x) A
  83. module_param(bcnt, int, S_IRUGO);$ l# D6 i6 {8 c! L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* i; D* U( S7 O, Y
3 ?, s" d& q% ?7 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# \! s" v  c. ]* M. L, q' B+ H* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 p, A: \) q( r7 L1 ^- a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ~$ q# Q  M8 ], q2 X
* k: ]! G2 s5 X, O$ D8 Y) x8 ~' ]* X* k8 V5 u# j* e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 04:48 , Processed in 0.037867 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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