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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 h, J  N, H, ~5 p4 Q) T: C
  1. [code]EDMA sample test application+ ]% U" N& u7 ~1 [* W" ^: ~
  2. /*
    1 n' I0 Y' i# a* D6 m, g4 C3 g
  3. * edma_test.c) M2 I$ P1 V  @2 P
  4. *
    . W* y7 T8 w4 C/ s+ F' V1 W3 y  I
  5. * brief  EDMA3 Test Application
    . ^6 x) \+ u" ], O7 K+ T) V
  6. *
    " {- ?# `% C: n/ s7 O
  7. *   This file contains EDMA3 Test code.
    ( ?6 ]% [7 L$ f' x
  8. *8 N8 q3 A! U! L& H0 W* I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ?: L2 l% ]+ o; l6 |2 l' E7 a6 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - V# j) }9 ~( ^' v3 {
  11. *         TO CHANGE.' D, W# @1 @- e* w$ l6 s
  12. *
    " R( K0 s6 _! u) c" L9 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # r) o' q# X; _* V1 J/ t$ ~' ?& P
  14. *
    / R( a6 q2 ^6 w
  15. * This program is free software; you can redistribute it and/or
      r. W. r$ T/ C. \- z
  16. * modify it under the terms of the GNU General Public License as
    1 X7 F5 i: K3 Y
  17. * published by the Free Software Foundation version 2.
    : v% e; D4 M/ f) g# Q9 f) [
  18. *' {$ L& k7 Y8 c% Y# W; y. e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" O7 F1 s" R# ?# X  f# w/ h
  20. * kind, whether express or implied; without even the implied warranty* D% R7 @4 @$ N: v) E9 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & e& C3 U) w! a7 j
  22. * GNU General Public License for more details.
    + l) h- a3 K$ i* v) o1 `3 C
  23. */& w7 U7 o7 }1 z# i8 {" e. g: ]
  24. 9 k9 [) t9 O5 f$ ?
  25. #include <linux/module.h>( O# D2 \" T5 \; r  F+ A2 S
  26. #include <linux/init.h>, ?2 d) d6 {; V# w6 H
  27. #include <linux/errno.h>3 ?& v& S5 q# f
  28. #include <linux/types.h>, K" j! y2 L; C" `& e7 ]* Q
  29. #include <linux/interrupt.h>
    - |! [& `4 y# l' h: `4 a
  30. #include <asm/io.h>$ x+ P7 R6 ~* a3 y3 p
  31. #include <linux/moduleparam.h>
    & M0 U( l9 K8 W3 }# C
  32. #include <linux/sysctl.h>1 [6 d# |  G4 A0 K
  33. #include <linux/mm.h>$ T# i* D9 w8 f3 w1 d# ~) L3 K2 O1 q
  34. #include <linux/dma-mapping.h>
    & P5 o& z( I. b6 j9 v& o2 W
  35. 6 L5 t# D' t. s1 E3 w- T- `) @
  36. #include <mach/memory.h>/ N% s* C  {8 R: z4 _+ [
  37. #include <mach/hardware.h>5 N7 i) U8 \# G) r$ X
  38. #include <mach/irqs.h>
    * b9 M4 E3 N% {" D
  39. #include <asm/hardware/edma.h>
    : x' T/ m* }0 l
  40. 2 G( _+ C5 Q- U% |" i
  41. #undef EDMA3_DEBUG
    , Y$ G5 H* Q! _1 V  a/ n9 _
  42. /*#define EDMA3_DEBUG*/
    ( D' ]4 F3 R$ r
  43. ( K) V+ J0 p7 v+ P5 Y' Y' e& x
  44. #ifdef EDMA3_DEBUG2 v. u0 h& |, R5 Z$ ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# e' i' ~; U* G+ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 S" N+ t, `6 x( U5 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . d* @3 j9 o3 s2 }
  48. #else( Y( }" I2 M; u
  49. #define DMA_PRINTK( x... )1 ]2 z# S5 V1 S8 P2 g* l
  50. #define DMA_FN_IN
    8 h$ E: C, s) t8 i! i, {2 [9 n
  51. #define DMA_FN_OUT
    6 i/ J3 E) Y' N. t2 Y% T7 g
  52. #endif
    . _7 m5 w) A, ^/ ~7 H: H$ g# {2 O

  53. " Q! i+ D8 [* c9 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , q' o. ~4 \! c3 k$ i  f# \4 Y
  55. #define STATIC_SHIFT                3
    0 e1 I& y1 Z+ \- E5 _* H) u& k
  56. #define TCINTEN_SHIFT               20
    / u8 `) t2 B6 U
  57. #define ITCINTEN_SHIFT              21
    1 W* O/ J6 n* ?' n2 z# b
  58. #define TCCHEN_SHIFT                22
    5 @$ b; k- Z6 R) R0 {+ S
  59. #define ITCCHEN_SHIFT               23
    3 u; _$ K* m& e; B/ ]6 v$ b
  60. 2 k7 o- ~5 S0 J0 {' _. T% V
  61. static volatile int irqraised1 = 0;
    $ o+ m8 _/ }: \
  62. static volatile int irqraised2 = 0;3 K: ]9 H8 E/ k2 m. G

  63. 0 M, c3 g, W: L! f! q( l1 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' _# M5 F( J6 h9 j) i/ p3 S3 J8 ^4 [, k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, c/ P0 B; M7 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / I& ~  y. [5 x: i

  67. 3 Y0 S6 B4 Q" L# O" D) o
  68. dma_addr_t dmaphyssrc1 = 0;+ ?6 n. S: E8 ?! u" Y
  69. dma_addr_t dmaphyssrc2 = 0;
    , `' k( o# x. Y& c, f) C
  70. dma_addr_t dmaphysdest1 = 0;( X* W# O0 k8 P4 j+ A* O
  71. dma_addr_t dmaphysdest2 = 0;/ j+ v4 j4 w, E: `- {5 q
  72. + C! v! O. `# l1 k& |/ `) h% H
  73. char *dmabufsrc1 = NULL;1 N3 m" O8 F/ q) D9 ^
  74. char *dmabufsrc2 = NULL;2 `, d& b4 K3 v- O. K, O6 L
  75. char *dmabufdest1 = NULL;
    1 R4 k. p9 ?5 [. a
  76. char *dmabufdest2 = NULL;
    3 B/ Y4 W- m7 w) O$ Y$ K6 {
  77. % r% O4 s% `: B8 l
  78. static int acnt = 512;. N# s" J2 H& H/ ^6 o) T& I' _  T
  79. static int bcnt = 8;
    ' `% R- `# Y2 W# [, |: N- y3 X
  80. static int ccnt = 8;
    2 |+ N( b. M6 m: q6 S; I0 Y2 ?

  81. % I# t* @' t4 @+ d2 h/ R: U/ S
  82. module_param(acnt, int, S_IRUGO);
    + a) X3 ?  h& E' X: u! ?) m
  83. module_param(bcnt, int, S_IRUGO);
    - O( x: X' D. o- O  |( A0 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; ]0 b* Z7 E3 o
6 B' [" }1 R0 Z/ ]2 _- B" X) N7 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 g4 ?# B2 i( s% K9 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ w5 v8 \9 I+ ^" }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" a! a- R3 R% k" B
: R% ~! K; w+ S" Z: W& X6 U' G$ o& S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 06:10 , Processed in 0.058154 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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