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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 V4 L' A& P6 x- q! E. F
  1. [code]EDMA sample test application$ q; t8 t8 S+ \$ ^
  2. /*
    2 x7 t" f7 ^9 K6 p
  3. * edma_test.c! D  w$ U" T& s
  4. *7 f& @7 D3 b' e( M% Z$ T
  5. * brief  EDMA3 Test Application
    % z) U! l9 a) W( k2 N' Q
  6. *8 y  C, A+ @" e/ R0 O
  7. *   This file contains EDMA3 Test code." v9 o7 {4 F5 N0 r  l" k. H, h
  8. *
    . G9 N: R+ x  Y0 Q+ ^5 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ c( o9 P6 f. t4 M2 N& ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      q5 H3 J1 ^2 `% d; t
  11. *         TO CHANGE.
    ! m5 A4 J6 h& j/ L* _* H
  12. *6 u! X- [, v! O4 E$ T% D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ]* M( Q  D: F5 v$ D+ o! a, x
  14. *
    $ W/ I2 O$ g# B8 F
  15. * This program is free software; you can redistribute it and/or5 |2 R7 R) G5 d
  16. * modify it under the terms of the GNU General Public License as
    4 ?* C$ F" J: M0 V; r- F
  17. * published by the Free Software Foundation version 2.
    ) Z3 X1 E, L% p9 f
  18. *! ~# z; m) G* _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 V, m/ F8 ]' g. s" c: A$ z* C
  20. * kind, whether express or implied; without even the implied warranty
    - _% a' @6 e* p* d. x/ ^0 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ q/ j* y5 r; D- T
  22. * GNU General Public License for more details.
    & y  ^  q, ?/ \& G  g6 {
  23. */* A. x1 P( n8 }( y- ]( g
  24. ! h5 m, U# X5 I* k
  25. #include <linux/module.h>
    5 {" Q( H2 c  r: i/ ?8 g+ V/ Y
  26. #include <linux/init.h>
    5 {# }; |8 S" H( B3 G
  27. #include <linux/errno.h>9 m  d" l: l& x9 F; ]7 u8 w
  28. #include <linux/types.h>' G6 U& {9 k+ O0 Q/ K) P" J. W; K6 A& p( S
  29. #include <linux/interrupt.h>
    6 z/ t  f$ V1 G+ W- V; s
  30. #include <asm/io.h>6 c2 k8 ~0 f6 R5 V
  31. #include <linux/moduleparam.h>
    7 l. i2 J' C  A2 Y( Z9 t+ W
  32. #include <linux/sysctl.h>
      `3 a6 N* [0 {. r* C3 P, m
  33. #include <linux/mm.h>  Y3 U( R' l: Q/ p; o0 m8 x. g" |) _. m
  34. #include <linux/dma-mapping.h>
    # H$ f9 X; m- u1 d) q
  35. ' G# o4 }# P/ T4 ^' t
  36. #include <mach/memory.h>
    8 U  C) _4 ^% @
  37. #include <mach/hardware.h>
      M2 o" k1 s# |, A5 ^# y
  38. #include <mach/irqs.h>4 Y' E# D+ I2 h. E1 e
  39. #include <asm/hardware/edma.h>
    3 t1 q# G5 ]& W' R
  40. 0 V) t2 x8 V. @6 @. D, B5 r
  41. #undef EDMA3_DEBUG
    5 H2 t6 }6 o# P7 N2 N1 s
  42. /*#define EDMA3_DEBUG*/
    : H" }0 C' s( x$ S- I+ t

  43. 9 m' \5 f* Z. V- B/ X
  44. #ifdef EDMA3_DEBUG0 ]% ]0 p7 ~* Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- F5 X0 W4 B$ A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" [1 \  C* |( b3 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' S7 A! {" m, `. s: C; c% }3 ~: y
  48. #else: r! f+ v* Q; }- K9 [: E' D
  49. #define DMA_PRINTK( x... )
    4 k# r# H+ v  B% W
  50. #define DMA_FN_IN
    ) S* l6 h% ^# j: n8 ]3 C4 e1 u% \' G5 e
  51. #define DMA_FN_OUT
    5 ?4 Y; h4 n8 t$ p$ ~. V- K  G& D
  52. #endif( R5 k- f, s8 N; \' m% [

  53. & ~+ u' Q& K$ f/ i& Y, y1 l" Z' [( V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % S! V6 B/ j' Q5 t9 ]. e1 a
  55. #define STATIC_SHIFT                3, G; `  a0 W; C) G5 o5 n. b
  56. #define TCINTEN_SHIFT               20
    . J! |8 E+ }% w& w! y! P9 o5 @2 ?, L: I
  57. #define ITCINTEN_SHIFT              210 r& e, q5 h( c
  58. #define TCCHEN_SHIFT                22
    $ @) h6 p: m4 x  q
  59. #define ITCCHEN_SHIFT               23+ |$ ^. ?3 i: q* o+ j

  60. $ ^0 Z; ]4 C) t
  61. static volatile int irqraised1 = 0;
    - B9 e- I/ n: E
  62. static volatile int irqraised2 = 0;( t8 P! ~3 d2 e9 k, H% Y

  63. $ J1 _. O* j+ l% q* Z' @. w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! m" u" H6 `. V( |4 x- F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Q) [6 J1 o; x  ]9 T' i. L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 N! A  \8 [4 d$ v$ G. V

  67.   L( ~0 C6 u6 j6 m& a4 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    # k1 I3 j& h. j, _3 B1 s2 k5 C
  69. dma_addr_t dmaphyssrc2 = 0;) q+ V% q2 l; q! ^8 Q* ?7 \
  70. dma_addr_t dmaphysdest1 = 0;( v! W4 c7 N! S% O! D9 @( I# F7 [) ]
  71. dma_addr_t dmaphysdest2 = 0;
    & Z+ A) X$ `8 l- P* S9 `

  72. 0 d; O& ^1 R/ K
  73. char *dmabufsrc1 = NULL;3 \: x# n: F& {  {: {
  74. char *dmabufsrc2 = NULL;
    7 d( K. K- ^0 `. }2 |' M8 \
  75. char *dmabufdest1 = NULL;
    # q$ Z2 ^1 _  R% M6 }  D, H) {* a
  76. char *dmabufdest2 = NULL;
    6 d# V4 E" z: s5 K
  77. : Q7 v. p# @3 k2 A& J
  78. static int acnt = 512;
    ; h" h! s- L' c6 N7 C
  79. static int bcnt = 8;
    + l1 V3 M  Q2 j# n
  80. static int ccnt = 8;$ r( d' V/ q+ V9 J

  81. ' p% R" B# K, E: O& c
  82. module_param(acnt, int, S_IRUGO);
    3 L7 g  Q9 t! r+ q7 j
  83. module_param(bcnt, int, S_IRUGO);
    ; H, K2 o( a( H9 a8 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# ]& s, E& ]2 _6 k

" D* S9 F4 q; c  L" |6 ^2 V) r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ O, Z+ f  Q0 d7 y/ Q4 b. ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* E* C5 C  h. B& L* m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, y2 E  @' M7 k/ D3 R/ Q$ }4 u; b& k  U1 y5 z
' K+ m4 M1 b% J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 20:16 , Processed in 0.048393 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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