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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ w) C/ t( P, u1 {2 A% P: C5 ~
  1. [code]EDMA sample test application# R  t, z6 z& F$ j, ?5 m
  2. /*
    3 }5 W2 a% y$ J2 r+ e
  3. * edma_test.c5 Z* T( h" {) J3 @7 T
  4. *
    ! [: z( t+ h0 a4 o9 }( [
  5. * brief  EDMA3 Test Application4 Z  s7 a; b9 H; f2 u) g: K
  6. *
    . R4 ?8 H( p4 [1 F
  7. *   This file contains EDMA3 Test code.
    ) E9 _, a5 i0 r2 g
  8. *7 d# p9 u+ M' {) Q0 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; Q9 C* g# C# U, Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , A2 O# F- v7 V2 w
  11. *         TO CHANGE.9 i0 e% z3 @+ \# k
  12. *
    2 F4 g3 {3 M# V7 r, v% R% n% ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + U. M& G5 G) q  n3 C1 H7 B
  14. *7 E2 _& w3 J0 f% I4 b6 q
  15. * This program is free software; you can redistribute it and/or
    - x( h) V# K* N  ^$ d+ j. D
  16. * modify it under the terms of the GNU General Public License as
    $ {# [, i4 }% ?* x
  17. * published by the Free Software Foundation version 2.
    ) e2 x6 ?1 i  l5 r; B2 E
  18. *
    + M8 P( H! ^' H! g7 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 |$ \4 X- A; I% K  ~
  20. * kind, whether express or implied; without even the implied warranty
    * Q8 w; `% {) l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / n" _8 t8 R7 L0 m) |" g  f, \. f" l
  22. * GNU General Public License for more details.
    * ?5 q# y( f3 B  x2 H3 w- v% B" Z& F* a
  23. */
    * }: t3 j) ?& C& h3 ?$ V6 B
  24. - X* K2 C0 k# l7 Q+ `# N
  25. #include <linux/module.h>
    " }0 ~& O: x6 w) L; s( @
  26. #include <linux/init.h>
    . W+ j6 h3 M6 p3 w9 |
  27. #include <linux/errno.h>
    9 ~) f* T# `6 P1 \
  28. #include <linux/types.h>
    + F$ F+ _$ t9 ~6 @7 p, n. {( ]5 N. U9 A
  29. #include <linux/interrupt.h>
    4 u; l  }( M+ j, U
  30. #include <asm/io.h>
    7 B1 H/ r  a2 W5 D
  31. #include <linux/moduleparam.h>
    : v) K% |& f9 y, Z
  32. #include <linux/sysctl.h>
    4 O) ~6 r6 N: i; ~6 r
  33. #include <linux/mm.h>
    6 \) G0 {2 y& _# w9 K
  34. #include <linux/dma-mapping.h>( o9 |2 L7 L3 l1 e+ R2 A  s' m

  35. . N: ?# R5 H: ]' r0 \# P, ?' i
  36. #include <mach/memory.h>
    - @! k: S' c  U* O# ?# c4 f
  37. #include <mach/hardware.h>
    9 I/ Z7 a' T6 l7 c" h% E3 D! f
  38. #include <mach/irqs.h>4 a( @  W! @' u9 j2 u$ B
  39. #include <asm/hardware/edma.h># y% [1 C' F# q) S

  40. $ {+ V! w6 Z5 c
  41. #undef EDMA3_DEBUG% T7 H- Z# f! q% d' w- N
  42. /*#define EDMA3_DEBUG*/3 j; h5 N1 b( Y: P1 p# b

  43. " ]0 F0 j* _, ^( L( N+ F9 e; W
  44. #ifdef EDMA3_DEBUG3 X2 \, y: j$ O- t: A+ l! Q4 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Q; T- c0 c/ ~) L6 ?; ~# j/ Y' T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). D) n1 L2 o& E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( f, E% F# A1 M  P) J, M# U' O
  48. #else
    0 @! K- B+ q1 x8 E2 O) e" M* f3 E
  49. #define DMA_PRINTK( x... )
    ' g7 {; U& F. X
  50. #define DMA_FN_IN
    # K# t1 h/ p# J) F0 p' T
  51. #define DMA_FN_OUT
    0 O2 v# G0 ]; F: R( e  q. J  y
  52. #endif* D$ q1 }. d9 @: q3 R
  53. 4 g4 Y3 v- y; y3 [- V5 i2 Z1 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % K/ O. H) \( ^9 o  H6 ~# U
  55. #define STATIC_SHIFT                3
    ! J: D- D+ C& t, H" H
  56. #define TCINTEN_SHIFT               20
    : c7 E! P" T2 q* K8 G1 p
  57. #define ITCINTEN_SHIFT              21
    : C8 W9 x- S, ~4 \6 R9 r
  58. #define TCCHEN_SHIFT                22
    + Q; ]/ a1 C. L) h0 D$ b
  59. #define ITCCHEN_SHIFT               23
    $ k- y) j- P7 y! }

  60. 3 p- i8 w1 H* g' {2 I
  61. static volatile int irqraised1 = 0;
    " O( P2 z* L5 o$ F4 n6 N
  62. static volatile int irqraised2 = 0;
    6 T% P) `& L* Q$ O( J
  63. ( h5 A$ q  Z/ ]. m! `$ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 A3 N+ A" h& C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( m5 g7 o' T* T' u9 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }! Z& j/ m" D+ T7 T1 V

  67. / a9 m- `. O1 @$ n8 [
  68. dma_addr_t dmaphyssrc1 = 0;
    1 K& ^0 n( B, G& d
  69. dma_addr_t dmaphyssrc2 = 0;" m; B: s, q  \: w4 ^
  70. dma_addr_t dmaphysdest1 = 0;
    * ~! n' g% |% v2 h5 M
  71. dma_addr_t dmaphysdest2 = 0;
    ! ^1 G" c* l: `( p% I/ b

  72. " J- Y6 d' L0 e* F7 K4 S( [$ @7 k
  73. char *dmabufsrc1 = NULL;1 C+ ^! S7 ~$ `0 Y( ?: |6 `% \
  74. char *dmabufsrc2 = NULL;5 P3 ~8 ?* P' |% m# w  d* b' Q+ _
  75. char *dmabufdest1 = NULL;9 Z( I) j' ?$ s  ~
  76. char *dmabufdest2 = NULL;
    - t8 e" O0 m# e! K# @8 d) C- Y

  77. / f+ N- y* {2 h8 h! J  F0 l  K; L, v
  78. static int acnt = 512;4 ~8 |6 n( [* F! [" U$ U( u+ f
  79. static int bcnt = 8;
    5 G/ s: g9 R; v5 B& _
  80. static int ccnt = 8;
    7 @+ k" M8 Y- G9 B
  81. 4 e6 O! n6 u9 d7 E; K+ B
  82. module_param(acnt, int, S_IRUGO);. k4 B6 O+ K7 t% a
  83. module_param(bcnt, int, S_IRUGO);
    4 f% }2 w+ q3 M; r; c: P. d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ b8 E- r/ e2 y; l6 V
) C( O$ {# Z! t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 n7 @$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% f: t6 _/ u1 B+ O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& W6 J" o& f, W) n
8 F9 S; |+ Y- m5 R7 J$ @8 |' H8 G  B, w0 w8 M4 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 19:53 , Processed in 0.041564 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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