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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 u* ~" h: `; V- J% `
  1. [code]EDMA sample test application
    + B3 y3 X9 B- c* K7 @7 I& N
  2. /*
      R8 \5 K( q) c$ H
  3. * edma_test.c
    + }% a+ R) n9 H% M8 \
  4. *
    - q4 m- P- a8 U" u/ e% z
  5. * brief  EDMA3 Test Application
    3 ~  a5 }) H) l; F
  6. *
    " m) Q8 t( L4 [1 L- Z
  7. *   This file contains EDMA3 Test code.
    ; B3 L1 y; {+ @- a( S% T
  8. *
    - `0 C/ B( S' j- E2 Q: F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 g: c. a5 z# v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ I2 X, `3 h0 Q) o8 D
  11. *         TO CHANGE.
    - v0 G9 i* O, J
  12. *
    7 J' x9 \! v1 N9 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. k. c$ K7 A7 Q5 D9 t
  14. *1 s4 W4 u, Q$ B. {( A! u
  15. * This program is free software; you can redistribute it and/or  K5 A- Z' g4 D3 n
  16. * modify it under the terms of the GNU General Public License as: U3 k; z8 R. _
  17. * published by the Free Software Foundation version 2.( ?. e( F0 Z3 W2 p5 e% r4 U0 ^, R
  18. *, I5 s9 B) `2 u" E; F) t, Y5 z4 ]$ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: y1 a. |+ r; k8 M
  20. * kind, whether express or implied; without even the implied warranty  o" f5 y1 P9 R7 ?2 M- y6 q' y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " g# P0 d( A; c) l7 C
  22. * GNU General Public License for more details.7 M! o$ G' P, o9 x6 _
  23. */
    % k2 N1 C. b* G. {0 C- w6 }
  24. % r& y" U( ^" _4 p# x9 ]0 w% W3 q
  25. #include <linux/module.h>
    $ e) T% ?2 A. B9 n; y% S( J
  26. #include <linux/init.h>
    . n  {" |9 {0 j1 Y6 [# d/ [9 C
  27. #include <linux/errno.h>- d2 ]9 c9 C) S+ V% ~
  28. #include <linux/types.h>
    ) w2 m( u/ A7 C5 X1 t9 h
  29. #include <linux/interrupt.h>1 t3 _! x# Q: a0 M) L
  30. #include <asm/io.h>& p$ W  T6 `( B- h
  31. #include <linux/moduleparam.h># z5 m; W9 L) J. [3 h# B
  32. #include <linux/sysctl.h>* U4 l& n% ~0 I0 R( R. J& c8 {
  33. #include <linux/mm.h>
    8 Y8 Y- m2 A8 ^) P( K# n( r
  34. #include <linux/dma-mapping.h>
    $ h( G0 }& S7 ]# E; q; R

  35. 6 H: K, T+ j$ z" i  j: o! ^
  36. #include <mach/memory.h>) `" O" s8 s/ X. E5 }7 y
  37. #include <mach/hardware.h>
    & v. _) D& R' v( ^/ F; A
  38. #include <mach/irqs.h>
    4 u. Q; Q- H+ Y: E" d$ r
  39. #include <asm/hardware/edma.h>
    / e  m/ @* i5 i$ m5 o
  40. , z" I; ~; C) l/ u8 r
  41. #undef EDMA3_DEBUG
    3 ~; o9 O7 G7 Y* {
  42. /*#define EDMA3_DEBUG*/
    + `0 n4 n" J/ A

  43. 5 }3 f8 a6 h, W' `$ I6 u  ~' E8 E
  44. #ifdef EDMA3_DEBUG
    % ^. g6 n; i- ^/ I4 x% l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( _- a$ p3 E9 \8 \8 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 m# ]: e" E% p! e8 j: r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ^* l4 P6 s9 Q) I. u  s
  48. #else
    5 C! M$ f1 J: V
  49. #define DMA_PRINTK( x... )' y6 t1 W- _1 t  m: f
  50. #define DMA_FN_IN
    - J$ P% [$ D/ m. G1 M% u
  51. #define DMA_FN_OUT; E9 Q6 f' u" C
  52. #endif' {) f0 h% ?0 t
  53. ) a+ G2 s7 I- V( ]! g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 d/ G2 y+ b) o9 ^
  55. #define STATIC_SHIFT                3$ L; I2 W3 y' ?; r+ S
  56. #define TCINTEN_SHIFT               20
    . ~) G3 q" H* l) ?3 _7 R) f
  57. #define ITCINTEN_SHIFT              21
    5 u( l' K1 ]% f' C% V$ J+ c4 f  @
  58. #define TCCHEN_SHIFT                22# O0 w% E9 Q) S7 T- H) [$ v7 Q
  59. #define ITCCHEN_SHIFT               23
    & j9 ~7 W6 U8 `1 k; |& O) P8 S

  60. 2 M. d2 i5 }0 z+ A
  61. static volatile int irqraised1 = 0;
    2 A- `; O) |5 u+ u4 |, J9 ?
  62. static volatile int irqraised2 = 0;4 b7 I0 Y5 V, `8 ~9 z
  63. 2 o$ R4 I* P) b. n. J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! a& f9 p; M1 l4 c6 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?" n, Z: e* u$ ^, g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V: s: j+ A  r( Q6 j
  67. : u7 S. r1 P- _  ^/ h4 ~. m
  68. dma_addr_t dmaphyssrc1 = 0;
    9 I; K3 h+ v5 e  G1 V
  69. dma_addr_t dmaphyssrc2 = 0;
    ' a$ x* U1 k3 r' o% g
  70. dma_addr_t dmaphysdest1 = 0;0 X% |1 u( p, X" V
  71. dma_addr_t dmaphysdest2 = 0;
    % M4 Y5 G8 `  t( n+ U$ l
  72. 9 U3 `2 H; W9 W6 k0 _: o
  73. char *dmabufsrc1 = NULL;9 m! w( p) o9 P' j5 y
  74. char *dmabufsrc2 = NULL;
    $ u/ O2 K, \2 x& Q
  75. char *dmabufdest1 = NULL;3 I+ s3 y: c, q* w0 I
  76. char *dmabufdest2 = NULL;
    ; N, J; I( {' Y, |: M
  77. # [$ U1 c) g  @! X3 \+ v/ T
  78. static int acnt = 512;
    # }! d% i. H- R+ o% p5 G. c; }
  79. static int bcnt = 8;/ \' O# S4 `+ \; \5 o8 z; L
  80. static int ccnt = 8;
    / o4 S3 W: U% {2 S% x' E

  81. & B' H2 D7 v" o. b8 a7 N
  82. module_param(acnt, int, S_IRUGO);
    8 M3 H2 L; z/ X6 Y
  83. module_param(bcnt, int, S_IRUGO);
    / S  C* t: G. s+ t8 X+ I, y0 Z& W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 K7 v6 Z# w. U) T* z0 F
( P" q+ ~- m' Z8 }$ [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* {" H4 P9 l& _, B8 s8 }& Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  K' {2 y/ h9 [. F( `2 n* {7 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) l& X9 \  L1 K% f4 @3 W# E9 a7 ~+ F! g  l
+ R! [  X& v) l7 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-6 16:31 , Processed in 0.048128 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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