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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 U6 `( I6 w' D  r5 A3 k
  1. [code]EDMA sample test application4 B. c8 _# J* P9 j( N& [0 S1 ?
  2. /*
    6 l3 V( j# @, ^
  3. * edma_test.c3 _1 W) G4 O( V+ K8 n1 C
  4. ** i0 H+ A5 R1 H5 r& j/ P" g
  5. * brief  EDMA3 Test Application
    1 _: n( Z2 R  A0 f# Q8 v, |! ?3 V
  6. *
    3 r  D2 n% [& U% K+ g6 a) c
  7. *   This file contains EDMA3 Test code.
    * ?% t& w0 N  L5 p& F: [
  8. *
    1 i- T' Q( P0 `1 ]0 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 z& R! n1 E( {/ y" M3 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Z6 ~0 p7 ^/ v
  11. *         TO CHANGE.' g* P8 c  ?3 T+ C* m3 b/ D
  12. *8 }- a- x7 V5 p  K4 L( q- D' b6 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 K) f- ?; W3 @! M; {
  14. *. L3 U- a) M% V4 C7 s& A
  15. * This program is free software; you can redistribute it and/or; ^$ V- ]! a( o
  16. * modify it under the terms of the GNU General Public License as
    - {/ }) L0 j0 l* @
  17. * published by the Free Software Foundation version 2.5 @- [5 m- ?2 Z2 d0 R+ Q- I3 D; H
  18. *
    ) N3 l* e& M# g- u4 j( U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 i& O& y" L7 V
  20. * kind, whether express or implied; without even the implied warranty
    ( g$ v- R5 @# h# P) I& k8 y8 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) O2 j- p( S% @: x. i
  22. * GNU General Public License for more details.; x  Z6 j  L" Y3 i& y7 s+ B: p
  23. */, R" q- n& l8 Z, r' t4 a  O
  24. 8 m" l/ V7 G9 V, `: R2 |5 M2 i# E
  25. #include <linux/module.h>
    2 |! b- e9 q* [4 y
  26. #include <linux/init.h>7 {4 n9 i) A( K8 s& t8 }* H
  27. #include <linux/errno.h>
    + i; Y  `# i: I" U4 l* E* s
  28. #include <linux/types.h>; ^6 E& [4 r: v  J6 c
  29. #include <linux/interrupt.h>
    ' A& s. r' ?; _1 F  E. h; S
  30. #include <asm/io.h>7 ?" l# B7 B# L
  31. #include <linux/moduleparam.h>. v0 d2 {% ]$ o' O4 l7 u
  32. #include <linux/sysctl.h>, h1 [* G( q. ^& B& x% A6 i6 Z
  33. #include <linux/mm.h>
    $ e0 m" c8 v% J- |
  34. #include <linux/dma-mapping.h>3 V# Q  Q. `9 c7 D8 F! C
  35. ) H; e7 L# ]7 k% G! c5 c: U
  36. #include <mach/memory.h>1 \0 n9 N( o6 F7 }5 Q7 ~
  37. #include <mach/hardware.h>
    / H/ N# L0 z1 G. R7 u" X  l
  38. #include <mach/irqs.h>! H4 u: t' U; M  v, C
  39. #include <asm/hardware/edma.h>) y$ ^% ]1 S7 |3 [( y0 G

  40. : y5 f+ z& E6 q, H- G
  41. #undef EDMA3_DEBUG. f# j$ ?; z3 O4 v+ Q8 p3 h3 Q7 I6 U$ ~
  42. /*#define EDMA3_DEBUG*/$ [2 X& x. C3 A& c5 I- k
  43. ( |& }3 Y; A9 @5 D+ Y
  44. #ifdef EDMA3_DEBUG
    # ?6 b- F2 D8 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  @- m/ S! V8 E% I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 s- {  ]# `( m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( \0 M, ]0 p' }$ s$ \
  48. #else
    ; E2 A6 t- @5 ^- q; ]; \( C" p/ T
  49. #define DMA_PRINTK( x... ): ?# C! \+ a, x, {0 Z0 b3 o0 M
  50. #define DMA_FN_IN' k' z* d! m7 _8 ^2 c5 ]
  51. #define DMA_FN_OUT8 {/ B4 x8 K9 m6 S+ L4 Q
  52. #endif
    ) `  w) R/ M+ d; s# b' d# f
  53. " ~1 }2 o7 u* G$ [6 H6 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / U( h( q/ K' m5 D; R4 ^
  55. #define STATIC_SHIFT                3
    1 h+ t/ L. q0 ^* ^; O
  56. #define TCINTEN_SHIFT               20+ F% c6 R/ b4 Y  ]( E
  57. #define ITCINTEN_SHIFT              21
    ! g7 t. G9 ~# v4 a  C" n6 B3 \
  58. #define TCCHEN_SHIFT                227 B4 V: F& e6 e$ r$ B* W3 S
  59. #define ITCCHEN_SHIFT               232 I$ y- W% L: N: {

  60. ; r" p) e, o" S/ h1 c; {! u- a
  61. static volatile int irqraised1 = 0;
    7 H' H1 r4 E. ]2 P* b0 Y
  62. static volatile int irqraised2 = 0;
    # H, @, t3 I1 M% u5 n5 H

  63. " L5 ?3 i, Y0 ^- P; [5 y: a1 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e3 d" h6 ^5 u) h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 `) l' D! |- R: d+ B7 R( r, d0 C7 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) o  ~: R, s  Z2 Y

  67. % v3 i. c" }+ P  |* J/ N! w
  68. dma_addr_t dmaphyssrc1 = 0;3 p6 O4 m- ]9 a  c, s0 |% n
  69. dma_addr_t dmaphyssrc2 = 0;
    ' F' e/ q0 U3 c5 x; ^
  70. dma_addr_t dmaphysdest1 = 0;
    ' U) @( u. N4 B: [% {3 f8 G' X
  71. dma_addr_t dmaphysdest2 = 0;
    # s9 H7 [- `- T7 T. |

  72. & k' ]0 x2 R+ Y! z, P( N# ^
  73. char *dmabufsrc1 = NULL;
    / p. o* z7 W, `+ L
  74. char *dmabufsrc2 = NULL;
    % I5 V% B4 K- m/ I, p
  75. char *dmabufdest1 = NULL;1 Z( y( n, F) ?6 H0 b2 w9 }
  76. char *dmabufdest2 = NULL;4 s' X6 r" L# [
  77. - F5 p5 t. Z$ V2 j  `2 \4 {
  78. static int acnt = 512;
    4 Z6 ?  l2 R, t% r0 \
  79. static int bcnt = 8;
    2 g  Q* L' ]. o
  80. static int ccnt = 8;& F: c6 r: `* \/ G) H
  81. $ Q' M) {3 [; n( N# ?' b
  82. module_param(acnt, int, S_IRUGO);
    % Z% N% l* r( i& x' a! n  l+ k
  83. module_param(bcnt, int, S_IRUGO);
    + y0 r6 l% g7 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 N! t4 l" s' r& D" `& x" F4 m  V2 a( I/ e5 D2 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G9 D0 _4 ]. w3 O& @2 I( Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ U& \: v' H  ^! P  s/ Y3 K7 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. d% }1 f. h6 K7 n
5 r) {$ ]6 J- ?* b$ q# K
* {$ I; Z" A& V0 m3 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 05:32 , Processed in 0.039034 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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