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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * D; N6 C  n2 h' C0 y; H
  1. [code]EDMA sample test application, o' ^. G& @& n
  2. /*# |/ A0 m4 ~2 B: |/ o, x, ?. t
  3. * edma_test.c
    ) ?) E5 E( q( U  [
  4. *1 H8 r, _/ z$ B1 B& a
  5. * brief  EDMA3 Test Application
    . n7 k6 m; d3 v3 c1 e6 A; z
  6. *
    3 @( `  C6 o: G5 [
  7. *   This file contains EDMA3 Test code.
    / {  x2 r% j7 y! G0 a
  8. *
    " @% U4 F- X# a$ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! z0 R7 l  @) l  F3 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( A; x; C" b, @
  11. *         TO CHANGE.
    / \) |1 H8 j  Y, F
  12. */ d5 F: D  ]( }  N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" W" ^# N# F  N3 n  K& [
  14. *8 e$ a& l, Y5 V8 G  S+ v; U
  15. * This program is free software; you can redistribute it and/or
    . _" b1 U1 P1 M& d9 `
  16. * modify it under the terms of the GNU General Public License as' c3 H  P6 ~# \2 l) H- q
  17. * published by the Free Software Foundation version 2.
    ) H( f2 p. v. E
  18. *# K6 V+ k' I- M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / B4 [9 s- e- J; q
  20. * kind, whether express or implied; without even the implied warranty
    : M2 r/ p5 g$ M: J4 u# d' z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) {& T% B- ]7 J' g# g" Z
  22. * GNU General Public License for more details.
    ! B0 l# A- j' _4 G
  23. */2 S" F, R, c+ M

  24. # Y$ z; O! z! `/ l/ p2 N: z, [7 `) G
  25. #include <linux/module.h>
    0 o6 U; v" V( ?5 q% Z' w# X
  26. #include <linux/init.h>
    # s0 m9 y: i, ^1 c
  27. #include <linux/errno.h>
    ; L( D7 D1 P) j' E
  28. #include <linux/types.h>
    . q' F# P% e: J# b! X
  29. #include <linux/interrupt.h>
    ; e" B9 D( c& e
  30. #include <asm/io.h>- A0 m  e& n4 f% N% n! P5 r* j+ J, k
  31. #include <linux/moduleparam.h>
    . c' {( u' `. Q0 l# e) O& v3 d: Q
  32. #include <linux/sysctl.h>
    & }, C: c+ U! U; M
  33. #include <linux/mm.h>
    - D' O9 \% \' h$ E- T3 H
  34. #include <linux/dma-mapping.h>3 }: Z6 A2 G4 h- I7 K
  35. 8 O$ d, i) P9 |9 t+ A8 J8 j0 ?
  36. #include <mach/memory.h>
    ! K: F  C$ u- `: V  \
  37. #include <mach/hardware.h>
    9 v. S5 a5 F" P5 }" F
  38. #include <mach/irqs.h>
    . U8 d& E8 ^: E  N  \
  39. #include <asm/hardware/edma.h>5 M: x# Q5 V1 {( [  H# v% N
  40. 5 J' Y5 T. m6 J2 O
  41. #undef EDMA3_DEBUG/ @: L) {7 Q8 D- E7 I
  42. /*#define EDMA3_DEBUG*/
    & R9 S( W. q" z: E( b

  43. : O, G* ]* F$ l3 |
  44. #ifdef EDMA3_DEBUG) o$ }. `0 F9 ]% v) `/ `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N; ~$ E- {6 Q7 W9 e% f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 k6 L  ^* H$ {4 Y6 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ q9 N. B/ G/ L- P* p- n
  48. #else. \6 l* T$ H% K: W( `
  49. #define DMA_PRINTK( x... )( y5 E4 O- g) R" L, }" p# B
  50. #define DMA_FN_IN
    . k9 U/ y; x9 f" Z: f! x* E4 m
  51. #define DMA_FN_OUT
    9 |  U6 b& }- k( M2 Y
  52. #endif4 {* B8 J: h* c7 m

  53. + H( s. X! V( S9 q7 U& U5 c1 l. S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- ]1 h( k3 @. ?. `, E" n7 L
  55. #define STATIC_SHIFT                3
    + [% b) k7 \; O- t& b- e
  56. #define TCINTEN_SHIFT               20
    6 D# G0 }7 R8 Z4 ]+ m3 `% S9 d  ?0 X/ U% o
  57. #define ITCINTEN_SHIFT              21
    " ?' y6 D  Z9 _0 w; z% `1 R
  58. #define TCCHEN_SHIFT                222 O, s2 w" v& f3 D- M/ f/ \# ]: C9 N3 P( }
  59. #define ITCCHEN_SHIFT               23
    + Q2 W% S# W) P# C2 r4 ]

  60. ; U$ ^% s* w( w& ?1 Z& f. n. {3 p& d
  61. static volatile int irqraised1 = 0;7 R( z8 a, G: M2 {7 X, I
  62. static volatile int irqraised2 = 0;
    2 n* b) }, J. k+ _3 p

  63. $ x( }) ?8 {! m  C, V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 N- e. P9 \  e8 L7 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V2 ^, C/ c5 v7 D) y, \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ E/ ]# `2 l( i5 D' q* a' }  G
  67. ! M* s6 d: c+ a5 X* ?4 s6 w
  68. dma_addr_t dmaphyssrc1 = 0;4 ^- f0 O: S" C4 n
  69. dma_addr_t dmaphyssrc2 = 0;; w' a5 r; l  \6 F  s5 h
  70. dma_addr_t dmaphysdest1 = 0;
    2 v7 n3 D' M8 t6 d: Y
  71. dma_addr_t dmaphysdest2 = 0;- R. Q( l, n- @; Y( v

  72. 8 a7 c/ O: g. q& L5 |0 {
  73. char *dmabufsrc1 = NULL;. I" ~2 B/ u/ K; G
  74. char *dmabufsrc2 = NULL;6 f; ]5 q8 z% r) a) C8 F. W
  75. char *dmabufdest1 = NULL;; N/ ?, j' \' u
  76. char *dmabufdest2 = NULL;& ~- z1 q! b- M0 f$ n; t: m

  77. % v! L  D1 o. v, W7 C* Y) f8 |
  78. static int acnt = 512;" ~8 {& l. u$ |3 g. \
  79. static int bcnt = 8;
    1 V) n7 d( g: l$ t& z/ C
  80. static int ccnt = 8;
    2 O* N4 Q9 L9 J% A9 t% ]2 o$ ]' J! I
  81. $ ]* e. M; S  V% d5 Z5 h. \1 O
  82. module_param(acnt, int, S_IRUGO);
    ) I; x' G- p: {% a
  83. module_param(bcnt, int, S_IRUGO);3 E5 D9 C, ^* g( {% A( D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) _' c, X9 i4 @. t' s9 N) v
1 L, T. Z% G( t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( f, A. M$ M* U
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! `, P# U1 I$ j6 J/ c9 U  m# q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 F# A+ X' X5 O
/ r# A- X% E9 q3 F" _
& ~/ i& ?; Z* Y1 v3 Z2 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-11 18:55 , Processed in 0.039887 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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