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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 g/ b$ ]# b) `" o4 U$ Y
  1. [code]EDMA sample test application
    5 ^5 ~( Y: h# y  x% J, Y
  2. /*
    , N' L* S6 g2 O; z! c% Y
  3. * edma_test.c4 [( K; t4 |6 l, U, w7 q
  4. *
    ( i# i' h/ W* B$ ]
  5. * brief  EDMA3 Test Application
      o! K. h( }  L9 J
  6. *5 i4 E% Q$ W$ l% f% o+ p- w
  7. *   This file contains EDMA3 Test code.) t2 d. Y8 E9 A# A( g
  8. *
    9 p! E1 e8 c; d$ h% V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / j  B- R! n9 I' G+ ?+ H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' Q1 g  f% H- o6 ]. I9 V
  11. *         TO CHANGE.) x3 y5 L# V, U
  12. *
    + e$ [" }# ]+ w7 Z$ r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* c" a3 P  H% m) g5 g+ D8 H5 Z: l
  14. *
    7 {6 _7 I0 m) f7 [: x
  15. * This program is free software; you can redistribute it and/or0 I$ i2 D! _0 r% \# i0 c
  16. * modify it under the terms of the GNU General Public License as) _: `' b! Q* C, ]4 ~5 J
  17. * published by the Free Software Foundation version 2.
    $ N1 I( ^; x, {) ^7 n, x
  18. *
    1 ]/ j* y7 U" C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; S; l" i; S4 m! A# s
  20. * kind, whether express or implied; without even the implied warranty- {, ~% S( [7 p' x' y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( b3 h" ^" ^0 s! ~
  22. * GNU General Public License for more details.' C1 g. E, T9 R/ e# ^# B
  23. *// q- k, U8 s- M7 [

  24.   o8 C4 B: u  A( j# l4 M
  25. #include <linux/module.h>
    : d  Y0 E$ |2 n! H( i, I
  26. #include <linux/init.h>
    ' ?" E5 O5 T$ _# ^# @* q
  27. #include <linux/errno.h>
    , E" i8 k5 ?. K. _" ^+ ^
  28. #include <linux/types.h>
    " O0 e+ s  O" S2 {
  29. #include <linux/interrupt.h>
    " w6 q, B5 b" V- Z, ^9 V: C% O
  30. #include <asm/io.h>
    ( ^( C- j* s2 v% G5 w0 c/ s
  31. #include <linux/moduleparam.h>
    " z3 _$ w1 \! @7 P' |) \  s0 f
  32. #include <linux/sysctl.h>
    & P5 j- M% p  s  b6 o: {
  33. #include <linux/mm.h>* Z# E7 c. P& E: @' ?1 O
  34. #include <linux/dma-mapping.h>/ u# L; c  Q; Y% P9 N
  35. 2 Q1 {! O/ N! f* |# c
  36. #include <mach/memory.h>) c7 z: T3 T0 N9 s5 E* C
  37. #include <mach/hardware.h>
    $ U( h) R  O4 |# E% }0 S
  38. #include <mach/irqs.h>, z' a; ^1 ~/ z/ y
  39. #include <asm/hardware/edma.h>1 g: T6 C' i+ H/ P
  40. * N+ P9 P0 b; W; k( i
  41. #undef EDMA3_DEBUG. t& W# L9 R' Q
  42. /*#define EDMA3_DEBUG*// x1 X' G, t- c, @7 p. T

  43. ; Z7 ~: _" E8 F; M' ?
  44. #ifdef EDMA3_DEBUG5 I- d! r4 ]$ ^8 o3 W5 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# l+ w9 {& i, f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      A8 \$ \1 y3 D0 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), x- g+ R: i+ y/ Q8 C% E
  48. #else8 U7 F3 B" \: H/ |8 S$ E5 \6 ?
  49. #define DMA_PRINTK( x... )
    # \( \( l# B1 \5 w1 ?; x
  50. #define DMA_FN_IN) r. A+ w$ q2 p: i  z
  51. #define DMA_FN_OUT) P+ Q: B/ f% n% R1 h6 A
  52. #endif$ R* E+ w& w! k$ K3 [
  53. " r; J; S( }: q& K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 Q- v' z& l9 O. P
  55. #define STATIC_SHIFT                3
    # Y! K. c* U* X% f
  56. #define TCINTEN_SHIFT               20
    8 I% `' ?' T  [( f
  57. #define ITCINTEN_SHIFT              214 ~2 b. I2 G' p/ t* A( e7 ?
  58. #define TCCHEN_SHIFT                22
    : b! ~) j; p5 H# _4 A
  59. #define ITCCHEN_SHIFT               23
    4 u9 R) l+ n( V2 N# Y4 n

  60. ! V3 b0 ~/ x  |3 ]) p4 a
  61. static volatile int irqraised1 = 0;; \: A& y, I; M# m5 R% I% A  w
  62. static volatile int irqraised2 = 0;! [1 J, ?& P2 J* s/ G  x$ v
  63. ( e; m* ?8 K& A7 r( g5 T% |+ Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 q. l8 n' z' F" Q$ @1 @% `9 F& O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 J$ h: A4 A& A; ]' A) w& G: F5 p0 N+ M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) [& K# D: Z5 ]- t: v! l
  67.   g( ~" O9 c/ j+ e+ h
  68. dma_addr_t dmaphyssrc1 = 0;: u; w  Q4 D$ Q1 y; ?) e. X2 Z, M
  69. dma_addr_t dmaphyssrc2 = 0;
    5 b* R8 J% Y. [" q) ]+ N3 C& X9 Z
  70. dma_addr_t dmaphysdest1 = 0;
    . p5 k5 C7 X0 _  S9 @) u8 M0 T
  71. dma_addr_t dmaphysdest2 = 0;+ P# `5 |4 u, R& |2 c

  72. " d) i- K) R  z7 R
  73. char *dmabufsrc1 = NULL;9 T1 c; j0 O) u
  74. char *dmabufsrc2 = NULL;
    + J/ s; a# z: [% L
  75. char *dmabufdest1 = NULL;7 l, M- b5 W6 s. s% a
  76. char *dmabufdest2 = NULL;- l% Z; U/ F- z6 o
  77. ) A( P: O- G" m9 F! o- r1 F( R
  78. static int acnt = 512;
    - }# X! o) e, W. z4 w
  79. static int bcnt = 8;
    4 i, I! H( J1 h4 g( V6 S, ~  Z
  80. static int ccnt = 8;! ]$ Q2 g2 {. m" K# Q  w) x" c
  81. 7 `; m3 g4 r# c! |- ]
  82. module_param(acnt, int, S_IRUGO);
    5 g  M" p$ T9 e3 a5 g. J  g8 W3 ?
  83. module_param(bcnt, int, S_IRUGO);) y3 P) E' I3 c# [5 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! T3 \# a3 k4 s- r. `
- L1 u  A" Q# y! u, g5 @5 F3 ~9 L" z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; \# R: D5 S7 m) tarm-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 m; q1 f8 Y9 y& F" p+ j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; u+ B; x7 z) M# Y/ k! D
( M! n  h3 K! J( d. g5 h9 O
6 F, b1 A9 H" A, Z8 l1 z' i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 17:36 , Processed in 0.042429 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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