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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F" w$ u' B8 X8 _( A
  1. [code]EDMA sample test application7 M8 @! E" P. a- s# q  D. U
  2. /*8 H/ g4 C; e+ r
  3. * edma_test.c
    6 X1 \' i' H- u4 L
  4. *
    : ?) @% g7 j8 M6 A
  5. * brief  EDMA3 Test Application/ ]2 z; j& h3 Y0 b& p5 z
  6. *9 l6 K: U9 x5 ^: A
  7. *   This file contains EDMA3 Test code.6 z7 U5 s5 G+ @2 E2 `5 w# o
  8. *2 `2 j# d6 x# |* m$ L: _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- T- I. ?2 {3 B( X  z7 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- R/ T. y" V0 i
  11. *         TO CHANGE.0 C: D  I6 Q/ Z3 {% U
  12. *
    ; h, z/ R# S4 t+ l6 ^) i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 C& Y  i- f5 P5 ^
  14. *6 y' p' P' F. g
  15. * This program is free software; you can redistribute it and/or# d1 p9 g0 G; W) J5 N
  16. * modify it under the terms of the GNU General Public License as( G* m1 \+ n* C7 w- C
  17. * published by the Free Software Foundation version 2.
    ) H7 _: n  A# Y, D+ H/ s
  18. *
    8 ?: d6 O' |* [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 a! d( w  [- ]. e  T" ]% D
  20. * kind, whether express or implied; without even the implied warranty% N3 ?/ g% J, @2 [# q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 P6 t: ~% [. ~3 B/ ?6 x
  22. * GNU General Public License for more details." Q; R# I3 U: ]* P  C8 z+ O
  23. */' i* Z2 m# O# j5 o0 ?8 l6 z/ `
  24. : h; ^* {7 n; P$ v7 k
  25. #include <linux/module.h>5 X& S, A. L9 L0 M
  26. #include <linux/init.h>0 e. B( J, n; Q- X, e$ f, y' i
  27. #include <linux/errno.h>
    - f' b& [! L) I% B" f* |' G
  28. #include <linux/types.h>  p1 e' e4 |' |0 ?. N
  29. #include <linux/interrupt.h>$ P; y% ?" Z' w
  30. #include <asm/io.h>$ {" i6 l6 @% c: u# @: l
  31. #include <linux/moduleparam.h>
    & _$ H+ F- T, P. h
  32. #include <linux/sysctl.h>+ ]) g! x0 S4 Z" p+ K
  33. #include <linux/mm.h>
    8 t! U( b8 y& M8 D! |, W$ r
  34. #include <linux/dma-mapping.h>! i3 |: u! z; i3 p  I
  35. ( W6 k# k! x# j% ]& M0 S
  36. #include <mach/memory.h>+ d6 a: j0 X+ d3 g! k
  37. #include <mach/hardware.h>
    " |' ?$ n8 l5 X! g5 M+ v+ b- E
  38. #include <mach/irqs.h>  z8 l+ e% S9 j
  39. #include <asm/hardware/edma.h>. ^  f/ U2 R1 i- o  m6 h

  40. / z; [' c" A2 x" k$ A) e- @5 n) ^$ A1 ~
  41. #undef EDMA3_DEBUG
    4 A1 n: D+ Q1 R* B8 n1 a
  42. /*#define EDMA3_DEBUG*/7 `( z$ l: M2 I1 G5 O8 L6 ^  b
  43. 0 j5 w, `# _, f5 I5 Q3 b
  44. #ifdef EDMA3_DEBUG* w$ u! n' `4 k9 W& ~, }, b+ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 k5 O* K6 j( e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % P$ \4 S" H6 n) f) M0 K* E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 q% j+ X- U" x5 w& ^
  48. #else2 m3 h" y0 g$ B" w/ Z3 Y' k- z8 h
  49. #define DMA_PRINTK( x... )
    9 ]3 N2 e  j, ^0 P' `
  50. #define DMA_FN_IN
    $ j* G8 |3 |& Y: `3 u
  51. #define DMA_FN_OUT
    ) N3 ~6 M" E% t
  52. #endif9 u9 f( c8 P" l: S1 z% ^' d

  53. 0 C# R+ V" C8 H/ s( E! C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), l5 {5 P; B8 p; y: ^' U
  55. #define STATIC_SHIFT                3; T4 W- k  Y6 @# `2 _% k4 T" ?! u
  56. #define TCINTEN_SHIFT               206 l# x, D1 {/ l8 `9 c9 r6 G
  57. #define ITCINTEN_SHIFT              21
    8 `# V. B! X, b) \! ~9 ~9 q+ n& u( Y
  58. #define TCCHEN_SHIFT                22! P2 w' l' H  `
  59. #define ITCCHEN_SHIFT               23; F. X6 c9 R! [4 m1 K( ?. t

  60. 9 G9 u8 Q. D# |% P& ?% X0 h
  61. static volatile int irqraised1 = 0;
    9 c7 q7 T; n. U" m$ J$ m* }
  62. static volatile int irqraised2 = 0;
    4 |& w# u! l; U
  63. # N& T' O8 s. A5 t' s8 h6 N  l9 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 M% X8 ?5 O. T. D9 z& m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d7 N! n- A7 o  r1 o7 m: ?+ q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      g5 i6 M- Q# g2 p3 v) j2 C
  67. " F' ?1 O- ^  N6 T& W/ ]' S
  68. dma_addr_t dmaphyssrc1 = 0;/ b, E4 |2 V, C3 @
  69. dma_addr_t dmaphyssrc2 = 0;6 T0 s! D, g+ Z- v. l8 c/ H
  70. dma_addr_t dmaphysdest1 = 0;% p7 m) k! e' w7 f- |
  71. dma_addr_t dmaphysdest2 = 0;
    8 R5 U2 L5 L- Q% @

  72. - c. ^, }# _  ]8 N4 B# U- W) U7 ^
  73. char *dmabufsrc1 = NULL;
    $ b; l6 g/ V7 G, Z/ b( o
  74. char *dmabufsrc2 = NULL;
    6 U/ f" R) C% k' w1 b3 L
  75. char *dmabufdest1 = NULL;" o  R8 F# L- h& f- ~. v
  76. char *dmabufdest2 = NULL;% Z' C  y' i8 S- j: o
  77. $ E/ H& l: q7 L7 w
  78. static int acnt = 512;
    $ S: z( U2 E6 N$ D0 y
  79. static int bcnt = 8;
    - ^$ [3 R9 D) J5 z# n2 W' {
  80. static int ccnt = 8;
    - X7 @, i$ N8 D9 j! V: M; A
  81. " `) d# I% A+ C6 K* l8 f# }
  82. module_param(acnt, int, S_IRUGO);% @* Y( G' S! K2 N! e
  83. module_param(bcnt, int, S_IRUGO);
    ; Z% P3 b, c( C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* |2 }% E) }) h
2 C5 F4 J, |, `5 r7 x: B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 o5 p) Q2 I8 k8 i2 F& F. ~8 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: v* t0 l: q- @  c5 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( ~) O  _: B- B6 B- \3 ]. V& N
: b, m9 _0 U: b" I/ g/ K. z( x7 f; E2 d

% Z3 @1 e, i- y( }. H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 07:25 , Processed in 0.038446 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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