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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 p# p. Q# [( S* Q* L
  1. [code]EDMA sample test application% W# Q) S- h. _7 V
  2. /*
    ) a! m- \& S3 }1 Z6 i5 [( ]$ j0 x
  3. * edma_test.c$ j' U( u% e5 z" F. [- B5 u
  4. *6 G6 I$ u0 p7 \. i, M- D
  5. * brief  EDMA3 Test Application
    7 {( X+ o1 p: ^* \8 c" c! _' }; l) _
  6. *6 p8 k/ P: a$ i5 o( v; @7 z% r
  7. *   This file contains EDMA3 Test code., e( ~* U! e# `, @) z* t+ F* y/ c* y
  8. *; N% U1 d9 J4 R* P9 z4 S- r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 @6 W7 c% b! s! A! f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . o6 [; R3 t0 Q$ }3 Z3 M8 V2 v' q" o
  11. *         TO CHANGE.
    4 \$ y! T$ w4 x$ {
  12. *
    3 Q2 |3 P& ~5 O3 M" p9 w* @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 j" F: I& @/ w5 D% }* M/ L9 ?3 ^
  14. *
    ! `/ _' x& T. P/ j0 J3 `" K
  15. * This program is free software; you can redistribute it and/or! I/ b3 ?; |; f, ]5 ^; i6 o
  16. * modify it under the terms of the GNU General Public License as) f( A; y9 F& ~2 m' t, j# x
  17. * published by the Free Software Foundation version 2.% e8 K7 r7 w. Y( `
  18. *
    * e  x/ X6 a* k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      b7 q# H. O/ g- Z* L; M( {5 _
  20. * kind, whether express or implied; without even the implied warranty
    : r5 b" S! z9 K& W* l- ?) O: C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 N: u2 Z( @( O8 @9 b
  22. * GNU General Public License for more details.1 d7 Q( ]6 x4 K# y& D' D4 O2 W$ e
  23. */
    ; k8 ]& h  A5 ]* P

  24. . R4 J" J2 J/ ]7 C
  25. #include <linux/module.h>
    ! y' N# c9 ^9 x1 x7 u( m1 s
  26. #include <linux/init.h>9 U3 B# ~; v# ^9 i1 W( x
  27. #include <linux/errno.h>1 K6 }: \/ ?! |( q8 `
  28. #include <linux/types.h>3 L8 l+ m" W: S# p% N5 R: U+ |
  29. #include <linux/interrupt.h>$ v, [7 w7 i) b. h
  30. #include <asm/io.h>  v9 I4 `4 p  |3 [# Z  y
  31. #include <linux/moduleparam.h>
    * q! b6 [. s$ F6 r; z
  32. #include <linux/sysctl.h>
    4 Z& `" W1 @; D5 `" Q; w( ]8 x* |8 G
  33. #include <linux/mm.h>
    0 \  y, p+ L( y7 d6 c
  34. #include <linux/dma-mapping.h>
    0 {' \: M/ V1 u
  35. + P- V- ], d6 S, W9 V2 w: ?! R( ^! a8 ^- T
  36. #include <mach/memory.h>: s* m0 r9 i# P- I
  37. #include <mach/hardware.h>
    ( q" w) S: o! M/ v' d9 h7 |& s4 i1 p
  38. #include <mach/irqs.h>8 `4 e3 r; w2 T* ]# s4 ~- \
  39. #include <asm/hardware/edma.h>
    " H' D7 r. I, j% ^3 S2 f$ `

  40. # C! D" s$ ]7 @$ y, h
  41. #undef EDMA3_DEBUG
    $ I% q; L4 N( J( |4 {) s+ i
  42. /*#define EDMA3_DEBUG*/1 Z- q3 D: v( c- m8 y

  43. ; ?" W6 ?0 |9 ^+ U" k9 x) o
  44. #ifdef EDMA3_DEBUG
    8 s6 d1 j3 J# q( S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ |4 U/ e6 U: B  N' V3 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 i3 A, o2 B% [5 I, O* ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ~- @% z) X3 S! ^5 [( Q
  48. #else
    . `* ~  N* |, Q3 V( s+ _2 ?/ A
  49. #define DMA_PRINTK( x... )3 N+ V! s) `# m* i
  50. #define DMA_FN_IN; V/ G, G, B) m8 P6 x' ^
  51. #define DMA_FN_OUT. x2 [" ^! v& d+ [  f4 ^8 k; o7 }
  52. #endif
    " E. H4 P$ C% {
  53. ) m7 L* j: l5 B: g- {& W  N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ U9 Q6 w. l, t! o1 d. F0 T& u" x" q
  55. #define STATIC_SHIFT                3+ f4 S$ \6 h+ C+ }
  56. #define TCINTEN_SHIFT               20+ M$ x) \4 y. n' K4 S" s5 _" {
  57. #define ITCINTEN_SHIFT              21
    ! a# G0 |4 B- \/ b9 Z
  58. #define TCCHEN_SHIFT                226 P0 E! L: a1 D9 m* q# ~
  59. #define ITCCHEN_SHIFT               23
    1 O- f* `$ N" F4 L6 S9 q
  60. 7 P5 [9 G+ i, Z2 x9 ~
  61. static volatile int irqraised1 = 0;
    . Y/ G& ?! D3 m, i
  62. static volatile int irqraised2 = 0;
    , m7 J; I* q# E* {# `5 {  n1 W0 y) {
  63. 4 O* K$ m9 m/ b7 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( m* v+ `1 |! l! k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - @# {- _% W7 J8 a5 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [2 o3 T- e- N1 h% [3 R+ u
  67. - W+ j# I7 C$ Z8 M
  68. dma_addr_t dmaphyssrc1 = 0;
    % U; k1 t0 ~4 w/ S
  69. dma_addr_t dmaphyssrc2 = 0;# b, f) [* u) ?' @0 W/ @
  70. dma_addr_t dmaphysdest1 = 0;
    5 J% x- {" K1 Y0 ]3 L7 X- Z+ b+ L9 k
  71. dma_addr_t dmaphysdest2 = 0;4 `# R" z* h4 E+ I
  72. 3 z6 y, P' n; e9 S$ @
  73. char *dmabufsrc1 = NULL;
    ; C4 K' q1 W8 a1 ]' i
  74. char *dmabufsrc2 = NULL;& ?6 w$ `4 ]7 b
  75. char *dmabufdest1 = NULL;8 j: {0 ~% m% ^+ L/ x
  76. char *dmabufdest2 = NULL;; X1 _0 l' j9 a
  77. 2 x/ I! L/ v  _& g4 a" g
  78. static int acnt = 512;4 D& p. b2 ^6 D/ o
  79. static int bcnt = 8;
    ) X1 i2 I5 u5 e& u4 r! {, L
  80. static int ccnt = 8;
    8 s3 o8 ]- H( i6 D

  81. ( ~, \8 o  L* ~+ D- U# w  |8 K1 G2 j
  82. module_param(acnt, int, S_IRUGO);
      F& a$ p4 f3 ?0 F
  83. module_param(bcnt, int, S_IRUGO);
    # t- v! v2 U7 {) j, y( G3 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 I$ z" G) m* ?
5 ^1 M: f' o3 h" D+ M! i1 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  w  Q1 ?2 L( @' f# i3 m; Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, T, Z+ ~: e. k* M7 D1 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 M) v, {! b' B# e; Q9 X
* e9 H5 ]/ Y0 w& \: _7 w# }

. |+ Q! l! R2 G/ z% o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-20 04:57 , Processed in 0.043277 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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