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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) E3 v! e8 s7 @. {  h
  1. [code]EDMA sample test application
      \6 I" h  d# I% e$ v6 S
  2. /*& @/ \3 U& z$ V, N0 u
  3. * edma_test.c3 i) r  l* W6 D; i. u# b
  4. *
    . R; Y2 c' x& b
  5. * brief  EDMA3 Test Application
    : s- i. d8 Y/ s+ _' z. T
  6. *' Z1 ?# X7 D* V! O
  7. *   This file contains EDMA3 Test code.0 z) p) M; s$ c
  8. *5 Z- j* j! M# ]0 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 @: t6 X. H8 |& |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      Q8 R' U9 g  d) M3 g* T2 b
  11. *         TO CHANGE.
    / L8 E) r( `9 L, V
  12. *
    , w5 K1 \: H. V: \& I; B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; b8 [/ q9 s. h1 W! M
  14. *
    5 U3 q# n$ Q8 }8 @6 k9 l
  15. * This program is free software; you can redistribute it and/or/ L& r  x  d* G
  16. * modify it under the terms of the GNU General Public License as
    & w- W6 A+ ]& H3 M  J9 x, T6 e  j% R
  17. * published by the Free Software Foundation version 2.  Q6 a! B" M  I) W; |
  18. *
    # {1 c: n0 p8 h, l0 z0 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ?- S/ f3 v. w3 q; a$ _( n! w, p
  20. * kind, whether express or implied; without even the implied warranty+ o: x  K/ M- b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( w* p" F& V- ]) J, r
  22. * GNU General Public License for more details.
    # M+ [& w; I) E! z9 Y
  23. */: t) R( r; g  E. g4 I
  24. 5 c; u! y8 b  g" V
  25. #include <linux/module.h>
    5 j# h6 K+ I, B7 T
  26. #include <linux/init.h>
    % d& p! K/ P. ?5 _5 T+ s" p
  27. #include <linux/errno.h>9 }" D) |* d7 k0 G! A. R  c  Z
  28. #include <linux/types.h>8 O5 q; o0 }: ~* t* u
  29. #include <linux/interrupt.h>4 S2 T1 |( T2 `* N; r6 f% J1 r0 V
  30. #include <asm/io.h>: e8 k% A: i* O6 M& Y" m
  31. #include <linux/moduleparam.h>
      f/ k# v  n, ?5 X; E
  32. #include <linux/sysctl.h>
    " W1 C, m" ^9 Q9 \4 p% _3 M7 ~, M
  33. #include <linux/mm.h>0 x4 T" J. t$ r, L7 @) k* q) k
  34. #include <linux/dma-mapping.h>
    3 d/ ]- q" @; Q+ \
  35. 5 U' D; Y5 J1 Q" q, x
  36. #include <mach/memory.h>
    / `% k5 s' O3 [0 h- u
  37. #include <mach/hardware.h>0 `5 _- |  q, O9 Y9 [
  38. #include <mach/irqs.h>3 E; s0 _# J, }# C4 w7 }
  39. #include <asm/hardware/edma.h>6 A; }' `9 q% Q* `( B- m
  40.   J* |9 @  u" k; j, h; g
  41. #undef EDMA3_DEBUG, L$ Q! ?0 j# h4 [" a5 x
  42. /*#define EDMA3_DEBUG*/, h' Z. r! i7 J$ g/ e

  43. ' P2 p* o" P& ^8 l! v8 V7 T
  44. #ifdef EDMA3_DEBUG
    : D1 l: B5 H0 W: O% f! W% O# U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). |1 p3 l) C/ |& j, {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) [4 P5 c" ?! ^( U& p) W% g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" P* P/ l1 g7 |8 r2 U
  48. #else3 ?, R/ ?0 u/ o& Y1 z' A& c
  49. #define DMA_PRINTK( x... )" y5 B2 V$ ?/ p6 w  o
  50. #define DMA_FN_IN
    . X) Z0 Q# o7 @5 {/ m
  51. #define DMA_FN_OUT
    ! u! D% N) T: d/ v
  52. #endif
    ! c9 a* b$ {1 ]

  53. + e4 P2 s4 q0 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" h; E( f9 w1 Q, J8 O
  55. #define STATIC_SHIFT                37 B( b$ H  ^5 T% _, r( c
  56. #define TCINTEN_SHIFT               20
    + L9 F, H! q/ x  R# x2 V, i
  57. #define ITCINTEN_SHIFT              21
    * i2 o. \. r- X/ F" p
  58. #define TCCHEN_SHIFT                22  H3 g2 V' C2 G0 d* w) B( [5 Y
  59. #define ITCCHEN_SHIFT               23
    * O$ g7 f1 P9 w; Q0 K$ t  P

  60. " y; ]3 @  _  T! f. O
  61. static volatile int irqraised1 = 0;8 u0 }* F" [9 q2 V" L
  62. static volatile int irqraised2 = 0;
    ; K. ~  B( v, S' A2 d: V

  63. 7 L5 e2 B! X8 ?% n; x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) v3 [9 Q& _9 \/ ]2 x. `6 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ L8 v/ z2 V8 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) r% q! I* v6 A7 W

  67. 4 p% P& ?0 N  ~: E7 a+ H3 x7 I" h
  68. dma_addr_t dmaphyssrc1 = 0;
    & ~. f, O4 r/ T* m; m
  69. dma_addr_t dmaphyssrc2 = 0;
    ; v$ t. x1 l% l' n& a& ?6 O
  70. dma_addr_t dmaphysdest1 = 0;8 J4 y3 q7 @' S* w3 S
  71. dma_addr_t dmaphysdest2 = 0;
    # F! M/ d8 c- e# G; _
  72. 0 G: Q( ]$ J# s
  73. char *dmabufsrc1 = NULL;" B+ s' n: `6 s. c0 _) L
  74. char *dmabufsrc2 = NULL;' k5 O: m9 X! Z- a2 e
  75. char *dmabufdest1 = NULL;
    ' Q0 c7 w: _3 d* v0 |. E/ I
  76. char *dmabufdest2 = NULL;) U9 m" b, ~# O( n8 A  D7 m

  77. 5 d' H/ Z) B8 }+ l# q
  78. static int acnt = 512;/ _( ^; d) f6 B! z% S
  79. static int bcnt = 8;
    3 ?0 w# `5 M% a: [: y
  80. static int ccnt = 8;6 \3 `  |, z5 _  I( x, W1 E/ k* V
  81. , g  b3 |$ N2 y
  82. module_param(acnt, int, S_IRUGO);
    ( H7 C6 U% {& o4 E, L
  83. module_param(bcnt, int, S_IRUGO);4 t9 ?7 D7 a  c& i+ H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 c  x- U- e0 N+ p$ M# |; O0 ]: q  J6 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% j: O# f$ s" B$ Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 R# {4 @, J, ^0 `1 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- g  a- R$ H" O
, \$ g; c$ J$ ]3 y

0 d" t8 |, @5 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 22:54 , Processed in 0.038985 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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