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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q1 i1 S- u4 L
  1. [code]EDMA sample test application
    6 ?+ ^; B& A* G6 y% J  f: W' v* z
  2. /*4 R$ m7 j8 j9 N/ L
  3. * edma_test.c( `4 [- C: ~0 O- O5 U
  4. *
    ' y# {" B3 i5 k$ ], W1 s+ S
  5. * brief  EDMA3 Test Application
    : c: T, R! Y9 Z/ {: B# q
  6. *
    . d. ?4 f# d% v) O4 e! S5 C9 M
  7. *   This file contains EDMA3 Test code.
    9 @) {1 h: L  ?6 u" |  |/ k
  8. *
    + Z) R+ W' d. }$ [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + n. G2 p+ G# w& t0 w) {- R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; v* w* ~3 H3 z9 ]$ X4 [' @
  11. *         TO CHANGE.
    8 C. }! A/ t! E/ S3 r! `
  12. *
    ; s  N1 h0 A+ w" _* M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 e; ^2 h8 t$ b
  14. *
    $ a5 v& P8 r- z7 K2 D
  15. * This program is free software; you can redistribute it and/or
    ; ~" V& r2 j- U3 z& b
  16. * modify it under the terms of the GNU General Public License as
    , ^/ j, s/ T/ {+ x* |! @
  17. * published by the Free Software Foundation version 2.9 I0 U$ B" i+ {$ {& g
  18. *. b" ^, t, @0 ~; i' A$ h  b& b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & e& n) R' x; V8 D1 N/ n' W
  20. * kind, whether express or implied; without even the implied warranty5 N9 f" v6 D$ l$ a. _% k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * G+ v5 s( T4 w( v
  22. * GNU General Public License for more details.! O" E3 K$ T+ ~# S
  23. */3 r; g  }$ N3 E- A4 }$ e

  24. : d" X1 J3 t- J6 M9 S
  25. #include <linux/module.h>
    4 n6 r! H6 \3 {& |
  26. #include <linux/init.h>
    9 K( r$ k2 _- y. M( `+ p9 A
  27. #include <linux/errno.h>2 d. ?& w( c5 C: T; s
  28. #include <linux/types.h>: [: v! z& L- C: {/ F  }$ o3 ~
  29. #include <linux/interrupt.h>: x1 b. I  h. G( M- O
  30. #include <asm/io.h>
    1 a* D" ^0 O  Z0 Y) |! b
  31. #include <linux/moduleparam.h>
    8 r- F+ h5 j5 f) |
  32. #include <linux/sysctl.h>
    & a" X8 {" K2 h! a. f: w7 \- X
  33. #include <linux/mm.h>
    # g. M1 Q8 R0 `4 ]& S; i
  34. #include <linux/dma-mapping.h>
    - w# G+ p2 ^2 x; F* [# h2 q6 Y

  35. + _4 c& q! A5 S; X( |
  36. #include <mach/memory.h>+ \; s9 x* w9 q$ Z4 A$ r/ u& p
  37. #include <mach/hardware.h>
    8 N7 m4 k/ E" w* t4 n* x
  38. #include <mach/irqs.h>9 h2 R$ j" A/ B3 p- K: E
  39. #include <asm/hardware/edma.h>' t' P+ O! X3 R2 ~2 s5 {

  40.   f3 @" h6 }' c: h& j. r
  41. #undef EDMA3_DEBUG
    * N, h! `1 W$ S+ j
  42. /*#define EDMA3_DEBUG*/3 H4 M( y1 t  w, n. O

  43. ) u/ D5 G+ U5 J+ @
  44. #ifdef EDMA3_DEBUG
    & w& A5 O1 e/ e! a! v2 j. X2 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 t; Q* f) P1 b. ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & Q( [% X! [* K4 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) l( ~# T. `. P2 f6 [' D1 k
  48. #else
    - u. o# c6 [4 A. K: |4 `
  49. #define DMA_PRINTK( x... )/ I$ ~/ Y, k+ D9 _" s0 ~6 {
  50. #define DMA_FN_IN7 S: |$ @& U) d7 E5 d
  51. #define DMA_FN_OUT
    1 j2 _3 V: \4 T2 Q
  52. #endif- @, N, p( Z4 a. j% q: d
  53. " |2 H5 ^3 A3 y# [8 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 w0 y3 W% t' [
  55. #define STATIC_SHIFT                3: g( u2 F# i6 e* E
  56. #define TCINTEN_SHIFT               20
    3 n- R( L) o5 z. l6 a6 L2 h
  57. #define ITCINTEN_SHIFT              21
    0 u8 q5 J3 @" D: g, s
  58. #define TCCHEN_SHIFT                22
    , m; \, k2 ]3 u3 @
  59. #define ITCCHEN_SHIFT               23
    * D3 c. `0 o5 N3 w

  60. ; V; @0 R& E; H: k6 ^0 [: C2 ~
  61. static volatile int irqraised1 = 0;) j" l" Q' e& c  e
  62. static volatile int irqraised2 = 0;
    1 R: \# _% i5 b# z- {" |" c
  63. , E6 G+ b9 z5 Y4 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " o. c( |- P6 b6 I" m& P& G) w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . M& N0 M0 s5 g6 ^7 G" P, Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; q4 C1 J/ m5 ~, S

  67. 7 g/ q8 ^* {( a. F9 o4 H( K
  68. dma_addr_t dmaphyssrc1 = 0;9 \, Y4 F7 [6 C
  69. dma_addr_t dmaphyssrc2 = 0;
    9 T6 h2 n8 x& ^- q0 Y6 F
  70. dma_addr_t dmaphysdest1 = 0;
    $ h* X' Q3 _' F1 Q
  71. dma_addr_t dmaphysdest2 = 0;% {2 A$ D) A& v7 ]. f
  72. 0 o! h0 o' ^( d7 z2 d/ P
  73. char *dmabufsrc1 = NULL;, n. x' d& h% m# _& V
  74. char *dmabufsrc2 = NULL;$ i8 B4 z+ o0 A  \3 ^( B" s
  75. char *dmabufdest1 = NULL;
    9 w8 P% H" ^/ s; {$ |0 w; y
  76. char *dmabufdest2 = NULL;& U9 j3 ^9 m" w/ e' t' V
  77. , e7 w+ }- p% h4 G! i, l
  78. static int acnt = 512;
    0 Y* `0 F( X/ Y- ?# F' d
  79. static int bcnt = 8;" }' w3 [( P  Y+ @' r9 i, T
  80. static int ccnt = 8;
    " p' {; l5 L2 ~3 Q9 J

  81. # }) l0 z1 U1 G- I- I
  82. module_param(acnt, int, S_IRUGO);! h* F2 ^: U) p+ h# S6 N
  83. module_param(bcnt, int, S_IRUGO);
    " W! r9 _1 [* ~, M' Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& w8 e7 z9 c/ C/ V+ a2 X) L3 S- X+ R; T3 l* [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 I; y5 W8 r0 G9 `7 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 {" o0 k# ^% P' w5 m7 |# Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# F% k0 ^. i) B4 u, j6 D
/ l, D8 u0 M$ j  w. w3 j" \
, }; f: _, A3 M8 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 13:30 , Processed in 0.037979 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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