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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Q# T' d) i. Z: y) B2 [, ~7 @
  1. [code]EDMA sample test application
    " \2 m" }$ m4 i2 O
  2. /*) }9 p; X& ^: u
  3. * edma_test.c
    ( p4 ^; N+ Y9 x0 O* l
  4. *
    # Q3 f( V  }; ^: C1 s) H
  5. * brief  EDMA3 Test Application
    ! ^' k/ P; w! g9 P
  6. *
    ' \6 n4 q* _) V! T" P
  7. *   This file contains EDMA3 Test code.- N5 o4 K9 C4 k3 }1 i$ t+ }
  8. *. d. }5 H& `9 @/ \% _$ q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) D  U0 b8 h) q. h2 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # |) u7 N4 A2 n' Z7 C2 a
  11. *         TO CHANGE.
    4 ]' A  w& ?+ i2 a
  12. *2 O: I0 u- a* L8 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % {/ W- H6 a; i+ o% X& E) t
  14. *. }, S3 A1 T2 f& ?6 S/ F
  15. * This program is free software; you can redistribute it and/or% _, C8 w6 R' ~# a* v: Z
  16. * modify it under the terms of the GNU General Public License as
    3 w$ E' L# ^5 c: w- v/ H8 }* m' {
  17. * published by the Free Software Foundation version 2.
    ) S$ D) c% f$ Z  g2 j
  18. *
    ) S5 {( n# T% ]( l( M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 Z1 y/ f9 y  i" o) L
  20. * kind, whether express or implied; without even the implied warranty8 Y9 ~2 E- A: G5 @4 D' G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' h1 x( Q$ c- K' [) I
  22. * GNU General Public License for more details.3 L, Q( k4 \1 Y
  23. */
    4 @# E9 s  ^- p/ m1 f$ k$ r

  24. - v3 d( P. g# w
  25. #include <linux/module.h>6 j! W$ ~8 n3 R4 ~) j: |' R
  26. #include <linux/init.h>
    # L. O# s" \- L: Y4 ]: t8 `7 [
  27. #include <linux/errno.h>& t1 Z1 ?& c9 v, C: H
  28. #include <linux/types.h>0 D, h7 z  ?6 n, w: ~" M1 z
  29. #include <linux/interrupt.h>) G  F2 }5 P( W/ _: B3 U
  30. #include <asm/io.h>
    * {- W2 B1 @+ S
  31. #include <linux/moduleparam.h>2 _3 e" _2 p  N- l1 j2 d" f
  32. #include <linux/sysctl.h>
    % }9 H0 `7 E' }: {' B' a
  33. #include <linux/mm.h>
    5 M# Z) g- Q. w3 U; A
  34. #include <linux/dma-mapping.h>
    8 b- G' t: B1 G- K7 y# `% n
  35. - {: I2 U, q* `- j! q5 ?4 l& b
  36. #include <mach/memory.h>( {; H0 n  }/ Y+ _! \# [& c% L
  37. #include <mach/hardware.h>% @2 ~# u0 P$ M9 ?9 s# c/ ?) Q5 }
  38. #include <mach/irqs.h>
    2 U6 K3 X# r9 u8 D! O
  39. #include <asm/hardware/edma.h>
    0 U9 |+ s% W# x' d  `
  40. 6 T! U9 M+ @' I2 t7 n" E- q) W2 X
  41. #undef EDMA3_DEBUG/ e4 a# k7 o) |. A
  42. /*#define EDMA3_DEBUG*/
    0 i, H" s+ ~9 \

  43. ; L# }  H' |' ^2 f- e1 ]8 ~
  44. #ifdef EDMA3_DEBUG
    2 M* b  i5 ~  `' C4 [7 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 m& s4 G$ ^% X6 I- }8 D& ~) I2 e9 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 v/ g/ v9 q* K( j2 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 E$ V/ }% K- D9 x7 o
  48. #else  k- |: h) u1 ~8 f6 l; H
  49. #define DMA_PRINTK( x... )
    , f% `, X# F# n5 f; [/ d
  50. #define DMA_FN_IN' d. Q% y7 t% h6 Y  F
  51. #define DMA_FN_OUT
    / U) _( d0 y5 A. Y9 j; V' O
  52. #endif, \0 F1 a8 _. ]: j

  53. . x, m2 T9 H9 W3 @, b; \6 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 _4 c, E$ K( J: s4 I
  55. #define STATIC_SHIFT                3
    6 B# w. r) m8 N1 I3 D
  56. #define TCINTEN_SHIFT               20
    - ]' l( ?& X' Q& N
  57. #define ITCINTEN_SHIFT              21* u. n; E+ D5 q6 i' n2 ?, h) _0 ]
  58. #define TCCHEN_SHIFT                22
    . I! W7 K% F# s$ A7 w) h9 t+ K
  59. #define ITCCHEN_SHIFT               23  X6 S  ^  K0 f3 ]( I
  60. - P6 q4 v' I- A( `5 m
  61. static volatile int irqraised1 = 0;8 k8 c0 r( n' w& |: g5 K! q" N
  62. static volatile int irqraised2 = 0;7 H  c7 v) M% @! n0 ?! G
  63. 0 B1 Z3 L$ t3 p6 p8 }$ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z$ }0 Y& |" ?: ~3 @/ b$ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - x1 `" A% [7 i; B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 b# g; D& _; v! ]8 p
  67. 6 f6 ~  q8 ^# @6 {  d, w9 F
  68. dma_addr_t dmaphyssrc1 = 0;
    $ v5 a# U: O5 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    ( c& r. t3 v  w8 Y, ~( d1 W
  70. dma_addr_t dmaphysdest1 = 0;$ o! J) d: R; c8 z1 J  f) q$ D# J4 ^
  71. dma_addr_t dmaphysdest2 = 0;
    & W$ M, E; F0 w: L. z9 R

  72. ( h- D: y6 u0 r+ x
  73. char *dmabufsrc1 = NULL;* Q) y4 t& ?7 v$ u/ m
  74. char *dmabufsrc2 = NULL;( s& r) M  |6 n4 [) o
  75. char *dmabufdest1 = NULL;
    4 i9 A& k2 b: Y+ c& W
  76. char *dmabufdest2 = NULL;
    8 [& m0 G& l! ?( \) Y, L
  77. + Z2 H& o' G6 n/ X
  78. static int acnt = 512;
    0 E; _9 Q( h/ a' ?# ^, T
  79. static int bcnt = 8;
    . c% B; a; b0 y6 m% M
  80. static int ccnt = 8;
    & @/ G! O( m  d0 |' |
  81. / Y0 X6 Z+ m0 M8 L% P8 o
  82. module_param(acnt, int, S_IRUGO);
    7 M7 y' c: M' c
  83. module_param(bcnt, int, S_IRUGO);
    1 n- N2 Z  H: G( Z1 C* m$ M( I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 ^' y7 L: F: ]5 r' u+ I

8 V# Q, K  y0 I: s6 ~  G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 |5 ?2 X) \. T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' }1 a* \8 \8 ?# Y) h& z& k9 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* \1 Q9 Y- ~& c& Z# D9 H8 W6 v1 v: ^9 i0 l" p2 N8 h' P; V; c2 {- ^& X

, R9 T+ K4 t' D/ c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-5 09:51 , Processed in 0.044952 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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