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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   [: K; }2 c, Q  l1 f# B4 D+ U1 v7 ]
  1. [code]EDMA sample test application4 P+ W8 K/ }; ]3 Q) m( ]" r% r( S* g
  2. /*
    3 @( f- b$ A+ ~
  3. * edma_test.c
    * _( H" x# T4 ?) x6 m) M7 t
  4. *
    6 T. M, n0 O5 Z8 f9 ~" I
  5. * brief  EDMA3 Test Application. n  C3 {* ^% G" j3 w( E
  6. *( r( C* O, B7 u
  7. *   This file contains EDMA3 Test code.7 \+ a) i# D- P  H, I2 V+ K
  8. *
    6 |$ X, u- {" g7 n% [+ Z" x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 M% O" f  V2 R- @1 g8 R) Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ _, d  s) b' w( H) a" {
  11. *         TO CHANGE.
    ' Y4 k  y4 {% N: A
  12. *7 ?6 L$ l% X3 X) A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 L  K; n$ P) F0 t" d8 l
  14. *
    : `4 ~+ D0 E: L* J5 C9 v
  15. * This program is free software; you can redistribute it and/or  M( T. N# h( M8 M  a+ n& h
  16. * modify it under the terms of the GNU General Public License as$ s, c$ m) F" x: F* H1 G$ H
  17. * published by the Free Software Foundation version 2.
    ! D  Q8 e" W4 {  h, L
  18. *, h* g2 f& x' F' W# ~/ u: U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : o3 Y* }2 h3 {9 K" d0 f
  20. * kind, whether express or implied; without even the implied warranty
    0 }- Q: t* J* ^# M2 {) H6 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% j9 D/ E1 x7 J$ |: x2 r
  22. * GNU General Public License for more details.5 q+ M" m! N- S5 W. a
  23. */
    3 p% z8 D9 U) N0 }
  24. ' S9 e5 T0 `2 z3 w$ L+ |
  25. #include <linux/module.h>
    5 O+ I4 X+ I1 w! h' f. v
  26. #include <linux/init.h>$ K' q2 q8 ~0 B: G
  27. #include <linux/errno.h>
    0 D4 k3 J. ?7 Z7 u. ~
  28. #include <linux/types.h>: W) L- U+ k/ S; {7 g+ S
  29. #include <linux/interrupt.h>$ i9 p% N  t" n! P. K
  30. #include <asm/io.h>
    . q: ?! e( A- f& B
  31. #include <linux/moduleparam.h>( T- G2 v) k  D4 j# Q. j; l% p
  32. #include <linux/sysctl.h>
    : ?0 D8 S8 o+ d7 s0 H( y
  33. #include <linux/mm.h>
    - t/ F; c) W- f# T
  34. #include <linux/dma-mapping.h>
    7 |! F  V; j" X: _: _# N
  35. 5 a# `) I+ `0 S# E4 l! v# a' H
  36. #include <mach/memory.h>
    3 d" c4 @4 j% ~; z* ^
  37. #include <mach/hardware.h>2 I  M9 k, z, O4 N- R, g
  38. #include <mach/irqs.h>
    ! }0 X1 {/ |/ }7 r) Z1 o. f7 X/ U2 G
  39. #include <asm/hardware/edma.h>
      K+ n8 I) I5 L* ^5 A2 A5 ^

  40. 1 l9 D; m5 D- h, z
  41. #undef EDMA3_DEBUG
    . ^$ x, a: ?, O+ w- s! p
  42. /*#define EDMA3_DEBUG*/
    2 U/ N" T& B1 _5 F- J0 @# K; C; ~
  43. 7 S* b" `5 w0 [, w
  44. #ifdef EDMA3_DEBUG8 M4 q( o- |6 z" ~% b# i, h; p4 t8 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): @9 F4 ^- ?) Y0 }0 h" Q# _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # H* \/ o4 i. u& z! C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); i. _. X+ R4 K4 F: @- n1 d4 u
  48. #else
    1 ]: o* B- a$ U. N
  49. #define DMA_PRINTK( x... )/ w; h$ J2 Z; y3 N( S7 \2 F
  50. #define DMA_FN_IN; j( ~5 G9 t, E  S7 G5 I, S& J
  51. #define DMA_FN_OUT
    ( n) z0 l5 R2 N, ~9 A# U
  52. #endif
    " D& a( ?+ M, R8 A$ e$ c' G+ \% d
  53. % y  `$ W4 \2 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); v1 |+ ?. y# I" x/ ]
  55. #define STATIC_SHIFT                3% G+ _9 d9 v) m+ M
  56. #define TCINTEN_SHIFT               20$ z0 C4 R# Z4 P$ V3 [' [  {- `3 Q" A
  57. #define ITCINTEN_SHIFT              21
    $ \) ~% S3 k9 D0 d" c. p
  58. #define TCCHEN_SHIFT                22/ C. V+ ]* a* l/ h9 G1 T
  59. #define ITCCHEN_SHIFT               23
    $ [' u5 T' k! |7 `

  60. / [6 \+ K- @/ r* d1 D! J! ~7 F
  61. static volatile int irqraised1 = 0;8 Z2 A! _+ |+ n$ i& F. y
  62. static volatile int irqraised2 = 0;
    / T- c0 c# h0 r" s# d4 ~, T5 U

  63. $ t% b7 p: E: I6 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( _! `; b7 C2 j4 H7 x  j: a/ H5 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ~4 W  j" s, y0 n( Z. I  Q4 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 o$ L2 w7 R4 |
  67. 8 ?0 J* _6 S8 s
  68. dma_addr_t dmaphyssrc1 = 0;
    : u$ B) v* g7 b; _  R4 d+ h
  69. dma_addr_t dmaphyssrc2 = 0;
    # I( Y3 S% ?" |$ C- c7 `9 s
  70. dma_addr_t dmaphysdest1 = 0;3 m& c/ X- l8 a3 o
  71. dma_addr_t dmaphysdest2 = 0;$ b7 C- J7 K  e0 v
  72. % d# C3 e) B8 E5 ?$ `; s
  73. char *dmabufsrc1 = NULL;$ T( S  d3 \* i+ ]* L- \
  74. char *dmabufsrc2 = NULL;
    ! p2 E8 r2 t3 D3 y1 \2 V: t3 ^
  75. char *dmabufdest1 = NULL;4 _% i$ }' I  {$ g% H
  76. char *dmabufdest2 = NULL;
    7 j- k0 ?# }! m3 ?1 N' {

  77. + M% _1 J; l6 q3 L- V% F
  78. static int acnt = 512;
    % R; S, e* b8 m/ |' Y/ E
  79. static int bcnt = 8;+ i+ S5 C/ I+ S7 W; P
  80. static int ccnt = 8;" F6 \% i0 M1 {( I
  81. ! @  v! v5 ]' F9 X* Y* I2 ~
  82. module_param(acnt, int, S_IRUGO);
    9 t) b0 ^1 a0 @+ {  p% I
  83. module_param(bcnt, int, S_IRUGO);
    # c- x& K+ I2 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 s, u0 B7 M( B# x0 j' e
* H- Y: d( k2 |% ~" O2 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 }5 t0 W. l  ^+ k# Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  r' U: F/ Q% U: u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; C5 v# I9 \& ]+ V7 I8 F$ b

/ }4 W$ k# d" T7 g* z  Y# A# u- X5 u* z: L. U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-27 01:28 , Processed in 0.049352 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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