OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q& x. q, {( J5 Q8 w, `5 {# h# p
  1. [code]EDMA sample test application4 x& d, F2 L: {
  2. /*: C5 g$ U( v3 w" H
  3. * edma_test.c( I$ S5 \' W% i9 A- \( B/ h
  4. *! P, W5 V; X% G, ?+ z* @  ]# @6 z
  5. * brief  EDMA3 Test Application
    ; h- t, D" @/ h
  6. *
    8 I2 l, r8 K% I! T. K( i
  7. *   This file contains EDMA3 Test code.
    1 b8 Y2 @; h- W5 w7 O7 j
  8. *) T: [  T; x8 Q9 a3 w0 |) c9 _3 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( x  D* e" j$ {: F, g4 d# ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " S4 G0 d9 ]6 E6 U% ^* \" l
  11. *         TO CHANGE.
    1 w, Z# y" o$ R) e! _' t
  12. *
    . A! c$ s5 q  s! c6 q/ p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) U7 W" Y) Y9 W0 [! n) B
  14. *
    0 E7 u3 v( H3 l1 e2 C
  15. * This program is free software; you can redistribute it and/or
    & r8 `1 w% a" R! M* ]
  16. * modify it under the terms of the GNU General Public License as3 I) Q& k. t; ?/ x
  17. * published by the Free Software Foundation version 2.' H8 M6 E' K  L/ Y
  18. *4 B) J+ I# Z! U" W! Y. x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 m1 N1 a3 P; |( d
  20. * kind, whether express or implied; without even the implied warranty1 t8 L& d7 _) R& h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- c4 N; \, }% w+ M7 [
  22. * GNU General Public License for more details./ ~7 Y2 U& i3 ^; J3 k. n
  23. */) {: S/ B8 {; A7 ], O

  24. 1 x7 A$ D5 ]& X. s# ?
  25. #include <linux/module.h>& _* q8 e' x7 f2 k# H  c7 ]9 ~  X
  26. #include <linux/init.h>
    $ f: j+ f% L' a9 S
  27. #include <linux/errno.h>" D0 d9 a3 {! E& K  o/ k2 L! p8 i
  28. #include <linux/types.h>, v3 \6 l/ [1 B; F
  29. #include <linux/interrupt.h>! t8 ~' T7 [* e7 K8 l- |; K8 D
  30. #include <asm/io.h>8 r$ x# T/ x& K. T( @+ x1 q
  31. #include <linux/moduleparam.h>6 g8 Q" o6 U5 V; |9 R
  32. #include <linux/sysctl.h>7 r! c3 C: j9 L$ b3 Q, D
  33. #include <linux/mm.h>& [4 u: e9 F+ K
  34. #include <linux/dma-mapping.h>0 t1 G0 G; R9 ]$ S: \

  35. # h. Y, O* a+ ^3 W7 D8 ]9 T
  36. #include <mach/memory.h>
    ! _% F' k+ x/ V1 o* k5 T* o% t- Z
  37. #include <mach/hardware.h>2 W8 B5 b0 b- u3 d  s* C
  38. #include <mach/irqs.h>
    ! u( o3 z( h) R7 I5 ^& X0 C
  39. #include <asm/hardware/edma.h>1 @( D; h5 Y4 M" w3 _
  40. 2 v  l" S# C1 M+ b
  41. #undef EDMA3_DEBUG; s5 E  [% Z( W% l3 C+ @- T* l; m
  42. /*#define EDMA3_DEBUG*/
    2 Z$ W5 s! q: j4 [1 p, V" @7 w6 q
  43. ( }3 V( T7 |0 i% ]* K' X# G+ \3 [
  44. #ifdef EDMA3_DEBUG
    * U9 {- H( ?4 S9 c& a  g: C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( w7 z: L9 C0 W( ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # G4 Z" e1 m3 p' l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); L$ V$ [8 r  D. {7 B: C7 p
  48. #else5 l# x5 u" R% P, g. O
  49. #define DMA_PRINTK( x... )
    $ ^2 g) K6 R+ T8 n! y5 i* O( T
  50. #define DMA_FN_IN6 W3 R& l( w: Q! o
  51. #define DMA_FN_OUT
    - a6 o* ?' R( \7 T) L
  52. #endif
    4 @4 g8 F+ G! D

  53. ) G- I, o) Q- h" c8 ]+ {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : M2 q/ C; m9 U+ _) m* f* B3 i
  55. #define STATIC_SHIFT                3+ G; y, l6 o2 \( H1 T7 W6 i
  56. #define TCINTEN_SHIFT               20
    8 L% D% g. y. G1 a
  57. #define ITCINTEN_SHIFT              21& M; K2 W/ z% V$ h! K1 E5 y" x
  58. #define TCCHEN_SHIFT                22
      X3 `% m, k5 Q- W* I: }
  59. #define ITCCHEN_SHIFT               23
    : Z; F5 P' w* F$ E
  60. 7 H* a6 ^2 L9 Y) O
  61. static volatile int irqraised1 = 0;* @( w2 W. Y1 e
  62. static volatile int irqraised2 = 0;
    + X  z( D# |( C5 d2 W1 b, T+ Y/ n
  63. % _7 P# N5 a# u, x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H1 S) i; P' O; t8 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 x9 X2 H! }, O2 _1 s" |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % r% g; x) r3 f- F7 s( T+ ~

  67. 7 Z  s# o+ ?6 W! v' u
  68. dma_addr_t dmaphyssrc1 = 0;
    # G& g& H9 ]" O3 C
  69. dma_addr_t dmaphyssrc2 = 0;8 t! c( n! |7 ~8 |9 j, W
  70. dma_addr_t dmaphysdest1 = 0;* ?$ q9 ?6 f% [: g* A9 I
  71. dma_addr_t dmaphysdest2 = 0;
    0 J  {( ]- k4 i  w0 s) A+ ?. v. x
  72. 9 b0 s+ j4 C2 ?3 C
  73. char *dmabufsrc1 = NULL;. T& q7 |  I+ A4 Y. }: t
  74. char *dmabufsrc2 = NULL;
    ) I% C  q! d! G: A4 t8 I$ m
  75. char *dmabufdest1 = NULL;
    , @( D# i* p6 Z( s0 C+ ^
  76. char *dmabufdest2 = NULL;
    ; W9 t  U, }' r  `0 q; u
  77. 5 L) m7 v- l4 @1 o, ]9 ~) G. W& j, ?
  78. static int acnt = 512;
    . s: U( w" @( m0 p/ m* Z) [/ C: P; K
  79. static int bcnt = 8;
    5 b" g! M( i% {4 b& v! J3 \
  80. static int ccnt = 8;
    2 h+ g( B( D- E# f+ N" o- R* y
  81.   [1 }) }0 ]! D$ |  |% M
  82. module_param(acnt, int, S_IRUGO);
      X0 Z' o; @" e+ b4 T; H
  83. module_param(bcnt, int, S_IRUGO);, E3 p8 A6 ^4 M( }4 A  C! E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 r7 o' w9 X( d6 i+ m

, {+ [3 }# b8 g& {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 D& m5 }; G& {/ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  j' w; g: T% L* ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 }( `0 n$ o6 h6 R8 ?7 \' C) ]5 Z/ v" l. U7 }9 B
  w& T( N3 o- p8 C& {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-4-4 17:43 , Processed in 0.040130 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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