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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 R' c" E9 [- ~! p4 B9 w
  1. [code]EDMA sample test application6 z8 y- L1 H: \2 z4 w' o9 u- ?5 u' Q
  2. /*
    0 q7 F% W& S; ]* P$ ~
  3. * edma_test.c
    6 g, v, ?* j7 P+ o1 [# S! V3 v
  4. *' A; Y1 j4 q$ y3 f! |( c) ^0 w8 g
  5. * brief  EDMA3 Test Application. E) _( i1 H& i0 X# }5 @3 i
  6. *
    & H% a5 Q6 G/ Y
  7. *   This file contains EDMA3 Test code.
    ) |2 L% ~6 |/ S
  8. *
    4 w- U* s! E9 R" a) [, M) J: B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : }- Q4 [4 J0 `# A+ G4 }7 p& |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : M6 z1 D0 {! J% N$ V
  11. *         TO CHANGE.3 r! T, Z4 p7 ^) D* B; [
  12. *
    5 `2 n5 N# [8 i. n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ^6 Q  k# l! N# B6 w' @
  14. *
    + U0 d& o5 I0 y$ h2 N/ y  w. S' _
  15. * This program is free software; you can redistribute it and/or
    0 c  H0 C; v# r  S
  16. * modify it under the terms of the GNU General Public License as& `6 [! W2 e0 r$ H3 A
  17. * published by the Free Software Foundation version 2.* S) A' M5 ~$ f* i: [! z( A
  18. *
    9 g& u# `: _  s  z* W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ {5 o, d5 B) B! U" |1 p
  20. * kind, whether express or implied; without even the implied warranty% @5 o/ J7 l2 v# r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, t8 o* T/ [8 p$ P% U
  22. * GNU General Public License for more details.
    % L  h0 l& |( o( z; P9 t, V: v
  23. */! o# G+ x3 I  K9 ?; T

  24. 7 j. O7 O, r, C  |2 @
  25. #include <linux/module.h>/ u6 `$ c2 F& F2 N+ I9 x
  26. #include <linux/init.h>
    4 X2 S) k' D1 E; K9 U
  27. #include <linux/errno.h>
    ) T3 r. c6 }2 U6 D+ j! x
  28. #include <linux/types.h>
    9 G- _* M. d3 ], k
  29. #include <linux/interrupt.h>: S/ z& f' V9 s1 b  T" g: _
  30. #include <asm/io.h>: c) o) G% P, C; c( P0 T
  31. #include <linux/moduleparam.h>
      h" g2 d+ R' [! X" w* P
  32. #include <linux/sysctl.h>
    1 b1 {! a8 B# h- u
  33. #include <linux/mm.h>
    / W! e$ ?) O; T1 f8 f0 \
  34. #include <linux/dma-mapping.h>1 x3 ]) ]9 Y. ^$ |2 `: ?- ^
  35. ( ^+ {# \' q- Y: s; f
  36. #include <mach/memory.h>) S0 Z  s# n+ C& X1 _  r# f
  37. #include <mach/hardware.h>
    9 n& n4 h% {+ k8 Y" H2 e
  38. #include <mach/irqs.h>
    3 y7 A* H% p, |4 L+ s" E' e6 u6 H
  39. #include <asm/hardware/edma.h>
    4 O, l( e3 H* f/ f7 C% p) J; |

  40. 5 {" D  `! p) m1 a; z
  41. #undef EDMA3_DEBUG
    + r5 N+ ~7 _+ @$ C8 N
  42. /*#define EDMA3_DEBUG*/
    % `: ]9 F4 D0 x* |6 R5 V
  43. " ?3 E" U, F  ~: I5 N# x
  44. #ifdef EDMA3_DEBUG
    8 L- j% K: i2 B2 n# ?7 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 L! v: ~+ \! g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 u' g' A) Y, W% N/ K9 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ {6 ^0 r0 ]& t8 f
  48. #else
      B0 _7 {3 H% }$ Y. a/ I& t
  49. #define DMA_PRINTK( x... )/ B9 @9 A  H& }( h2 e: {+ u
  50. #define DMA_FN_IN5 t, z' F5 E3 _5 W: X9 j. s) h! W
  51. #define DMA_FN_OUT
    1 U" r( o: B5 Z. q
  52. #endif
    2 @# a% k' {- S8 }( h: T# T$ y

  53. ! ?3 z% c' r0 n0 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) B7 `7 M9 T: H5 o8 N$ _
  55. #define STATIC_SHIFT                3) {* d) {- s* s: M8 A
  56. #define TCINTEN_SHIFT               20& {" T7 _! r1 F8 }
  57. #define ITCINTEN_SHIFT              21  S; P- D% m5 Z* ~: g) R& `# F
  58. #define TCCHEN_SHIFT                22: O5 B; ~6 d2 n9 D0 M
  59. #define ITCCHEN_SHIFT               23
    6 [3 g3 M% O7 E% c% X# I7 z8 s

  60. & v* m3 m5 o4 G4 t+ m3 v
  61. static volatile int irqraised1 = 0;
    # P, Y$ k0 A/ U2 B) }3 `+ P7 B
  62. static volatile int irqraised2 = 0;
    . f, b9 ~8 p" s/ V2 t+ y

  63. : W$ |/ z/ N. o) V8 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # G, P- `" _2 S; O6 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 |$ F' m5 Z8 J7 b) e* i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! h$ @3 s3 {9 |- x/ @: \8 \, ?
  67. 2 l2 f4 u: @; l' d; Y
  68. dma_addr_t dmaphyssrc1 = 0;
    ! |( j& k# `8 l) p  q# u
  69. dma_addr_t dmaphyssrc2 = 0;% C% g# V- k( ^0 {
  70. dma_addr_t dmaphysdest1 = 0;
    1 p; ?2 l  M5 a2 i  a7 P0 Z
  71. dma_addr_t dmaphysdest2 = 0;5 N2 s# ~! A5 |8 h. v. `8 Z- O
  72. 6 X. R( m- R. ]' x
  73. char *dmabufsrc1 = NULL;
    9 p8 w3 Y& l5 k6 W% e( V1 o
  74. char *dmabufsrc2 = NULL;, T$ F/ j7 b" a+ _) D  l5 [
  75. char *dmabufdest1 = NULL;. P* v* N+ W9 a; h# S
  76. char *dmabufdest2 = NULL;
      C! ]7 w' X$ K% s

  77. ! X3 o0 m  `' s* U  p- q
  78. static int acnt = 512;& b. x, r8 |$ d$ j' m9 m
  79. static int bcnt = 8;& }/ ]9 |, \# O6 [
  80. static int ccnt = 8;% G9 ^& h. e4 f" G
  81. 9 j3 R" E) ~. k; e, v
  82. module_param(acnt, int, S_IRUGO);
    - x7 Q2 o! v) \; R
  83. module_param(bcnt, int, S_IRUGO);- d& ^0 ?3 `. i+ o9 Z% B" t0 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. r9 f) F/ j9 Y; S1 J* s6 B- Z, Z/ C# X8 L4 ~7 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 L* ]' [8 J+ k3 M5 X& {: m. warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- x  l2 G6 i" e4 w. x0 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 ~3 s1 G. `. E8 [7 ~
2 `0 P' C; ~( J0 G5 O" p
: d1 |0 T1 E; f) Q( A- b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 05:35 , Processed in 0.057842 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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