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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; U) \5 n/ X  V
  1. [code]EDMA sample test application
    % o: B& F* q) x" t  J) ]' S
  2. /*
    : e9 D4 t! F7 U' k: x4 A
  3. * edma_test.c/ `( U) F* ~! S
  4. *; v% D* X3 J" e) |9 L$ v; j
  5. * brief  EDMA3 Test Application8 L+ F0 ^. F" u8 h7 |: X
  6. *) h" p% u  A$ l
  7. *   This file contains EDMA3 Test code.$ y9 w$ U2 ~" e* C* u* Y
  8. *; N0 V. J0 {# ~6 n( q" I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ U6 A7 H. P& t9 M, c  {' X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ ~: `6 i/ d% v1 T# H! F8 b# J
  11. *         TO CHANGE.
    * I; m( L+ r  J- y- ~5 K- ]
  12. *1 A2 f! a0 Z" d, j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! O/ A0 v/ y+ `5 L& G
  14. *- f& N; R: G/ D' ]
  15. * This program is free software; you can redistribute it and/or
    * s8 E0 D; G" N" t5 E1 X! g
  16. * modify it under the terms of the GNU General Public License as
    ' _* h: M; X5 q8 _% F
  17. * published by the Free Software Foundation version 2.
    6 L% Q' h& ^7 `% q6 [5 o
  18. *
    0 t- L$ c$ M3 x# m7 ]( k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , ]% F& d7 s0 A# q
  20. * kind, whether express or implied; without even the implied warranty
    & W; K3 {: q8 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + N5 m4 G9 M# U
  22. * GNU General Public License for more details.
    7 t) }1 i" f! r' y& [; v
  23. */1 U, s, j# v8 Z

  24. 0 o% K/ X/ {1 v" I/ ^) _
  25. #include <linux/module.h>' Q" l4 N$ ~7 `
  26. #include <linux/init.h>
    1 ?$ t1 b: ~9 b1 ]
  27. #include <linux/errno.h>% Y" y5 t5 @! H0 f2 J9 i( P' t
  28. #include <linux/types.h>5 C" X9 f! y1 \. V! ^
  29. #include <linux/interrupt.h>3 G) V# n6 R5 P
  30. #include <asm/io.h>& \$ m& h; }8 B: F
  31. #include <linux/moduleparam.h>
    2 G5 n4 e( A: U0 [9 z. \7 G1 O) t
  32. #include <linux/sysctl.h>; V4 a" |1 S4 _$ T0 M5 I
  33. #include <linux/mm.h>
    # c; [# @% f7 c4 S( M' V' [
  34. #include <linux/dma-mapping.h>
      c3 K. q+ s. d3 W) y$ V$ o* ~
  35. 0 y5 Q' V& y% u7 k: _' [0 c% b
  36. #include <mach/memory.h>
    8 z5 M, x' i+ q. B, R7 K
  37. #include <mach/hardware.h>6 T8 x8 P+ ~7 ?0 M, T+ K
  38. #include <mach/irqs.h>, m& X9 _, t; x& i" |
  39. #include <asm/hardware/edma.h>, K: i3 ?" y. Y

  40. / E8 ?+ X- N3 A$ @) G. r" b* M
  41. #undef EDMA3_DEBUG" N6 c* H/ p; x  l  d- l+ Q! e
  42. /*#define EDMA3_DEBUG*/  ^/ \. q9 J3 I; C3 Q2 X
  43. ; y1 l% \) l( R. H
  44. #ifdef EDMA3_DEBUG
    4 S- [: o8 O7 ?% C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * p1 M7 u+ P  f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! S9 ^2 e; @4 K/ g3 S- B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  [) P3 _+ d* H9 [4 N* U
  48. #else
    8 T4 O/ M6 J; e, M% C
  49. #define DMA_PRINTK( x... )' k1 W7 t+ e% s# `9 N1 h# |
  50. #define DMA_FN_IN
    9 [# R4 J* o9 s7 J' ?+ O
  51. #define DMA_FN_OUT
    4 U! X$ q  Q: K; }3 i
  52. #endif/ z) \  u% w" v& a+ k0 ]( J
  53. ) y3 w+ i. F7 U2 g( M3 v- j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( W4 P  ^8 a$ o2 R( h8 c
  55. #define STATIC_SHIFT                3& q& l2 e. A$ d- Y: b6 ^5 Y
  56. #define TCINTEN_SHIFT               201 n+ b" b( a* B" p
  57. #define ITCINTEN_SHIFT              211 C8 j7 S  o' W9 E0 y
  58. #define TCCHEN_SHIFT                22& O7 K4 x8 i) ^$ e8 c
  59. #define ITCCHEN_SHIFT               23* Z/ J9 g: ~4 O9 f: z2 e2 h8 p

  60. 8 \% n. P7 X8 Z
  61. static volatile int irqraised1 = 0;
    % f8 |9 H% u3 h7 s
  62. static volatile int irqraised2 = 0;. l2 p- ~8 m( B/ l$ _. N7 c
  63. " _; u6 d% d* }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + C1 E' d& G, L8 `) q( t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 d: m* E! p: }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G; a  I& o: \

  67. ( n, E8 r- R; \2 j
  68. dma_addr_t dmaphyssrc1 = 0;' ^9 W) n8 K  |3 h$ l3 i4 i* f
  69. dma_addr_t dmaphyssrc2 = 0;
    5 Z# _9 c1 d. _5 v$ z; ]6 E( p( A
  70. dma_addr_t dmaphysdest1 = 0;
    - T! ~6 E2 W; Y! S$ a: ?  R
  71. dma_addr_t dmaphysdest2 = 0;" n0 T# I! Z3 q% _
  72. % q! y# |: C& c2 e4 n8 r# i
  73. char *dmabufsrc1 = NULL;
    6 Y/ J7 T- T6 j& {$ _2 }$ p  g
  74. char *dmabufsrc2 = NULL;
    . Y4 H9 z5 ^# M2 ?& Q' d$ w
  75. char *dmabufdest1 = NULL;9 u: n8 u. T( b' M4 t# w2 c
  76. char *dmabufdest2 = NULL;
      {; f( A% O7 E& F+ Y) v! T

  77. , l0 u, @  P8 O0 t5 `
  78. static int acnt = 512;
    ( W7 _/ q$ p/ L" W! r
  79. static int bcnt = 8;
    0 W! n& P& ]2 w/ W  F7 g/ b
  80. static int ccnt = 8;
    3 H7 \: W' y1 r, q+ r! g/ c$ t4 p

  81. ; G: Q4 E8 ~" d8 g! [5 Z* `
  82. module_param(acnt, int, S_IRUGO);
    - P) V, S0 [; {
  83. module_param(bcnt, int, S_IRUGO);& T" V: e) t5 n) \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- b: v" w3 z6 {  F. u1 `

' n; N1 I7 J- z5 u( a3 W- e( f7 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! }/ ^7 N9 ?; f( u' n5 c) darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& |; t! [8 A% }; Y9 A# k: x/ T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! h$ s( N2 _+ W1 g/ t2 v: r

, C# y" ^, W( U2 P2 V0 q! ]  @7 G: y! Z) J4 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 10:53 , Processed in 0.042338 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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