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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " H' P7 W. T" D# b5 h
  1. [code]EDMA sample test application
    1 b: F, l' C6 l2 Z2 Q: j2 F7 V
  2. /*
    % y% @) u$ ?* d: q( ?0 N1 z
  3. * edma_test.c
    " u3 t3 T* N' [
  4. *8 T4 E( P; E0 P8 F4 N
  5. * brief  EDMA3 Test Application
    " Y! v# x0 R- f2 H* Q
  6. *9 S1 @. j3 M3 q5 h: D) ]
  7. *   This file contains EDMA3 Test code.
    ( W) R* [) C7 ?" N% b. z# i
  8. *8 A+ ~; I* n' k3 C1 T, |4 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + a, w( T" g' i' Z% u' C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 q$ f: b! H( d
  11. *         TO CHANGE./ m& z1 `" E. z1 P( @
  12. *
    & w! u# Z/ h# j: r4 Y2 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 C' j3 c# }% H- `. J
  14. *
    + r; P9 M; w( }8 ~$ J/ A' ~* b
  15. * This program is free software; you can redistribute it and/or# Q/ s6 p& B3 X  L; B, @7 Z, F1 _& x
  16. * modify it under the terms of the GNU General Public License as
    3 q+ i  [, [- k. O/ p
  17. * published by the Free Software Foundation version 2.
    6 {' c7 P3 Q/ p( \& T) F2 ?9 D
  18. *
    5 j/ ^$ ]8 Y' u- H  R. s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * g/ Q+ _( F3 c7 ?
  20. * kind, whether express or implied; without even the implied warranty1 d# B9 `" Y0 b1 t. D; u7 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- k& f+ i) L5 h9 s  q
  22. * GNU General Public License for more details.6 ]" z" ?5 x3 T# K$ Y
  23. */
    & l3 ]1 H7 [. @, v# [( h8 T

  24. . j+ D  x4 m  o
  25. #include <linux/module.h>
    4 s- B! }. _7 a. N
  26. #include <linux/init.h>
    9 ]( P& I. ?+ B$ l
  27. #include <linux/errno.h>, k7 D. P' S! @
  28. #include <linux/types.h>$ o7 a/ F; N( j  ]' i
  29. #include <linux/interrupt.h>
    ) l6 u3 A$ c4 |6 h% ]) B: L' j
  30. #include <asm/io.h>/ G9 r# u$ y# E7 r  ~0 h
  31. #include <linux/moduleparam.h>* l' M  Z0 u5 D
  32. #include <linux/sysctl.h>5 {" B- o( X4 E9 H2 K+ a- U
  33. #include <linux/mm.h>
    + m; U% \6 X9 M8 r% Q+ a2 `
  34. #include <linux/dma-mapping.h>7 ~8 o0 i7 {8 ]& A+ m% ~
  35. ; |6 q8 c# S+ k2 m
  36. #include <mach/memory.h>: n4 e! I: r" o! o/ q2 w" d( I
  37. #include <mach/hardware.h>. n! c/ a  l. K6 t' {- T: l7 x% h3 T
  38. #include <mach/irqs.h>
    / Q6 S8 `% B( m8 Z* _- T/ V
  39. #include <asm/hardware/edma.h>
    5 x1 p/ }/ X, m& l

  40. 0 H" r+ u* K) H
  41. #undef EDMA3_DEBUG5 O1 s3 J2 `# d0 x, J  [
  42. /*#define EDMA3_DEBUG*/" `5 d3 ^2 c2 \7 w' [

  43. ' [+ C, ?2 J4 `  d$ O; m. e* l0 ]
  44. #ifdef EDMA3_DEBUG! I) z8 J" z! \' T  }, ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), @, A& a; g5 E, b- ~' _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # o1 x" Y: o7 l% }6 H5 b( B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; O$ c8 b$ I+ B; t  U; b
  48. #else) w( R4 ~0 Y* E- t
  49. #define DMA_PRINTK( x... )
    3 \3 d# P4 N/ U
  50. #define DMA_FN_IN
    ( E; \3 `" ]6 p6 x
  51. #define DMA_FN_OUT
    2 y/ R& e2 R6 g  a* `" L
  52. #endif) i! R" i" J7 A1 K

  53. % p  r& V- ^* p6 e: }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& u6 A+ O& x% e- q  x/ d5 w' N+ o
  55. #define STATIC_SHIFT                3
    2 p# _% J. a% m; N9 P
  56. #define TCINTEN_SHIFT               201 o( s) f$ n* b
  57. #define ITCINTEN_SHIFT              211 R* w0 s5 z. A+ d3 V
  58. #define TCCHEN_SHIFT                22
    * }* O* f. ^8 {0 r
  59. #define ITCCHEN_SHIFT               23" E) d# W3 q2 u; S& a3 S
  60. . q) J. P/ P" U) ~4 |) a" ?: C- k
  61. static volatile int irqraised1 = 0;5 B) T2 Y' |/ a$ [
  62. static volatile int irqraised2 = 0;% y" j4 q3 K1 ]# q

  63. 3 D9 M1 g( _( n7 N: S5 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( i7 o/ H6 S6 U3 O! V! Y' _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # b8 \2 o7 P: N* Z3 l3 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 r6 I( A" ]: M+ `4 z* Y
  67. + G! I  l5 x' l, ~& m8 f/ X  p7 W
  68. dma_addr_t dmaphyssrc1 = 0;4 f+ K: e- ^: c& E! B
  69. dma_addr_t dmaphyssrc2 = 0;1 l2 A# q, Z$ x- t1 P( e
  70. dma_addr_t dmaphysdest1 = 0;
    ; B; B+ B1 E' a- z& V
  71. dma_addr_t dmaphysdest2 = 0;
    ) k- X6 E- M: S1 D4 M% |
  72. $ m, u) U& w  T. W, w6 G+ b
  73. char *dmabufsrc1 = NULL;
    2 f, U" V6 U( m
  74. char *dmabufsrc2 = NULL;
    3 W4 d" g' `, s* R' q
  75. char *dmabufdest1 = NULL;9 K( Q3 o' g4 h% C- v1 e3 M( x  m
  76. char *dmabufdest2 = NULL;
    2 r8 B% f8 b) g! D4 u

  77. 3 D5 U7 B+ X$ o2 \! K
  78. static int acnt = 512;' }5 m* z* w! T; c/ q: N
  79. static int bcnt = 8;
    # A* O) W9 i! E) c* @7 ?
  80. static int ccnt = 8;' D# Q+ h4 R/ m: G6 i7 P. o
  81. 5 _- ^% n7 ?2 w) b5 T4 N! Z8 U" Y
  82. module_param(acnt, int, S_IRUGO);
    4 y+ g1 z7 B: a2 x" P3 y3 d
  83. module_param(bcnt, int, S_IRUGO);, `/ P) G  h& J* I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* \1 _$ V$ l; g# N) G
) |& q' h1 r: I5 c' ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' t+ {: h3 f3 \! d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 H. E+ e% ^* K" R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  n: j& g. L' q2 g0 z
9 C' Z8 g! r  D( b- E8 {8 L3 h" n' G

( v& H$ ~; x$ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 17:57 , Processed in 0.037685 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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