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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& p( ~3 H# E9 D" Q1 P7 c" W8 D: V
  1. [code]EDMA sample test application
    . A5 \% D$ L) R' U6 R' d( Q# U
  2. /*
    6 O$ q+ c  N, y8 u( m# _7 b) W
  3. * edma_test.c
    + O, S# G) _, c" `
  4. *; c$ i  W  e# H) h; y4 V
  5. * brief  EDMA3 Test Application) L4 h) Q- C( H
  6. *3 F* k  U' m, X" d
  7. *   This file contains EDMA3 Test code.; e) o( W* c3 r- A4 K
  8. *
    ! }& E/ s' T+ b3 W1 ?4 ?3 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 v) t# f& z6 i9 p0 |# a% D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 _/ C: Y  ^3 j$ ^4 F) P
  11. *         TO CHANGE.9 H+ F' z, `3 p4 Y" H
  12. *$ E6 O  B1 \. t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Z8 X8 x) I: f) H/ N8 [
  14. *0 |4 K& F. r1 Z9 {* u1 |+ F
  15. * This program is free software; you can redistribute it and/or3 K9 d! ?5 L+ l9 U, y+ {
  16. * modify it under the terms of the GNU General Public License as
    0 w& n3 n; M; ?- E- V
  17. * published by the Free Software Foundation version 2.. V" o; N- H7 W7 x# D
  18. *
    " Z0 N4 T1 ?* n  W- L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 {7 q, }4 q, S1 E' \" A5 H' d9 e
  20. * kind, whether express or implied; without even the implied warranty/ o: V' u3 t' f7 V. R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & Q8 ]: N+ R" U% Q8 r
  22. * GNU General Public License for more details.
    # \2 v; H, J% I8 R  B
  23. */
    & M4 ]; J2 N, K+ ^" }3 M
  24. , m/ c( O# I" v% q
  25. #include <linux/module.h>
    9 {- U  s! N8 x, p
  26. #include <linux/init.h>
    # r1 g* ]7 _) a
  27. #include <linux/errno.h>  H& b( g/ t- T, K3 \; w1 A
  28. #include <linux/types.h>
    3 `# L! `; a$ m- i- y
  29. #include <linux/interrupt.h>% d. q. c) I7 \; b8 t! x3 G" }" E
  30. #include <asm/io.h>, Z+ N/ [  \- R* a) w% e' P; D
  31. #include <linux/moduleparam.h>$ z1 G9 r- y& q3 r! f2 S6 Q. g
  32. #include <linux/sysctl.h>) h! B' m% |5 J/ d$ t  N
  33. #include <linux/mm.h>
    ! Y- \: W  O% d5 {, J+ B
  34. #include <linux/dma-mapping.h>
    ( |+ J" ]% q1 z0 G# Z, r* w2 S

  35. " J1 H9 a+ y- G; Z6 F
  36. #include <mach/memory.h>' y( a  m: {0 R# l9 `8 r( e
  37. #include <mach/hardware.h>7 I7 R! B0 G8 [, W' ^7 n8 W/ T
  38. #include <mach/irqs.h>7 O) D% `! v4 x  _7 \5 V
  39. #include <asm/hardware/edma.h>
    % R& q. P# ~4 b. f3 h: v7 q
  40. 5 o# _9 W. O9 o* V4 s
  41. #undef EDMA3_DEBUG; o; q3 P" t+ E; C' T6 _# f% r
  42. /*#define EDMA3_DEBUG*/. l3 {6 x, c, u5 O

  43. / V2 e- e) ?7 `' `( G; S% V
  44. #ifdef EDMA3_DEBUG, O7 s7 h2 A# K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / _9 h5 L; l' J2 D2 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 X7 J  |/ }6 O1 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # L: [) Z& M, D9 z
  48. #else
      U8 g; m- T( j" Y
  49. #define DMA_PRINTK( x... )
      L, u3 R1 X# y4 C
  50. #define DMA_FN_IN
      e$ Y0 N: F8 y5 T) c8 s
  51. #define DMA_FN_OUT
    0 W  k9 S" d  `7 `! Y4 @5 ^
  52. #endif  E* {6 T- @  Q8 V! S

  53. 8 y" f' Y8 Z( a' B3 ?2 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# @: `# J' X" J- b
  55. #define STATIC_SHIFT                3
    $ A( i6 V5 m; v0 m4 H7 F7 ^6 M
  56. #define TCINTEN_SHIFT               20& \7 T1 l) {0 l+ a& x
  57. #define ITCINTEN_SHIFT              21
    - s$ a9 a5 q( r, j# b
  58. #define TCCHEN_SHIFT                22
    . I6 a! ]4 \8 j6 _5 O% E$ g
  59. #define ITCCHEN_SHIFT               231 u' M, M- R$ L0 ]; c2 ~0 \" v

  60. " L* E" D+ U5 f: @6 R- m  V8 O+ m
  61. static volatile int irqraised1 = 0;9 {( _  k) F- B% [) T* @7 j2 v
  62. static volatile int irqraised2 = 0;' K4 `$ ~3 ?" ^& g8 Q- _

  63. % F' K. B4 c- z4 B' c. h% R" o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }0 G. E# z8 _* b8 T0 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; O6 A: d' z" V2 B" X% M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ C; r/ }5 X- ]  l, a, ]: v2 c# K, z
  67. $ b3 X/ @$ a. c2 p3 Q, E- [3 o8 j
  68. dma_addr_t dmaphyssrc1 = 0;8 m. s  o7 Y& A0 _* M- e
  69. dma_addr_t dmaphyssrc2 = 0;" n0 [1 @% s( B
  70. dma_addr_t dmaphysdest1 = 0;
    1 N- h  G1 i: C& q# l) q, k+ }
  71. dma_addr_t dmaphysdest2 = 0;
    + C5 n; Z( c( K. A6 B: Z
  72. % |6 ]7 c9 p2 T# r
  73. char *dmabufsrc1 = NULL;
    ; z  t' a" b6 [
  74. char *dmabufsrc2 = NULL;3 d" l6 s0 l: q3 M$ P. ^9 ]! M2 y
  75. char *dmabufdest1 = NULL;* g* C$ @# \' D3 P! Q& l
  76. char *dmabufdest2 = NULL;
    % ?# _$ d4 p0 u! p& h
  77.   t" z6 y1 p3 V; M: C; P
  78. static int acnt = 512;
      r) |$ ~2 J9 {+ }' C; x" P
  79. static int bcnt = 8;# w  [7 l8 U) S6 V# Y8 E$ m
  80. static int ccnt = 8;
    0 X% u0 V" n; i7 D! l0 p9 d) X# m

  81. ( U5 e4 Q9 ?+ y; T1 B5 c9 F& `
  82. module_param(acnt, int, S_IRUGO);
    $ n8 \5 e* L5 ]1 l( E* f
  83. module_param(bcnt, int, S_IRUGO);
    ' A' n$ {2 u+ t$ }9 i) s6 Q! I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* ~. T" a1 N1 X+ y4 j4 U5 J" F/ g- f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 T- e: M- b) y, P$ qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Q+ J( p( ^6 ~5 {$ H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' L% {8 w3 L8 G
. X8 R6 e8 I, Z, S8 R( i4 `; a. g' E( [5 B# v3 w) A, I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 19:16 , Processed in 0.040445 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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