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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 m* w8 M* R9 J8 S
  1. [code]EDMA sample test application  _1 O# J; W6 A' S
  2. /*
    0 S# @1 E3 l" F3 Z/ R
  3. * edma_test.c8 J7 @/ S7 r# C
  4. *
    - k2 t$ _+ j$ C. C  J# C& w
  5. * brief  EDMA3 Test Application* R3 q, T; Z8 D+ }' c) |, ^
  6. *% f# {0 O" x" n
  7. *   This file contains EDMA3 Test code.7 e7 T! U% S$ f5 {& a$ y* T
  8. *# Q1 _! @& w; o0 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : \4 g7 x. B8 G, O6 k( {: U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) o6 {( X% D1 v
  11. *         TO CHANGE.2 F6 |2 D, J; f5 B6 F9 f. A0 S- v* f
  12. *6 E4 O+ Q! G% y& ^4 H' ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. g) D* E: Q4 H6 ^1 I0 R/ ^
  14. *2 Y7 e# D/ ?; |; Z* p: l
  15. * This program is free software; you can redistribute it and/or
    * L& W, Z/ D3 W; Y4 Y; q6 `6 y
  16. * modify it under the terms of the GNU General Public License as
    . A3 r/ c+ s" s9 e
  17. * published by the Free Software Foundation version 2.
    ) {% [9 T8 y+ b2 I" g4 a# L
  18. *9 R* e" O4 g8 W) B! Y7 r; D6 k( g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 D. X- Q6 s$ `
  20. * kind, whether express or implied; without even the implied warranty& g" F7 p1 }" z" Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) {5 P6 S# y+ N  G
  22. * GNU General Public License for more details.
    3 U( V: o4 ]. O1 O) q4 i
  23. */7 S9 M6 D$ w! i: s0 ]* R# ?

  24. 0 q% t% C( D7 ]) h  u; e
  25. #include <linux/module.h>) N% g. |. v* T9 p
  26. #include <linux/init.h>
    ; z; y' i) k; V
  27. #include <linux/errno.h>
    7 E1 h) A3 Q! {( J" q
  28. #include <linux/types.h>
    ) y9 i$ W/ h8 Q4 _2 e# O' k5 q6 h
  29. #include <linux/interrupt.h>
    # Q( j$ G0 }8 [
  30. #include <asm/io.h>2 ]( b  N0 o% {& m* z
  31. #include <linux/moduleparam.h>3 i2 j1 |; g0 N7 N. A0 i
  32. #include <linux/sysctl.h>: R9 E! Y* R; D# W% o0 o, p
  33. #include <linux/mm.h>, c" W$ H" m( X
  34. #include <linux/dma-mapping.h>8 N4 ?' u% Y# }" U. }
  35. : p5 ?1 S' b, k/ P5 g$ i( u
  36. #include <mach/memory.h>
    + p3 C$ g; W$ `7 z
  37. #include <mach/hardware.h>
    3 q) f  `- A0 i- l
  38. #include <mach/irqs.h>
    9 o+ L; O6 N  P
  39. #include <asm/hardware/edma.h>3 r* a5 f2 M, f$ ]0 o

  40. ) R3 G. F  d; j2 A1 k( ~! A  g+ |: ]1 V
  41. #undef EDMA3_DEBUG
    8 Y6 e. P1 N9 V9 ?( D. m
  42. /*#define EDMA3_DEBUG*/7 X0 w' w8 ?& A) y% O

  43. - Q' D9 p  ?( N# z5 e
  44. #ifdef EDMA3_DEBUG
    2 v3 K3 E/ Q! i* T8 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : p. X7 B2 e6 H' G- j5 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( F7 [) ?2 W+ B! ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ j" ?% p& K7 s7 S- F
  48. #else
    2 T  |) @+ M  n
  49. #define DMA_PRINTK( x... ); i: D" k: L( x+ ^& S+ M9 H
  50. #define DMA_FN_IN
    0 }( w" c2 F: @
  51. #define DMA_FN_OUT/ ^' C2 d. A6 y
  52. #endif
    - ]( d+ B0 E0 h
  53. 3 @3 n' Z, _' ?3 R, t  M! M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , B, i$ B/ w( M. L0 ~
  55. #define STATIC_SHIFT                3
    ; @7 ?  m5 _2 V) F4 G6 o! [8 c. F: Y
  56. #define TCINTEN_SHIFT               20
    : }! F2 B% H) I9 n% e
  57. #define ITCINTEN_SHIFT              21% `, U" }7 q0 G# \
  58. #define TCCHEN_SHIFT                22. v- Q3 ?; R; Y& t, P  k
  59. #define ITCCHEN_SHIFT               23, |* d: P1 `+ ^4 K  ^
  60. 6 f) y+ t( [' s* `( d4 \6 {
  61. static volatile int irqraised1 = 0;4 X! S, y" F# h& \) m$ m3 `
  62. static volatile int irqraised2 = 0;- ]3 o7 X" _/ a4 Z- S

  63. 7 Z2 ^: v: i' \3 M4 q: g. H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 E4 \# h: S: w( s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x6 D8 l* f0 [( B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O, k6 g. m3 q' g

  67. : e# u4 k: X6 M
  68. dma_addr_t dmaphyssrc1 = 0;0 {+ S8 b6 a, g) a: B6 i9 A2 A
  69. dma_addr_t dmaphyssrc2 = 0;
    9 R+ e  k$ n6 L9 C
  70. dma_addr_t dmaphysdest1 = 0;
    ! S3 U, h, e6 i& O1 u! @
  71. dma_addr_t dmaphysdest2 = 0;* h3 {/ l) P2 X4 V! o, m) Q7 i
  72. " J5 R* G/ f. r0 b9 L' g, o
  73. char *dmabufsrc1 = NULL;- k; ~  t8 i5 Q4 h, G4 }
  74. char *dmabufsrc2 = NULL;
    ; F: B( q. j4 |1 [4 W
  75. char *dmabufdest1 = NULL;  H4 G4 {# B& U4 Y  x
  76. char *dmabufdest2 = NULL;
    6 Z+ `- b8 I0 N* r

  77. # I! j  W5 F3 c/ {$ C& C. N
  78. static int acnt = 512;
    " b1 N. B/ m) e6 `+ d  ?
  79. static int bcnt = 8;
    # }. q. a7 b9 E7 j. {/ s
  80. static int ccnt = 8;, p) A9 b/ s0 x+ \. I

  81. . B9 ]) R; ^, k; U: ^: M* F) `" f
  82. module_param(acnt, int, S_IRUGO);7 l1 v2 A! L/ D8 j
  83. module_param(bcnt, int, S_IRUGO);
    0 d0 ~0 @+ j. R, b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, l' d  f' O9 y$ k- A5 K7 T- f) K: U' ~6 G, F- s" K6 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- D5 H$ v& H; c* U! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. v; {8 B) O8 P( Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- P& E/ Q/ D. `: `' [# I( c) G% D5 W; |. \

, Z) v& T# o8 Y1 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-16 14:58 , Processed in 0.039840 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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