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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 r* I: Z2 l1 W: `$ f
  1. [code]EDMA sample test application
    % W8 @  P! U4 q7 T: w# k
  2. /*
    3 E) p) c. i0 D" r* Y( P0 ^
  3. * edma_test.c
    ( H+ b0 }2 o% z6 t4 P
  4. *( R3 A1 H4 ^1 j6 ^! j: B+ q
  5. * brief  EDMA3 Test Application
    % [- R/ e* c! d8 [' w
  6. ** w7 O) c& q9 D/ c; x
  7. *   This file contains EDMA3 Test code.4 K( J  ]0 ~* \5 V8 y
  8. *
    2 v) [, w% ~1 U# [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; [# U# `; ?7 {  g+ q, x  S8 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 P& G" t- o2 v/ R& F2 _- n
  11. *         TO CHANGE.
    3 Q: j% `; O0 N
  12. *
    . y; M# S7 e9 x' U! i: t6 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 Y- Y/ K! ^& ]" }
  14. *
      \  h1 Z5 k0 g; `
  15. * This program is free software; you can redistribute it and/or
    ' F: W' l- U+ {( c+ Z; Y
  16. * modify it under the terms of the GNU General Public License as; ]( S/ |" g5 w0 w, [
  17. * published by the Free Software Foundation version 2.
    ( I$ X) P0 v6 G" F
  18. *
    + U2 d/ f) i- H1 n2 h( f: s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W( y# q1 E  N
  20. * kind, whether express or implied; without even the implied warranty
    " G7 \/ j6 j! A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * Y+ }: u: T) C  [' |1 z
  22. * GNU General Public License for more details.* T6 U# }( B' P1 q4 w% S2 T' T
  23. */" n# [# Y' t8 ~3 M# q. C: H, Y

  24. 0 V' w, S5 h& }: s# Z2 C
  25. #include <linux/module.h>/ q: l& B* A, j2 Y
  26. #include <linux/init.h>" L* r4 j+ [3 @/ C' E* x, R
  27. #include <linux/errno.h>3 h% x9 B. G/ ]4 o
  28. #include <linux/types.h>
    5 t+ A# Q0 N2 L) X; O
  29. #include <linux/interrupt.h>: ~5 `- e+ I, N" c
  30. #include <asm/io.h>
    ' d+ I9 G) ?, n  O: T
  31. #include <linux/moduleparam.h>
    & J) {+ f4 Z9 k: j% |
  32. #include <linux/sysctl.h>
    1 U* ?2 O; h; F
  33. #include <linux/mm.h>$ p2 S3 e$ F- F; X# p& s
  34. #include <linux/dma-mapping.h>
    ' x! F2 K9 x4 d) d& k. i
  35. ' r+ h, `1 R6 Y: C
  36. #include <mach/memory.h>. V. P, S% p* p) n
  37. #include <mach/hardware.h>* F6 V) F) Y( E" z6 c2 e* W; y
  38. #include <mach/irqs.h>
    9 k, h$ Q3 f8 p& I/ z$ x- T. j
  39. #include <asm/hardware/edma.h>
    " m3 `" n) n% ?* c- E; b

  40. & p- y3 a( U" m) b1 F% m; O  |
  41. #undef EDMA3_DEBUG
    1 P5 |* [$ v/ l5 v5 j1 N+ S
  42. /*#define EDMA3_DEBUG*/
    0 j& @8 N' U  D

  43. 8 `* ]6 A; W: w. P
  44. #ifdef EDMA3_DEBUG
    2 g' A8 h& O) Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & y. O( R6 c$ T4 p" G1 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ z9 K* a6 p' Z; Z' R& j$ h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( X; e3 O7 V3 G1 R$ s* {7 w
  48. #else- R. L' B, f6 r" E, [% ~
  49. #define DMA_PRINTK( x... )
    ; B: ~/ ^6 @/ M5 F% E
  50. #define DMA_FN_IN
    6 N: ?6 f5 M; M, [$ E+ A
  51. #define DMA_FN_OUT0 Y  W# u7 I5 b: [) Z. e/ O# ]
  52. #endif. [/ {% j+ H4 j& J1 N: S) J/ ?3 q8 ]
  53. 0 H* E. V+ Z% U) a. q( K6 d% S; _5 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " U: l, j& R- T2 J6 [* e
  55. #define STATIC_SHIFT                3
    9 c5 U/ w3 o2 B
  56. #define TCINTEN_SHIFT               20
    & F. P- r+ z8 n5 C4 [0 b
  57. #define ITCINTEN_SHIFT              21
    . |3 n+ G1 r; ^% k$ d2 o. _4 \
  58. #define TCCHEN_SHIFT                22
    7 [# t) h' h: h7 L" x8 j  @% c
  59. #define ITCCHEN_SHIFT               234 ^- a$ @2 R! o+ l

  60. 2 t7 O% z/ s4 h
  61. static volatile int irqraised1 = 0;4 L! C  ]4 b; v( H# I
  62. static volatile int irqraised2 = 0;
    0 z' y1 W/ b& e+ u
  63. * U- j3 a* T; S4 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. i! l6 V# Q2 _% q# r% y& q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s3 D3 E6 j% ]6 S% N! ]- U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' E% u9 O, M$ @2 ?: n& \" n

  67. 8 L. j- T  S! {! Z6 E% v
  68. dma_addr_t dmaphyssrc1 = 0;
    1 t4 M! S0 i8 D* Y' O
  69. dma_addr_t dmaphyssrc2 = 0;
    / a3 }  U/ T. F  c$ c
  70. dma_addr_t dmaphysdest1 = 0;' g9 e8 D' J" s6 N9 J
  71. dma_addr_t dmaphysdest2 = 0;
    + l7 F; ]9 T5 A
  72. ! M1 z  n1 C6 R. Q
  73. char *dmabufsrc1 = NULL;* n9 q1 _7 e7 [: x) l7 G
  74. char *dmabufsrc2 = NULL;
    " v( z& ~6 U' D; @0 z9 i( c# P
  75. char *dmabufdest1 = NULL;7 c* g$ G. s# K( H0 r
  76. char *dmabufdest2 = NULL;! C0 j7 _9 C" W5 }; }5 T& x
  77. # \( L9 y, V1 V' W  T4 b
  78. static int acnt = 512;) B; D1 w4 F, u% c6 E6 X
  79. static int bcnt = 8;
    $ L) q( v5 h; ~2 n
  80. static int ccnt = 8;0 f. b/ v  ~2 p
  81. : E3 u, c# }8 n
  82. module_param(acnt, int, S_IRUGO);' z& D/ g5 Y0 \& k8 O1 Q
  83. module_param(bcnt, int, S_IRUGO);0 b3 t3 o6 Z3 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' `: _' F' X4 J0 {6 |, f

( }( l* p: E% Q& f" L  v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ Q2 B& D( B+ m# N( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* |  y1 C8 X6 X2 Y  I" O2 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: l3 X+ v3 p3 G* |
3 M4 }3 E% e9 P' ?# y4 F; t: K' X' v! H* h' H% Q7 u" D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 02:59 , Processed in 0.037772 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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