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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 N5 _% v: @/ F( r
  1. [code]EDMA sample test application) V% i/ d( {: X, L; i
  2. /*
    9 X! ?. R" v8 F/ }
  3. * edma_test.c* m; p* I6 j; x6 V( ?! j
  4. *
    6 @' I1 i' ~* K# I5 _/ Z
  5. * brief  EDMA3 Test Application# x$ @$ {% V' i1 d% g4 S
  6. *% n* \, Y) S( E1 N
  7. *   This file contains EDMA3 Test code.( G& ?  V" U, w
  8. *
    # m$ t0 o3 I6 M- b& y3 U0 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - u5 w1 _9 I) ?3 f& ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 S2 f! s. |4 U" e. N5 a+ }) G/ G
  11. *         TO CHANGE.
    . `$ R. B) B9 p) B
  12. *" e2 f3 s! W! B! Q+ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 B) N3 W* A; {( _
  14. *& ~' q( {' M3 R/ y: M1 E! m$ s
  15. * This program is free software; you can redistribute it and/or6 f% D7 Q; D% H5 J* P6 G8 P
  16. * modify it under the terms of the GNU General Public License as' A7 e, m8 ]5 h8 X. G+ H
  17. * published by the Free Software Foundation version 2.
    + b, N8 \5 V. Z0 U+ _( e# @, K# P
  18. *
    ' T3 {. t+ I2 W/ V! Z: ?# V$ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 R+ O: z# S& _
  20. * kind, whether express or implied; without even the implied warranty* H" z8 G- ]; E  d$ H' F. H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & y1 Q% `' t! d8 Z: Y8 j
  22. * GNU General Public License for more details.
    , U$ S- L5 h  I
  23. */7 \! A- _! d& O
  24. ( Z' p6 @  H. y* Z& A3 D7 }
  25. #include <linux/module.h>6 L2 d/ S! K0 }- g0 E2 N( D
  26. #include <linux/init.h>) |0 z! {- {( }& T6 B
  27. #include <linux/errno.h>2 B1 h! `: M$ q, y5 n
  28. #include <linux/types.h>8 e5 e* \3 P% I; e8 @5 d
  29. #include <linux/interrupt.h>$ B' `% n( P0 d9 O' k+ P
  30. #include <asm/io.h>
    & n. H8 h$ h7 ?- i
  31. #include <linux/moduleparam.h>/ z) l" i/ O2 x8 n$ f9 \
  32. #include <linux/sysctl.h>9 P. C2 N, r' z, W9 ~+ c2 @* Q
  33. #include <linux/mm.h>
    $ V1 Z& O( V, k4 `7 I
  34. #include <linux/dma-mapping.h>( ~# c1 ?2 {0 P% t$ ]$ B1 A

  35. 6 D6 z+ ~+ {; s) v5 e/ z. I
  36. #include <mach/memory.h>' g* F% x0 V/ S' T
  37. #include <mach/hardware.h>
    $ u6 y. K8 @, a; B
  38. #include <mach/irqs.h>5 p' k) S' S, p# c
  39. #include <asm/hardware/edma.h>
    * m: ]/ G5 v- J  B$ N4 v* i! M' H

  40. * b+ ?; I" d. n
  41. #undef EDMA3_DEBUG
    % m1 W' g# g: R5 E4 U. ?7 I
  42. /*#define EDMA3_DEBUG*/
    * _  D/ L3 Z2 D# i- j: H

  43. ( P  ~3 `3 E; [0 \. p7 `1 d; C
  44. #ifdef EDMA3_DEBUG% @, q0 |7 O0 f( E6 o# H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % B- S/ z8 {6 |& o! ]# E$ s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 P+ x& h, g' }6 G0 A  {; v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 f# `, Q7 H, v' R. D0 p4 D
  48. #else6 q& B; ?" |0 t% T0 F
  49. #define DMA_PRINTK( x... )
    % Y' a3 d) p! j# y  \
  50. #define DMA_FN_IN# n5 I; ?. g) L* \( Q6 c9 n
  51. #define DMA_FN_OUT
    : A* c, p: U; w% [
  52. #endif& e1 q5 I2 ?. ?

  53. - V4 i3 l" k. a& ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ L: v6 s+ Y: ~* }# \% S4 |. B
  55. #define STATIC_SHIFT                3
    ; V4 w9 O- I/ q; X3 E
  56. #define TCINTEN_SHIFT               20
    ; _; r& y: h9 t# v, H- V5 W
  57. #define ITCINTEN_SHIFT              21
      B3 L1 w! Z* |& {
  58. #define TCCHEN_SHIFT                229 J$ z  c) Z8 i# {4 e* ~% s1 s* y
  59. #define ITCCHEN_SHIFT               23& ~- w$ w' x; Q

  60. 4 y+ Y. X/ _" D" g  _
  61. static volatile int irqraised1 = 0;( e0 N! G! ?! b% Q5 M
  62. static volatile int irqraised2 = 0;
    4 l0 O7 D# a. M8 u

  63. / ]5 \8 L% U+ f! {" G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ A. u8 `5 A# T- e0 {7 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U7 S# C. I; L: [6 b3 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ M% j0 e) I. g2 _+ x8 ^
  67. # u7 _# B6 {* I$ G
  68. dma_addr_t dmaphyssrc1 = 0;6 {5 ]  B& u5 f! W0 g
  69. dma_addr_t dmaphyssrc2 = 0;% C% R; Q  `9 j: a) F/ N$ r5 c
  70. dma_addr_t dmaphysdest1 = 0;
    7 G+ ^. I. ]/ Z; X# z" M# P
  71. dma_addr_t dmaphysdest2 = 0;7 t9 V. [4 x2 c9 H/ i. V% |
  72. ( G5 F8 x0 w, z1 G
  73. char *dmabufsrc1 = NULL;
    & _' Z4 s2 r& K3 e) I. X
  74. char *dmabufsrc2 = NULL;
    " h# c4 a4 K0 I  u
  75. char *dmabufdest1 = NULL;
    0 c# \* M0 D+ G: f6 Z7 c
  76. char *dmabufdest2 = NULL;
    . F# V! O9 ^6 Y. D
  77. # d$ u0 u# y0 i9 l4 V& J
  78. static int acnt = 512;$ y1 v6 x" H7 r% N: F6 p' e' \, h! @4 v
  79. static int bcnt = 8;1 E) M/ e% o6 p/ N+ B- x2 w/ a% q2 }
  80. static int ccnt = 8;, ~. r! O# S& q% U4 g( D
  81. 4 s/ V  m5 n" v: r1 ~9 J+ b
  82. module_param(acnt, int, S_IRUGO);5 K. N5 W) @# b0 ^! u' W, Z
  83. module_param(bcnt, int, S_IRUGO);5 s$ Z) P; g; i4 O) z8 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. ~3 }2 p3 S! W& W) n! ]( ]

8 v! w+ J' n1 z! T0 d5 d2 m3 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. b) q" S. ~6 W* T* J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i$ j* X9 ?5 ~) w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 h7 N: U/ S0 ], _8 f+ W! s
" E  V* W( V* L

7 L7 k$ ^# C, J5 u* B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 00:42 , Processed in 0.045128 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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