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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; v3 K: S- Z; k
  1. [code]EDMA sample test application% V4 O- r. m, k& W1 U8 E/ o
  2. /*) q- ]# B1 b7 h# Z3 x
  3. * edma_test.c
    3 J  h  N; O7 w0 S. C
  4. *
    , e6 _& n7 G) u. l9 F& q7 G, [
  5. * brief  EDMA3 Test Application. R6 H% y' J- {9 v; K! m- u
  6. *
    9 b" x* Q. e4 `! ^6 L
  7. *   This file contains EDMA3 Test code.6 M0 E9 L3 U3 `% C+ [1 @2 M9 a
  8. *& W0 s& ^8 k$ M9 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' M2 s/ C3 F4 k/ \/ r1 x7 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ d# {5 T. P0 F. c4 N0 {
  11. *         TO CHANGE.7 {0 K( Y9 b1 I8 o8 T
  12. *7 i& g, I' c! w2 i* U! J/ N! d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& G, b5 P5 E3 f7 ]9 ~5 v
  14. *
    , e* ~1 d' D1 c. z- l
  15. * This program is free software; you can redistribute it and/or* G) Q4 c" @4 r9 i
  16. * modify it under the terms of the GNU General Public License as+ U6 E1 m2 J1 y  _/ y' d3 A
  17. * published by the Free Software Foundation version 2.; G/ S. P2 w- w  Z
  18. *
    ) U, \2 ?0 A( b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " E1 K, z7 y7 J: Q
  20. * kind, whether express or implied; without even the implied warranty9 {% t9 g4 k5 j4 q$ t& o3 C4 z1 r+ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, C! i4 f. L: [$ K5 G. K% t/ Z
  22. * GNU General Public License for more details.. _3 x: [, X/ s3 Y. |# x
  23. */0 ^  \+ F' U0 ~' Y
  24. ! g# B( Q& ?; C6 ^
  25. #include <linux/module.h>! L) D# ~4 K9 w5 D# [$ Y
  26. #include <linux/init.h>
    + k' T' P) M2 z- S
  27. #include <linux/errno.h>  D9 ~" r) ^8 t% M; B4 N- Q! W
  28. #include <linux/types.h>
      _0 H2 I; I+ n' @. t' H
  29. #include <linux/interrupt.h>
    & B' n5 D' \1 X: a; Y' `% y+ N( Z! c/ q
  30. #include <asm/io.h>5 j) Z3 Z3 ]% k5 _% k- j  k4 r
  31. #include <linux/moduleparam.h>
    % o. r, \  k$ V! h
  32. #include <linux/sysctl.h>
    ( y  t) @' v1 a  K. j2 ]: C
  33. #include <linux/mm.h>2 H) y" L3 R# I6 }7 b0 p
  34. #include <linux/dma-mapping.h>
    7 S" b* t# A1 v4 G' N2 D6 F

  35. 6 u( ^4 c+ v5 e8 s" b
  36. #include <mach/memory.h>
    3 Q. M7 n" s5 T: J' [# J
  37. #include <mach/hardware.h># k1 M8 v4 w8 _
  38. #include <mach/irqs.h>$ R) `. m( j( o: Z
  39. #include <asm/hardware/edma.h>
      J* |' N  X, w( x) i- _
  40. ' Q: o/ E8 Z& W% T2 G1 `: ?/ m& w) Y
  41. #undef EDMA3_DEBUG
    / f8 m/ u7 [9 g3 ~4 |0 H
  42. /*#define EDMA3_DEBUG*/, Y- Z" x& H2 k; y

  43. & f6 t$ v, N8 B4 R! `
  44. #ifdef EDMA3_DEBUG2 t5 ?2 `: ?7 }; K& |( c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) P8 V% g' e! a( t, R: t* A( b4 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      \% j9 D9 K$ c2 \% J1 a/ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 H6 x7 h2 r& C" C. p. j! r/ c# H, [
  48. #else1 r+ L) U% ]- T. p- G  K; g
  49. #define DMA_PRINTK( x... )
    ! O/ o9 ^/ K; ^
  50. #define DMA_FN_IN5 }' k! L" ?3 o0 \
  51. #define DMA_FN_OUT& r! B# W* T" l- G
  52. #endif
    4 U3 k6 f4 v* ]8 n2 L/ J" s
  53. * |2 X( y) S6 G9 U+ K9 @# N1 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ V4 U/ j9 i0 o6 H9 O1 a+ j% K$ J. `
  55. #define STATIC_SHIFT                3
    5 P' z% h6 E5 G. @; u
  56. #define TCINTEN_SHIFT               203 t& r* e: X) z+ k3 k/ t2 F
  57. #define ITCINTEN_SHIFT              21
    $ u% M" N% k8 J3 D1 W' F. x* ]- g! i
  58. #define TCCHEN_SHIFT                22* q6 @0 o# n$ r/ P' V7 b! m
  59. #define ITCCHEN_SHIFT               23) r% p7 n* W" a2 p
  60. " R) m: R8 d" ^# D0 a
  61. static volatile int irqraised1 = 0;) S: p+ Y) |. d& ^4 Y
  62. static volatile int irqraised2 = 0;
    ) K) ]7 q" `4 {6 _6 S1 B
  63. 3 N- T2 j& E( Q9 a  p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' e+ g: |& y! U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * I. c9 U5 ?; @0 A/ s* r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 f9 f$ E2 g+ U; a- j# I. i
  67. ( j4 P$ L( `: Y2 R2 b% ?2 M
  68. dma_addr_t dmaphyssrc1 = 0;* Y; h+ x' h9 z% G+ O8 n
  69. dma_addr_t dmaphyssrc2 = 0;( X" S( u9 M; ]( S. J
  70. dma_addr_t dmaphysdest1 = 0;4 L' ?/ F3 D% g1 b7 J
  71. dma_addr_t dmaphysdest2 = 0;! H9 I0 |6 l# A7 |9 F# W7 T4 d+ p+ l
  72. 8 }7 l: Q1 s& Q5 d5 ?" R" {. Y
  73. char *dmabufsrc1 = NULL;
    ' f2 A/ w' U( r# v/ i( z1 T3 K/ ^
  74. char *dmabufsrc2 = NULL;
    4 p* ^" M0 H$ b) G4 G9 p7 x
  75. char *dmabufdest1 = NULL;( a% h4 l" |) K9 w1 O5 f. b
  76. char *dmabufdest2 = NULL;1 \% d; A+ f; D/ g, ]
  77. 2 S2 q8 B) N. T" Y1 ^1 y' E& Q
  78. static int acnt = 512;
    6 N5 {7 D% `4 v' U0 V3 U/ t2 T
  79. static int bcnt = 8;
    * Z- W: R7 N+ K4 |. {
  80. static int ccnt = 8;2 N* Y5 v  r1 b$ [8 t

  81. ' x7 u/ x* H" `/ z. X
  82. module_param(acnt, int, S_IRUGO);1 `9 F  a/ m9 Q! g1 K  w4 Y3 A& @
  83. module_param(bcnt, int, S_IRUGO);
    1 W) |. E7 R0 ], y$ ~+ n/ W0 o, i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 j5 I" v2 U& Y+ o1 T* f4 Q% [( ^* F" ]% J( \- `2 G! F6 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: y( C" n, `" I' w, |% E8 Z( Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 v2 H# i1 \( i: j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Q7 }& e+ Z# }/ y% E6 t
! b- s! h, v# L

) f$ T6 s9 u' K  i' T) ~' W" q) b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 15:30 , Processed in 0.043025 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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