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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 N" `% M( I7 R+ E8 e; S
  1. [code]EDMA sample test application
    3 K9 b$ c# }" y2 C6 X: n
  2. /*) e8 M1 @" e6 A+ L% s) [
  3. * edma_test.c
    & i9 T5 I; {8 t5 Q1 H4 O; a
  4. *
    7 e) k9 X9 U% s* h
  5. * brief  EDMA3 Test Application$ {3 K1 m! ~7 K- {  I
  6. *0 [, B3 r# Z$ s! h' I9 _3 K
  7. *   This file contains EDMA3 Test code.; c+ K* l4 h2 u/ G
  8. *
    & S6 w, l0 L+ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 k+ u* Y8 l1 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! r( G) H) ]) M! C" o
  11. *         TO CHANGE.7 w3 [4 _0 {6 V  e+ `
  12. *
    7 \. A6 g# S/ B. H3 ^) H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' C6 H2 A) A- n& v
  14. *
    $ P* X& L  s' J. y
  15. * This program is free software; you can redistribute it and/or
    : k0 j" V: c+ l% a" w* r4 H
  16. * modify it under the terms of the GNU General Public License as* ^$ S8 [5 M; {7 G5 ~) p6 v( x" z
  17. * published by the Free Software Foundation version 2.
    7 v1 T! Q  Y5 o! h
  18. *. N8 V& ?, n( U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) g  W' }+ C; f$ G4 K. Y
  20. * kind, whether express or implied; without even the implied warranty1 y3 M( d1 B: A; w  H, x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ s8 {( O5 ]( a+ C: f1 s* ?
  22. * GNU General Public License for more details.
    ' W0 e& w) M9 Q
  23. */
    & M+ {+ x8 b& h' r1 G

  24. 6 F8 ^# t& i, G0 i- A6 B
  25. #include <linux/module.h>
    2 q" ^1 M) Q" A; Q
  26. #include <linux/init.h>
    ( \8 u" R& P/ R  L8 z- o5 ~$ e4 E
  27. #include <linux/errno.h>) c+ [4 S& L- m+ q# `
  28. #include <linux/types.h>
    2 ]0 v% q6 s; A, \0 F6 l
  29. #include <linux/interrupt.h>
    2 w" r7 q$ s- |8 G" j7 q$ u
  30. #include <asm/io.h>
    ' R1 N# d  ^0 e& o
  31. #include <linux/moduleparam.h>% k3 q" y# R: T3 r! _, N" _
  32. #include <linux/sysctl.h># ?' ^3 L! Y. N3 H) N6 O9 k
  33. #include <linux/mm.h>
    0 ^$ ~9 K1 A3 M6 ?6 y, \
  34. #include <linux/dma-mapping.h>
    ! J2 y- U$ M% O8 S7 L
  35. ! D( H2 _6 P2 \- w# c: G4 ~
  36. #include <mach/memory.h>' j0 O4 z1 a+ r/ k- k! O
  37. #include <mach/hardware.h>
    3 n* M) ^. [3 M# ]% P# L, x
  38. #include <mach/irqs.h>
    9 C$ ~8 \8 X5 l
  39. #include <asm/hardware/edma.h>. s; S, q) H$ ~! H: X
  40. / |7 v( I; j4 a0 Z* z; `$ [
  41. #undef EDMA3_DEBUG" t4 I4 x, r; E
  42. /*#define EDMA3_DEBUG*/
    , Y& q: |! t& X3 R: R5 K* a
  43. 9 E. j( R. P2 A. R" H. r. y" g
  44. #ifdef EDMA3_DEBUG
    9 l8 P8 r- W# [& }9 p/ C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), f' }2 }8 j# U' I' a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # n( a  H4 Y! w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      b" W4 c  H" }- n0 ^4 w# |
  48. #else" g  I1 I2 H/ |, g
  49. #define DMA_PRINTK( x... )$ a. |/ @( x) [5 N! }6 G- x
  50. #define DMA_FN_IN) l  K% G* Z2 u  ^8 O3 l' w- _/ w5 A
  51. #define DMA_FN_OUT; k; ]" v9 {' U* Q) X$ y
  52. #endif
    1 A6 ^' z6 Y2 g" p# Q
  53. * K9 V& K( J8 j1 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 a5 K0 O. g0 L. u. w! q" D
  55. #define STATIC_SHIFT                3& S/ y) A) ^, f, K( V8 [9 C
  56. #define TCINTEN_SHIFT               202 z. v; Z" t9 {5 Z
  57. #define ITCINTEN_SHIFT              21
    ; @$ g3 }) D# P/ @* E) m0 N
  58. #define TCCHEN_SHIFT                22
    , F, \. R2 z- Y( q) X5 i
  59. #define ITCCHEN_SHIFT               23& U4 W& @: a! W8 i' \/ ~

  60. 7 @6 t8 w3 G8 K; d/ q! ~" n3 E
  61. static volatile int irqraised1 = 0;* P" ?: _4 u/ m+ V; _5 D5 z  L+ P- e
  62. static volatile int irqraised2 = 0;
    8 c: _6 h8 ]3 l8 r. L
  63. * U& O9 i& q( w+ |( c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 {( _, z% h. E  r' q; t) D# \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( F+ X' S0 @# \1 [0 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: S8 n- F  c& j* q+ k  ]
  67. : X( t) ]3 Q' s- w+ C7 T
  68. dma_addr_t dmaphyssrc1 = 0;
    1 \+ C2 x# B: a
  69. dma_addr_t dmaphyssrc2 = 0;# h7 S. _+ q  v+ n2 J5 `) N
  70. dma_addr_t dmaphysdest1 = 0;& F# l0 H+ P1 C; Z( e
  71. dma_addr_t dmaphysdest2 = 0;
      Z; `& ], O- o9 m

  72. * _8 F% q0 x2 m0 E' L8 n3 D
  73. char *dmabufsrc1 = NULL;6 j) s$ f  c8 m& z7 r
  74. char *dmabufsrc2 = NULL;
    ( y/ H; J; X; |9 q6 ]! C/ o
  75. char *dmabufdest1 = NULL;+ {5 _$ {% X5 Q3 H, N4 ?' Z' P
  76. char *dmabufdest2 = NULL;
    ) c+ p  Q8 \! F
  77.   n5 h' w' R+ Z3 w
  78. static int acnt = 512;5 |+ \5 f2 u+ f& _4 c6 }
  79. static int bcnt = 8;
    ! L8 k. R/ `$ \% ^
  80. static int ccnt = 8;
    5 J* L4 z1 t7 U! m
  81. % `( L0 X( |5 t; [" j; u- O/ H
  82. module_param(acnt, int, S_IRUGO);, W! C$ u$ ~( I8 v7 k2 m" K
  83. module_param(bcnt, int, S_IRUGO);. X3 l1 p9 K* C0 N9 m) N/ H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: c  N% [, M- E& P5 n1 `1 t: D1 H+ T7 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 w+ l5 d1 F$ d! J$ G8 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 K8 k8 G# Q4 s$ {* g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- k7 M; H8 N2 Q+ k
. p" k; {% X: g+ v# w% N  ~" d0 q8 q' \1 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 21:40 , Processed in 0.041265 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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