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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 s* y/ M4 A5 `3 o* a  @
  1. [code]EDMA sample test application
    ) D4 S& d1 U; G6 w, Q3 T) S3 a/ a
  2. /*
    4 Y0 `5 S- r$ b% k: Q
  3. * edma_test.c
    ( ~$ s" t; A9 s0 `$ |5 a1 b# D
  4. *: ^7 z/ x& o9 y$ f+ o
  5. * brief  EDMA3 Test Application
    / @6 N% ~8 [) \7 Q. n; q* X
  6. *
    0 |' H4 r7 Z, x3 A5 G
  7. *   This file contains EDMA3 Test code.
    , f2 o. V8 B$ b: X
  8. *
    * A4 I$ S. @" B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% |' I5 z( `, w5 U( H5 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # v! g3 t( T! M! Y: O
  11. *         TO CHANGE.
    # f! S. S( D- I) [: l/ A  y
  12. *, \) ^0 P9 S0 s7 [, l2 |, k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . v0 O! W, E4 g1 N+ [
  14. *
    1 ?- I5 x( G$ f: [' I3 c
  15. * This program is free software; you can redistribute it and/or( {$ A9 ?/ g2 o
  16. * modify it under the terms of the GNU General Public License as
    1 ~, z# s: `+ V7 L
  17. * published by the Free Software Foundation version 2.
    % d4 f- n; t* s# \/ Y/ l# f
  18. *( l- ^2 \- U) T$ `" F6 m2 j% b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" s0 Z& a2 H. I
  20. * kind, whether express or implied; without even the implied warranty6 K; o$ |6 \& n7 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ A# K6 B' ^0 m; Q0 O
  22. * GNU General Public License for more details.6 T  s, n4 E2 X, T9 j
  23. */5 q) |* \! T& {3 Q: Y7 N" b; e
  24. - H, F# W1 i* T, Z6 ]9 I
  25. #include <linux/module.h>
    " C: @7 W5 x2 r: j4 X/ ]$ C
  26. #include <linux/init.h>' t. q4 R7 B, S+ J) q1 L8 B
  27. #include <linux/errno.h>
    0 C% P2 Y& W0 X) D
  28. #include <linux/types.h>0 Y; q! z5 M6 {' n- S6 Y
  29. #include <linux/interrupt.h>; s/ S( `# d1 y8 \( F
  30. #include <asm/io.h>- z7 i# E5 j' _/ w$ F* Y' L: W+ s
  31. #include <linux/moduleparam.h>7 H! G3 v7 R6 u" S; o7 {* W6 P
  32. #include <linux/sysctl.h>5 N( b6 _2 H# W& P* Q- e& l" Q
  33. #include <linux/mm.h>- U7 ^. Z: A$ T+ F) n% ?
  34. #include <linux/dma-mapping.h>9 o, J1 x" j, ~1 x
  35.   ^0 u  Q3 z7 {; x1 K4 t! g* N
  36. #include <mach/memory.h>
    , Q  p" d' R. R/ J
  37. #include <mach/hardware.h>0 C. ~5 i7 j5 r4 f
  38. #include <mach/irqs.h>: }0 H1 w$ R# m# S/ S7 h
  39. #include <asm/hardware/edma.h>
    + \1 q- J* d# n* `7 c

  40. * I( T* b: N3 b5 D' A$ p# P0 a
  41. #undef EDMA3_DEBUG
    0 X$ P0 J5 V$ P3 Q% q* @- @, b
  42. /*#define EDMA3_DEBUG*/
    , b3 Q4 t  U& o
  43. * F# D+ H, O0 G1 M% P9 d' f- G
  44. #ifdef EDMA3_DEBUG
    % u- r5 X4 v9 Z' @' j3 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- i8 G  m! j5 L* u; Z, _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ A9 ?6 _5 }' @1 F% Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 f6 q  W% @4 ~' D- X
  48. #else$ [  Z5 Z' P8 H) {" `; c
  49. #define DMA_PRINTK( x... )
    # j5 B$ b& W, s" s
  50. #define DMA_FN_IN
    9 G/ @& Z$ R6 l/ }+ `3 E
  51. #define DMA_FN_OUT
    2 m' T6 R5 l% M2 A; s
  52. #endif  i+ {$ s( p6 I( M1 N

  53. : ?  N: g) z2 v: s; X# y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ G, ]5 T, X7 ?& ~  Q: T8 N9 L/ ^
  55. #define STATIC_SHIFT                37 T/ ^8 ]; v) g# m# ]  J
  56. #define TCINTEN_SHIFT               20
    6 B3 M8 ]- t  L  C& T! X! q
  57. #define ITCINTEN_SHIFT              215 Y/ L0 B3 J7 U+ Y8 L$ q& L$ b" r
  58. #define TCCHEN_SHIFT                22$ s+ i* i9 N3 `
  59. #define ITCCHEN_SHIFT               23) y  G, A- `$ r* u, n% m, _" ~
  60. , {8 ~6 x" r3 G6 j5 k' O9 b' ?. B& d- Q( `
  61. static volatile int irqraised1 = 0;
    : i5 ?7 R0 r: T8 w
  62. static volatile int irqraised2 = 0;
    $ D& r, T' Z/ C& q1 E+ h, f5 ?
  63. * F* P: j- J( b/ V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ~. Z: K+ I0 v+ Y; d1 h5 m7 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( n% |- D# o1 E4 V- X; v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  q7 F! e, _" B( j' L
  67. " S' B  u4 x) r) X, P
  68. dma_addr_t dmaphyssrc1 = 0;
    $ l  y) Y* `* I! v2 [0 N
  69. dma_addr_t dmaphyssrc2 = 0;) a" J4 s4 c$ @% ^" K1 x3 Y
  70. dma_addr_t dmaphysdest1 = 0;! b& u& Z* l: ]/ O
  71. dma_addr_t dmaphysdest2 = 0;
    # B0 g5 s9 M( Y/ F* q4 O. C
  72. & v5 _, Z9 f" _( e8 C, s
  73. char *dmabufsrc1 = NULL;
    9 s/ i* ^2 b4 s9 ?# r7 {3 v. h
  74. char *dmabufsrc2 = NULL;5 F( Q- E5 o0 j) \# `5 d2 J
  75. char *dmabufdest1 = NULL;
    # Q! p( r/ r% N; S- z( O9 V7 |/ E6 d
  76. char *dmabufdest2 = NULL;
    7 P& B' p0 j. X0 |0 l1 J
  77. 9 `, G) L& G* O' a( P1 E
  78. static int acnt = 512;
    1 e3 V. O4 B! K' t' _7 E" X4 w
  79. static int bcnt = 8;
    ! W6 o, N/ t. g4 k" y; k
  80. static int ccnt = 8;
    . W; n8 d; L# _
  81. $ s, m/ |! b' o$ M& ?3 h
  82. module_param(acnt, int, S_IRUGO);
    , ^. `( m5 e( x! _" R& w
  83. module_param(bcnt, int, S_IRUGO);) {3 v: P. u* P: |6 X' ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ C+ `* l% e% W# O8 A1 T! Y

. p. y; R2 g- V0 ], R- r& U, B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! e& ?; w% l# X% K: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 M1 t' Z5 w  h$ k' l/ C, A& G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ~  C1 j' J! |' \' p* S8 d8 o4 _+ }" K2 C

! O/ r) W% W/ X' ^% x! U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-19 00:50 , Processed in 0.036654 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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