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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) j) T; p4 N9 [$ k1 ~8 h
  1. [code]EDMA sample test application
    & u' J' |# ~5 R+ H0 d1 x) g9 K4 ]
  2. /*3 M; Z$ ^8 Y+ M1 M( `; Y
  3. * edma_test.c
    % {0 A8 r0 x: K* i1 [, M3 P2 M
  4. *
    & W6 T% y: L; \( b
  5. * brief  EDMA3 Test Application
    3 H) t8 ?8 H% o9 f' e# q
  6. *
    $ \- Y& B% z, B7 B# N" p/ w
  7. *   This file contains EDMA3 Test code.9 _) J& m4 U$ o4 \& O5 ]$ K9 t' e
  8. *
    * U! M" ^& g% V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 M8 R! H2 j7 F0 R, L* c% q/ b0 H. w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! B, H& I/ ?6 c
  11. *         TO CHANGE.% `$ ^6 C0 s/ _: }9 Z
  12. *
    ) ]! y) `  b) L! A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 X! K# n% @& P" ~: C( n
  14. *
    " I- B6 c6 ^; _- m9 z% V$ ?2 Y
  15. * This program is free software; you can redistribute it and/or$ {- \3 n) d- [( P
  16. * modify it under the terms of the GNU General Public License as
    4 E/ G' V* l5 f! ~0 s/ n
  17. * published by the Free Software Foundation version 2.
    " @' g8 q  p, N7 H9 y8 I
  18. *
    8 \6 w& [7 b' }3 D/ q( a5 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; y% P/ K% R2 l' A7 x8 J
  20. * kind, whether express or implied; without even the implied warranty% E; @4 N3 \" z6 R5 l# E$ L9 m4 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, _( \" R, Z9 [. G6 ~9 Y
  22. * GNU General Public License for more details.
    6 u7 R0 }+ A6 ~" `8 N. P) c& @
  23. */4 Z: f* Y- R( ~# i; O" @# ?
  24. $ O/ h4 v- y  E3 h: ~: K! S# M
  25. #include <linux/module.h>
    $ Z7 S. y: N4 }) T# n, c& v
  26. #include <linux/init.h>: _) k1 m( A4 ^. M- B- s9 z8 a
  27. #include <linux/errno.h>+ ~+ |/ y: f& z8 A2 V# A9 Q
  28. #include <linux/types.h>
    ! Q8 |9 T9 \) R* {; @8 z+ d
  29. #include <linux/interrupt.h>% ]. t6 L5 Y9 }- }
  30. #include <asm/io.h>' A0 D4 D, F0 z+ N$ V
  31. #include <linux/moduleparam.h>4 N9 X4 \+ p5 c# P* `* S
  32. #include <linux/sysctl.h>
    " M! r, Q8 V0 o
  33. #include <linux/mm.h>
    - N' }8 S# J4 m& |) w! n* E/ h
  34. #include <linux/dma-mapping.h>
    , X/ `! L" z% [$ ]' D0 x* ]3 x7 ^" n

  35. 2 \+ [. \4 {2 e" s7 F! G
  36. #include <mach/memory.h>9 l; Y* E* c8 W0 m9 N- O
  37. #include <mach/hardware.h>& s! K; d- }' |  Y! K
  38. #include <mach/irqs.h>; r9 [+ y4 C: g, P
  39. #include <asm/hardware/edma.h>9 b/ g3 m# m4 l- p2 P

  40. ' V- A$ s7 R0 p6 n3 i
  41. #undef EDMA3_DEBUG1 {' ]' x7 g, y" J; v) o+ Y
  42. /*#define EDMA3_DEBUG*/
    ; T1 U& _+ f7 C. n2 w4 n

  43. 1 `! ~: _+ ^- T9 c1 G  |9 p
  44. #ifdef EDMA3_DEBUG
    * i& h9 g) _( V0 n- ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 u- Z+ `/ x2 ], L- X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 w, D. g" ]* w# I2 M+ c2 m0 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( `+ w% W; H* j7 g
  48. #else
    2 L6 ^& K5 E0 ~3 `6 c# ^5 @( {
  49. #define DMA_PRINTK( x... )9 I6 e- a; i( A6 T7 D& v% r$ |9 V
  50. #define DMA_FN_IN9 {# l4 \" T. ]2 n$ e2 e, B  ]+ E
  51. #define DMA_FN_OUT
    ' M( L& }; u6 e
  52. #endif
    % T: ^: k# I. e3 q1 {
  53. # ?2 l( w: ^( v: z2 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- Y" _4 Z& i4 F! b! `* I# A
  55. #define STATIC_SHIFT                30 v: e& Q# O. A; d
  56. #define TCINTEN_SHIFT               20
    * A7 x. B! d  }5 J6 p
  57. #define ITCINTEN_SHIFT              21  ^7 m: N) q$ l9 P8 a% K, u
  58. #define TCCHEN_SHIFT                22
    0 s! m( f* Q. U/ Z3 B
  59. #define ITCCHEN_SHIFT               23
    0 c1 l+ S" R- q) p
  60. 6 R* _  V" R4 K5 n
  61. static volatile int irqraised1 = 0;
    4 `- b: t' w4 Z  j5 G
  62. static volatile int irqraised2 = 0;
    6 Q$ @8 e3 e: {- S. Z
  63. # e/ a! t, P( P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S8 p% C* n" f& r- C' m6 s  b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \8 p& c& j9 w0 T3 x0 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, N! E% c0 i6 {/ x' w0 N6 I4 E

  67. - y# s+ r4 `; i9 i5 {( i: T) f% s
  68. dma_addr_t dmaphyssrc1 = 0;
    % V/ K7 G. l  ]0 k5 T6 e) \
  69. dma_addr_t dmaphyssrc2 = 0;2 ~5 L, D9 V( l! V
  70. dma_addr_t dmaphysdest1 = 0;
    7 ?2 j& t3 o1 d" L
  71. dma_addr_t dmaphysdest2 = 0;
    $ {) k/ u6 h* I7 C2 E6 I
  72. / @3 S" V( j- c' C( A
  73. char *dmabufsrc1 = NULL;
    ! I/ t! [. D% Q6 k  A7 ^
  74. char *dmabufsrc2 = NULL;5 V7 x- g" {7 F- k+ Z
  75. char *dmabufdest1 = NULL;
    6 \+ \9 g: Y( X4 i+ D, i' r
  76. char *dmabufdest2 = NULL;) _, q# x: H( ]4 V
  77. 3 B; |! M& o. K
  78. static int acnt = 512;
    # q0 y- B7 v, F: a+ D- R/ k
  79. static int bcnt = 8;
    ( O' a7 Y$ Q% m
  80. static int ccnt = 8;
    & @: ?) o! m8 y& P: P/ y9 ?1 X

  81. / {) {2 I  W: j
  82. module_param(acnt, int, S_IRUGO);
    5 z/ M" o% r1 c
  83. module_param(bcnt, int, S_IRUGO);
    ) m4 N, q- f7 ?! M! D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' \8 F' |% J: y# S
1 |+ v6 d- ^1 J# y( e- K& l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! c8 X$ L: n, P3 U6 o; ^& D9 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; X+ ?5 {; R& d; E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- V2 x4 U1 `; X+ x4 i$ N0 M% }
: e# W* e7 J/ k. x: z  X; B0 u6 x; O; \+ {4 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-16 11:17 , Processed in 0.040372 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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