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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) n$ k, i6 b0 d% n5 e* h0 t4 ?& K
  1. [code]EDMA sample test application. a; f4 o9 d+ Z- s9 ]$ f( G% }
  2. /*
    ( \, o( h9 ~5 w4 k
  3. * edma_test.c+ {" `" K' N- P) F
  4. *3 s. C2 T4 w) U5 }
  5. * brief  EDMA3 Test Application
    2 k, z3 _+ M) E  \) E" j
  6. *3 Z/ W2 q# t' U3 V% d
  7. *   This file contains EDMA3 Test code.
    3 p% S- c8 h5 d! G: t' E2 q* ?
  8. *
    $ d. y# I+ W; x/ E) L+ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 }. r; r4 b" }4 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' M4 }3 q0 E0 z# a+ N6 X. P
  11. *         TO CHANGE.. n1 b) e/ ^5 c8 r
  12. *
    $ ?" z$ t  Q  P0 J6 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # V2 \9 \6 w; Q2 O
  14. *- n& U$ ~/ f# B3 t! Q" i
  15. * This program is free software; you can redistribute it and/or
    2 f! [% L% V- K* M0 [) g6 r
  16. * modify it under the terms of the GNU General Public License as; I" ?6 Q( i, m* i$ O5 F* w
  17. * published by the Free Software Foundation version 2.
    % t3 s/ H$ `' v4 A2 I
  18. ** p9 R# u, g7 K# U! Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 H. e. T/ K/ ~) G( }7 f
  20. * kind, whether express or implied; without even the implied warranty- a6 o4 g+ @& i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * s0 O# C" r" Q" I( k. T3 @
  22. * GNU General Public License for more details.2 W# F! J5 P% v3 O+ B8 b
  23. */: P" f  a* B; K! D9 m/ c

  24. + F( t" g0 C4 J4 R; ?5 q. O
  25. #include <linux/module.h>; \5 F/ p; l+ B4 r
  26. #include <linux/init.h>2 s) D, _8 I. m+ t8 y& y3 g2 X
  27. #include <linux/errno.h>  g6 K1 Q* C) `3 Q
  28. #include <linux/types.h>
    * P& L% q* l; {% o! n0 g
  29. #include <linux/interrupt.h>
    . f* F1 |- X7 G( R$ b3 g
  30. #include <asm/io.h>- s( J/ [$ E" U/ G
  31. #include <linux/moduleparam.h>+ G9 M6 t0 A8 W  C7 o$ s( }6 z1 ~
  32. #include <linux/sysctl.h>
    ; G! i. O, i1 l! u8 B; B+ Q# U
  33. #include <linux/mm.h>
    & f2 r2 }: [8 I9 e( X9 A
  34. #include <linux/dma-mapping.h>
    . W* j2 W/ `# [+ D5 B

  35. " F8 g/ T8 z" @; m. a
  36. #include <mach/memory.h>0 Z  x3 p4 o8 i% K5 R0 `7 U+ B" L) m) h
  37. #include <mach/hardware.h>
    2 v7 u. X% u6 _& w/ R
  38. #include <mach/irqs.h>0 t- }6 ]8 J+ h
  39. #include <asm/hardware/edma.h>
    - V; r, H# Z. X0 H# q( k
  40. 3 G8 c6 N* J. J+ M9 ]2 _
  41. #undef EDMA3_DEBUG+ U2 U2 o! z+ p0 C8 S+ h# O
  42. /*#define EDMA3_DEBUG*/+ {8 t( c0 v8 m  F* y3 A1 ]

  43. ) N9 k2 @/ {$ Z- @2 K* K
  44. #ifdef EDMA3_DEBUG$ |5 V) D0 ]; f9 l! `& x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 q* W' G6 a. B* B1 n4 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " C* Y. X. N0 y& e5 C) s0 q8 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 c- S6 c2 e! _4 @: q# W, S! E1 d
  48. #else
    ' G- b' L8 S- |7 Q
  49. #define DMA_PRINTK( x... )
    # y& [, s" ~" \( g" l
  50. #define DMA_FN_IN  d) T7 p+ }6 A1 ?* ]
  51. #define DMA_FN_OUT
    9 r0 `/ a, w; Q' s: C( [
  52. #endif4 B/ b/ X; F* L, b% Y! E2 h
  53. % b5 s6 @3 n8 e1 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 S3 h1 v. m5 l/ h
  55. #define STATIC_SHIFT                3* B! e+ q) P- u4 ?
  56. #define TCINTEN_SHIFT               20
    ) X( r  a5 z& z2 w! Q! ?
  57. #define ITCINTEN_SHIFT              21# w0 i4 b" X3 h( I
  58. #define TCCHEN_SHIFT                22
    - }: ^' Z& {; t+ w7 e5 Q
  59. #define ITCCHEN_SHIFT               23/ Y# X8 x6 x  y0 l2 |- P/ c2 m
  60.   Z) G* s. `1 R& m. a" H
  61. static volatile int irqraised1 = 0;
    ) {* w7 C- V+ D4 c- ~
  62. static volatile int irqraised2 = 0;. u4 {5 V0 h' D; c/ w

  63. " N. K; r4 K* N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - B, L" t5 ~, f4 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) k8 L7 }6 r$ ]& V8 X" I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 G, f, ~# F) K& x, v$ i* H+ a
  67. " v3 |; c: B1 N; Z/ V: o& N- {8 ?
  68. dma_addr_t dmaphyssrc1 = 0;( c* E! Z) ^% H+ E8 S8 D
  69. dma_addr_t dmaphyssrc2 = 0;5 H, d- `* q4 A" I- }
  70. dma_addr_t dmaphysdest1 = 0;
    + ^: L, D& f& n1 j) m. G
  71. dma_addr_t dmaphysdest2 = 0;& i0 N3 `& b4 A& B) t, F

  72. # K7 }# m) b  ]- n7 w
  73. char *dmabufsrc1 = NULL;/ O# @3 |3 `) t7 y6 _
  74. char *dmabufsrc2 = NULL;, ]. ^' W4 a5 i' b
  75. char *dmabufdest1 = NULL;
    7 j/ E3 K( t) M7 t5 [+ k
  76. char *dmabufdest2 = NULL;
    # n) g, Z8 b3 v" R! M1 b5 K7 }
  77. 5 `7 J" h4 X1 _. M8 C+ k. `
  78. static int acnt = 512;
    0 U* k, k( }8 Z4 H( e
  79. static int bcnt = 8;
    ) W' f! [2 h! z8 H* B  l
  80. static int ccnt = 8;
    ' X7 ^% p6 H# D+ T. L6 q9 t" W! i

  81. - s4 k; e8 ]. g/ x  J) r
  82. module_param(acnt, int, S_IRUGO);
    9 k% l% n* }, g! l$ p
  83. module_param(bcnt, int, S_IRUGO);
    4 L" x. h! [+ M( A4 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- l2 d7 E8 `5 [$ ^) q5 t/ Z, ?! ?5 f! j* R3 \4 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ^& D/ C4 r2 ^& W7 h6 e
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 ?& b7 T, M( N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 v+ R$ }9 r2 i5 u' G5 e1 `0 e9 h3 d

4 j( |. i1 D# t( r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-17 00:10 , Processed in 0.039901 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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