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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 q. u$ Y! x, @* k& s3 [* P
  1. [code]EDMA sample test application4 j* I6 A; c9 e3 [: t" f2 c# ]
  2. /*7 J0 {, B8 q. A: ?0 F
  3. * edma_test.c- `5 Y9 I7 g# }6 ?
  4. *
    ' q0 f! n- m1 {  u6 D" f, t
  5. * brief  EDMA3 Test Application) k' m6 k+ x) ^5 @) _
  6. *
    & w; B9 R0 z+ B, X; Z
  7. *   This file contains EDMA3 Test code.' w" s. H, v( M( }' F* ^
  8. *
    , N& |5 d# c5 \4 O) D7 ?+ Y1 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" T: d. ^# z! r1 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 k5 ^, t* G: J* z) E
  11. *         TO CHANGE.
    5 q6 U' ^4 x3 A% s5 N
  12. *
    ' g& w2 C6 f6 U" k: }3 @) [. X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( I8 [; N9 ^0 R; U
  14. *
    2 w! r  T. o* q6 S- S8 j) s
  15. * This program is free software; you can redistribute it and/or* V1 w5 m4 \7 c0 R0 {! [, E' v
  16. * modify it under the terms of the GNU General Public License as
    8 V& U1 U; r' \2 s" z) W; \
  17. * published by the Free Software Foundation version 2.
    % f5 b' m1 ?: k  S. j; c
  18. *
    . M' Y9 v" Y4 l3 h, S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! ~' b5 B  J* c' w8 [4 V
  20. * kind, whether express or implied; without even the implied warranty
    ! K& }2 h- S5 \6 q& l; ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) |! Y+ f4 T, E" x; {
  22. * GNU General Public License for more details.
    0 {& c4 b5 ?# J: R' |# u  y6 ~
  23. */
    2 T- ^2 U9 |1 @* t6 @; u6 N, G
  24. - q2 |/ n) m$ ?' u# d' @; W
  25. #include <linux/module.h>7 @! m' l- J& C: }. L
  26. #include <linux/init.h>
    ) @# E( e+ Y' d
  27. #include <linux/errno.h>
    9 `- `& E' y7 R0 k, F' A
  28. #include <linux/types.h>
    - o# g5 k4 k- O# a2 |
  29. #include <linux/interrupt.h>) s, t1 k+ p% A
  30. #include <asm/io.h>
    + s/ d4 N4 h( |; b7 n
  31. #include <linux/moduleparam.h>
    % D; N- E; p% k8 u! l
  32. #include <linux/sysctl.h>3 G: @+ P  f, s7 w) K# O
  33. #include <linux/mm.h>, k0 m+ k9 f- Q9 V) e& h& x' r  J
  34. #include <linux/dma-mapping.h>* e% S6 M9 ^7 b8 Y4 z
  35. 4 W( E. G# s: w# A* `7 D" I
  36. #include <mach/memory.h>* D+ p( m' N* A3 t9 U* i& a* }0 o
  37. #include <mach/hardware.h>$ w* z2 d, m3 A0 b
  38. #include <mach/irqs.h>2 z: e6 {+ I& c+ U7 d  l7 `  E
  39. #include <asm/hardware/edma.h>
    7 T- s6 Y/ o) W, u
  40. , w4 |' A! a5 |" ]9 @
  41. #undef EDMA3_DEBUG# w+ \8 e! t( G8 B; [
  42. /*#define EDMA3_DEBUG*/7 [# `5 o! \8 u) ^; b/ P
  43. 6 ]1 T  n2 T( a% H
  44. #ifdef EDMA3_DEBUG+ p; s- v5 X" H, U) ~5 Q1 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * W6 W' |9 `* T8 M" S2 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ t/ I( j; l$ o2 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). W8 T. h+ `) k; n( W$ Q
  48. #else
    ' N: y! r3 P6 [+ K  s2 e
  49. #define DMA_PRINTK( x... )3 I/ D: V+ h- W& q
  50. #define DMA_FN_IN4 w+ J& v7 C0 R1 m7 J
  51. #define DMA_FN_OUT  w" C0 {) O# t; v6 U
  52. #endif& q0 u* `! [) m# Q

  53. 0 J% z8 T- l/ n: f+ P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ n* {  L) r" J, {; Z/ |
  55. #define STATIC_SHIFT                3  A5 Q. L9 _2 }" Y# M, O* P4 }
  56. #define TCINTEN_SHIFT               20! b: W( q7 |' o) r( H! H
  57. #define ITCINTEN_SHIFT              21* O, J# x% E0 g! j0 G9 }
  58. #define TCCHEN_SHIFT                22- D( P' b8 U- Z4 |
  59. #define ITCCHEN_SHIFT               238 R3 j" O3 ?: A" c9 ]0 E

  60. 2 R+ x& C+ U, P8 _
  61. static volatile int irqraised1 = 0;) T3 _9 S% J: n. |" z
  62. static volatile int irqraised2 = 0;) C& r9 b- p% [3 S* Q9 c0 Y

  63. 8 j$ b  Y  e/ M; K% D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' v3 U  B4 ]+ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R* I6 e; y" m) m% q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / k3 s; E1 j; Q: ~
  67. + u9 L3 G8 g  o2 c) S
  68. dma_addr_t dmaphyssrc1 = 0;
    * O2 a( s2 @& y0 u) B* ]
  69. dma_addr_t dmaphyssrc2 = 0;
    ( q' p" C: |+ T1 m) U# N
  70. dma_addr_t dmaphysdest1 = 0;
    0 U, W  G) n5 j
  71. dma_addr_t dmaphysdest2 = 0;1 |9 N! J& g" v6 I9 d# p- w8 X

  72. 7 ~! l! K# w# |9 ^4 ]8 r- ~+ h
  73. char *dmabufsrc1 = NULL;
    9 _# P; j: A. d9 F" _& U$ k% n# J
  74. char *dmabufsrc2 = NULL;
    . e9 @* T% s" H* R
  75. char *dmabufdest1 = NULL;# f+ \% b$ f# t4 \1 O+ g; S/ Q7 N
  76. char *dmabufdest2 = NULL;9 H- A' G3 }, e2 ?/ T
  77. * ^+ t0 B' I! N/ m# W# X
  78. static int acnt = 512;
    " P$ J( n/ s% h- t
  79. static int bcnt = 8;: H) X; g  l% D
  80. static int ccnt = 8;
    & z# R+ w# ?0 k/ a
  81. 3 `, }! R: O' C: d4 ^( o; F
  82. module_param(acnt, int, S_IRUGO);# _& ~2 Y. e' _# P% @
  83. module_param(bcnt, int, S_IRUGO);
    / ]9 w$ _$ d/ t& s3 U$ x9 H1 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 e$ p2 _: }% m' M9 B

1 I2 e# O) S# x* g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( X  M* t0 a6 Y$ O0 u" iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 a4 U2 @" S# G7 s; y3 f- b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- ~6 @+ F" q, H% D9 T! N3 Z! m
6 |. L1 T" Z) Z, M
+ F; ^- N* e# T$ T  j3 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 17:39 , Processed in 0.041240 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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