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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 B, Z* `: ^8 Q: u3 D8 s  x+ {
  1. [code]EDMA sample test application
    ) y& v2 f9 \6 j
  2. /*8 w3 t4 L! n2 ]( ]; p% u, [+ f
  3. * edma_test.c
    ( S$ [' a$ z" `. I$ `
  4. *$ N/ Q# {9 I3 i7 g" h
  5. * brief  EDMA3 Test Application
    & `0 \, J# t; P6 b
  6. *
    7 Y$ _  @% I$ v, c3 H
  7. *   This file contains EDMA3 Test code.
    * ^7 ~: d4 J7 N" m2 o3 o3 D
  8. *
    + k% d( @2 u9 l. s8 j( t7 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  c3 {' _4 H) a3 v1 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  ~7 g' J4 f, M" I+ l- _4 e) ]
  11. *         TO CHANGE.4 A$ s3 }, O3 g5 p
  12. *
    7 b3 H- P) `$ r) E( v7 j2 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * z4 _7 s: {* H) Q+ U- z# ^8 i
  14. *
    * Q8 \! `7 f3 b7 A$ x2 b/ M( e
  15. * This program is free software; you can redistribute it and/or; F9 A$ v1 A& d4 v+ t
  16. * modify it under the terms of the GNU General Public License as2 B8 k1 T9 A1 X) E$ Y* u1 M6 O
  17. * published by the Free Software Foundation version 2.
    6 G6 [& H. d" d4 h% L  A
  18. *
    3 a4 y* e9 q( M4 O9 d) i7 Y9 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / g' d+ R- g3 Z1 S! q8 a! h/ N/ R
  20. * kind, whether express or implied; without even the implied warranty5 p/ ?  n+ C4 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      E% w* i7 B( ?3 H' i  ]! V
  22. * GNU General Public License for more details.
    - [5 H5 i, E& X# R
  23. */
    ! r& J- e) @* S3 e4 G) S& s
  24. ' C5 T  i" \! q; m+ B: h$ j, E/ h8 W
  25. #include <linux/module.h>
    0 u5 {8 a9 v. a" t, l2 r( I
  26. #include <linux/init.h>5 c/ m9 j! y! R  @" O" O7 c& |
  27. #include <linux/errno.h>
    7 P# C" n+ _) Q4 _# U2 n
  28. #include <linux/types.h>
    7 \0 J+ j+ f4 q& D9 U
  29. #include <linux/interrupt.h>
    + C1 T2 m( e9 A( @. h
  30. #include <asm/io.h>; i# B. U3 _% _- S! M, y4 B
  31. #include <linux/moduleparam.h>
    * W: r" Q7 H  ]; H
  32. #include <linux/sysctl.h>: j: `' E3 ?4 b4 r" c: c& d7 m# I
  33. #include <linux/mm.h>3 z3 Y/ ^, }, U0 t$ \# Y) b, z1 ]
  34. #include <linux/dma-mapping.h>
    & S# ~1 B3 _/ `

  35. ! L+ k$ t. E* G# D2 O3 h
  36. #include <mach/memory.h>: F$ q# V2 v) y
  37. #include <mach/hardware.h>9 l# {/ e3 ]7 X
  38. #include <mach/irqs.h>
    , B' O- e+ O; X. y) [+ p# V6 ~  W9 V
  39. #include <asm/hardware/edma.h>0 w" {- D7 f/ Q) `$ J. V$ w
  40. ) \+ R. M( a: u0 t( E$ p
  41. #undef EDMA3_DEBUG7 Z, D4 w7 u: M5 ]9 [& O
  42. /*#define EDMA3_DEBUG*/7 H# J/ o3 o0 }. P- x( V
  43. 0 }. `, _# @# p: r* h; `
  44. #ifdef EDMA3_DEBUG
    9 C9 [* ~6 N% N3 O9 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 B- \; ~: n* b2 P3 S' m! [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ _+ s7 G2 a* I. T+ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ B/ y# W& A& T: V% K6 s
  48. #else
    1 s7 Q' g8 E4 _  C  z& V0 v# ?
  49. #define DMA_PRINTK( x... )0 a7 n" i& `, |' }
  50. #define DMA_FN_IN
    9 j; L2 r2 o5 y1 L1 a$ H4 M
  51. #define DMA_FN_OUT
    8 G2 h, C  U' C: k0 [8 w! w
  52. #endif% f: M6 X4 L2 W' ^( d

  53. 2 V1 i# g2 r2 b, x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 L2 z) l" `0 b8 n2 M; M8 t
  55. #define STATIC_SHIFT                36 j% }$ A) l5 i
  56. #define TCINTEN_SHIFT               20
    8 d3 q  v( t* t( F
  57. #define ITCINTEN_SHIFT              21
    ( i. E, J( e9 O, U  Q8 U! o
  58. #define TCCHEN_SHIFT                22( m/ x7 E1 E2 N
  59. #define ITCCHEN_SHIFT               23
    - A, F% X$ y. g
  60. 6 ~$ ?* U+ Z4 Y; y; t4 C
  61. static volatile int irqraised1 = 0;. X8 _0 d3 M+ X  ?5 u3 @
  62. static volatile int irqraised2 = 0;1 y# D1 v2 w0 V
  63.   I: P$ E5 J! l) M' N) }! P% ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J- o; K6 V2 J9 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]0 f+ y3 {. B& h7 _- z$ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S+ D  O# n+ T! _8 x7 x
  67. # L% ?5 O5 h% `$ V/ C9 Y8 S4 P
  68. dma_addr_t dmaphyssrc1 = 0;
    $ q$ ^  y: f; p
  69. dma_addr_t dmaphyssrc2 = 0;) t# A' W& I# d) M# D* S- c3 ^
  70. dma_addr_t dmaphysdest1 = 0;/ J6 F8 u% R4 G7 g
  71. dma_addr_t dmaphysdest2 = 0;, ]$ @, Y1 b0 i% g
  72. 4 m. ?  J# n- k2 J/ K
  73. char *dmabufsrc1 = NULL;1 X9 H. R7 C/ D2 E. Y' y( _
  74. char *dmabufsrc2 = NULL;
    5 p5 L, v" x5 ]" M( U0 ?
  75. char *dmabufdest1 = NULL;
      B, v9 ~' F# k6 D
  76. char *dmabufdest2 = NULL;! Y$ ]0 c5 K6 j/ h$ Q$ C

  77. 1 Z- D0 D+ v. p" L( e+ V- C
  78. static int acnt = 512;, t% l, j$ E' |: g5 S
  79. static int bcnt = 8;
    & k, D% F( V8 G# H0 F
  80. static int ccnt = 8;
    9 n) G% {- k% l/ h  @/ w

  81. / b( l' F- z- b
  82. module_param(acnt, int, S_IRUGO);- `/ W' d0 g8 X3 v7 G' I5 g# e6 p8 F
  83. module_param(bcnt, int, S_IRUGO);) w  J  B8 b* P; y% `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. }) j* g7 E# c! b0 Z5 t

. m/ E4 D& U* U" {7 [8 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  s6 M3 u5 w/ g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 [: L( b. `1 u2 ]2 m% A( ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ j7 d: y, \3 n& _. L

% P  b  {. F9 R; k+ @8 K4 z7 B7 T$ u, M( O1 t( w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 01:10 , Processed in 0.041799 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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