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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 G# R6 F' v- F
  1. [code]EDMA sample test application
    5 p$ z/ W( q2 {' B8 B. T
  2. /*' @' b5 O: V4 W; e, g
  3. * edma_test.c- T; y2 Q4 {8 ^& ]
  4. *
    $ o8 E1 Z2 F" a2 m, j$ A( i
  5. * brief  EDMA3 Test Application
    : \1 G# o  h5 S/ L
  6. *1 E& C+ _6 U: _1 ?
  7. *   This file contains EDMA3 Test code.
    " b. y1 B8 U0 B4 j) d
  8. *
    8 I7 K5 d2 [& |+ B( e( I* d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % j+ B6 G5 _7 x$ ^9 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: o* {- t# @( _' F+ T6 g2 x6 f
  11. *         TO CHANGE.
    # b8 O, V# X. b7 ]" _( S8 U& j9 f
  12. *
    7 f% q% F5 m; k( W7 ?3 e, b4 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 _. N; B# Q8 s" v9 }& O- L- Z
  14. *+ |: U/ G* d8 @
  15. * This program is free software; you can redistribute it and/or
    # i1 |/ n2 ^- n. V& e( x( @
  16. * modify it under the terms of the GNU General Public License as
    4 z- d4 ?; i( M+ N( Q1 W8 Y
  17. * published by the Free Software Foundation version 2.7 u" Q) ~/ x- y
  18. *" s) w. m- P" B% i" C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: o2 s4 i( }' P# n& t
  20. * kind, whether express or implied; without even the implied warranty
    3 r, H4 [7 b9 Q* O* V8 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " ]. ~4 D- Y! r- q
  22. * GNU General Public License for more details.
    # m, c' o8 w& X4 ?
  23. */
    1 @5 S: Y, p. a
  24. # c! c: ]" }- V/ Z1 V9 U0 B
  25. #include <linux/module.h>
    3 {9 G8 B1 u# ^2 ]+ e' x4 D; u
  26. #include <linux/init.h># f$ i0 @' X/ M; D
  27. #include <linux/errno.h>/ @5 _  m0 A% U* Z6 D8 r
  28. #include <linux/types.h>
    4 g$ o0 F. @8 m: Z6 e  f
  29. #include <linux/interrupt.h>
    " C. a) b& k( l$ h# w2 \. @
  30. #include <asm/io.h>0 R+ n2 y+ v8 f
  31. #include <linux/moduleparam.h>
    0 y- n1 n6 f0 X' H' n& A0 G
  32. #include <linux/sysctl.h>
    3 `9 y: w3 ~$ Q: w
  33. #include <linux/mm.h>
    1 p7 Y. I, C1 i4 R. \
  34. #include <linux/dma-mapping.h>
    . D$ @) G- ~9 B; w! b- i: }# X

  35. ( z3 D7 Z) O4 _, c( ~3 ?: n
  36. #include <mach/memory.h>
    ; ^& u5 B' t( m1 |
  37. #include <mach/hardware.h>- X) \) x2 K3 O. n
  38. #include <mach/irqs.h>
    * G7 x  c; U+ I0 n; m1 Z
  39. #include <asm/hardware/edma.h>5 e1 @* E! i5 g4 Y. U) d' l
  40. : l" u, k( d. K5 ?! c
  41. #undef EDMA3_DEBUG" p5 V4 N% P! ]7 I( M' v
  42. /*#define EDMA3_DEBUG*/
    1 I! O( x, m3 `( O% W: T" s
  43. & }" t2 ]# n, ~8 l6 M' p( t
  44. #ifdef EDMA3_DEBUG" l* U! Y5 R* R. O! ]. }& `. U5 N0 i5 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * w! F; S9 F4 m7 p; L! h" F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 T+ |2 }( J% k* ^' [' C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 I0 A" `) u9 ^& y
  48. #else3 M! e2 s. c9 U" _* `: B1 Z) w) A
  49. #define DMA_PRINTK( x... )# w  _6 P8 Y( |/ M1 ]
  50. #define DMA_FN_IN
    1 x1 ^% f0 h) I) g7 D
  51. #define DMA_FN_OUT3 v+ o; G6 y; Z4 r; T
  52. #endif6 x' u6 V+ h  s/ p2 p1 L9 Q
  53.   M6 J, m0 k- S0 w: x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* c" N4 C; D" ~' K, Q$ F9 ~7 N% i
  55. #define STATIC_SHIFT                3
    ! k) e( }" t5 {
  56. #define TCINTEN_SHIFT               20
    - g* H+ [* K: j- Q" Y! j1 q
  57. #define ITCINTEN_SHIFT              21
    ! }6 |; z" r# B, D2 e5 y" T) O- o+ }' }
  58. #define TCCHEN_SHIFT                22
    # v8 o2 b' o, D  [
  59. #define ITCCHEN_SHIFT               237 G9 B# @+ ]% m# A( f

  60. , @+ Y6 b7 I& F" T
  61. static volatile int irqraised1 = 0;6 F0 ?, D2 O4 k8 s! j/ ]2 f
  62. static volatile int irqraised2 = 0;; p5 f# W- Z5 z* U
  63.   c) `9 Q$ b9 m/ Q8 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) {. s5 D* s. i& Z9 y3 k( P/ y* S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x- V: |' v0 _5 y2 [8 R" `/ d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K) e- s7 N4 g
  67. ( W9 N, T7 X1 ~; X) }
  68. dma_addr_t dmaphyssrc1 = 0;6 A  a1 c. P/ x+ G( S- k
  69. dma_addr_t dmaphyssrc2 = 0;4 Q" z/ X) d9 A( D" o/ @
  70. dma_addr_t dmaphysdest1 = 0;
    7 M1 G# I- @' E& V3 Q
  71. dma_addr_t dmaphysdest2 = 0;; O- A/ e' _- F# F& I( @8 M1 X
  72. ; g* \, o# B8 G7 i- b1 x& v& |
  73. char *dmabufsrc1 = NULL;
    4 K' W8 t9 e+ Z
  74. char *dmabufsrc2 = NULL;
    4 e! M. O+ L- g0 ~3 ?& B
  75. char *dmabufdest1 = NULL;
    - q, E! e  O1 v. w3 v
  76. char *dmabufdest2 = NULL;
    " ^1 m( c1 o" \( u6 B% s& `5 @
  77. $ a, ?1 `: K8 n; o" O: S
  78. static int acnt = 512;" I/ @" x, z. ~; w$ O% x
  79. static int bcnt = 8;
    % c; L3 _8 \5 u: i
  80. static int ccnt = 8;/ L+ d9 Z' j+ B. k5 H
  81. 5 {8 t% i- ^. q8 ?! H1 g* ]6 O% J, j
  82. module_param(acnt, int, S_IRUGO);6 l1 C9 W  l) A; l
  83. module_param(bcnt, int, S_IRUGO);9 }- S' Y: Y# \! R, w3 D! g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! r" g9 _9 h/ o& Z! m( H
" M- Z, t) j3 C1 D- e2 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# T6 N6 _- k9 D+ w+ d- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- M8 m. e  b- P$ O+ K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& P$ T, ]' J9 i  u( T" J0 K2 D! ?  @9 @

2 q, u2 {7 n* D, i
6 V+ O7 m4 {2 o9 `0 {9 @& M+ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 09:45 , Processed in 0.039802 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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