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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; c! W; p. n2 f1 _( {! ~* D
  1. [code]EDMA sample test application5 `' G, S8 @# O7 P# T9 X
  2. /*
    8 `' o# S# q7 P3 F0 x
  3. * edma_test.c
    ! T) [# T) s  X' F7 m
  4. *
    9 g, ^, r5 x2 e7 A# W
  5. * brief  EDMA3 Test Application1 S9 _( K5 c/ ^) j, V& R5 N9 w) ?0 O
  6. *
    8 w3 _& G, c6 K2 d9 m4 @3 ~
  7. *   This file contains EDMA3 Test code.
    4 r+ c/ H, Y5 L# M9 j0 B( A( p
  8. *
    ) W% ^% ^1 f# ]: s  o9 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& T, s* f* ]; d$ N0 U4 ~8 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 k, m, [5 A; R" V! u
  11. *         TO CHANGE.' N7 I* n6 q: u4 X  S: g' _
  12. */ X# E/ l1 w8 O, U9 s+ T! O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . ]% X1 H3 q) b) D
  14. *" {) m9 T5 h: y; ~9 L+ o
  15. * This program is free software; you can redistribute it and/or
    ! F( N5 C" K* v
  16. * modify it under the terms of the GNU General Public License as
    8 o5 k' {8 P% ]1 A# k1 \8 f
  17. * published by the Free Software Foundation version 2.* ]9 m1 F7 F6 \/ c4 o& q
  18. *
    % \0 d; L* h! E$ J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' H$ B8 z9 ?: ^, w
  20. * kind, whether express or implied; without even the implied warranty
    9 D% t+ o5 f/ h; \$ J$ @: V) T+ Q% I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; \& h0 e3 q; B( D2 u
  22. * GNU General Public License for more details.
    ) `8 z* ~2 I( C" Y: N
  23. */
    $ A7 R3 H; G* ]9 _7 s+ J# E

  24. * G- ?0 A% y' }5 I
  25. #include <linux/module.h>
    8 r7 U* o0 M; r2 c; j! K$ Z. s
  26. #include <linux/init.h>& q8 a7 ~- g- U: s8 o6 D
  27. #include <linux/errno.h>
    5 ^, r4 b5 a  y3 |8 X# _) L5 P: q2 g( \
  28. #include <linux/types.h>
    4 k0 I; \1 g# D( f
  29. #include <linux/interrupt.h>
    ) \0 M- X  q! _# N; O
  30. #include <asm/io.h>
    ( w' _0 Z! p+ K' c% o
  31. #include <linux/moduleparam.h>6 G( {# [; S) N0 @
  32. #include <linux/sysctl.h>; H1 Q4 w0 f3 \% g
  33. #include <linux/mm.h>( ~" I" E: R+ D$ o# F6 Z- V
  34. #include <linux/dma-mapping.h>
    5 }' n& V$ w3 \. Z  s% E/ j* X
  35. ' K0 _6 s  U: ~3 t0 ]! H
  36. #include <mach/memory.h>" M/ B" ]5 }$ F
  37. #include <mach/hardware.h>2 z& Z. ]2 @$ O. B; X
  38. #include <mach/irqs.h>( v- I% _5 I# O/ }9 d1 g
  39. #include <asm/hardware/edma.h>
    / x$ c* N+ K- K4 A% V! ~4 Y4 F/ I5 w
  40. 7 [6 V8 N3 m: B& ^6 e
  41. #undef EDMA3_DEBUG7 X0 u8 k' Z1 x6 I
  42. /*#define EDMA3_DEBUG*/, _; L& t% J$ ]

  43. 3 b; A: m6 z$ h% p$ y  {; U- I
  44. #ifdef EDMA3_DEBUG
    ! G' K6 e  J4 y+ M5 X' k' H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : R1 T! h0 p1 |& u$ t: a3 z8 u0 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 D) j8 n2 L1 G% u2 ]* e# Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . [$ K$ }+ L6 d
  48. #else  @5 C( L! [+ ~2 i- H: N
  49. #define DMA_PRINTK( x... )
    + p" P; M2 k! u: ]: c
  50. #define DMA_FN_IN' X4 E9 c* v  w; D3 ?
  51. #define DMA_FN_OUT' v0 p* C6 f1 J/ `/ T# R
  52. #endif5 H! |+ ^* b. m5 I# Z/ r6 Y

  53. 3 U0 I% m; `$ b1 u2 F$ n7 U( U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( q( b4 B' J& e
  55. #define STATIC_SHIFT                3" ~" \9 a) `) S9 e% \: ]7 A3 A
  56. #define TCINTEN_SHIFT               20
    3 ~) E% D2 V3 P  Z* e4 ^
  57. #define ITCINTEN_SHIFT              218 p" _- j/ Z0 X9 q
  58. #define TCCHEN_SHIFT                222 F( ?) {3 G9 r$ ?1 h; B
  59. #define ITCCHEN_SHIFT               23
    ' P9 I, c8 A( T

  60. 5 Q6 l8 b8 k1 H! H; D) U( s
  61. static volatile int irqraised1 = 0;
    4 s  J9 A1 f. `2 _5 ]
  62. static volatile int irqraised2 = 0;
      j0 ~% q* G1 O. m8 r+ x' V4 y
  63. / n8 q+ x+ j- ]: z. e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R) M# k0 Y1 S6 O2 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( L2 H0 l1 B  [( X% U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 q8 ]2 @5 u: n+ [0 n1 O: ]

  67. " V% n4 S+ J4 d/ m) z8 T4 a3 o
  68. dma_addr_t dmaphyssrc1 = 0;
    ! J7 h0 x" D% n0 Q
  69. dma_addr_t dmaphyssrc2 = 0;2 Z, B6 d7 ~! Z5 g  H  i7 o" u
  70. dma_addr_t dmaphysdest1 = 0;
    - q- E3 y) v% g8 B
  71. dma_addr_t dmaphysdest2 = 0;
    5 x# c7 D! H6 ]- D, @( O& h

  72. 0 T& u7 S( @6 I7 G) m  d
  73. char *dmabufsrc1 = NULL;* r5 Y) w5 f) r; q  Y
  74. char *dmabufsrc2 = NULL;
    5 z2 o; f5 X+ p
  75. char *dmabufdest1 = NULL;
    + B$ U5 P! e4 D' x
  76. char *dmabufdest2 = NULL;! [4 d" b% b- ]' U1 r: g

  77. 6 U& @" h+ ]) A4 E$ B/ u1 k2 L
  78. static int acnt = 512;3 Z. E/ U& U+ I5 @9 B) x0 s, v* G
  79. static int bcnt = 8;
    ( Q$ `7 h" \) C( s0 M: H
  80. static int ccnt = 8;2 m, C/ C1 P: k4 G2 r
  81. ) s7 ?! F# |% r. U
  82. module_param(acnt, int, S_IRUGO);% E, A; V! f: A3 G- N( \
  83. module_param(bcnt, int, S_IRUGO);
    " f7 n) X* L1 ~9 w2 b; z# ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 |+ k1 D/ F: F
* ~+ H, J! F, A! ]; f0 g, g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 ~- O0 v9 j% p2 f0 N2 c7 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% G/ C! {' \, H2 K6 c; z5 g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* X* X+ ^+ R/ Y3 J# y5 T8 a
2 R& w& D* ~0 w: ]3 J

: V% ~! G7 X( y. p' o8 w, k- ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 04:58 , Processed in 0.046924 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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