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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" P! g( \6 ^/ s! |% x
  1. [code]EDMA sample test application" @" }0 K! _. C( m
  2. /*
    : _; A* i% _# N3 F. F# i# I& h  ]8 @
  3. * edma_test.c
    ' v% i+ k7 b; z% ]# a; K
  4. *
    8 _' a- i: c2 A* M2 l6 o6 o
  5. * brief  EDMA3 Test Application: B: `! \( l" I9 @6 p+ b
  6. *
    ' h$ B( ]/ W* b" T4 h* ]
  7. *   This file contains EDMA3 Test code.
    " P5 u9 |9 e  W: B3 R
  8. *+ l* n& V5 z, l9 M& Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & s0 X0 R  R4 p8 ^/ Q: D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ]0 N  R+ F* G# k
  11. *         TO CHANGE.
    + c1 H# ?5 j& c
  12. *$ L- f& o* H9 e7 R  K! j- d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; b1 c9 V" d% U! i6 b
  14. ** h6 z4 \2 `: z; r7 _: g. g
  15. * This program is free software; you can redistribute it and/or
    : c% E  i- ]# k: t1 m& d! N
  16. * modify it under the terms of the GNU General Public License as2 {8 z/ Y0 S- N( B
  17. * published by the Free Software Foundation version 2.
    3 p( X7 J4 P* T
  18. *' L9 w) j" ^# d& ]# m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 }- H) a/ o& r$ h0 B
  20. * kind, whether express or implied; without even the implied warranty% y3 v: u2 A: O9 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + e) R: s7 d& r0 U7 L  a7 E6 d) K' v6 p
  22. * GNU General Public License for more details." g5 U) s3 K5 \* ]; a) J; _
  23. */
      m- Y9 i+ Q& Q9 E3 m# _+ h

  24. . @9 V$ ]# h4 p0 @
  25. #include <linux/module.h>% d4 p, {# A8 A# a
  26. #include <linux/init.h>
    # K$ h6 M) s% z5 {! K
  27. #include <linux/errno.h>% Z) M9 t9 m7 j- y6 q. f3 d
  28. #include <linux/types.h>
    0 S9 B: z; c0 S, t% g" O" y
  29. #include <linux/interrupt.h>1 s, d) ?$ o2 q* J
  30. #include <asm/io.h>
    ' _, `* b8 ]& d6 w' {' S: L
  31. #include <linux/moduleparam.h>
    $ z5 _* d( Y) C' q1 K: U
  32. #include <linux/sysctl.h>
    7 `  G# d# r7 r* E7 |, M4 r# C, M
  33. #include <linux/mm.h>- ^6 C1 z/ [6 ?6 L! @( W2 g
  34. #include <linux/dma-mapping.h>
    - X3 d4 N/ q# ^( h- z' p

  35. ( z! g2 k- x' ]: F% H( G3 Q! L
  36. #include <mach/memory.h>
    0 U. D6 m# B0 W3 G" [
  37. #include <mach/hardware.h>+ `: \- Q+ n* @3 F! h) v
  38. #include <mach/irqs.h>. U4 L( Q8 R9 V+ U2 @9 g) m/ @
  39. #include <asm/hardware/edma.h>" ]3 B# A, p2 x5 d

  40. 4 J5 i/ i. V7 A# [! B; o+ t  }$ V8 K
  41. #undef EDMA3_DEBUG( h5 t# v5 x* {2 U6 q
  42. /*#define EDMA3_DEBUG*/
    , A( b. p* ^6 H9 |8 L! |3 r. W
  43. 5 i4 d2 v5 W! d/ Y8 s8 Z; i
  44. #ifdef EDMA3_DEBUG6 D4 L* l' Z2 O; E6 \4 j  Q0 @, R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 L. ^& [* D- e/ d, n5 p' [$ {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 ^2 i. {& b3 Z8 k7 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 {- K/ ^9 N5 r/ o5 @
  48. #else
    / I; W6 _4 X' y6 {3 L) h1 V
  49. #define DMA_PRINTK( x... ). r1 v5 L+ W; Y$ s* B
  50. #define DMA_FN_IN
    $ C; \4 u$ p( u9 d0 [  X- W
  51. #define DMA_FN_OUT
    7 N: x1 k, [- o1 R
  52. #endif
    * [, @7 `, |! u* E/ t: N3 w, h5 G

  53. : q# b6 o; ^0 V( v# S; U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % _4 Z4 b# M( @: i
  55. #define STATIC_SHIFT                3# b: A8 K. ~4 k& y
  56. #define TCINTEN_SHIFT               20! T( S3 t2 ?9 B% a5 Q, O. [: p
  57. #define ITCINTEN_SHIFT              217 s$ ^& _4 A. b! k/ d0 i
  58. #define TCCHEN_SHIFT                22
    % F# x8 l" i* ^
  59. #define ITCCHEN_SHIFT               230 q; H0 J4 X" Q8 V, m' P

  60. 7 k2 M/ W! D4 ^# {  V; [* v
  61. static volatile int irqraised1 = 0;6 ~+ W* [" ]$ N3 E6 W
  62. static volatile int irqraised2 = 0;
    , R/ D4 H7 B- `( R9 G

  63. 1 v" A4 k! A3 l& q* q$ k$ Y' M4 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 M2 g  W- H% ^' z% [: P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 [+ G) h$ B5 \9 p7 ]6 q9 s# T5 b5 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ^; j" v  R8 S0 l- S* F# [; l
  67. 9 q1 V) Z4 D9 L. Q9 }+ Z. C
  68. dma_addr_t dmaphyssrc1 = 0;
    8 g" f7 @' p, n7 V- I- y
  69. dma_addr_t dmaphyssrc2 = 0;) o, L! n  M* _4 {8 I% n# Y
  70. dma_addr_t dmaphysdest1 = 0;. t: f/ j: z3 K' y0 S% _9 f: B1 U! x
  71. dma_addr_t dmaphysdest2 = 0;
    $ X+ V) d5 l2 P+ q9 ^

  72. , r7 O' S( r0 O: g
  73. char *dmabufsrc1 = NULL;
    1 I( ]4 B: V2 K, |% q. X
  74. char *dmabufsrc2 = NULL;% F) i, j; H4 X7 E$ T
  75. char *dmabufdest1 = NULL;
    % o) ?! V5 }  H
  76. char *dmabufdest2 = NULL;: e8 ?& {3 c: p3 N, V$ d# S

  77. ' q; t3 u4 b/ h
  78. static int acnt = 512;: }( }3 z8 _1 p# e% ~
  79. static int bcnt = 8;1 P( Z2 @' k. I- N3 o  y8 R
  80. static int ccnt = 8;
    3 {( O8 u4 \% w3 U1 ?1 B6 L7 D4 }
  81. , z& E, f% k. z- K7 k
  82. module_param(acnt, int, S_IRUGO);5 c. a' b# G/ Y: I* X0 H& L
  83. module_param(bcnt, int, S_IRUGO);
    ' S" I; n/ U- x$ h8 n/ q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 x0 J- ~8 P7 R2 k0 Y0 Q1 _

  n5 S! S4 ?! x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" L& Q  b( T+ N2 V; e6 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) l7 V/ S( B& k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ~* Z; V5 r. R

7 r- N6 X0 S7 A5 k+ t  S/ a, U  Z" R$ |0 p0 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-22 08:23 , Processed in 0.039766 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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