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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' G2 \1 @( s4 n+ J$ W4 O( N2 v) Q
  1. [code]EDMA sample test application+ Y5 r1 ]2 |3 U3 ~0 E5 K6 k% @
  2. /*
    $ l; L. k/ o* Z) c& K5 X
  3. * edma_test.c
    * w. s0 b; f( K! U( o; q( f: B
  4. *9 J5 O# H1 y- V; U0 t
  5. * brief  EDMA3 Test Application# M8 u- O' O; e3 `% x6 `
  6. ** r: m& E( Z. `& `: r$ e
  7. *   This file contains EDMA3 Test code.
    $ a3 g3 N- Z2 ?5 a
  8. *
    : a0 A9 Q5 K) r% H# E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( J8 m+ v. q: U, t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' o0 y7 U5 J) }( Y% \( U$ _
  11. *         TO CHANGE.
    # b* r/ M; U9 F
  12. *
    6 f  ?. G& P3 p$ J' }  f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) t# [& \0 D" k6 y1 S- @
  14. *
    0 R' N4 L3 {( Z0 |
  15. * This program is free software; you can redistribute it and/or4 H( I6 m: j$ P: c
  16. * modify it under the terms of the GNU General Public License as
    8 Y8 U: {6 r3 f% [( N4 L) A1 Q
  17. * published by the Free Software Foundation version 2.
    0 v9 k' W6 L( t0 d- _( a) x2 m
  18. *, W: g3 e4 ~# S2 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% D7 q2 j$ d0 G# X) H
  20. * kind, whether express or implied; without even the implied warranty
    ; ^/ ~4 X! ^3 }: q! C: o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! W% m" B- T$ Y; h0 B# d: t# Q
  22. * GNU General Public License for more details.
      Y& ^/ f7 q' o
  23. */! T# A, j/ t# P/ s6 a4 w
  24. + `1 z+ ^- Y! J- G
  25. #include <linux/module.h>
    7 Y1 _; V' ~5 \0 ^
  26. #include <linux/init.h>
    0 C/ q/ C+ t# a) D- [* t3 U2 X; ]
  27. #include <linux/errno.h>' p) @$ z' ]3 h
  28. #include <linux/types.h>
    / O; _* Q- j- r. `9 w7 K  n
  29. #include <linux/interrupt.h>, a6 H' Q0 l1 B7 h) p
  30. #include <asm/io.h>0 V' S: K* t; w% g4 \/ A4 A3 H
  31. #include <linux/moduleparam.h>
    2 t4 _7 t4 d7 f! _1 Z& x' `9 `
  32. #include <linux/sysctl.h>% s3 C. z# f: B, P/ o- r4 G, t
  33. #include <linux/mm.h>4 H, W% D1 Y0 O+ @0 O
  34. #include <linux/dma-mapping.h>( J, ]6 w, E0 ?' T: `7 F
  35. * m7 K/ f! u1 Z: W+ T
  36. #include <mach/memory.h>- q. k! @& }- B. o) b
  37. #include <mach/hardware.h>
    ( W  N( `5 f3 T+ `
  38. #include <mach/irqs.h>  M2 P8 h, z2 h! ?; ^4 j: B) r9 C
  39. #include <asm/hardware/edma.h>
    ( J& ]/ G& n! ~. _0 T$ `
  40. & x1 G2 U$ c) G
  41. #undef EDMA3_DEBUG
    4 C0 I, ]) Z7 C( g; }
  42. /*#define EDMA3_DEBUG*/
    0 E5 ^* C9 I- {; {. k
  43. : e( Y' Z6 T! R( v
  44. #ifdef EDMA3_DEBUG
    - @& p# Z, Q! u9 n# V; L3 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ d- \5 U9 o' e# B; s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * {8 x( y' H; M$ }) u) D! G9 [% U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). z' ^$ U6 v5 q! |& v
  48. #else
    & P9 U: ]& Q0 }
  49. #define DMA_PRINTK( x... )$ ?- I3 g4 |: y' S
  50. #define DMA_FN_IN9 k3 \3 T- o  Z5 y6 d
  51. #define DMA_FN_OUT
    ; |3 A' }/ I- v5 m2 f' H( {- ]
  52. #endif
    9 L$ H, X  f5 j7 F" c3 n. h; u
  53. # c3 y6 j! m* D' k: a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 S) z6 o+ _/ G& \$ E7 o3 K# Q1 N
  55. #define STATIC_SHIFT                3
    . U& Q6 a& h1 N
  56. #define TCINTEN_SHIFT               20
    8 K# k+ M  i7 t5 Z8 x6 X% k
  57. #define ITCINTEN_SHIFT              21: v8 o, `2 |' V& x" n5 F
  58. #define TCCHEN_SHIFT                22
    3 _$ @% ]! I1 o4 |* M
  59. #define ITCCHEN_SHIFT               23/ @% ~  K4 S, E: L) J" G

  60. - ~9 t- \: x8 L
  61. static volatile int irqraised1 = 0;
    5 J# `4 h! K, T# }/ b
  62. static volatile int irqraised2 = 0;) f) P  s6 O9 p" @
  63. 0 k+ A+ I2 a! B9 F- n7 p0 ?6 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 x5 m2 w' F6 [7 W7 s5 q4 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* z" y6 o6 s/ n& o, m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ?. ?* ~3 B; j4 U: o' }

  67. * `9 ~0 {9 r  ]+ X4 |
  68. dma_addr_t dmaphyssrc1 = 0;& l8 a$ t2 m# w3 g/ G' g/ f
  69. dma_addr_t dmaphyssrc2 = 0;
    ' i9 J; ?7 K+ D  O: x. _: D
  70. dma_addr_t dmaphysdest1 = 0;
    $ ~( `- M7 S4 C: D1 o! b
  71. dma_addr_t dmaphysdest2 = 0;
    + L: [7 {" ]& l- c% F

  72. ; R6 ^4 F: Y# W$ f8 X* S
  73. char *dmabufsrc1 = NULL;
    * L' X7 v: e$ s* ]' p" @
  74. char *dmabufsrc2 = NULL;
    9 Y4 Z6 }8 _& b  G% M& T* i9 B. S
  75. char *dmabufdest1 = NULL;
    ; B; }/ _4 w, y3 i3 q8 Y& I
  76. char *dmabufdest2 = NULL;
    " W: N( h) m( M, M( }) K

  77. 7 g: g. D, c7 W+ i. H
  78. static int acnt = 512;
    2 w  s8 R* d4 Z7 n2 d
  79. static int bcnt = 8;
    2 B5 C1 ~  V$ S; s1 J( j1 Q
  80. static int ccnt = 8;
    * Z5 K0 O% M; I/ ]2 y9 A" f& h
  81. / X% H4 W7 _) R
  82. module_param(acnt, int, S_IRUGO);
    # f6 n% _. M! w: M1 c7 M/ k5 c
  83. module_param(bcnt, int, S_IRUGO);
      p0 d% r; {, n+ A, k7 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! s% ?; f3 |/ `* P
9 ~. G7 E+ P7 C0 m# i" E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 V- t6 p) G$ j( c: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ f5 [; i- l7 O6 b2 Y: W( z/ ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 f) Q4 |0 O! A2 n5 U4 ]: V
2 q1 z2 ~4 `/ K+ q- s2 }
% F* m/ s' _2 {! d1 B$ v) m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-2 02:43 , Processed in 0.048254 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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