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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( O% r+ K) U8 \# u+ H  t
  1. [code]EDMA sample test application
    4 K$ ~+ _+ b1 Q, Q& D' ~/ p  u
  2. /** d8 l6 @: L+ d. f6 f
  3. * edma_test.c8 @: V1 }9 i! g6 D
  4. *- ]0 Z6 z+ v9 W) S6 M
  5. * brief  EDMA3 Test Application
    ' N. }; U. w- S8 T+ g1 N
  6. *( g1 e: e- N4 z2 `  x0 Q4 W
  7. *   This file contains EDMA3 Test code.
      M, X' j8 m8 n0 x: T/ P
  8. *
    ( U2 x$ o0 p/ x2 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! }) [1 y% f  O  G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r& v& ?0 }! U: Y. e$ o1 E
  11. *         TO CHANGE.5 O* |* b% V1 ~& L6 N! Y+ E, x) _
  12. *
    7 K# l# S9 o3 D6 f" b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ]4 D( m( R: y/ X, y
  14. *
    . s) s1 d4 x3 k) i( k! I, s
  15. * This program is free software; you can redistribute it and/or
    " J0 J3 S) p9 |/ l- P
  16. * modify it under the terms of the GNU General Public License as! f5 C) I( _8 T) m% T( t& D( N
  17. * published by the Free Software Foundation version 2.
    7 X8 ^1 X3 S8 |7 M" q
  18. *
    * J0 y+ }0 S7 H4 G' R* `* N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; h% S; O8 _3 `% }
  20. * kind, whether express or implied; without even the implied warranty! l5 l9 m# B  I1 b( q7 L* v. q+ v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + x/ P, Z' ^) l+ j  A2 T
  22. * GNU General Public License for more details.  f& z0 h( H  g+ g6 k; }% n5 t* u
  23. */
    6 v7 z  |; ]/ x9 |2 v" v) y
  24. 1 n6 q! \' f% J) P/ L
  25. #include <linux/module.h>
    4 i7 c* c3 [- o. P
  26. #include <linux/init.h>
    4 Q, [' R$ }: J
  27. #include <linux/errno.h>
    : M+ B* |" e3 ?7 h5 {* H' p+ ]
  28. #include <linux/types.h>
    & p. ?- V3 M, k. N/ k: B" j
  29. #include <linux/interrupt.h>
    * x% B  A8 w6 E, M" G
  30. #include <asm/io.h>
    ( c$ {$ i* ^- E  h" K2 ]
  31. #include <linux/moduleparam.h>2 B# e! n) e4 Y
  32. #include <linux/sysctl.h>
    * c% l7 ?2 g$ O- [% y3 t
  33. #include <linux/mm.h>
    3 q" \( G& T; W5 [; i
  34. #include <linux/dma-mapping.h>9 N% T3 r" f  s, j4 r

  35. , e& }  H. U" Y$ t/ ^# E
  36. #include <mach/memory.h>! L0 p4 m% I$ p- s8 B% Y6 D
  37. #include <mach/hardware.h>1 E# H: i8 ^9 z  o9 w7 p0 ?; z4 h9 F
  38. #include <mach/irqs.h>
    , S0 |* |$ T- L: w) ?) }. D0 s
  39. #include <asm/hardware/edma.h>
    * N/ m6 ?  V& U5 d

  40. # h; S, X/ ^3 k# [, P& t! r, i
  41. #undef EDMA3_DEBUG
    8 ^/ Z2 m+ M" Q" i5 ]* T/ r; H
  42. /*#define EDMA3_DEBUG*/; Q9 Y) s# ?( r
  43. 2 \! D4 j# A  @
  44. #ifdef EDMA3_DEBUG+ s2 W. t) d0 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      @) A! c( X9 n* W8 s/ L& o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 |7 Z& P, C3 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" Y5 e% u9 }( v- l, d& Z3 |
  48. #else+ M/ M. [& A* y, m7 B; h
  49. #define DMA_PRINTK( x... )6 k- K0 ^# j- {% y9 p8 Z) F9 F- m
  50. #define DMA_FN_IN/ p/ z7 U: d  d1 h
  51. #define DMA_FN_OUT
    ( B; w  k; p! z$ T7 u6 {, z0 c3 I
  52. #endif
    " W: c' ^- `& j" W3 n& a

  53. * j' s: n2 y" M# \# v0 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      J/ [. z. L3 I8 p2 h
  55. #define STATIC_SHIFT                3$ Z/ i+ {& n) r. s: V6 d6 E
  56. #define TCINTEN_SHIFT               20
    9 G7 q' a) Q: {0 t: g* H) a! q
  57. #define ITCINTEN_SHIFT              21. i, t% A. n" `' w6 C: k. e7 H- P
  58. #define TCCHEN_SHIFT                22
    8 `; ~# J/ v( P) w0 S
  59. #define ITCCHEN_SHIFT               236 f" f! R' t( [
  60. ) v, Z" u6 |" S" L, [
  61. static volatile int irqraised1 = 0;
    ( F5 S: m# `( C& f
  62. static volatile int irqraised2 = 0;
    # \: O: G7 y# l

  63. 2 m1 Z$ }9 B- J) k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k* l! f5 p& P1 h  H0 k' H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j& n  T' K# g+ `$ a, M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . z) C- y2 G; \

  67. + H+ d- D' L2 x& M+ p* [/ v! a
  68. dma_addr_t dmaphyssrc1 = 0;
    3 o, R5 x1 G3 \2 e
  69. dma_addr_t dmaphyssrc2 = 0;) P1 o7 J$ m/ u% T$ ~9 o6 @
  70. dma_addr_t dmaphysdest1 = 0;$ D6 k' d6 S5 N7 |8 \: q
  71. dma_addr_t dmaphysdest2 = 0;
    : S* y3 C6 n; V6 h. X" {
  72.   ]% f7 u2 E1 Y' F- B
  73. char *dmabufsrc1 = NULL;
    1 z3 g% L, j# s1 K% _) ?; o! j+ ~
  74. char *dmabufsrc2 = NULL;
    8 j0 g3 O4 t  K; {  z
  75. char *dmabufdest1 = NULL;) G! l  \; B. k0 k7 O  t
  76. char *dmabufdest2 = NULL;( @) r2 c6 Y6 A2 }( H7 [' r
  77. * Y! m  C( V2 S2 C
  78. static int acnt = 512;( Q4 A* E' D8 F# F
  79. static int bcnt = 8;$ t0 N% M% A! e1 N. c  m
  80. static int ccnt = 8;  C8 k5 w, l* S# U# Q' f& S8 h) o
  81. 2 i7 b( l/ }$ t8 H' v
  82. module_param(acnt, int, S_IRUGO);
    + I, x4 i% x9 s4 V& M
  83. module_param(bcnt, int, S_IRUGO);, K2 Q! s( U; z# T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ \+ v9 D  a2 W1 J

" z* O+ w( Z8 ~. A. M+ p: S& W. D7 m! R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" T0 U) R/ ]& E1 p2 T6 I5 c  marm-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% z3 _6 a" @5 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) @8 J3 ^1 r( n* C3 w' p* X( c
; T4 R, j' E, U+ n& C6 w/ p1 ~3 G
" t  l; [$ h0 S) G/ b) a+ ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-15 10:19 , Processed in 0.042519 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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